chickadee » msgpack

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

msgpack

Author

Hugo Arregui

Requirements

Description

A MessagePack implementation for scheme.

API

Pack

pack PORT VALUEprocedure

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 VALUEprocedure
pack-sint PORT VALUEprocedure
pack-float PORT VALUEprocedure
pack-double PORT VALUEprocedure
pack-bin PORT BYTE-BLOBprocedure
pack-str PORT STRINGprocedure
pack-array PORT VECTORprocedure
pack-map PORT HASH-TABLEprocedure
pack-ext PORT EXTprocedure

Unpack

(unpack PORT [MAPPER identity])procedure

Extension

Definition:

extension type datarecord
  • type: integer from 0 to 127
  • data: a byte-blob

Example:

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

License

BSD

Contents »