npatrick04 / monkeylib-binary-data

Binary data library based on code from chapter 24 of Practical Common Lisp

Home Page:http://gigamonkeys.com/book/practical-parsing-binary-files.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

monkeylib-binary-data

Binary data library based on code from chapter 24 of Practical Common Lisp

Non-book alterations

This version has some updates to handle endianness in the generic integers, updated enumeration definition (which I don't think was even in the book), and added tagged data structure inheritance.

Also added are pre/post read/write hooks for individual data items. Let's say you have a regular binary class where you want to take an action based on an endianness indicator.

(define-binary-class special-file () ((endian endianness) (data1 (u4-o :order endian)) (data2 (u4-o :order endian)) (data3 (u4-o :order endian)) (data4 (u4-o :order endian)))

Instead, you can add a post-read hook to endian.

(define-binary-class special-file () ((endian endianness :post-read (setf monkey-types:endianness endian) :post-write (setf monkey-types:endianness endian)) (data1 u4) (data2 u4) (data3 u4) (data4 u4)))

About

Binary data library based on code from chapter 24 of Practical Common Lisp

http://gigamonkeys.com/book/practical-parsing-binary-files.html

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Common Lisp 100.0%