An implementation of MessagePack for CHICKEN scheme v5.
Forked from msgpack-scheme and partially rewritten (ported to CHICKEN 5 and built-in byte blob API). I kept the original license and most of the original API. However, the byte-blob have been replaced with Chicken 5 native blob. I removed the dependency on bind egg and the need for C++ code using built-ins features of C5.
Hugo Arregui: Original author of the egg.
Théo Cavignac: ported the egg to Chicken 5
Find the code at github.com.
This package requires the following eggs:
Through Chicken egg repository: Run chicken-install -s msgpack anywhere.
- Install the required eggs listed above.
- Clone this repository.
- Run chicken-install -s in the root of this repository.
Primitive pack-family procedures:
- pack-uint port valueprocedure
- pack-sint port valueprocedure
pack integer, will produce an error if the input does not respect the expected signedness
- pack-float port FLONUMprocedure
pack 32b floats, support both exact and inexact but convert to flonum (inexact) anyway
- pack-double port FLONUMprocedure
pack 64b floats, support both exact and inexact but convert to flonum (inexact) anyway
- pack-bin port BLOBprocedure
pack chicken.blob byte blob
- pack-str port STRINGprocedure
- pack-array port VECTORprocedure
pack scheme vectors or lists
- pack-map port HASH-TABLEprocedure
pack srfi-69 hash-table
- pack-ext port EXTprocedure
pack extension record (see below)
- pack port valueprocedure
Will infer the right packer to use and write the msgpack result to port
- pack/blob valueprocedure
Will inter the right packer and return the message as a byte blob
These procedures will call primitive type packers, with the following rules:
- if the value has a packer, apply it.
- if the value is a string, it will be packed as str.
- if the value is a blob, it will be packed as bin.
- if the value is a char, it will be packed as a uint.
- if the value is a list, it will be packed as an array.
- if the value is a extension (see below), it will be packed as an ext
The /blob version return a blob of packed data, the others directly write it to the port.
Unpack procedures: <procedure>(unpack port [mapper])</procedure> Read msgpack data from port and return the unpacked data.
- unpack/blob blob #!optional mapperprocedure
Treat the blob as a msgpack data and return the unpacked data.
The optional mapper argument is applied to the output before returning. The /blob version unpack the content of blob instead of reading from a port.
Extension is a record defined as:
(define-record extension type data)
- type: integer from 0 to 127
- data: a blob
(make-extension 10 (string->byte-blob "hi"))
Distributed under the New BSD License.
- v1.0.3 Ironing details for publication.
- v1.0.0 Port to Chicken 5. Breaking changes: All blob related APIs have been changed to support Chicken native blob type.
- v0.4 Last Chicken 4 version (2016)