diff --git a/changelog b/changelog index 5d9c27d..62fcfc1 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +20090815 tpd src/axiom-website/patches.html 20090815.04.tpd.patch +20090815 tpd src/interp/Makefile move cstream.boot to cstream.lisp +20090815 tpd src/interp/cstream.lisp added, rewritten from cstream.boot +20090815 tpd src/interp/cstream.boot removed, rewritten to cstream.lisp 20090815 tpd src/axiom-website/patches.html 20090815.03.tpd.patch 20090815 tpd src/input/Makefile add shannonmatrix.regress 20090815 tpd src/input/shannonmatrix.input added diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index bc0dd19..62fd26b 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -1792,6 +1792,8 @@ cparse.lisp rewrite from boot to lisp
src/interp/Makefile remove debugsys
20090815.03.tpd.patch src/input/Makefile add shannonmatrix.regress
+20090815.04.tpd.patch +cstream.lisp rewrite from boot to lisp
diff --git a/src/interp/Makefile.pamphlet b/src/interp/Makefile.pamphlet index 7369bfa..086d19c 100644 --- a/src/interp/Makefile.pamphlet +++ b/src/interp/Makefile.pamphlet @@ -418,7 +418,6 @@ DOCFILES=${DOC}/as.boot.dvi \ ${DOC}/c-doc.boot.dvi \ ${DOC}/cfuns.lisp.dvi \ ${DOC}/compiler.boot.dvi \ - ${DOC}/cstream.boot.dvi \ ${DOC}/c-util.boot.dvi ${DOC}/daase.lisp.dvi \ ${DOC}/database.boot.dvi \ ${DOC}/define.boot.dvi \ @@ -5583,45 +5582,26 @@ ${MID}/dq.lisp: ${IN}/dq.lisp.pamphlet @ -\subsection{cstream.boot} +\subsection{cstream.lisp} <>= -${OUT}/cstream.${O}: ${MID}/cstream.clisp - @ echo 528 making ${OUT}/cstream.${O} from ${MID}/cstream.clisp - @ if [ -z "${NOISE}" ] ; then \ - echo '(progn (compile-file "${MID}/cstream.clisp"' \ +${OUT}/cstream.${O}: ${MID}/cstream.lisp + @ echo 136 making ${OUT}/cstream.${O} from ${MID}/cstream.lisp + @ ( cd ${MID} ; \ + if [ -z "${NOISE}" ] ; then \ + echo '(progn (compile-file "${MID}/cstream.lisp"' \ ':output-file "${OUT}/cstream.${O}") (${BYE}))' | ${DEPSYS} ; \ else \ - echo '(progn (compile-file "${MID}/cstream.clisp"' \ + echo '(progn (compile-file "${MID}/cstream.lisp"' \ ':output-file "${OUT}/cstream.${O}") (${BYE}))' | ${DEPSYS} \ >${TMP}/trace ; \ - fi + fi ) @ -<>= -${MID}/cstream.clisp: ${IN}/cstream.boot.pamphlet - @ echo 529 making ${MID}/cstream.clisp from ${IN}/cstream.boot.pamphlet +<>= +${MID}/cstream.lisp: ${IN}/cstream.lisp.pamphlet + @ echo 137 making ${MID}/cstream.lisp from ${IN}/cstream.lisp.pamphlet @ (cd ${MID} ; \ - ${TANGLE} ${IN}/cstream.boot.pamphlet >cstream.boot ; \ - if [ -z "${NOISE}" ] ; then \ - echo '(progn (boottran::boottocl "${MID}/cstream.boot") (${BYE}))' \ - | ${BOOTSYS} ; \ - else \ - echo '(progn (boottran::boottocl "${MID}/cstream.boot") (${BYE}))' \ - | ${BOOTSYS} >${TMP}/trace ; \ - fi ; \ - rm cstream.boot ) - -@ -<>= -${DOC}/cstream.boot.dvi: ${IN}/cstream.boot.pamphlet - @echo 530 making ${DOC}/cstream.boot.dvi \ - from ${IN}/cstream.boot.pamphlet - @(cd ${DOC} ; \ - cp ${IN}/cstream.boot.pamphlet ${DOC} ; \ - ${DOCUMENT} ${NOISE} cstream.boot ; \ - rm -f ${DOC}/cstream.boot.pamphlet ; \ - rm -f ${DOC}/cstream.boot.tex ; \ - rm -f ${DOC}/cstream.boot ) + ${TANGLE} ${IN}/cstream.lisp.pamphlet >cstream.lisp ) @ @@ -6758,8 +6738,7 @@ clean: <> <> -<> -<> +<> <> <> diff --git a/src/interp/cstream.boot.pamphlet b/src/interp/cstream.boot.pamphlet deleted file mode 100644 index e604ee2..0000000 --- a/src/interp/cstream.boot.pamphlet +++ /dev/null @@ -1,131 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/interp cstream.boot} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -The input stream is parsed into a large s-expression by repeated calls -to Delay. Delay takes a function f and an argument x and returns a list -consisting of ("nonnullstream" f x). Eventually multiple calls are made -and a large list structure is created that consists of -("nonnullstream" f x ("nonnullstream" f1 x1 ("nonnullstream" f2 x2... - -This delay structure is given to StreamNull which walks along the -list looking at the head. If the head is "nonnullstream" then the -function is applied to the argument. - -So, in effect, the input is "zipped up" into a Delay data structure -which is then evaluated by calling StreamNull. This "zippered stream" -parser was a research project at IBM and Axiom was the testbed (which -explains the strange parsing technique). -\section{License} -<>= --- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --- All rights reserved. --- --- Redistribution and use in source and binary forms, with or without --- modification, are permitted provided that the following conditions are --- met: --- --- - Redistributions of source code must retain the above copyright --- notice, this list of conditions and the following disclaimer. --- --- - Redistributions in binary form must reproduce the above copyright --- notice, this list of conditions and the following disclaimer in --- the documentation and/or other materials provided with the --- distribution. --- --- - Neither the name of The Numerical ALgorithms Group Ltd. nor the --- names of its contributors may be used to endorse or promote products --- derived from this software without specific prior written permission. --- --- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS --- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED --- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER --- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, --- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, --- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -@ -<<*>>= -<> - -)package "BOOT" - ---% Stream Utilities - -npNull x== StreamNull x - -StreamNull x== - null x or EQCAR (x,"nullstream") => true - while EQCAR(x,"nonnullstream") repeat - st:=APPLY(CADR x,CDDR x) - RPLACA(x,CAR st) - RPLACD(x,CDR st) - EQCAR(x,"nullstream") - -incIgen n==Delay(function incIgen1,[n]) -incIgen1(:z)== - [n]:=z - n:=n+1 - cons(n,incIgen n) - -incZip(g,f1,f2)==Delay(function incZip1,[g,f1,f2]) -incZip1(:z)== - [g,f1,f2]:=z - StreamNull f1 => StreamNil - StreamNull f2 => StreamNil - cons(FUNCALL(g,car f1,car f2),incZip(g,cdr f1,cdr f2)) - -incAppend(x,y)==Delay(function incAppend1,[x,y]) - -incAppend1(:z)== - [x,y]:=z - if StreamNull x - then if StreamNull y - then StreamNil - else y - else cons(car x,incAppend(cdr x,y)) - -next(f,s)==Delay(function next1,[f,s]) -next1(:z)== - [f,s]:=z - StreamNull s=> StreamNil - h:= APPLY(f, [s]) - incAppend(car h,next(f,cdr h)) - -nextown(f,g,s)==Delay(function nextown1,[f,g,s]) -nextown1 (:z)== - [f,g,s]:=z - StreamNull s=> - spadcall1 g - StreamNil - StreamNull s - h:=spadcall2 (f, s) - incAppend(car h,nextown(f,g,cdr h)) - -nextown2(f,g,e,x)==nextown(cons(f,e),cons(g,e),x) - -spadcall1(g)== - [impl, :env] := g - APPLY(impl, [env]) - -spadcall2(f,args) == - [impl, :env] := f - APPLY(impl, [args, env]) -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/interp/cstream.lisp.pamphlet b/src/interp/cstream.lisp.pamphlet new file mode 100644 index 0000000..7e1787a --- /dev/null +++ b/src/interp/cstream.lisp.pamphlet @@ -0,0 +1,218 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/interp cstream.lisp} +\author{The Axiom Team} +\maketitle +\begin{abstract} +\end{abstract} +\eject +\tableofcontents +\eject +The input stream is parsed into a large s-expression by repeated calls +to Delay. Delay takes a function f and an argument x and returns a list +consisting of ("nonnullstream" f x). Eventually multiple calls are made +and a large list structure is created that consists of +("nonnullstream" f x ("nonnullstream" f1 x1 ("nonnullstream" f2 x2... + +This delay structure is given to StreamNull which walks along the +list looking at the head. If the head is "nonnullstream" then the +function is applied to the argument. + +So, in effect, the input is "zipped up" into a Delay data structure +which is then evaluated by calling StreamNull. This "zippered stream" +parser was a research project at IBM and Axiom was the testbed (which +explains the strange parsing technique). + +@ +<<*>>= + +(IN-PACKAGE "BOOT") +; +;--% Stream Utilities +; +;npNull x== StreamNull x +(DEFUN |npNull| (|x|) (PROG NIL (RETURN (|StreamNull| |x|)))) + +;StreamNull x== +; null x or EQCAR (x,"nullstream") => true +; while EQCAR(x,"nonnullstream") repeat +; st:=APPLY(CADR x,CDDR x) +; RPLACA(x,CAR st) +; RPLACD(x,CDR st) +; EQCAR(x,"nullstream") +(DEFUN |StreamNull| (|x|) + (PROG (|st|) + (RETURN + (COND + ((OR (NULL |x|) (EQCAR |x| (QUOTE |nullstream|))) T) + ((QUOTE T) + (PROGN + ((LAMBDA NIL + (LOOP + (COND + ((NOT (EQCAR |x| (QUOTE |nonnullstream|))) (RETURN NIL)) + ((QUOTE T) + (PROGN + (SETQ |st| (APPLY (CADR |x|) (CDDR |x|))) + (RPLACA |x| (CAR |st|)) + (RPLACD |x| (CDR |st|)))))))) + (EQCAR |x| (QUOTE |nullstream|)))))))) + +;incIgen n==Delay(function incIgen1,[n]) +(DEFUN |incIgen| (|n|) + (PROG NIL + (RETURN + (|Delay| (FUNCTION |incIgen1|) (LIST |n|))))) + +;incIgen1(:z)== +; [n]:=z +; n:=n+1 +; cons(n,incIgen n) +(DEFUN |incIgen1| (&REST |z|) + (PROG (|n|) + (RETURN + (PROGN + (SETQ |n| (CAR |z|)) + (SETQ |n| (+ |n| 1)) + (CONS |n| (|incIgen| |n|)))))) + +;incZip(g,f1,f2)==Delay(function incZip1,[g,f1,f2]) +(DEFUN |incZip| (|g| |f1| |f2|) + (PROG NIL + (RETURN + (|Delay| (FUNCTION |incZip1|) (LIST |g| |f1| |f2|))))) + +;incZip1(:z)== +; [g,f1,f2]:=z +; StreamNull f1 => StreamNil +; StreamNull f2 => StreamNil +; cons(FUNCALL(g,car f1,car f2),incZip(g,cdr f1,cdr f2)) +(DEFUN |incZip1| (&REST |z|) + (PROG (|f2| |f1| |g|) + (RETURN + (PROGN + (SETQ |g| (CAR |z|)) + (SETQ |f1| (CADR . #0=(|z|))) + (SETQ |f2| (CADDR . #0#)) + (COND + ((|StreamNull| |f1|) |StreamNil|) + ((|StreamNull| |f2|) |StreamNil|) + ((QUOTE T) + (CONS + (FUNCALL |g| (CAR |f1|) (CAR |f2|)) + (|incZip| |g| (CDR |f1|) (CDR |f2|))))))))) + +;incAppend(x,y)==Delay(function incAppend1,[x,y]) +(DEFUN |incAppend| (|x| |y|) + (PROG NIL + (RETURN + (|Delay| (FUNCTION |incAppend1|) (LIST |x| |y|))))) + +;incAppend1(:z)== +; [x,y]:=z +; if StreamNull x +; then if StreamNull y +; then StreamNil +; else y +; else cons(car x,incAppend(cdr x,y)) +(DEFUN |incAppend1| (&REST |z|) + (PROG (|y| |x|) + (RETURN + (PROGN + (SETQ |x| (CAR |z|)) + (SETQ |y| (CADR |z|)) + (COND + ((|StreamNull| |x|) + (COND + ((|StreamNull| |y|) |StreamNil|) + (#0=(QUOTE T) |y|))) + (#0# (CONS (CAR |x|) (|incAppend| (CDR |x|) |y|)))))))) + +;next(f,s)==Delay(function next1,[f,s]) +(DEFUN |next| (|f| |s|) + (PROG NIL + (RETURN + (|Delay| (FUNCTION |next1|) (LIST |f| |s|))))) + +;next1(:z)== +; [f,s]:=z +; StreamNull s=> StreamNil +; h:= APPLY(f, [s]) +; incAppend(car h,next(f,cdr h)) +(DEFUN |next1| (&REST |z|) + (PROG (|h| |s| |f|) + (RETURN + (PROGN + (SETQ |f| (CAR |z|)) + (SETQ |s| (CADR |z|)) + (COND + ((|StreamNull| |s|) |StreamNil|) + ((QUOTE T) + (PROGN + (SETQ |h| (APPLY |f| (LIST |s|))) + (|incAppend| (CAR |h|) (|next| |f| (CDR |h|)))))))))) + +;nextown(f,g,s)==Delay(function nextown1,[f,g,s]) +(DEFUN |nextown| (|f| |g| |s|) + (PROG NIL + (RETURN + (|Delay| (FUNCTION |nextown1|) (LIST |f| |g| |s|))))) + +;nextown1 (:z)== +; [f,g,s]:=z +; StreamNull s=> +; spadcall1 g +; StreamNil +; StreamNull s +; h:=spadcall2 (f, s) +; incAppend(car h,nextown(f,g,cdr h)) +(DEFUN |nextown1| (&REST |z|) + (PROG (|h| |s| |g| |f|) + (RETURN + (PROGN + (SETQ |f| (CAR |z|)) + (SETQ |g| (CADR . #0=(|z|))) + (SETQ |s| (CADDR . #0#)) + (COND + ((|StreamNull| |s|) (PROGN (|spadcall1| |g|) |StreamNil|)) + ((QUOTE T) + (PROGN + (|StreamNull| |s|) + (SETQ |h| (|spadcall2| |f| |s|)) + (|incAppend| (CAR |h|) (|nextown| |f| |g| (CDR |h|)))))))))) + +;nextown2(f,g,e,x)==nextown(cons(f,e),cons(g,e),x) +(DEFUN |nextown2| (|f| |g| |e| |x|) + (PROG NIL + (RETURN + (|nextown| (CONS |f| |e|) (CONS |g| |e|) |x|)))) + +;spadcall1(g)== +; [impl, :env] := g +; APPLY(impl, [env]) +(DEFUN |spadcall1| (|g|) + (PROG (|env| |impl|) + (RETURN + (PROGN + (SETQ |impl| (CAR |g|)) + (SETQ |env| (CDR |g|)) + (APPLY |impl| (LIST |env|)))))) + +;spadcall2(f,args) == +; [impl, :env] := f +; APPLY(impl, [args, env]) +(DEFUN |spadcall2| (|f| |args|) + (PROG (|env| |impl|) + (RETURN + (PROGN + (SETQ |impl| (CAR |f|)) + (SETQ |env| (CDR |f|)) + (APPLY |impl| (LIST |args| |env|)))))) + +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document}