diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 4c1befb..0e4715a 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -1773,6 +1773,50 @@ Symbolics read-line returns embedded newlines in a c-m-Y.") @ +\defun{getScriptName}{getScriptName} +\calls{getScriptName}{identp} +\calls{getScriptName}{postError} +\calls{getScriptName}{internl} +\calls{getScriptName}{stringimage} +\calls{getScriptName}{decodeScripts} +\calls{getScriptName}{pname} +<>= +(defun |getScriptName| (op a numberOfFunctionalArgs) + (when (null (identp op)) + (|postError| (list " " op " cannot have scripts" ))) + (internl '* (stringimage numberOfFunctionalArgs) + (|decodeScripts| a) (pname op))) + +@ + +\defun{decodeScripts}{decodeScripts} +\calls{decodeScripts}{qcar} +\calls{decodeScripts}{qcdr} +\calls{decodeScripts}{strconc} +\calls{decodeScripts}{stringimage} +\calls{decodeScripts}{decodeScripts} +<>= +(defun |decodeScripts| (a) + (labels ( + (fn (a) + (let ((tmp1 0)) + (if (and (pairp a) (eq (qcar a) '|,|)) + (dolist (x (qcdr a) tmp1) (setq tmp1 (+ tmp1 (fn x)))) + 1)))) + (cond + ((and (pairp a) (eq (qcar a) '|PrefixSC|) + (pairp (qcdr a)) (eq (qcdr (qcdr a)) nil)) + (strconc (stringimage 0) (|decodeScripts| (qcar (qcdr a))))) + ((and (pairp a) (eq (qcar a) '|;|)) + (apply 'strconc (loop for x in (qcdr a) collect (|decodeScripts| x)))) + ((and (pairp a) (eq (qcar a) '|,|)) + (stringimage (fn a))) + (t + (stringimage 1))))) + +@ + + \chapter{The Compiler} \section{Compiling EQ.spad} @@ -4878,6 +4922,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> +<> <> <> @@ -4885,6 +4930,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> +<> <> <> diff --git a/changelog b/changelog index be414ed..e7d48b1 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20101006 tpd src/axiom-website/patches.html 20101006.04.tpd.patch +20101006 tpd src/interp/parsing.lisp treeshake compiler +20101006 tpd books/bookvol9 treeshake compiler 20101006 tpd src/axiom-website/patches.html 20101006.03.tpd.patch 20101006 tpd src/interp/parsing.lisp treeshake compiler 20101006 tpd books/bookvol9 treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 0fd3fd2..34d848d 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3198,5 +3198,7 @@ books/bookvol9 treeshake compiler
books/bookvol9 treeshake compiler
20101006.03.tpd.patch books/bookvol9 treeshake compiler
+20101006.04.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index fe72f8c..e7c84f1 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -4320,29 +4320,7 @@ parse ;;; *** |postScripts| REDEFINED (DEFUN |postScripts| (#0=#:G167060) (PROG (|op| |a|) (RETURN (PROGN (SPADLET |op| (CADR #0#)) (SPADLET |a| (CADDR #0#)) (CONS (|getScriptName| |op| |a| 0) (|postTranScripts| |a|)))))) -;getScriptName(op,a,numberOfFunctionalArgs) == -; if null IDENTP op then -; postError ['" ",op,'" cannot have scripts"] -; INTERNL("*",STRINGIMAGE numberOfFunctionalArgs, -; decodeScripts a,PNAME op) -;;; *** |getScriptName| REDEFINED - -(DEFUN |getScriptName| (|op| |a| |numberOfFunctionalArgs|) (PROGN (COND ((NULL (IDENTP |op|)) (|postError| (CONS " " (CONS |op| (CONS " cannot have scripts" NIL)))))) (INTERNL (QUOTE *) (STRINGIMAGE |numberOfFunctionalArgs|) (|decodeScripts| |a|) (PNAME |op|)))) -;decodeScripts a == -; a is ['PrefixSC,b] => STRCONC(STRINGIMAGE 0,decodeScripts b) -; a is [";",:b] => APPLX('STRCONC,[decodeScripts x for x in b]) -; a is [",",:b] => -; STRINGIMAGE fn a where fn a == (a is [",",:b] => +/[fn x for x in b]; 1) -; STRINGIMAGE 1 - -;;; *** |decodeScripts,fn| REDEFINED - -(DEFUN |decodeScripts,fn| (|a|) (PROG (|b|) (RETURN (SEQ (IF (AND (PAIRP |a|) (EQ (QCAR |a|) (QUOTE |,|)) (PROGN (SPADLET |b| (QCDR |a|)) (QUOTE T))) (EXIT (PROG (#0=#:G167125) (SPADLET #0# 0) (RETURN (DO ((#1=#:G167130 |b| (CDR #1#)) (|x| NIL)) ((OR (ATOM #1#) (PROGN (SETQ |x| (CAR #1#)) NIL)) #0#) (SEQ (EXIT (SETQ #0# (PLUS #0# (|decodeScripts,fn| |x|)))))))))) (EXIT 1))))) - -;;; *** |decodeScripts| REDEFINED - -(DEFUN |decodeScripts| (|a|) (PROG (|ISTMP#1| |b|) (RETURN (SEQ (COND ((AND (PAIRP |a|) (EQ (QCAR |a|) (QUOTE |PrefixSC|)) (PROGN (SPADLET |ISTMP#1| (QCDR |a|)) (AND (PAIRP |ISTMP#1|) (EQ (QCDR |ISTMP#1|) NIL) (PROGN (SPADLET |b| (QCAR |ISTMP#1|)) (QUOTE T))))) (STRCONC (STRINGIMAGE 0) (|decodeScripts| |b|))) ((AND (PAIRP |a|) (EQ (QCAR |a|) (QUOTE |;|)) (PROGN (SPADLET |b| (QCDR |a|)) (QUOTE T))) (apply (QUOTE STRCONC) (PROG (#0=#:G167147) (SPADLET #0# NIL) (RETURN (DO ((#1=#:G167152 |b| (CDR #1#)) (|x| NIL)) ((OR (ATOM #1#) (PROGN (SETQ |x| (CAR #1#)) NIL)) (NREVERSE0 #0#)) (SEQ (EXIT (SETQ #0# (CONS (|decodeScripts| |x|) #0#))))))))) ((AND (PAIRP |a|) (EQ (QCAR |a|) (QUOTE |,|)) (PROGN (SPADLET |b| (QCDR |a|)) (QUOTE T))) (STRINGIMAGE (|decodeScripts,fn| |a|))) ((QUOTE T) (STRINGIMAGE 1))))))) ;postIf t == ; t isnt ['if,:l] => t ; ['IF,:[(null (x:= postTran x) and null $BOOT => 'noBranch; x)