write-msgpack ( obj -- )
MessagePack

Prev:msgpack> ( seq -- obj )
Next:>msgpack ( obj -- bytes )


Vocabulary
msgpack

Inputs
objan object


Outputs
None

Word description
Encodes an object into the MessagePack format, writing to an output-stream.

Definition


Methods
















M: integer write-msgpack
dup 0 >= [
{
{ [ dup 127 <= ] [ write1 ] }
{ [ dup 255 <= ] [ 204 write1 write1 ] }
{ [ dup 65535 <= ] [ 205 write1 2 >be write ] }
{ [ dup 4294967295 <= ] [ 206 write1 4 >be write ] }
{
[ dup 18446744073709551615 <= ]
[ 207 write1 8 >be write ]
}
[ cannot-convert ]
} cond
] [
{
{ [ dup -31 >= ] [ write1 ] }
{ [ dup -128 >= ] [ 208 write1 write1 ] }
{ [ dup -32768 >= ] [ 209 write1 2 >be write ] }
{
[ dup -2147483648 >= ]
[ 210 write1 4 >be write ]
}
{
[ dup -9223372036854775808 >= ]
[ 211 write1 8 >be write ]
}
[ cannot-convert ]
} cond
] if ;