mirror of
https://github.com/aziascreations/PB-MessagePack.git
synced 2026-11-03 17:01:24 +01:00
0362f17bd2
Update .gitignore, MessagePack.pbi, LICENSE, and 2 more files
23 lines
595 B
Plaintext
23 lines
595 B
Plaintext
|
|
|
|
EnableExplicit
|
|
|
|
Define *Buffer = MsgPackCreateMsgBuffer(16)
|
|
MsgPackWriteI8(*Buffer, 42)
|
|
MsgPackWriteI8(*Buffer, 7)
|
|
MsgPackFreeMsgBuffer(*Buffer, #True)
|
|
|
|
; Wrapping an existing buffer for reading
|
|
Define *RawData = AllocateMemory(4)
|
|
PokeA(*RawData + 0, #MsgPack_FormatCode_UInt8)
|
|
PokeA(*RawData + 1, 42)
|
|
PokeA(*RawData + 2, #MsgPack_FormatCode_Int8)
|
|
PokeB(*RawData + 3, -3)
|
|
|
|
Define *ReadBuffer = MsgPackWrapMsgBuffer(*RawData, 4)
|
|
Debug MsgPackReadU8(*ReadBuffer)
|
|
Debug MsgPackReadI8(*ReadBuffer)
|
|
|
|
MsgPackFreeMsgBuffer(*ReadBuffer, #False) ; #False: *RawData is owned by us
|
|
FreeMemory(*RawData)
|
|
|