diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 879cb40..57b68fa 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -49939,6 +49939,153 @@ This needs to work off the internal exposure list, not the file. \end{chunk} \chapter{HyperDoc Basic Command support} + +\section{Hyperdoc macro handling and util.ht} + +All of the macros used in hyperdoc are in this hash table. +User-defined macros are read from the file {\bf doc/util.ht} + +\defdollar{htMacroTable} +\begin{chunk}{initvars} +(defvar |$htMacroTable| (make-hash-table :test #'equal)) + +\end{chunk} + +These are the primitive hyperdoc commands. They are directly +implemented. The {\bf buildHtMacroTable} function adds these +to the \verb|$htMacroTable| at startup. + +\defdollar{primitiveHtCommands} +\begin{chunk}{initvars} +(defvar |$primitiveHtCommands| + '(("\\ContinueButton" . 1) + ("\\andexample" . 1) + ("\\autobutt" . 0) + ("\\autobuttons" . 0) + ("\\begin" . 1) + ("\\beginscroll" . 0) + ("\\bound" . 1) + ("\\fbox" . 1) + ("\\centerline" . 1) + ("\\downlink" . 2) + ("\\em" . 0) + ("\\end" . 1) + ("\\endscroll" . 0) + ("\\example" . 1) + ("\\free" . 1) + ("\\graphpaste" . 1) + ("\\helppage" . 1) + ("\\htbmdir" . 0) + ("\\htbmfile" . 1) + ("\\indent" . 1) + ("\\inputbitmap" . 1) + ("\\inputstring" . 3) + ("\\item" . 0) + ("\\keyword" . 1) + ("\\link" . 2) + ("\\lispdownlink" . 2) + ("\\lispmemolink" . 2) + ("\\lispwindowlink" . 2) + ("\\menudownlink" . 2) + ("\\menuitemstyle" . 1) + ("\\menulink" . 2) + ("\\menulispdownlink" . 2) + ("\\menulispmemolink" . 2) + ("\\menulispwindowlink" . 2) + ("\\menumemolink" . 2) + ("\\menuwindowlink" . 2) + ("\\newline" . 0) + ("\\radioboxes" . 3) + ("\\space" . 1) + ("\\spadcommand" . 1) + ("\\stringvalue" . 1) + ("\\tab" . 1) + ("\\table" . 1) + ("\\vspace" . 1) + ("\\windowlink" . 2))) + +\end{chunk} + +\defun{buildHtMacroTable}{Build the table of hyperdoc macros} +Hash user-defined macros from {\bf doc/util.ht} into {\bf htMacroTable}. +Hash primitive hyperdoc macros into {\bf htMacroTable}. +\seebook{buildHtMacroTable}{util.ht}{7.1} +\calls{buildHtMacroTable}{getHtMacroItem} +\calls{buildHtMacroTable}{sayBrightly} +\calls{buildHtMacroTable}{concat} +\calls{buildHtMacroTable}{getEnv} +\calls{buildHtMacroTable}{hput} +\usesdollar{buildHtMacroTable}{htMacroTable} +\usesdollar{buildHtMacroTable}{primitiveHtCommands} +\begin{chunk}{defun buildHtMacroTable} +(defun |buildHtMacroTable| () + (let (fn instream) + (declare (special |$htMacroTable| |$primitiveHtCommands|)) + (setq fn (concat (|getEnv| "AXIOM") "/doc/util.ht")) + (cond + ((probe-file fn) + (with-open-file (instream fn) + (loop + for line = (read-line instream nil :eof) + until (eq line :eof) + do + (when + (mulitple-value-bind (command numOfArgs) (|getHtMacroItem| line) + (hput |$htMacroTable| command numOfArgs)))) + (dolist (pair |$primitiveHtCommands|) + (hput |$htMacroTable| (car pair) (cdr pair))))) + (t (|sayBrightly| "Warning: macro table not found"))) + |$htMacroTable|)) + +\end{chunk} + +\defun{getHtMacroItem}{Get new command name and number of args} +This processes {\bf newcommand} lines read from {\bf doc/util.ht} +An example newcommand looks like +\begin{verbatim} + \newcommand{\menulink}[2] {\menudownlink{#1}{#2}} +\end{verbatim} +This function returns a pair whose CAR is the new command name +and whose CDR is the number of arguments. If there are zero arguments +the brackets and number will not appear. + +However brackets can appear in the new command so we need to fix +the original code to handle this new case. We set up a wall +starting after the first closing brace. +\begin{verbatim} + \newcommand{\beginmenu} {\beginitems[\MenuDotBitmap]} +\end{verbatim} + +\seebook{getHtMacroItem}{util.ht}{7.1} + +\sig{getHtMacroItem}{String}{Values (String NonNegativeInteger)} +\begin{chunk}{defun getHtMacroItem} +(defun |getHtMacroItem| (line) + (let (k command m i j wall digitString) + (when (|stringPrefix?| "\\newcommand{" line) + (setq k (position #\} line :start 11)) + (setq wall (position #\{ line :start k)) ; wall off the body of command + (setq command (substring line 12 (- k 12))) + (setq m (length line)) + (setq i (position #\[ line :start k)) + (if (and i (< i m) (< i wall)) + (progn ; brackets. parse number of args + (setq j (position #\] line :start (+ i 1))) + (setq digitString (substring line (+ i 1) (- (- j i) 1))) + (when (every #'digitp digitString) + (values command (parse-integer digitString)))) + (values command 0))))) ; no brackets + +\end{chunk} + +We populate the htMacroTable at load time. +\begin{chunk}{postvars} +(eval-when (eval load) + (|buildHtMacroTable|)) + +\end{chunk} + +\section{Functions creating pages} Most of the functions create a new page with a call to the function {\tt htMakePage}. This function takes an association list which has several possible keys. diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 03da229..f4a7555 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -20925,6 +20925,44 @@ Note that {\tt u} should start with an open brace. \end{chunk} +\defun{spadSysChoose}{spadSysChoose} +\calls{spadSysChoose}{lassoc} +\calls{spadSysChoose}{spadSysBranch} +\begin{chunk}{defun spadSysChoose} +(defun |spadSysChoose| (tree form) ; tree is ((word . tree) ..) + (let (lookupOn newTree) + (cond + ((null form) t) + ((null tree) nil) + (t + (if (and (consp form) (consp (qcdr form)) (eq (qcddr form) nil)) + (setq lookupOn (qcar form)) + (setq lookupOn form)) + (when (setq newTree (lassoc lookupOn tree)) + (|spadSysBranch| newTree (cadr form))))))) + +\end{chunk} + +\defun{spadSysBranch}{spadSysBranch} +\calls{spadSysBranch}{spadSysChoose} +\calls{spadSysBranch}{member} +\calls{spadSysBranch}{systemError} +\begin{chunk}{defun spadSysBranch} +(defun |spadSysBranch| (tree arg) ; tree is (msg kind TREEorSomethingElse ...) + (let (kind) + (cond + ((null arg) t) + (t + (setq kind (elt tree 2)) + (cond + ((eq kind 'tree) (|spadSysChoose| (elt tree 4) arg)) + ((eq kind 'literals) (|member| arg (ELT tree 4))) + ((eq kind 'integer) (integerp arg)) + ((eq kind 'function) (atom arg)) + (t (|systemError| "unknown tree branch"))))))) + +\end{chunk} + \defun{checkTexht}{checkTexht} \calls{checkTexht}{ifcdr} \calls{checkTexht}{ifcar} @@ -26775,6 +26813,7 @@ The current input line. \getchunk{defun spad} \getchunk{defun spadCompileOrSetq} \getchunk{defun spad-fixed-arg} +\getchunk{defun spadSysBranch} \getchunk{defun splitEncodedFunctionName} \getchunk{defun stack-clear} \getchunk{defun stack-load} diff --git a/books/bookvolbib.pamphlet b/books/bookvolbib.pamphlet index 803dabc..2e50797 100644 --- a/books/bookvolbib.pamphlet +++ b/books/bookvolbib.pamphlet @@ -15789,6 +15789,70 @@ Math. Tables Aids Comput. 10 91--96. (1956) \end{chunk} +\index{Fateman, Richard J.} +\index{Martin, W.A.} +\begin{chunk}{axiom.bib} +@misc{Martxx, + author = "Martin, W.A. and Fateman, R.J.", + title = "The Macsyma System", + url = "http://groups.csail.mit.edu/mac/classes/symbolic/spring13/readings/simplification/martin-fateman-macsyma.pdf", + paper = "Martxx.pdf", + abstract = " + MACSYMA is a system for symbolic manipulation of algebraic expressions + which is being developed at Project MAC, M.I.T. This paper discusses + its philosophy, goals, and current achievements. + + Drawing on the past work of Maring, Moses, and Engelman, it extends + the capabilities of automated algebraic manipulation systems in + several areas, including + + a) limit calculations + b) symbolic integration + c) solution of equations + d) canonical simplification + e) user-level pattern matching + f) user-specified expression manipulation + g) programming and bookkeeping assistance + + MACSYMA makes extensive use of the power of its rational function + subsystem. The facilities derived from this are discussed in + considerable detail. + + An appendix briefly notes some highlights of the overall system." + +} + +\end{chunk} + +\index{Andrews, George E.} +\index{Knopfmacher, Arnold} +\index{Paule, Peter} +\index{Zimmermann, Burkhard} +\begin{chunk}{axiom.bib} +@misc{Andr00, + author = "Andrews, George E. and Knopfmacher, Arnold and Paule, Peter + and Zimmermann, Burkhard", + title = "Engel Expansions of q-Series by Computer Algebra", + year = "2000", + url = "http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.32.207", + paper = "Andr00.pdf", + abstract = " + The $q$-Engle Expansion is an algorithm that leads to unique series + expansions of $q$-series. Various examples related to classical + partition theorems, including the Rogers-Ramanujan identities together + with the elegant generalization found by Garrett, Ismail and Stanton, + have been described recently. The object of this paper is to present + the computer algebra package Engel, written in Mathematics, that has + already played a signiicant role in this work. The package now is made + freely available via the web and should help to intensify research in + this new branch of $q$-series theory. Among various illustrative + examples we present a new infinite Rogers-Ramanujan type family that + has been discovered by using the package." + +} + +\end{chunk} + \eject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Bibliography} diff --git a/changelog b/changelog index 53e37d8..26940f0 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,11 @@ +20141226 tpd src/axiom-website/patches.html 20141226.02.tpd.patch +20141226 tpd books/bookvolbib add Martxx and Andr00 +20141226 tpd src/axiom-website/patches.html 20141226.01.tpd.patch +20141226 tpd books/bookvol5 absorb buildHtMacroTable and getHtMacroItem +20141226 tpd books/bookvol9 absorb spadSysChoose, spadSysBranch +20141226 tpd src/interp/Makefile remove htcheck.lisp +20141226 tpd src/interp/br-con.lisp rewrite READLINE calls from htcheck +20141226 tpd src/interp/htcheck.lisp absorbed and removed 20141225 tpd src/axiom-website/patches.html 20141225.05.tpd.patch 20141225 tpd books/bookvol5 remove unused functions 20141225 tpd src/axiom-website/patches.html 20141225.04.tpd.patch diff --git a/patch b/patch index 563ef84..583604a 100644 --- a/patch +++ b/patch @@ -1,3 +1,14 @@ -books/bookvol5 remove unused functions +books/bookvolbib add Martxx and Andr00 + + author = "Martin, W.A. and Fateman, R.J.", + title = "The Macsyma System", + + author = "Andrews, George E. and Knopfmacher, Arnold and Paule, Peter + and Zimmermann, Burkhard", ++ title = "Engel Expansions of q-Series by Computer Algebra", + + + + diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 7dfe3e5..d2bf172 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -4846,6 +4846,10 @@ books/bookvol9 simplify logic in compDefineCapsuleFunction
src/interp/br-con.lisp remove unused function
20141225.05.tpd.patch books/bookvol5 remove unused functions
+20141226.01.tpd.patch +src/interp/htcheck.lisp absorbed and removed
+20141226.02.tpd.patch +books/bookvolbib add Martxx and Andr00
diff --git a/src/interp/Makefile.pamphlet b/src/interp/Makefile.pamphlet index fd42e7b..4ccd467 100644 --- a/src/interp/Makefile.pamphlet +++ b/src/interp/Makefile.pamphlet @@ -187,8 +187,7 @@ OBJS= ${OUT}/vmlisp.${O} \ ${OUT}/category.${O} \ ${OUT}/functor.${O} \ ${OUT}/info.${O} ${OUT}/iterator.${O} \ - ${OUT}/nruncomp.${O} \ - ${OUT}/htcheck.${O} + ${OUT}/nruncomp.${O} \end{chunk} diff --git a/src/interp/br-con.lisp.pamphlet b/src/interp/br-con.lisp.pamphlet index acf1f14..64c9b4e 100644 --- a/src/interp/br-con.lisp.pamphlet +++ b/src/interp/br-con.lisp.pamphlet @@ -176,7 +176,7 @@ (DO () ((NULL (NULL (EOFP |instream|))) NIL) (SEQ (EXIT (PROGN (SPADLET |fp| (FILE-POSITION |instream|)) - (SPADLET |line| (READLINE |instream|)) + (SPADLET |line| (read-line |instream|)) (SPADLET |cname| (INTERN (|dbName| |line|))) (COND @@ -240,7 +240,7 @@ (STRCONC (|getEnv| "AXIOM") "/algebra/libdb.text"))) (FILE-POSITION |instream| |n|) - (SPADLET |line| (READLINE |instream|)) + (SPADLET |line| (read-line |instream|)) (SHUT |instream|) |line|)))) @@ -269,12 +269,12 @@ (STRCONC (|getEnv| "AXIOM") "/algebra/comdb.text"))) (FILE-POSITION |instream| |n|) - (SPADLET |line| (READLINE |instream|)) + (SPADLET |line| (read-line |instream|)) (SPADLET |k| (|dbTickIndex| |line| 1 1)) (SPADLET |line| (SUBSTRING |line| (PLUS |k| 1) NIL)) (DO () ((NULL (AND (NULL (EOFP |instream|)) - (SPADLET |x| (READLINE |instream|)) + (SPADLET |x| (read-line |instream|)) (SPADLET |k| (MAXINDEX |x|)) (SPADLET |j| (|dbTickIndex| |x| 1 1)) (> |k| |j|) @@ -357,7 +357,7 @@ (TERPRI |comstream|) (DO () ((NULL (NULL (EOFP |instream|))) NIL) (SEQ (EXIT (PROGN - (SPADLET |line| (READLINE |instream|)) + (SPADLET |line| (read-line |instream|)) (SPADLET |outP| (FILE-POSITION |outstream|)) (SPADLET |comP| @@ -657,7 +657,7 @@ (SPADLET |lastLineHadTick| NIL) (DO () ((NULL (NULL (EOFP |instream|))) NIL) (SEQ (EXIT (PROGN - (SPADLET |line| (READLINE |instream|)) + (SPADLET |line| (read-line |instream|)) (COND ((EQL (|#| |line|) 0) '|skip|) ('T @@ -10565,7 +10565,7 @@ ((NUMBERP N) (FILE-POSITION |instream2| N) (SPADLET |line| - (READLINE |instream2|))) + (read-line |instream2|))) ('T NIL)))) (SPADLET |kind| (|dbKind| |line|)) (COND @@ -13220,7 +13220,7 @@ (SPADLET |address| (SUBSTRING |firstPart| 1 NIL)) (SPADLET |instream| (OPEN (|grepSource| |key|))) (FILE-POSITION |instream| (PARSE-INTEGER |address|)) - (SPADLET |line| (READLINE |instream|)) + (SPADLET |line| (read-line |instream|)) (CLOSE |instream|) |line|)))) diff --git a/src/interp/g-util.lisp.pamphlet b/src/interp/g-util.lisp.pamphlet index 25e4728..a225d71 100644 --- a/src/interp/g-util.lisp.pamphlet +++ b/src/interp/g-util.lisp.pamphlet @@ -280,35 +280,6 @@ (SPADLET |fill1| (STRCONC |fillchar| |fill1|)))) (CONS |fill1| (CONS |text| (CONS |fill2| NIL)))))))))) -;stringPrefix?(pref,str) == -; -- sees if the first #pref letters of str are pref -; -- replaces STRINGPREFIXP -; null (STRINGP(pref) and STRINGP(str)) => NIL -; (lp := QCSIZE pref) = 0 => true -; lp > QCSIZE str => NIL -; ok := true -; i := 0 -; while ok and (i < lp) repeat -; not EQ(SCHAR(pref,i),SCHAR(str,i)) => ok := NIL -; i := i + 1 -; ok - -(DEFUN |stringPrefix?| (|pref| |str|) - (PROG (|lp| |ok| |i|) - (RETURN - (SEQ (COND - ((NULL (AND (STRINGP |pref|) (STRINGP |str|))) NIL) - ((EQL (SPADLET |lp| (QCSIZE |pref|)) 0) 'T) - ((> |lp| (QCSIZE |str|)) NIL) - ('T (SPADLET |ok| 'T) (SPADLET |i| 0) - (DO () ((NULL (AND |ok| (> |lp| |i|))) NIL) - (SEQ (EXIT (COND - ((NULL (EQ (SCHAR |pref| |i|) - (SCHAR |str| |i|))) - (SPADLET |ok| NIL)) - ('T (SPADLET |i| (PLUS |i| 1))))))) - |ok|)))))) - ;stringChar2Integer(str,pos) == ; -- replaces GETSTRINGDIGIT in UT LISP ; -- returns small integer represented by character in position pos diff --git a/src/interp/htcheck.lisp.pamphlet b/src/interp/htcheck.lisp.pamphlet deleted file mode 100644 index 6dfaafd..0000000 --- a/src/interp/htcheck.lisp.pamphlet +++ /dev/null @@ -1,280 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/interp htcheck.lisp} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\begin{chunk}{*} -(IN-PACKAGE "BOOT" ) - -;$primitiveHtCommands := '( -; ("\ContinueButton" . 1) -; ("\andexample" . 1) -; ("\autobutt" . 0) -; ("\autobuttons". 0) -; ("\begin" . 1) -; ("\beginscroll". 0) -; ("\bound" . 1) -; ("\fbox" . 1) -; ("\centerline" . 1) -; ("\downlink" . 2) -; ("\em" . 0) -; ("\end" . 1) -; ("\endscroll" . 0) -; ("\example" . 1) -; ("\free" . 1) -; ("\graphpaste" . 1) -; ("\helppage" . 1) -; ("\htbmdir" . 0) -; ("\htbmfile" . 1) -; ("\indent" . 1) -; ("\inputbitmap" . 1) -; ("\inputstring" . 3) -; ("\item" . 0) -; ("\keyword" . 1) -; ("\link" . 2) -; ("\lispdownlink" . 2) -; ("\lispmemolink" . 2) -; ("\lispwindowlink" . 2) -; ("\menudownlink" . 2) -; ("\menuitemstyle" . 1) -; ("\menulink" . 2) -; ("\menulispdownlink" . 2) -; ("\menulispmemolink" . 2) -; ("\menulispwindowlink" . 2) -; ("\menumemolink" . 2) -; ("\menuwindowlink" . 2) -; ("\newline" . 0) -; ("\radioboxes" . 3) -; ("\space" . 1) -; ("\spadcommand" . 1) -; ("\stringvalue" . 1) -; ("\tab" . 1) -; ("\table" . 1) -; ("\vspace" . 1) -; ("\windowlink" . 2)) - -(SPADLET |$primitiveHtCommands| - '(("\\ContinueButton" . 1) ("\\andexample" . 1) - ("\\autobutt" . 0) ("\\autobuttons" . 0) ("\\begin" . 1) - ("\\beginscroll" . 0) ("\\bound" . 1) ("\\fbox" . 1) - ("\\centerline" . 1) ("\\downlink" . 2) ("\\em" . 0) - ("\\end" . 1) ("\\endscroll" . 0) ("\\example" . 1) - ("\\free" . 1) ("\\graphpaste" . 1) ("\\helppage" . 1) - ("\\htbmdir" . 0) ("\\htbmfile" . 1) ("\\indent" . 1) - ("\\inputbitmap" . 1) ("\\inputstring" . 3) ("\\item" . 0) - ("\\keyword" . 1) ("\\link" . 2) ("\\lispdownlink" . 2) - ("\\lispmemolink" . 2) ("\\lispwindowlink" . 2) - ("\\menudownlink" . 2) ("\\menuitemstyle" . 1) - ("\\menulink" . 2) ("\\menulispdownlink" . 2) - ("\\menulispmemolink" . 2) ("\\menulispwindowlink" . 2) - ("\\menumemolink" . 2) ("\\menuwindowlink" . 2) - ("\\newline" . 0) ("\\radioboxes" . 3) ("\\space" . 1) - ("\\spadcommand" . 1) ("\\stringvalue" . 1) ("\\tab" . 1) - ("\\table" . 1) ("\\vspace" . 1) ("\\windowlink" . 2))) - -;buildHtMacroTable() == -; $htMacroTable := MAKE_-HASHTABLE 'UEQUAL -; fn := CONCAT(getEnv '"AXIOM", '"/doc/util.ht") -; if PROBE_-FILE(fn) then -; instream := MAKE_-INSTREAM fn -; while not EOFP instream repeat -; line := READLINE instream -; getHtMacroItem line is [string,:numOfArgs] => -; HPUT($htMacroTable,string,numOfArgs) -; for [s,:n] in $primitiveHtCommands repeat HPUT($htMacroTable,s,n) -; else -; sayBrightly '"Warning: macro table not found" -; $htMacroTable - -(DEFUN |buildHtMacroTable| () - (PROG (|fn| |instream| |line| |ISTMP#1| |string| |numOfArgs| |s| |n|) - (declare (special |$htMacroTable| |$primitiveHtCommands|)) - (RETURN - (SEQ (PROGN - (SPADLET |$htMacroTable| (MAKE-HASHTABLE 'UEQUAL)) - (SPADLET |fn| - (CONCAT (|getEnv| "AXIOM") - "/doc/util.ht")) - (COND - ((PROBE-FILE |fn|) - (SPADLET |instream| (MAKE-INSTREAM |fn|)) - (DO () ((NULL (NULL (EOFP |instream|))) NIL) - (SEQ (EXIT (PROGN - (SPADLET |line| (READLINE |instream|)) - (COND - ((PROGN - (SPADLET |ISTMP#1| - (|getHtMacroItem| |line|)) - (AND (CONSP |ISTMP#1|) - (PROGN - (SPADLET |string| - (QCAR |ISTMP#1|)) - (SPADLET |numOfArgs| - (QCDR |ISTMP#1|)) - 'T))) - (HPUT |$htMacroTable| |string| - |numOfArgs|))))))) - (DO ((G166089 |$primitiveHtCommands| (CDR G166089)) - (G166066 NIL)) - ((OR (ATOM G166089) - (PROGN (SETQ G166066 (CAR G166089)) NIL) - (PROGN - (PROGN - (SPADLET |s| (CAR G166066)) - (SPADLET |n| (CDR G166066)) - G166066) - NIL)) - NIL) - (SEQ (EXIT (HPUT |$htMacroTable| |s| |n|))))) - ('T - (|sayBrightly| - "Warning: macro table not found"))) - |$htMacroTable|))))) - -;READLINE(:s) == -; s => read_-line(first s) -; read_-line(_*STANDARD_-INPUT_*) - -(DEFUN READLINE (&REST t1 &AUX |s|) - (DSETQ |s| t1) - (COND - (|s| (|read-line| (CAR |s|))) - ((QUOTE T) (|read-line| *STANDARD-INPUT*)))) - -;getHtMacroItem line == -; null stringPrefix?('"\newcommand{",line) => nil -; k := charPosition(char '_},line,11) -; command := SUBSTRING(line,12,k - 12) -; numOfArgs := -; m := #line -; i := charPosition(char '_[,line,k) -; i = m => 0 -; j := charPosition(char '_],line,i + 1) -; digitString := SUBSTRING(line,i + 1,j - i - 1) -; and/[DIGITP digitString.i for i in 0..MAXINDEX digitString] -; => PARSE_-INTEGER digitString -; return nil -; [command,:numOfArgs] - -(DEFUN |getHtMacroItem| (|line|) - (PROG (|k| |command| |m| |i| |j| |digitString| |numOfArgs|) - (RETURN - (SEQ (COND - ((NULL (|stringPrefix?| "\\newcommand{" - |line|)) - NIL) - ('T (SPADLET |k| (|charPosition| (|char| '}) |line| 11)) - (SPADLET |command| - (SUBSTRING |line| 12 (SPADDIFFERENCE |k| 12))) - (SPADLET |numOfArgs| - (PROGN - (SPADLET |m| (|#| |line|)) - (SPADLET |i| - (|charPosition| (|char| '[) |line| - |k|)) - (COND - ((BOOT-EQUAL |i| |m|) 0) - ('T - (SPADLET |j| - (|charPosition| (|char| ']) |line| - (PLUS |i| 1))) - (SPADLET |digitString| - (SUBSTRING |line| (PLUS |i| 1) - (SPADDIFFERENCE - (SPADDIFFERENCE |j| |i|) 1))) - (COND - ((PROG (G166110) - (SPADLET G166110 'T) - (RETURN - (DO - ((G166116 NIL (NULL G166110)) - (G166117 - (MAXINDEX |digitString|)) - (|i| 0 (QSADD1 |i|))) - ((OR G166116 - (QSGREATERP |i| G166117)) - G166110) - (SEQ - (EXIT - (SETQ G166110 - (AND G166110 - (DIGITP - (ELT |digitString| |i|))))))))) - (PARSE-INTEGER |digitString|)) - ('T (RETURN NIL))))))) - (CONS |command| |numOfArgs|))))))) - -;spadSysChoose(tree,form) == --tree is ((word . tree) ..) -; null form => true -; null tree => false -; lookupOn := -; form is [key,arg] => key -; form -; newTree := LASSOC(lookupOn,tree) => spadSysBranch(newTree,IFCAR IFCDR form) -; false - -(DEFUN |spadSysChoose| (|tree| |form|) - (PROG (|key| |ISTMP#1| |arg| |lookupOn| |newTree|) - (RETURN - (COND - ((NULL |form|) 'T) - ((NULL |tree|) NIL) - ('T - (SPADLET |lookupOn| - (COND - ((AND (CONSP |form|) - (PROGN - (SPADLET |key| (QCAR |form|)) - (SPADLET |ISTMP#1| (QCDR |form|)) - (AND (CONSP |ISTMP#1|) - (EQ (QCDR |ISTMP#1|) NIL) - (PROGN - (SPADLET |arg| (QCAR |ISTMP#1|)) - 'T)))) - |key|) - ('T |form|))) - (COND - ((SPADLET |newTree| (LASSOC |lookupOn| |tree|)) - (|spadSysBranch| |newTree| (IFCAR (IFCDR |form|)))) - ('T NIL))))))) - -;spadSysBranch(tree,arg) == --tree is (msg kind TREEorSomethingElse ...) -; null arg => true -; kind := tree.2 -; kind = 'TREE => spadSysChoose(tree.4,arg) -; kind = 'LITERALS => MEMBER(arg,tree.4) -; kind = 'INTEGER => INTEGERP arg -; kind = 'FUNCTION => atom arg -; systemError '"unknown tree branch" - -(DEFUN |spadSysBranch| (|tree| |arg|) - (PROG (|kind|) - (RETURN - (COND - ((NULL |arg|) 'T) - ('T (SPADLET |kind| (ELT |tree| 2)) - (COND - ((BOOT-EQUAL |kind| 'TREE) - (|spadSysChoose| (ELT |tree| 4) |arg|)) - ((BOOT-EQUAL |kind| 'LITERALS) - (|member| |arg| (ELT |tree| 4))) - ((BOOT-EQUAL |kind| 'INTEGER) (INTEGERP |arg|)) - ((BOOT-EQUAL |kind| 'FUNCTION) (ATOM |arg|)) - ('T (|systemError| "unknown tree branch")))))))) - -;buildHtMacroTable() - -(|buildHtMacroTable|) - -\end{chunk} -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/interp/vmlisp.lisp.pamphlet b/src/interp/vmlisp.lisp.pamphlet index ba70dd2..a712f5f 100644 --- a/src/interp/vmlisp.lisp.pamphlet +++ b/src/interp/vmlisp.lisp.pamphlet @@ -719,9 +719,6 @@ can be restored. (string2id-n (subseq cvec end) (1- sint)))) 0)))) -(defun substring (cvec start length) - (setq cvec (string cvec)) - (if length (subseq cvec start (+ start length)) (subseq cvec start))) ; 17.3 Searching