[gambit-list] Mobile Reversi
Marc Feeley
feeley at iro.umontreal.ca
Wed Oct 21 11:51:28 EDT 2015
The source code is the only doc at this point, but it is a fairly straightforward encoding. Basically it is a prefix encoding of a tree using bytes, with a special code when there are cycles or sharing. Here’s a quick overview:
Single byte encoding for specific common objects:
#x50 0
#x51 1
#x52 2
#x53 3
#x54 4
#x55 5
#x56 6
#x57 7
#x58 8
#x59 9
#x5a 10
#x70 #f
#x71 #t
#x72 ()
#x73 #!eof
#x75 #!void
...
Multi byte encoding for exact integers:
#x5e BYTE1 8 bit integer BYTE1 (top bit is sign)
#x5d BYTE1 BYTE2 16 bit integer BYTE1 BYTE2
#x5c BYTE1 BYTE2 BYTE3 24 bit integer BYTE1 BYTE2 BYTE3
#x5b BYTE1 BYTE2 BYTE3 BYTE4 32 bit integer BYTE1 BYTE2 BYTE3 BYTE4
#x5f n BYTE1 ... BYTEn 8*n bit integer BYTE1 ... BYTEn
Multi byte encoding for pairs:
#x64 <car> <cdr> (<car> . <cdr>)
Multi byte encoding for vectors:
#x20 #()
#x21 <ELEM1> #(ELEM1)
#x22 <ELEM1> <ELEM2> #(ELEM1 ELEM2)
#x23 <ELEM1> <ELEM2> <ELEM3> #(ELEM1 ELEM2 ELEM3)
...
#x2e <ELEM1> ... <ELEM14> #(ELEM1 ... ELEM14)
#x2f n <ELEM1> ... <ELEMn> #(ELEM1 ... ELEMn)
So for example, (object->u8vector '#(#f 20 (1 2 3))) is:
#u8(#x23 #x70 #x5e #x14 #x64 #x51 #x64 #x52 #x64 #x53 #x72)
---- ---- --------- ---- ---- ---- ---- ---- ---- ----
vect #f 20 pair 1 pair 2 pair 3 ()
Marc
> On Oct 21, 2015, at 9:30 AM, mikel evins <mevins at me.com> wrote:
>
>
>> On Oct 21, 2015, at 7:40 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
>>
>> On the other hand, object->u8vector and u8vector->object are compatible for types other than procedures and continuations. It is possible to transfer data (even with circularities) between them, so an ad-hoc remote procedure call implementation should not be too difficult to build.
>
> Speaking of this, is there documentation of the format used by object->u8vector and u8vector->object, other than the source code? If I want to use Gambit’s serialization, but also want to implement a strategy for exchanging serialized data with a tool written in something other than Gambit, what’s the best way to understand the format?
>
>
More information about the Gambit-list
mailing list