chickadee » msgpack

msgpack

Author

Hugo Arregui

Requirements

Description

A MessagePack implementation for scheme.

API

Pack

(pack PORT VALUE) procedure

This procedure 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
(pack-uint PORT VALUE) procedure
(pack-sint PORT VALUE) procedure
(pack-float PORT VALUE) procedure
(pack-double PORT VALUE) procedure
(pack-bin PORT BYTE-BLOB) procedure
(pack-str PORT STRING) procedure
(pack-array PORT VECTOR) procedure
(pack-map PORT HASH-TABLE) procedure
(pack-ext PORT EXT) procedure

Unpack

(unpack PORT [MAPPER identity]) procedure

Extension

Definition:

(extension type data) record
  • type: integer from 0 to 127
  • data: a byte-blob

Example:

(make-extension 1 (string->byte-blob "hi"))

License

BSD

Contents »