userial
A Common Lisp library for serializing to binary buffers. This library is the serialization layer for the forthcoming unet library.

Homepage: http://nklein.com/software/unet/userial/

This library is by Patrick Stein.

Here is a simple example of serializing into a buffer:

(make-enum-serializer :opcode (:login :run :jump :logout))
(make-bitfield-serializer :login-flags (:hidden :stay-logged-in))

(serialize* :opcode :login
            :uint32 sequence-number
            :login-flags (:hidden)
            :string login-name
            :string password)

Here are several easy ways to unserialize the contents:

(let (opcode sequence-number flags login-name password)
  (unserialize* :opcode opcode
                :uint32 sequence-number
                :login-flags flags
                :string login-name
                :string password)
  ...)
  
(unserialize-let* (:opcode opcode
                   :uint32 sequence-number
                   :login-flags flags
                   :string login-name
                   :string password)
  ...)

(let ((parts (unserialize-list* '(:opcode 
                                  :uint32
                                  :login-flags
                                  :string
                                  :string))))
  ...)

For more examples, see the web page or the included test cases.


wire format serialization