1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
This is an implementation of a UBF(A) (as specified by
http://www.sics.se/~joe/ubf/site/ubfa.html) reader and writer. I have
tried to make both as correct, tidy and efficient as possible. If they
aren't, do something about it. (-:
Mapping of UBF data types into lisp types:
* integers map to CL integers
* strings map to strings
* & map to CONS pairs
* # maps to nil
* 'constants' map to (case-sensitive) symbols in the UBF.A-CONSTANT
package
* `type tags` put the last object on the stack into the OBJECT
slot of a new TAGGED-OBJECT structure, intern the type in the
UBF.A-TYPE package and put the symbol into the TYPE slot
* { structures } map to lisp vectors.
* 11,~binary data~ maps to the type UBF.A::BINARY-DATA. Data
itself is stored in a (vector (unsigned-byte 8)). In fact,
BINARY-DATA is a deftype for (vector (unsigned-byte 8)). Be
careful not to confuse them with { structures }. Test for
BINARY-DATAness first.
* register values are not exported as I think they are internal to
the UBF virtual machine (-:
Hints:
* Use streams with an element-type of '(unsigned-char 8) if you plan
to write binary data out (obviously).
* To write a literal UBF structure out, use something like:
(ubf.a:write-message `#(1 2 ,(identity 2)) the-out-stream)
;; arch-tag: "bc94a74a-e9e0-11d7-ad53-000c76244c24"
|