Changeset 33669 in project


Ignore:
Timestamp:
09/22/16 17:31:05 (5 years ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [201.250.188.147]:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/msgpack

    r29428 r33669  
    2626
    2727* if the VALUE has a packer, apply it.
    28 * if the VALUE is a string, it will be packed as raw.
    29 * if the VALUE is a blob, it will be packed as raw.
     28* if the VALUE is a string, it will be packed as str.
     29* if the VALUE is a blob, it will be packed as bin.
    3030* if the VALUE is a char, it will be packed as a uint.
    3131* if the VALUE is a list, it will be packed as an array.
     32* if the VALUE is a extension (see below), it will be packed as an ext
     33
    3234
    3335<procedure>(pack-uint PORT VALUE)</procedure>
     
    3941<procedure>(pack-double PORT VALUE)</procedure>
    4042
    41 <procedure>(pack-raw PORT VALUE)</procedure>
     43<procedure>(pack-bin PORT BYTE-BLOB)</procedure>
    4244
    43 <procedure>(pack-array PORT VALUE)</procedure>
     45<procedure>(pack-str PORT STRING)</procedure>
    4446
    45 <procedure>(pack-map PORT VALUE)</procedure>
     47<procedure>(pack-array PORT VECTOR)</procedure>
     48
     49<procedure>(pack-map PORT HASH-TABLE)</procedure>
     50
     51<procedure>(pack-ext PORT EXT)</procedure>
    4652
    4753==== Unpack
     
    4955<procedure>(unpack PORT [MAPPER identity])</procedure>
    5056
    51 ==== Mappers
     57=== Extension
    5258
    53 <procedure>(raw->string/mapper VALUE)</procedure>
     59==== Definition:
     60
     61A extension type is simply a three element list (header type data):
     62
     63* header: 'ext symbol
     64* type: integer from 0 to 127
     65* data: a byte-blob
     66
     67
     68<enscript highlight="scheme">
     69(list 'ext TYPE DATA)
     70</enscript>
     71
     72
     73==== Example:
     74
     75<enscript highlight="scheme">
     76(list 'ext 1 ,(string->byte-blob "hi"))
     77</enscript>
    5478
    5579=== License
Note: See TracChangeset for help on using the changeset viewer.