about summary refs log tree commit diff stats
path: root/cxdrt.lisp
blob: 3e9533445d563a9f484a19461f69b80560231b41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;;; Depends on the "frpc" package from QuickLisp
(ql:quickload "frpc")

(defun xwrt (fname)
  (with-open-file (f fname :direction :output :if-exists :supersede :element-type '(unsigned-byte 8))
    (frpc:write-xtype :int32 f 1234)
    (frpc:write-xtype :real32 f 3.14159)
    (frpc:write-xtype :real64 f 2.71828d0)
    (frpc:write-xtype :int32 f -5678)
    (frpc:write-xtype :string f "XDR and Common Lisp")
    (frpc:write-xtype :int32 f 21845)))

(defun xrdr (fname)
  (with-open-file (f fname :direction :input :element-type '(unsigned-byte 8))
    (format *standard-output* "~A ~A ~A ~A ~A~%~A~%"
            (frpc:read-xtype :int32 f)
            (frpc:read-xtype :real32 f)
            (frpc:read-xtype :real64 f)
            (frpc:read-xtype :int32 f)
            (frpc:read-xtype :string f)
            (frpc:read-xtype :int32 f))))