-LSPLIB = -A lsp-util/lsp-util.a -A lsp-dbus/lsp-dbus.a
+LSPLIB = -A lsp-misc/lsp-misc.a -A lsp-dbus/lsp-dbus.a
LSPSRC = lsp-dbus-test.lsp
--- /dev/null
+# Create the newlisp library foop.lsplib
+
+LSPSRC = misc.lsp foop.lsp
+
+lsp-misc.a: ${LSPSRC}
+ ar r $@ $^
--- /dev/null
+;; This newlisp module provides FOOP modelling support
+;;
+;; Functional Object-Oriented Programming (FOOP) is an abstraction
+;; overlay using the newlisp context notion as similar to the class
+;; notion in genuine object-oriented programming languages. This is
+;; set out in newlisp by means of the representation principle that an
+;; instance of a FOOP "class" (i.e. context) is a list headed by the
+;; context itself, and followed by the "member values".
+;;
+;; FOOP further includes by the "method invocation" syntax where a
+;; function is preceded by ':' and then followed by the instance
+;; concerned before actual function arguments. That instance is then
+;; stoved away as implicitly available via the (self) function, and
+;; the member values accessible via index, e.g. the term (self 3)
+;; refers to the third member of the instance. The self references are
+;; destructively assignable with setf.
+;;
+;; This modelling support adds member name declaration together with
+;; automatic getter and setter defintions. The (FOOP ...) term is used
+;; for declaring member names in order. For example:
+;;
+;; (context 'MAIN:EX")
+;; (FOOP a b c)
+;; (define (EX:EX n) (list (context) (+ n 4) 3 2))
+;;
+;; That would declare a FOOP context EX with instances having three
+;; members named a, b and c. The declaratin results in a variable EX:.
+;; whose value is (FOOP a b c), as well as three access functions for
+;; each member: the member position index (.member), a getter
+;; (%member) and a setter (!member V).
+;;
+;; As indicated in the example, (FOOP a b c) does not define the
+;; "constructor". It only defines the access functions.
+
+(context 'FOOP)
+
+;; Helper function to make a new symbol for the context of S by
+;; preceeding it with string P.
+(define (name P S) (sym (string P (term S)) (prefix S)))
+
+;; (FOOP name ...)
+; foop is a language extension to declare the field names of a FOOP
+; object type, and thereby gain getter and setter functions with the
+; naming formats (:%name obj) and (:!name obj value) respectively .
+(define-macro (FOOP:FOOP)
+ (let ((K (sym "." (prefix (first (args)))))
+ (V (cons (context) (args)))
+ (I 0))
+ (set K V)
+ (dolist (S (args))
+ (letex ((GET (name "%" S))
+ (SET (name "!" S))
+ (IT (name "." S))
+ (V (sym "V" (prefix S)))
+ (I (inc I)))
+ (define (IT) I)
+ (define (GET) (self I))
+ (define (SET V) (setf (self I) V))))
+ ))
+
+"foop.lsp"
--- /dev/null
+(define (prog1 X) X)
+(global 'prog1)
+
+(define (die N)
+ (when (args) (write-line 2 (join (map string (args)) " ")))
+ (exit N))
+(global 'die)
+
+;; Print binary byte as octal or as ASCII character [32-126]
+(define (octal-byte x)
+ (if (and (> x 31) (< x 127)) (char x) (format "\\%o" x)))
+
+;; Print string as binary octals
+(define (octals-string S)
+ (join (map octal-byte (unpack (dup "b" (length S)) S))) "")
+(global 'octals-string 'octal-byte)
+++ /dev/null
-# Create the newlisp library foop.lsplib
-
-LSPSRC = foop.lsp misc.lsp
-
-lsp-util.a: ${LSPSRC}
- ar r $@ $^
+++ /dev/null
-;; This newlisp module provides FOOP modelling support
-;;
-;; Functional Object-Oriented Programming (FOOP) is an abstraction
-;; overlay using the newlisp context notion as similar to the class
-;; notion in genuine object-oriented programming languages. This is
-;; set out in newlisp by means of the representation principle that an
-;; instance of a FOOP "class" (i.e. context) is a list headed by the
-;; context itself, and followed by the "member values".
-;;
-;; FOOP further includes by the "method invocation" syntax where a
-;; function is preceded by ':' and then followed by the instance
-;; concerned before actual function arguments. That instance is then
-;; stoved away as implicitly available via the (self) function, and
-;; the member values accessible via index, e.g. the term (self 3)
-;; refers to the third member of the instance. The self references are
-;; destructively assignable with setf.
-;;
-;; This modelling support adds member name declaration together with
-;; automatic getter and setter defintions. The (FOOP ...) term is used
-;; for declaring member names in order. For example:
-;;
-;; (context 'MAIN:EX")
-;; (FOOP a b c)
-;; (define (EX:EX n) (list (context) (+ n 4) 3 2))
-;;
-;; That would declare a FOOP context EX with instances having three
-;; members named a, b and c. The declaratin results in a variable EX:.
-;; whose value is (FOOP a b c), as well as three access functions for
-;; each member: the member position index (.member), a getter
-;; (%member) and a setter (!member V).
-;;
-;; As indicated in the example, (FOOP a b c) does not define the
-;; "constructor". It only defines the access functions.
-
-(context 'FOOP)
-
-;; Helper function to make a new symbol for the context of S by
-;; preceeding it with string P.
-(define (name P S) (sym (string P (term S)) (prefix S)))
-
-;; (FOOP name ...)
-; foop is a language extension to declare the field names of a FOOP
-; object type, and thereby gain getter and setter functions with the
-; naming formats (:%name obj) and (:!name obj value) respectively .
-(define-macro (FOOP:FOOP)
- (let ((K (sym "." (prefix (first (args)))))
- (V (cons (context) (args)))
- (I 0))
- (set K V)
- (dolist (S (args))
- (letex ((GET (name "%" S))
- (SET (name "!" S))
- (IT (name "." S))
- (V (sym "V" (prefix S)))
- (I (inc I)))
- (define (IT) I)
- (define (GET) (self I))
- (define (SET V) (setf (self I) V))))
- ))
-
-"foop.lsp"
+++ /dev/null
-(define (prog1 X) X)
-(global 'prog1)
-
-(define (die N)
- (when (args) (write-line 2 (join (map string (args)) " ")))
- (exit N))
-(global 'die)
-
-;; Print binary byte as octal or as ASCII character [32-126]
-(define (octal-byte x)
- (if (and (> x 31) (< x 127)) (char x) (format "\\%o" x)))
-
-;; Print string as binary octals
-(define (octals-string S)
- (join (map octal-byte (unpack (dup "b" (length S)) S))) "")
-(global 'octals-string 'octal-byte)