X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fbackq.lisp;h=acc783918cd3f352e05dd074083d6523cbe5828d;hb=a37de74b393a808825585000bb5b2b92218d46c0;hp=710e4025256f8c81d8709f45f38ed812c3e371b6;hpb=a8fa26a6e9804d3548f5bca9361a91345a689099;p=sbcl.git diff --git a/src/code/backq.lisp b/src/code/backq.lisp index 710e402..acc7839 100644 --- a/src/code/backq.lisp +++ b/src/code/backq.lisp @@ -11,6 +11,8 @@ (in-package "SB!IMPL") +(/show0 "entering backq.lisp") + ;;; The flags passed back by BACKQUOTIFY can be interpreted as follows: ;;; ;;; |`,|: [a] => a @@ -45,6 +47,8 @@ (defvar *bq-dot-flag* '(|,.|)) (defvar *bq-vector-flag* '(|bqv|)) +(/show0 "backq.lisp 50") + ;;; the actual character macro (defun backquote-macro (stream ignore) (declare (ignore ignore)) @@ -57,6 +61,8 @@ (%reader-error stream ",. after backquote in ~S" thing)) (values (backquotify-1 flag thing) 'list)))) +(/show0 "backq.lisp 64") + (defun comma-macro (stream ignore) (declare (ignore ignore)) (unless (> *backquote-count* 0) @@ -74,6 +80,8 @@ (cons *bq-comma-flag* (read stream t nil t)))) 'list))) +(/show0 "backq.lisp 83") + ;;; This does the expansion from table 2. (defun backquotify (stream code) (cond ((atom code) @@ -128,6 +136,8 @@ (values 'list* (list a (backquotify-1 dflag d))))))))))) +(/show0 "backq.lisp 139") + ;;; This handles the cases. (defun comma (code) (cond ((atom code) @@ -144,6 +154,8 @@ (values 'list* (cdr code))) (t (values *bq-comma-flag* code)))) +(/show0 "backq.lisp 157") + ;;; This handles table 1. (defun backquotify-1 (flag thing) (cond ((or (eq flag *bq-comma-flag*) @@ -169,8 +181,11 @@ ;;;; magic BACKQ- versions of builtin functions -;;; Define synonyms for the lisp functions we use, so that by using them, we -;;; backquoted material will be recognizable to the pretty-printer. +(/show0 "backq.lisp 184") + +;;; Define synonyms for the lisp functions we use, so that by using +;;; them, the backquoted material will be recognizable to the +;;; pretty-printer. (macrolet ((def-frob (b-name name) (let ((args (gensym "ARGS"))) ;; FIXME: This function should be INLINE so that the lists @@ -186,24 +201,31 @@ (def-frob backq-nconc nconc) (def-frob backq-cons cons)) +(/show0 "backq.lisp 204") + (defun backq-vector (list) (declare (list list)) (coerce list 'simple-vector)) ;;;; initialization +(/show0 "backq.lisp 212") + ;;; Install BACKQ stuff in the current *READTABLE*. ;;; -;;; In the target Lisp, we have to wait to do this until the readtable has been -;;; created. In the cross-compilation host Lisp, we can do this right away. -;;; (You may ask: In the cross-compilation host, which already has its own -;;; implementation of the backquote readmacro, why do we do this at all? -;;; Because the cross-compilation host might -- as SBCL itself does -- express -;;; the backquote expansion in terms of internal, nonportable functions. By -;;; redefining backquote in terms of functions which are guaranteed to exist on -;;; the target Lisp, we ensure that backquote expansions in code-generating -;;; code work properly.) +;;; In the target Lisp, we have to wait to do this until the readtable +;;; has been created. In the cross-compilation host Lisp, we can do +;;; this right away. (You may ask: In the cross-compilation host, +;;; which already has its own implementation of the backquote +;;; readmacro, why do we do this at all? Because the cross-compilation +;;; host might -- as SBCL itself does -- express the backquote +;;; expansion in terms of internal, nonportable functions. By +;;; redefining backquote in terms of functions which are guaranteed to +;;; exist on the target Lisp, we ensure that backquote expansions in +;;; code-generating code work properly.) (defun !backq-cold-init () (set-macro-character #\` #'backquote-macro) (set-macro-character #\, #'comma-macro)) #+sb-xc-host (!backq-cold-init) + +(/show0 "done with backq.lisp")