(setq SCCS-backquote "@(#)backquote.l 1.4 3/7/81")
(setsyntax '\; 'splicing 'zapline)
;---- This file contains the definitions of the backquote and sharpsign
; character macros. [The backquote macro actually uses two characters,
(eval-when (eval) (cond ((null (getd 'declare))
(def declare (nlambda (l) nil)))))
(declare (special **backquote**))
(back=quotify ((lambda (**backquote**) (read))
(def back-quote-comma-macro
(cond ((zerop **backquote**)
(error "comma not inside a backquote."))
(cond ((atom x) (list 'quote x))
((eq (car x) '\,) (cdr x))
(not (memq (caar x) '( \,@ \,\.))))
(setq a (back=quotify (car x)) d (back=quotify (cdr x))
dqp (and (not ad) (eq (car d) 'quote)))
(cond ((and dqp (not (atom a)) (eq (car a) 'quote))
(list 'quote (cons (cadr a) (cadr d))))
((and dqp (null (cadr d)))
((and (not ad) (eq (car d) 'list))
(cons 'list (cons a (cdr d))))
(list 'append (cdar x) (back=quotify (cdr x))))
(list 'nconc (cdar x)(back=quotify (cdr x))))
(setsyntax '\` 'macro 'back-quote-ch-macro)
(setsyntax '\, 'macro 'back-quote-comma-macro)
;------- sharpsign macro, used for conditional assembly
;#O <SEXP> or #o <SEXP> reads sexp with ibase bound to 8.
;#+<FEATURE> <SEXP> makes <SEXP> exist if (STATUS FEATURE <FEATURE>) is T
;#-<FEATURE> <SEXP> makes <SEXP> exist if (STATUS FEATURE <FEATURE>) is NIL
;#+(OR F1 F2 ...) <SEXP> makes <SEXP> exist of any one of F1,F2,... are in
; the (STATUS FEATURES) list.
;#+(AND F1 F2 ...) works similarly except all must be present in the list.
;#+(NOT <FEATURE>) is the same as #-<FEATURE>.
;#/CHAR returns the numerical character code of CHAR.
;#\SYMBOL gets the numerical character code of non-printing characters.
;#' is to FUNCTION as ' is to QUOTE.
;#.<SEXP> evaluates <SEXP> at read time and leaves the result.
;#,<SEXP> evaluates <SEXP> at load time. Here it is the same as "#.".
(declare (special franz-symbolic-character-names ibase))
(setsyntax '\# 'splicing 'sharp-sign-macro)
(cond ((or (eq char 79.) ;O
((lambda (ibase) (list (read))) 8.))
(cond ((not (feature-present frob)) (read)))
(cond ((feature-present frob) (read)))
(list (tyi))) ;return numeric value of CHAR
((eq char 94.) ; ^ returns following char
(list (boole 1 31. (tyi)))) ; made into a control char
(list (list 'function (read))))
((or (eq char 44.) (eq char 46.)) ;, or .
(setq frob (read)) ;get symbolic name of character
(cdr (assq frob franz-symbolic-character-names)))
(or char (error '|Illegal character name in #\\| frob))
(t (error '|Bad character after #| (ascii char)))))
(defun feature-present (feature)
(memq feature (status features))) ;damn fsubrs
(not (feature-present (cadr feature))))
(do ((list (cdr feature) (cdr list)))
(cond ((not (feature-present (car list)))
(do ((list (cdr feature) (cdr list)))
(cond ((feature-present (car list))
(t (error '|Unknown form after #+ or #-| feature))))
(setq franz-symbolic-character-names
'((eof . -1) (bs . 8.) (backspace . 8.)
(tab . 9.) (lf . 10.) (linefeed . 10.)
(ff . 12.) (form . 12.) (return . 13.) (cr . 13.)
(newline . 10.) (vt . 9.)