[Small-cl-src] tracing setf

Pascal J.Bourguignon pjb at informatimago.com
Fri Sep 10 02:17:39 UTC 2004


;; TRACE cannot be applied on "built-ins", and in any case, not on a
;; special operator!  So, here is a SETF* macro that will "trace"
;; the assignments.

(defmacro setf* (&rest args)
  `(progn ,@(do ((var args (cddr var))
                 (body '()))
                ((null var) (nreverse body))
              (push `(setf ,(car var) ,(cadr var)) body)
              (push `(format *trace-output* "~20:A := (THE ~S ~S) ~%"
                             ',(car var) (type-of ,(car var)) ,(car var))
                    body))));;setf*


;; [144]> (decode-span-lex-word "*a\rguen~as#")
;; LINE                 := (THE (SIMPLE-BASE-STRING 9) "arguen~as") 
;; (AREF NEW J)         := (THE BASE-CHAR #\a) 
;; J                    := (THE BIT 1) 
;; I                    := (THE BIT 1) 
;; (AREF NEW J)         := (THE BASE-CHAR #\r) 
;; J                    := (THE (INTEGER 0 16777215) 2) 
;; I                    := (THE (INTEGER 0 16777215) 2) 
;; (AREF NEW J)         := (THE BASE-CHAR #\g) 
;; J                    := (THE (INTEGER 0 16777215) 3) 
;; I                    := (THE (INTEGER 0 16777215) 3) 
;; (AREF NEW J)         := (THE BASE-CHAR #\u) 
;; J                    := (THE (INTEGER 0 16777215) 4) 
;; I                    := (THE (INTEGER 0 16777215) 4) 
;; (AREF NEW J)         := (THE BASE-CHAR #\e) 
;; J                    := (THE (INTEGER 0 16777215) 5) 
;; I                    := (THE (INTEGER 0 16777215) 5) 
;; (AREF NEW J)         := (THE BASE-CHAR #\LATIN_SMALL_LETTER_N_WITH_TILDE) 
;; J                    := (THE (INTEGER 0 16777215) 6) 
;; I                    := (THE (INTEGER 0 16777215) 7) 
;; (AREF NEW J)         := (THE BASE-CHAR #\a) 
;; J                    := (THE (INTEGER 0 16777215) 7) 
;; I                    := (THE (INTEGER 0 16777215) 8) 
;; (AREF NEW J)         := (THE BASE-CHAR #\s) 
;; J                    := (THE (INTEGER 0 16777215) 8) 
;; I                    := (THE (INTEGER 0 16777215) 9) 
;; LINE                 := (THE (SIMPLE-BASE-STRING 8) "argueñas") 
;; "argueñas"
;; [145]> 

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we.




More information about the Small-cl-src mailing list