Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-pack Reference Manual, version 1.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 03:56:27 2022 GMT+0.
Next: Systems, Previous: The cl-pack Reference Manual, Up: The cl-pack Reference Manual [Contents][Index]
cl-pack supplies Perl/PHP/Ruby/Python compatible pack()
and unpack()
functions to allow easy use of (binary format) protocols and files with the above mentioned languages and C. cl-pack was released by Dan Ballard dan@mindstab.net under the BSD-3-Clause license.
The purpose of cl-pack is to take native Lisp data like numbers, floats, and strings and encode it in a safe binary format in string that can then be written to a file or exchanged with another program while unpack can extract data from binary formats and protocols.
cl-pack has nearly full support for all features offered by Perl's pack. It boasts full support for most data types and formating rules from numbers and string to formating rules and grouping and templates. cl-pack also supports endian safe floats as outlined by ruby. cl-pack is supports ASDF so as to make it easy to integrate into your existing system.
cl-pack is available in QuickLisp
CL-USER> (ql:quickload "cl-pack")
CL-PACK> (pack "VgA*c*" #x41424344 161.99 " a string " 69 70 71)
;; => "DCBAC!ýq a string EFG"
CL-PACK> (unpack "B8H2Ng" "ABCDEFC!ýq")
;; => "01000001"
;; => "42"
;; => 1128547654
;; => 161.99
Documentation is currently a bit sparse, but is contained in cl-pack.lisp. Additionally, a good overview of pack and unpack functions can be seen at http://perldoc.perl.org/functions/pack.html.
Nearly every feature except a few esoteric ones are supported, check the documentation inside cl-pack.lisp if in doubt and if a feature you need isn't currently supported feel free to contact me and I'll see if I can add it.
Note I think the this release is about as feature complete as I feel I need to get at the moment so I'm pushing it out.
Cavets cl-pack was developed on an x86 running Ubuntu with SBCL. It should be endian safe where required and conform to host CPU endianness where required but I haven't been able to test on anything but x86. I would hope that it would work with most Lisps out there. Please feel free to get a hold of me if you have issues that need fixing
Next: Files, Previous: Introduction, Up: The cl-pack Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Perl compatible binary pack() and unpack() library
Dan Ballard <dan@mindstab.net>
BSD-3-Clause
1.0.1
ieee-floats (system).
Next: Packages, Previous: Systems, Up: The cl-pack Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-pack/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-pack (system).
Next: cl-pack/cl-pack.lisp, Previous: cl-pack/cl-pack.asd, Up: Lisp [Contents][Index]
cl-pack (system).
Previous: cl-pack/package.lisp, Up: Lisp [Contents][Index]
cl-pack (system).
Next: Definitions, Previous: Files, Up: The cl-pack Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: cl-pack-system, Previous: Packages, Up: Packages [Contents][Index]
Next: Indexes, Previous: Packages, Up: The cl-pack Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Previous: Public Interface, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
macro for building string type bodies for case statements in pack() or unpack()
create a subseq of form that skips the current syntax object
Macro to define the pack function for an int
macro for building string type bodies for case statements in pack()
Macro to define the unpack function for a signed int
macro to define a normal uint that with the ! modifier is a signed int
macro for building string type bodies for case statements in unpack()
Macro to define the unpack function for an unsigned int
Turn a 2 hex digit string into a number unpacked by mapper
turns a string of 8 or less bits into a byte
byte-form specifies the packing order of bits into the byte, deaulting to decending order
Take a BER number as a binary string and returns a number
function to encode a BER number into a binary byte string
pack a bit string into a byte string, decending order by default
turn a string of bytes into an extended string of bits unpacked by unpack-fn
Turn a byte into a string of 2 hex characters
turns a byte into a string of bits
convert a byte to a bit string, lowest bit first
bytes: Some binary data in lisp number form that ldb can access bytes-to-list pulls out 8bit bytes from bytes and turns them into their corresponding characters and returns the list of them
puts length bytes from bytes into a string
puts length bytes from bytes into a reversed string
turn a string of hex digits into a string of packed bytes, unpacking 2 hex digits at a time by mapper
turn a character of 0-9 or a-f or A-F into a hex digit of 0-15
Turn a string of bytes into a string of hex digits
Get the next char from a string of null if offset is past end of string
returns a char that is the first char of str
returns the rest of str
takes length bytes from string and returns an int
Previous: Definitions, Up: The cl-pack Reference Manual [Contents][Index]
Jump to: | 2
8
B C D E F G H I M N P S T U |
---|
Jump to: | 2
8
B C D E F G H I M N P S T U |
---|
Jump to: | C F P S |
---|
Jump to: | C F P S |
---|