I just want to announce I've uptated my binary-types package, which is
a library for reading and writing raw "binary" files in lisp. Most
notably, I've removed/changed some of the really ugly parts of the
design (which I wrote as a lisp novice), so I now think the code can
be deemed "usable" by others.
Also note that the syntax of binary-type declarations is somewhat
changed. The syntax now mirrors that of DEFCLASS and DEFSTRUCT (by
BT:DEF-BINCLASS and BT:DEF-BINSTRUCT, respectively), so that you can
add binary read/write capability to such lisp objects by simply adding
binary-type slot-options, for example:
(def-signed raw-number 8 :big-endian) ; RAW-NUMBER is 64-bit signed integer
=> RAW-NUMBER
(def-binstruct raw-complex
(real 0 :bt 'raw-number)
(imag 0 :bt 'raw-number))
=> RAW-COMPLEX
(with-binary-file (stream "x.raw" :direction :output)
(write-binary 'raw-complex stream #S(raw-complex :real 12 :imag 43)))
=> 16 ; wrote 16 octets
(with-binary-file (stream "x.raw" :direction :input)
(read-binary 'raw-complex stream))
=> #s(raw-complex :real 12 :imag 43)
=> 16 ; read 16 octets
% hexdump -C x.raw
00000000 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 00 2b |...............+|
--
Frode Vatvedt Fjeld
In article <··············@dslab7.cs.uit.no>,
Frode Vatvedt Fjeld <······@acm.org> wrote:
>
> I just want to announce I've uptated my binary-types package, which is
> a library for reading and writing raw "binary" files in lisp. Most
> notably, I've removed/changed some of the really ugly parts of the
> design (which I wrote as a lisp novice), so I now think the code can
> be deemed "usable" by others.
>
Is it available for download somewhere?
Is it generic Common Lisp or implementation-specific?
glauber
--
Glauber Ribeiro
··········@my-deja.com http://www.myvehiclehistoryreport.com
"Opinions stated are my own and not representative of Experian"
Sent via Deja.com http://www.deja.com/
Before you buy.
glauber <··········@my-deja.com> writes:
> Is it available for download somewhere?
Duh.. <URL:http://www.cs.uit.no/~frodef/sw/binary-types/>
> Is it generic Common Lisp or implementation-specific?
It is supposed to be generic. I use ACL myself, but I've briefly
checked that it works in clisp and CMUCL.
--
Frode Vatvedt Fjeld