diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index bcd59b0..6659e5b 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -135,6 +135,22 @@ \index{#1!{calls #2}}}% %% +%% uses marks use of a throw tagvar +%% +\newcommand{\throws}[2]{% e.g. \throws{thisfunc}{tagvar} +[#2 p\pageref{#2}]\\% +\index{throws!#1}% +\index{#1!throws}} + +%% +%% uses marks use of a catch tagvar +%% +\newcommand{\catches}[2]{% e.g. \catches{thisfunc}{tagvar} +[#2 p\pageref{#2}]\\% +\index{catches!#1}% +\index{#1!catches}} + +%% %% uses marks a special variable use %% \newcommand{\uses}[2]{% e.g. \calls{thisfunc}{specialvar} @@ -618,6 +634,9 @@ information is initialized. @ \defun{runspad}{runspad} +\catches{runspad}{quitTag} +\catches{runspad}{coerceFailure} +%\catches{runspad}{top\_level} \calls{runspad}{seq} \calls{runspad}{exit} \calls{runspad}{resetStackLimits} @@ -650,7 +669,7 @@ information is initialized. (system:reset-stack-limits)) @ -\chapter{Handling Input} +\chapter{Handling Terminal Input} \section{Streams} \defvar{curinstream} The curinstream variable is set to the value of the @@ -741,6 +760,7 @@ the Bill Burge's parser. Note that the SpadInterpretStream function uses a list of three strings as an argument. The values in the list seem to have no use and can eventually be removed. +\catches{intloop}{intTopLevel} \calls{intloop}{SpadInterpretStream} \calls{intloop}{resetStackLimits} \usesdollar{intloop}{intTopLevel} @@ -866,6 +886,7 @@ caution. \end{itemize} Notice that all but two paths (a null input or a ``)fi'' or a ``)fin'') will end up as a recursive call to ourselves. +%\throws{intloopReadConsole}{top\_level} \calls{intloopReadConsole}{serverReadLine} \calls{intloopReadConsole}{leaveScratchpad} \calls{intloopReadConsole}{mkprompt} @@ -927,6 +948,8 @@ will end up as a recursive call to ourselves. @ \defun{InterpExecuteSpadSystemCommand}{InterpExecuteSpadSystemCommand} +\catches{InterpExecuteSpadSystemCommand}{intCoerceFailure} +\catches{InterpExecuteSpadSystemCommand}{intSpadReader} \calls{InterpExecuteSpadSystemCommand}{ExecuteInterpSystemCommand} \usesdollar{InterpExecuteSpadSystemCommand}{intSpadReader} \usesdollar{InterpExecuteSpadSystemCommand}{intCoerceFailure} @@ -1291,6 +1314,9 @@ this is what the current code does so I won't change it. @ \defunsec{serverReadLine}{READ-LINE in an Axiom server system} +\catches{serverReadLine}{coerceFailure} +%\catches{serverReadLine}{top\_level} +%\catches{serverReadLine}{spad\_reader} \calls{serverReadLine}{read-line} \calls{serverReadLine}{addNewInterpreterFrame} \calls{serverReadLine}{sockSendInt} @@ -1466,6 +1492,10 @@ this is what the current code does so I won't change it. @ \defun{intloopSpadProcess}{intloopSpadProcess} +\catches{intloopSpadProcess}{flung} +\catches{intloopSpadProcess}{SpadCompileItem} +\catches{intloopSpadProcess}{intCoerceFailure} +\catches{intloopSpadProcess}{intSpadReader} \calls{intloopSpadProcess}{ncPutQ} \calls{intloopSpadProcess}{CatchAsCan} \calls{intloopSpadProcess}{Catch} @@ -1652,6 +1682,7 @@ carrier[lines,messages,..]-> carrier[lines,messages,..] @ \defun{ncError}{ncError} +\throws{ncError}{SpadCompileItem} <>= (defun |ncError| () (throw '|SpadCompileItem| '|ncError|)) @@ -4350,6 +4381,7 @@ This function is used to build the scanKeyTable \chapter{Input Stream Parser} \defun{npParse}{Input Stream Parser} +\catches{npParse}{trappoint} \calls{npParse}{npFirstTok} \calls{npParse}{npItem} \calls{npParse}{ncSoftError} @@ -4725,6 +4757,8 @@ to fill the table, otherwise we do a key lookup in the hash table. @ \defun{cacheKeyedMsg}{Cache messages read from message database} +\catches{cacheKeyedMsg}{done} +\throws{cacheKeyedMsg}{done} \uses{cacheKeyedMsg}{*msghash*} <>= (defun cacheKeyedMsg (file) @@ -13065,6 +13099,7 @@ back. @ \defun{safeWritify}{safeWritify} +\catches{safeWritify}{writifyTag} \calls{safeWritify}{writify} <>= (defun |safeWritify| (ob) @@ -13072,6 +13107,7 @@ back. @ \defun{writify,writifyInner}{writify,writifyInner} +\throws{writify,writifyInner}{writifyTag} \calls{writify,writifyInner}{seq} \calls{writify,writifyInner}{exit} \calls{writify,writifyInner}{hget} @@ -13454,6 +13490,7 @@ back. @ \defun{ScanOrPairVec,ScanOrInner}{ScanOrPairVec,ScanOrInner} +\throws{ScanOrPairVec,ScanOrInner}{ScanOrPairVecAnswer} \calls{ScanOrPairVec,ScanOrInner}{hget} \calls{ScanOrPairVec,ScanOrInner}{pairp} \calls{ScanOrPairVec,ScanOrInner}{hput} @@ -13481,6 +13518,7 @@ back. @ \defun{ScanOrPairVec}{ScanOrPairVec} +\catches{ScanOrPairVec}{ScanOrPairVecAnswer} \calls{ScanOrPairVec}{ScanOrPairVec,ScanOrInner} \usesdollar{ScanOrPairVec}{seen} <>= @@ -21679,6 +21717,7 @@ This reports the traced functions \defun{letPrint2}{letPrint2} +\catches{letPrint2}{letPrint2} \calls{letPrint2}{lassoc} \calls{letPrint2}{memq} \calls{letPrint2}{isgenvar} @@ -21735,6 +21774,7 @@ This reports the traced functions \defun{letPrint3}{letPrint3} This is the version for use when we have our hands on a function to convert the data into type "Expression" +\catches{letPrint3}{letPrint2} \calls{letPrint3}{lassoc} \calls{letPrint3}{memq} \calls{letPrint3}{isgenvar} @@ -23707,6 +23747,7 @@ o )library @ \defun{zsystemdevelopment1}{zsystemdevelopment1} +\catches{zsystemdevelopment1}{filenam} \calls{zsystemdevelopment1}{selectOptionLC} \calls{zsystemdevelopment1}{/D,1} \calls{zsystemdevelopment1}{/comp} @@ -24280,6 +24321,335 @@ The \verb|$msgdbPrims| variable is set to: @ +\chapter{Handling input files} +\defun{readSpadProfileIfThere}{} +\uses{readSpadProfileIfThere}{/editfile} +<>= +(defun |readSpadProfileIfThere| () + (let ((file (list '|.axiom| '|input|))) + (declare (special /editfile)) + (when (make-input-filename file) (setq /editfile file) (/rq)))) + +@ + +\defun{/rq}{} +\calls{/rq}{/rf-1} +\uses{/rq}{Echo-Meta} +<>= +(defun /RQ (&rest foo &aux (Echo-Meta nil)) + (declare (special Echo-Meta)) + (/rf-1 nil)) + +@ + +\defun{/rf-1}{/rf-1} +\calls{/rf-1}{ncINTERPFILE} +\usesdollar{/rf-1}{useNewParser} +\uses{/rf-1}{/editfile} +\uses{/rf-1}{Echo-Meta} +<>= +(defun /rf-1 (ignore) + (declare (ignore ignore)) + (let* ((input-file (vmlisp::make-input-filename /editfile)) + (type (pathname-type input-file))) + (declare (special |$useNewParser| Echo-Meta /editfile)) + (cond + ((string= type "lisp") (load input-file)) + ((and (string= type "input") |$useNewParser|) + (|ncINTERPFILE| input-file Echo-Meta)) + (t (spad input-file))))) + +@ + +\defvar{boot-line-stack} +<>= +(defvar boot-line-stack nil "List of lines returned from preparse") + +@ + +\defvar{in-stream} +<>= +(defvar in-stream t "Current input stream.") + +@ +\defvar{out-stream} +<>= +(defvar out-stream t "Current output stream.") + +@ +\defvar{file-closed} +<>= +(defvar file-closed nil "Way to stop EOF tests for console input.") + +@ +\defvar{echo-meta} +<>= +(defvar echo-meta nil "T if you want a listing of what has been read.") + +@ + +\defun{spad}{spad} +%\catches{spad\_reader} +\calls{spad}{addBinding} +\calls{spad}{makeInitialModemapFrame} +\calls{spad}{init-boot/spad-reader} +\calls{spad}{initialize-preparse} +\calls{spad}{preparse} +\calls{spad}{PARSE-NewExpr} +\calls{spad}{pop-stack-1} +\calls{spad}{s-process} +\calls{spad}{ioclear} +\calls{spad}{shut} +\usesdollar{spad}{noSubsumption} +\usesdollar{spad}{InteractiveFrame} +\usesdollar{spad}{InitialDomainsInScope} +\usesdollar{spad}{InteractiveMode} +\uses{spad}{line} +\uses{spad}{echo-meta} +\uses{spad}{/editfile} +\uses{spad}{*comp370-apply*} +\uses{spad}{*eof*} +\uses{spad}{file-closed} +\uses{spad}{xcape} +<>= +(defun spad (&optional (*spad-input-file* nil) (*spad-output-file* nil) + &aux (*comp370-apply* #'print-defun) + (*fileactq-apply* #'print-defun) + ($spad t) ($boot nil) (xcape #\_) (optionlist nil) (*eof* nil) + (file-closed nil) (/editfile *spad-input-file*) + (|$noSubsumption| |$noSubsumption|) in-stream out-stream) + (declare (special echo-meta /editfile *comp370-apply* *eof* + file-closed xcape |$noSubsumption| |$InteractiveFrame| + |$InteractiveMode| |$InitialDomainsInScope|)) + ;; only rebind |$InteractiveFrame| if compiling + (progv (if (not |$InteractiveMode|) '(|$InteractiveFrame|)) + (if (not |$InteractiveMode|) + (list (|addBinding| '|$DomainsInScope| + `((fluid . |true|) + (|special| . ,(copy-tree |$InitialDomainsInScope|))) + (|addBinding| '|$Information| nil + (|makeInitialModemapFrame|))))) + (init-boot/spad-reader) + (unwind-protect + (progn + (setq in-stream (if *spad-input-file* + (open *spad-input-file* :direction :input) + *standard-input*)) + (initialize-preparse in-stream) + (setq out-stream (if *spad-output-file* + (open *spad-output-file* :direction :output) + *standard-output*)) + (when *spad-output-file* + (format out-stream "~&;;; -*- Mode:Lisp; Package:Boot -*-~%~%") + (print-package "BOOT")) + (setq curoutstream out-stream) + (loop + (if (or *eof* file-closed) (return nil)) + (catch 'spad_reader + (if (setq boot-line-stack (preparse in-stream)) + (let ((line (cdar boot-line-stack))) + (declare (special line)) + (|PARSE-NewExpr|) + (let ((parseout (pop-stack-1)) ) + (when parseout + (let ((*standard-output* out-stream)) + (s-process parseout)) + (format out-stream "~&"))) + ))) + (ioclear in-stream out-stream))) + (if *spad-input-file* (shut in-stream)) + (if *spad-output-file* (shut out-stream))) + t)) + +@ + +\defdollar{envHashTable} +The \verb|$envHashTable| variable is a hashtable that optimizes lookups +in the environment, which normally involve search. This gets populated +in the addBinding function. +<>= +(defvar |$envHashTable| nil) + +@ + +\defun{addBinding}{Dynamically add bindings to the environment} +\calls{addBinding}{getProplist} +\calls{addBinding}{addBindingInteractive} +\calls{addBinding}{hput} +\usesdollar{addBinding}{InteractiveMode} +\usesdollar{addBinding}{envHashTable} +<>= +(defun |addBinding| (var proplist e) + (let (tailContour tailEnv tmp1 curContour lx) + (declare (special |$InteractiveMode| |$envHashTable|)) + (setq curContour (caar e)) + (setq tailContour (cdar e)) + (setq tailEnv (cdr e)) + (cond + ((eq proplist (|getProplist| var e)) e) + (t + (when |$envHashTable| + (do ((prop proplist (cdr prop)) (u nil)) + ((or (atom prop) + (progn (setq u (car prop)) nil)) + nil) + (hput |$envHashTable| (list var (car u)) t))) + (cond + (|$InteractiveMode| (|addBindingInteractive| var proplist e)) + (t + (when (and (pairp curContour) + (progn + (setq tmp1 (qcar curContour)) + (and (pairp tmp1) (equal (qcar tmp1) var)))) + (setq curContour (cdr curContour))) + (setq lx (cons var proplist)) + (cons (cons (cons lx curContour) tailContour) tailEnv))))))) + +@ + +\defun{getProplist}{Fetch a property list for a symbol from CategoryFrame} +\calls{getProplist}{getProplist} +\calls{getProplist}{search} +\usesdollar{getProplist}{CategoryFrame} +<>= +(defun |getProplist| (x e) + (let (u pl) + (declare (special |$CategoryFrame|)) + (cond + ((null (atom x)) (|getProplist| (car x) e)) + ((setq u (|search| x e)) u) + ((setq pl (|search| x |$CategoryFrame|)) pl)))) + +@ + +\defun{search}{Search for a binding in the environment list} +\calls{search}{searchCurrentEnv} +\calls{search}{searchTailEnv} +<>= +(defun |search| (x e) + (let ((curEnv (car e)) (tailEnv (cdr e))) + (or (|searchCurrentEnv| x curEnv) (|searchTailEnv| x tailEnv)))) + +@ + +\defun{searchCurrentEnv}{Search for a binding in the current environment} +\begin{verbatim} +searchCurrentEnv(x,currentEnv) == + for contour in currentEnv repeat + if u:= ASSQ(x,contour) then return (signal:= u) + KDR signal +\end{verbatim} +\calls{searchCurrentEnv}{assq} +\calls{searchCurrentEnv}{kdr} +<>= +(defun |searchCurrentEnv| (x currentEnv) + (prog (u signal) + (return + (seq + (progn + (do ((thisenv currentEnv (cdr thisenv)) (contour nil)) + ((or (atom thisenv) (progn (setq contour (car thisenv)) nil)) nil) + (seq + (exit + (cond + ((setq u (assq x contour)) (return (setq signal u))) + (t nil))))) + (kdr signal)))))) + +@ + +\defun{searchTailEnv}{searchTailEnv} +\begin{verbatim} +;searchTailEnv(x,e) == +; for env in e repeat +; signal:= +; for contour in env repeat +; if (u:= ASSQ(x,contour)) and ASSQ("FLUID",u) then return (signal:= u) +; if signal then return signal +; KDR signal +\end{verbatim} +\calls{searchTailEnv}{assq} +\calls{searchTailEnv}{kdr} +<>= +(defun |searchTailEnv| (x e) + (prog (u signal) + (return + (seq + (progn + (do ((thise e (cdr thise)) (env nil)) + ((or (atom thise) (progn (setq env (car thise)) nil)) nil) + (seq + (exit + (setq signal + (progn + (do ((cone env (cdr cone)) (contour nil)) + ((or (atom cone) (progn (setq contour (car cone)) nil)) nil) + (seq + (exit + (cond + ((and (setq u (assq x contour)) (assq 'fluid u)) + (return (setq signal u))) + (t nil))))) + (cond + (signal (return signal)) + (t nil))))))) + (kdr signal)))))) + +@ + +\defun{addBindingInteractive}{Bind a variable in the interactive environment} +\calls{addBindingInteractive}{assq} +<>= +(defun |addBindingInteractive| (var proplist e) + (let ((curContour (caar e)) u) + (cond + ((setq u (assq var curContour)) (rplacd u proplist) e) + (t (rplac (caar e) (cons (cons var proplist) curContour)) e)))) + +@ + +\defvar{line-handler} +<>= +(defparameter line-handler 'next-META-line "Who grabs lines for us.") + +@ + +\defun{init-boot/spad-reader}{Initialize the spad reader} +\calls{init-boot/spad-reader}{next-lines-clear} +\calls{init-boot/spad-reader}{ioclear} +%\usesdollar{init-boot/spad-reader}{spad\_errors} +\uses{init-boot/spad-reader}{spaderrorstream} +\uses{init-boot/spad-reader}{*standard-output* } +\uses{init-boot/spad-reader}{xtokenreader} +\uses{init-boot/spad-reader}{line-handler} +%\uses{init-boot/spad-reader}{meta\_error\_handler} +\uses{init-boot/spad-reader}{file-closed} +\uses{init-boot/spad-reader}{boot-line-stack} +<>= +(defun init-boot/spad-reader () + (declare (special $spad_errors spaderrorstream *standard-output* + xtokenreader line-handler meta_error_handler file-closed + boot-line-stack)) + (setq $spad_errors (vector 0 0 0)) + (setq spaderrorstream *standard-output*) + (setq xtokenreader 'get-BOOT-token) + (setq line-Handler 'next-BOOT-line) + (setq meta_error_handler 'spad_syntax_error) + (setq file-closed nil) + (next-lines-clear) + (ioclear)) + +@ + +\defun{next-lines-clear}{Set boot-line-stack to nil} +\uses{next-lines-clear}{boot-line-stack} +<>= +(defun next-lines-clear () + (setq boot-line-stack nil)) + +@ + + \chapter{Handling output} \section{Special Character Tables} @@ -25705,7 +26075,7 @@ The localdatabase function tries to find files in the order of: (format t " Ignoring unknown )library option: ~a~%" options)) (values only dir noexpose))) (processDir (dirarg thisdir) - (let (allfiles skipasos) + (let (allfiles) (declare (special vmlisp::*index-filename*)) (system:chdir (string dirarg)) (setq allfiles (directory "*")) @@ -25714,8 +26084,7 @@ The localdatabase function tries to find files in the order of: (when (string-equal (pathname-type f) "nrlib") (list (concatenate 'string (namestring f) "/" vmlisp::*index-filename*)))) allfiles)))) - (let (thisdir nrlibs asos asys libs object only dir key - (|$forceDatabaseUpdate| t) noexpose) + (let (thisdir nrlibs object only dir key (|$forceDatabaseUpdate| t) noexpose) (declare (special |$forceDatabaseUpdate| vmlisp::*index-filename* |$ConstructorCache|)) (setq thisdir (namestring (truename "."))) @@ -27327,319 +27696,6 @@ See Steele Common Lisp 1990 pp305-307 @ -\chapter{Dangling references} -\section{shell variables} -\begin{verbatim} -AXIOM -\end{verbatim} - -\section{catch tags} -\begin{verbatim} -|coerceFailure| -filenam -|$intTopLevel| -|letPrint2| -|$quitTag| -|ScanOrPairVecAnswer| -|top_level| -|writifyTag| -\end{verbatim} - -\section{catch tags} -\begin{verbatim} -|ScanOrPairVecAnswer| -|top_level| -|writifyTag| -\end{verbatim} - -\section{defined special variables} -\begin{verbatim} -|$abbreviateTypes| -|$algebraFormat| -|$algebraOutputFile| -|$algebraOutputStream| -|$asharpCmdlineFlags| -|$BreakMode| -|$clearExcept| -|$clearOptions| -|$CommandSynonymAlist| -|$compileDontDefineFunctions| -|$compileRecurrence| -compiler::*compile-verbose* -credits -|$defaultFortranType| -*default-pathname-defaults* -|$defaultSpecialCharacters| -|$displayDroppedMap| -|$displayMsgNumber| -|$displayOptions| -|$displaySetValue| -|$displayStartMsgs| -|$formulaFormat| -|$formulaOutputFile| -|$fortIndent| -|$fortInts2Floats| -|$fortLength| -|$fortranArrayStartingIndex| -|$fortranDirectory| -|$fortranFormat| -|$fortranLibraries| -|$fortranOptimizationLevel| -|$fortranOutputFile| -|$fortranPrecision| -|$fortranSegment| -|$fortranTmpDir| -|$fortPersistence| -|$fractionDisplayType| -|$frameMessages| -|$fullScreenSysVars| -|$giveExposureWarning| -|$HiFiAccess| -|$highlightAllowed| -|$historyDirectory| -|$historyDisplayWidth| -|$historyFileType| -|$InitialCommandSynonymAlist| -|$inputPromptType| -|$linearFormatScripts| -$linelength -|$mapSubNameAlist| -|$mathmlFormat| -|$mathmlOutputFile| -|$maximumFortranExpressionLength| -|$nagEnforceDouble| -|$nagHost| -|$nagMessages| -|$noParseCommands| -|$oldHistoryFileName| -|$openMathFormat| -|$openMathOutputFile| -$openServerIfTrue -|$optionAlist| -|$options| -|$plainRTspecialCharacters| -|$plainSpecialCharacters0| -|$plainSpecialCharacters1| -|$plainSpecialCharacters2| -|$plainSpecialCharacters3| -$prettyprint -|$printAnyIfTrue| -|$printFortranDecs| -|$printLoadMsgs| -|$printMsgsToFile| -|$printStatisticsSummaryIfTrue| -|$printTimeIfTrue| -|$printTypeIfTrue| -|$printVoidIfTrue| -|$quitCommandType| -|$reportBottomUpFlag| -|$reportCoerceIfTrue| -|$reportCompilation| -|$reportEachInstantiation| -|$reportInstantiations| -|$reportInterpOnly| -|$reportOptimization| -|$reportSpadTrace| -|$RTspecialCharacters| -*standard-input* -*standard-output* -|$SpadServer| -$SpadServerName -|$specialCharacterAlist| -|$specialCharacters| -|$streamCount| -|$streamsShowAll| -compiler::*suppress-compiler-notes* -compiler::*suppress-compiler-warnings* -|$systemCommandFunction| -$syscommands -|$systemCommands| -*terminal-io* -|$testingSystem| -|$texFormat| -|$texOutputFile| -|$tokenCommands| -system::*top-level-hook* -|$tracedMapSignatures| -|$traceNoisely| -|$traceOptionList| -underbar -|$useEditorForShowOutput| -|$useFullScreenHelp| -|$useInternalHistoryTable| -|$useIntrinsicFunctions| -|$UserLevel| -|$whatOptions| -\end{verbatim} - -\section{undefined special variables} -\begin{verbatim} -|$attributeDb| -$boot -|$cacheAlist| -|$cacheCount| -|$CatOfCatDatabase| -|$CloseClient| -|$coerceIntByMapCounter| -|$compileMapFlag| -|$ConstructorCache| -|$constructors| -/countlist -|$convPhase| -curinstream -curoutstream -|$currentCarrier| -$current-directory -|$currentFrameNum| -|$currentLine| -$dalymode -|$defaultMsgDatabaseName| -|$dependeeClosureAlist| -$directory-list -|$displayStartMsgs| -|$domains| -|$DomOfCatDatabase| -|$domainTraceNameAssoc| -|$doNotAddEmptyModeIfTrue| -|$e| -|$echoLineStack| -/editfile -|$EmptyEnvironment| -|$env| -*eof* -|$erMsgToss| -|$existingFiles| -|flung| -|$fn| -|$formulaOutputStream| -|$fortranOutputStream| -|$frameMessages| -|$frameRecord| -|$fromSpadTrace| -|$functionTable| -|$globalExposureGroupAlist| -|$HistList| -|$HistListAct| -|$HistListLen| -|$HistRecord| -|$inLispVM| -|$InitialModemapFrame|)) -in-stream -|$intCoerceFailure| -|$InteractiveFrame| -|$internalHistoryTable| -|$interpreterFrameName| -|$interpreterFrameRing| -|$intRestart| -|$intSpadReader| -|$intTopLevel| -|$IOindex| -|$JoinOfCatDatabase| -|$JoinOfDomDatabase| -|$lastPos| -|$lastUntraced| -|$letAssoc| -|$libQuiet| -$library-directory-list -|$lines| -|$localExposureData| -|$localExposureDataDefault| -|$lookupDefaults| -|$mathmlOutputStream| -|$mathTraceList| -|$mkTestInputStack| -|$msgAlist| -|$msgDatabase| -|$msgDatabaseName| -|$ncmParse| -|$ncmPhase| -|$ncMsgList| -|$newConlist| -|$NonNullStream| -|$nopos| -|$newcompErrorCount| -|$newcompMode| -$newspad -|$NullStream| -|$okToExecuteMachineCode| -|$openMathOutputStream| -|$operationNameList| -|$outputLibraryName| -|$OutputForm| -|$packages| -/pretty -|$prevCarrier| -|$previousBindings| -|$PrintCompilerMessageIfTrue| -|$printLoadMsgs| -|$promptMsg| -|$QuickLet -|$quitTag| -$relative-directory-list -$relative-library-directory-list -|$seen| -|$SessionManager| -|$setOptions| -|$stepNo| -|$slamFlag| -/sourcefiles -|$sourceFiles| -/spacelist -$spad -$spadroot -|$texOutputStream| -/timerlist -|$timerTicksPerSecond| -|$tracedMapSignatures| -|$tracedModemap| -|$tracedSpadModemap| -|$traceErrorStack| -$traceletflag -|$traceletFunctions| -|$undoFlag| -|$useFullScreenHelp| -|$UserAbbreviationsAlist| -|$variableNumberAlist| -|$Void| -|$writifyComplained| -/wsname -|$xdatabase| -\end{verbatim} - -\section{undefined functions} -\begin{verbatim} -|char| -|Catch| -|CatchAsCan| -currenttime -error -expand-tabs -|incAppend| -|intInterpretPform| -|intnplisp| -|intSayKeyedMsg| -|intSetNeedToSignalSessionManager| -|ListMemberQ?| -|macroExpanded| -|MakeSymbol| -maxindex -|ncBug| -|ncEltQ| -|ncPutQ| -|ncloopEchoParse| -|ncloopProcess| -|next| -|npParse| -|%pform| -|poGlobalLinePosn| -|porigin| -|resetStackLimits| -|shoeread-line| -|StreamNull| -|tokPart| -|tokPosn| -\end{verbatim} - \chapter{The Interpreter} <>= (in-package "BOOT") @@ -27691,6 +27747,8 @@ maxindex <> <> <> +<> +<> <> <> <> @@ -27878,6 +27936,7 @@ maxindex <> <> <> +<> <> <> <> @@ -27943,6 +28002,7 @@ maxindex <> <> <> +<> <> <> <> @@ -28068,6 +28128,7 @@ maxindex <> <> <> +<> <> <> <> @@ -28150,6 +28211,7 @@ maxindex <> <> <> +<> <> <> <> @@ -28176,6 +28238,8 @@ maxindex <> <> <> +<> +<> <> <> @@ -28217,6 +28281,9 @@ maxindex <> <> <> +<> +<> +<> <> <> <> diff --git a/changelog b/changelog index 26a9db3..0d59874 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,12 @@ -20091222 tpd src/axiom-website/patches.html 20091222.01.lxd.patch +20091222 tpd src/axiom-website/patches.html 20091222.02.tpd.patch +20091222 tpd src/interp/wi1.lisp treeshake .input file reader +20091222 tpd src/interp/patches.lisp treeshake .input file reader +20091222 tpd src/interp/parsing.lisp treeshake .input file reader +20091222 tpd src/interp/i-toplev.lisp treeshake .input file reader +20091222 tpd src/interp/i-intern.lisp treeshake .input file reader +20091222 tpd src/interp/g-util.lisp treeshake .input file reader +20091222 tpd books/bookvol5 treeshake .input file reader +20091222 tpd src/axiom-website/patches.html 20091222.01.tpd.patch 20091222 tpd src/interp/Makefile remove daase.lisp 20091222 tpd src/interp/util.lisp remove asharp initialization code 20091222 tpd src/interp/patches.lisp tree shake database code into bookvol5 diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 5b1a28a..ebca20c 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2328,5 +2328,7 @@ src/hyperdoc/axbook fix Lee Duham typos, add Stack, Queue
books/bookvol5 tree shake code from msgdb, vmlisp, patches
20091222.01.tpd.patch books/bookvol5 merge, remove daase.lisp
+20091222.02.tpd.patch +books/bookvol5 treeshake .input file reader
diff --git a/src/interp/g-util.lisp.pamphlet b/src/interp/g-util.lisp.pamphlet index 65b95a2..86eeb4b 100644 --- a/src/interp/g-util.lisp.pamphlet +++ b/src/interp/g-util.lisp.pamphlet @@ -985,97 +985,6 @@ (DEFUN |opOf| (|x|) (COND ((ATOM |x|) |x|) ('T (CAR |x|)))) -;getProplist(x,E) == -; not atom x => getProplist(first x,E) -; u:= search(x,E) => u -; --$InteractiveMode => nil -; --$InteractiveMode and (u:= search(x,$InteractiveFrame)) => u -; (pl:=search(x,$CategoryFrame)) => -; pl - -(DEFUN |getProplist| (|x| E) - (PROG (|u| |pl|) - (DECLARE (SPECIAL |$CategoryFrame|)) - (RETURN - (COND - ((NULL (ATOM |x|)) (|getProplist| (CAR |x|) E)) - ((SPADLET |u| (|search| |x| E)) |u|) - ((SPADLET |pl| (|search| |x| |$CategoryFrame|)) |pl|))))) - -;-- (pl:=PROPLIST x) => pl -;-- Above line commented out JHD/BMT 2.Aug.90 -;search(x,e is [curEnv,:tailEnv]) == -; searchCurrentEnv(x,curEnv) or searchTailEnv(x,tailEnv) - -(DEFUN |search| (|x| |e|) - (PROG (|curEnv| |tailEnv|) - (RETURN - (PROGN - (SPADLET |curEnv| (CAR |e|)) - (SPADLET |tailEnv| (CDR |e|)) - (OR (|searchCurrentEnv| |x| |curEnv|) - (|searchTailEnv| |x| |tailEnv|)))))) - -;searchCurrentEnv(x,currentEnv) == -; for contour in currentEnv repeat -; if u:= ASSQ(x,contour) then return (signal:= u) -; KDR signal - -(DEFUN |searchCurrentEnv| (|x| |currentEnv|) - (PROG (|u| |signal|) - (RETURN - (SEQ (PROGN - (DO ((G1417 |currentEnv| (CDR G1417)) (|contour| NIL)) - ((OR (ATOM G1417) - (PROGN (SETQ |contour| (CAR G1417)) NIL)) - NIL) - (SEQ (EXIT (COND - ((SPADLET |u| (ASSQ |x| |contour|)) - (RETURN (SPADLET |signal| |u|))) - ('T NIL))))) - (KDR |signal|)))))) - -;searchTailEnv(x,e) == -; for env in e repeat -; signal:= -; for contour in env repeat -; if (u:= ASSQ(x,contour)) and ASSQ("FLUID",u) then return (signal:= u) -; if signal then return signal -; KDR signal - -(DEFUN |searchTailEnv| (|x| |e|) - (PROG (|u| |signal|) - (RETURN - (SEQ (PROGN - (DO ((G1418 |e| (CDR G1418)) (|env| NIL)) - ((OR (ATOM G1418) - (PROGN (SETQ |env| (CAR G1418)) NIL)) - NIL) - (SEQ (EXIT (SPADLET |signal| - (PROGN - (DO - ((G1419 |env| (CDR G1419)) - (|contour| NIL)) - ((OR (ATOM G1419) - (PROGN - (SETQ |contour| - (CAR G1419)) - NIL)) - NIL) - (SEQ - (EXIT - (COND - ((AND - (SPADLET |u| - (ASSQ |x| |contour|)) - (ASSQ 'FLUID |u|)) - (RETURN - (SPADLET |signal| |u|))) - ('T NIL))))) - (COND - (|signal| (RETURN |signal|)) - ('T NIL))))))) - (KDR |signal|)))))) ;augProplist(proplist,prop,val) == ; $InteractiveMode => augProplistInteractive(proplist,prop,val) @@ -1149,58 +1058,9 @@ ((LASSOC '|isLiteral| |proplist|) (EXIT (|warnLiteral| |x|)))))))) -;DEFPARAMETER($envHashTable,nil) - -(DEFPARAMETER |$envHashTable| NIL) - -;addBinding(var,proplist,e is [[curContour,:tailContour],:tailEnv]) == -; EQ(proplist,getProplist(var,e)) => e -; if $envHashTable then -; for u in proplist repeat -; HPUT($envHashTable,[var, CAR u],true) -; $InteractiveMode => addBindingInteractive(var,proplist,e) -; if curContour is [[ =var,:.],:.] then curContour:= rest curContour -; --Previous line should save some space -; [[[lx,:curContour],:tailContour],:tailEnv] where lx:= [var,:proplist] ;;; *** |addBinding| REDEFINED -(DEFUN |addBinding| (|var| |proplist| |e|) - (PROG (|tailContour| |tailEnv| |ISTMP#1| |curContour| |lx|) - (DECLARE (SPECIAL |$InteractiveMode| |$envHashTable|)) - (RETURN - (SEQ (PROGN - (SPADLET |curContour| (CAAR |e|)) - (SPADLET |tailContour| (CDAR |e|)) - (SPADLET |tailEnv| (CDR |e|)) - (COND - ((EQ |proplist| (|getProplist| |var| |e|)) |e|) - ('T - (COND - (|$envHashTable| - (DO ((G1420 |proplist| (CDR G1420)) - (|u| NIL)) - ((OR (ATOM G1420) - (PROGN (SETQ |u| (CAR G1420)) NIL)) - NIL) - (SEQ (EXIT (HPUT |$envHashTable| - (CONS |var| (CONS (CAR |u|) NIL)) - 'T)))))) - (COND - (|$InteractiveMode| - (|addBindingInteractive| |var| |proplist| |e|)) - ('T - (COND - ((AND (PAIRP |curContour|) - (PROGN - (SPADLET |ISTMP#1| (QCAR |curContour|)) - (AND (PAIRP |ISTMP#1|) - (EQUAL (QCAR |ISTMP#1|) |var|)))) - (SPADLET |curContour| (CDR |curContour|)))) - (SPADLET |lx| (CONS |var| |proplist|)) - (CONS (CONS (CONS |lx| |curContour|) |tailContour|) - |tailEnv|)))))))))) - ;position(x,l) == ; posn(x,l,0) where ; posn(x,l,n) == diff --git a/src/interp/i-intern.lisp.pamphlet b/src/interp/i-intern.lisp.pamphlet index 70f1a4f..1ae1202 100644 --- a/src/interp/i-intern.lisp.pamphlet +++ b/src/interp/i-intern.lisp.pamphlet @@ -2035,26 +2035,6 @@ May be a number or a vector ((QUOTE T) |$failure|))))) @ -\subsection{addBindingInteractive} -<<*>>= -;addBindingInteractive(var,proplist,e is [[curContour,:.],:.]) == -; -- change proplist of var in e destructively -; u := ASSQ(var,curContour) => -; RPLACD(u,proplist) -; e -; RPLAC(CAAR e,[[var,:proplist],:curContour]) -; e - -(DEFUN |addBindingInteractive| (|var| |proplist| |e|) - (PROG (|curContour| |u|) - (RETURN - (PROGN - (SPADLET |curContour| (CAAR |e|)) - (COND - ((SPADLET |u| (ASSQ |var| |curContour|)) (RPLACD |u| |proplist|) |e|) - ((QUOTE T) - (RPLAC (CAAR |e|) (CONS (CONS |var| |proplist|) |curContour|)) |e|)))))) - @ \subsection{augProplistInteractive} <<*>>= diff --git a/src/interp/i-toplev.lisp.pamphlet b/src/interp/i-toplev.lisp.pamphlet index 806f7bf..eb3d539 100644 --- a/src/interp/i-toplev.lisp.pamphlet +++ b/src/interp/i-toplev.lisp.pamphlet @@ -171,25 +171,6 @@ from LISP. (COND ((NULL |l|) (|runspad|))) '|EndOfSpad|)))) -;readSpadProfileIfThere() == -; -- reads SPADPROF INPUT if it exists -; file := ['_.axiom,'input] -; MAKE_-INPUT_-FILENAME file => -; SETQ(_/EDITFILE,file) -; _/RQ () -; NIL - -(DEFUN |readSpadProfileIfThere| () - (PROG (|file|) - (declare (special /EDITFILE)) - (RETURN - (PROGN - (SPADLET |file| - (CONS (INTERN ".axiom" "BOOT") (CONS '|input| NIL))) - (COND - ((MAKE-INPUT-FILENAME |file|) (SETQ /EDITFILE |file|) (/RQ)) - ('T NIL)))))) - ;--% Parser Output --> Interpreter ;processInteractive(form, posnForm) == ; -- Top-level dispatcher for the interpreter. It sets local variables diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index e3128a1..b445197 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -54,10 +54,6 @@ ; 0. Current I/O Stream definition -(defparameter in-stream t "Current input stream.") -(defparameter out-stream t "Current output stream.") -(defparameter File-Closed nil "Way to stop EOF tests for console input.") - (defun IOStreams-Show () (format t "~&Input is coming from ~A, and output is going to ~A.~%" (or (streamp in-stream) "the keyboard") @@ -642,8 +638,6 @@ is a token separator, which blank is equivalent to." ; *** Next Line -(defparameter Echo-Meta nil "T if you want a listing of what has been read.") -(defparameter Line-Handler 'next-META-line "Who grabs lines for us.") (defun next-line (&optional (in-stream t)) (funcall Line-Handler in-stream)) @@ -679,15 +673,6 @@ Symbolics read-line returns embedded newlines in a c-m-Y.") (return nil))) (if (setq Current-Fragment (read-line stream)) (return (read-a-line stream))))))) -#+:CCL -(defun read-a-line (&optional (stream t)) - (let ((line (read-line stream nil nil))) - (if (null line) - (progn (setq File-Closed t *EOF* t) - (Line-New-Line (make-string 0) Current-Line) - nil) - line))) - ; *** Print New Line (defparameter Printer-Line-Stack (make-stack) @@ -1036,9 +1021,6 @@ Symbolics read-line returns embedded newlines in a c-m-Y.") @ bootlex <<*>>= -(defparameter Boot-Line-Stack nil "List of lines returned from PREPARSE.") - -(defun Next-Lines-Clear () (setq Boot-Line-Stack nil)) (defun Next-Lines-Show () (and Boot-Line-Stack (format t "Currently preparsed lines are:~%~%")) @@ -1048,17 +1030,6 @@ bootlex ; *** 1. BOOT file handling -(defun init-boot/spad-reader () - (setq $SPAD_ERRORS (VECTOR 0 0 0)) - (setq SPADERRORSTREAM *standard-output*) - (setq XTokenReader 'get-BOOT-token) - (setq Line-Handler 'next-BOOT-line) - (setq Meta_Error_Handler 'spad_syntax_error) - (setq File-Closed nil) - (Next-Lines-Clear) - (setq Boot-Line-Stack nil) - (ioclear)) - (defmacro test (x &rest y) `(progn (setq spaderrorstream t) @@ -1098,6 +1069,7 @@ bootlex ; (DEF-PROCESS parseout) parseout)) +;; note that this is no longer called or used. Boot has been removed. (defun boot (&optional (*boot-input-file* nil) (*boot-output-file* nil) @@ -1144,64 +1116,6 @@ bootlex (IOClear in-stream out-stream))) T) -(defun spad (&optional - (*spad-input-file* nil) - (*spad-output-file* nil) - &aux - (*comp370-apply* (function print-defun)) - (*fileactq-apply* (function print-defun)) - ($SPAD T) - ($BOOT nil) - (XCape #\_) - (OPTIONLIST nil) - (*EOF* NIL) - (File-Closed NIL) - (/editfile *spad-input-file*) - (|$noSubsumption| |$noSubsumption|) - in-stream out-stream) - (declare (special echo-meta /editfile *comp370-apply* *EOF* - File-Closed Xcape |$noSubsumption|)) - ;; only rebind |$InteractiveFrame| if compiling - (progv (if (not |$InteractiveMode|) '(|$InteractiveFrame|)) - (if (not |$InteractiveMode|) - (list (|addBinding| - '|$DomainsInScope| - `((FLUID . |true|) - (|special| . ,(COPY-TREE |$InitialDomainsInScope|))) - (|addBinding| '|$Information| NIL (|makeInitialModemapFrame|))))) - (init-boot/spad-reader) - (unwind-protect - (progn - (setq in-stream (if *spad-input-file* - (open *spad-input-file* :direction :input) - *standard-input*)) - (initialize-preparse in-stream) - (setq out-stream (if *spad-output-file* - (open *spad-output-file* :direction :output) - *standard-output*)) - (when *spad-output-file* - (format out-stream "~&;;; -*- Mode:Lisp; Package:Boot -*-~%~%") - (print-package "BOOT")) - (setq curoutstream out-stream) - (loop - (if (or *eof* file-closed) (return nil)) - (catch 'SPAD_READER - (if (setq Boot-Line-Stack (PREPARSE in-stream)) - (let ((LINE (cdar Boot-Line-Stack))) - (declare (special LINE)) - (|PARSE-NewExpr|) - (let ((parseout (pop-stack-1)) ) - (when parseout - (let ((*standard-output* out-stream)) - (S-PROCESS parseout)) - (format out-stream "~&"))) - ;(IOClear in-stream out-stream) - ))) - (IOClear in-stream out-stream))) - (if *spad-input-file* (shut in-stream)) - (if *spad-output-file* (shut out-stream))) - T)) - (defun READ-BOOT (FN FM TO) (let (($boot t)) (READ-SPAD1 FN 'BOOT FM TO))) diff --git a/src/interp/patches.lisp.pamphlet b/src/interp/patches.lisp.pamphlet index 8c55897..12fe959 100644 --- a/src/interp/patches.lisp.pamphlet +++ b/src/interp/patches.lisp.pamphlet @@ -181,36 +181,10 @@ It used to read: (defun /RF (&rest foo &aux (Echo-Meta 'T)) (declare (special Echo-Meta)) (/RF-1 nil)) -(defun /RQ (&rest foo &aux (Echo-Meta nil)) - (declare (special Echo-Meta)) - (/RF-1 nil)) (defun |/RQ,LIB| (&rest foo &aux (Echo-Meta nil) ($LISPLIB T)) (declare (special Echo-Meta $LISPLIB)) (/RF-1 nil)) -(defun /RF-1 (ignore) - (declare (ignore ignore)) - (let* ((input-file (vmlisp::make-input-filename /EDITFILE)) - (lfile ()) - (type (pathname-type input-file))) - (cond - ((string= type "boot") -#-:CCL - (boot input-file - (setq lfile (make-pathname :type "lisp" - :defaults input-file))) -#+:CCL - (boot input-file - (setq lfile (make-pathname :name (pathname-name input-file) - :type "lisp"))) - (load lfile)) - ((string= type "lisp") (load input-file)) - ((string= type "bbin") (load input-file)) - ((and (string= type "input") - |$useNewParser|) - (|ncINTERPFILE| input-file Echo-Meta)) - (t (spad input-file))))) - (defun /EF (&rest foo) (obey (concat "vi " (namestring (vmlisp::make-input-filename /EDITFILE))))) #-:CCL diff --git a/src/interp/wi1.lisp.pamphlet b/src/interp/wi1.lisp.pamphlet index 6455eeb..62293ee 100644 --- a/src/interp/wi1.lisp.pamphlet +++ b/src/interp/wi1.lisp.pamphlet @@ -139,39 +139,6 @@ |e|) ('T (|addBinding| |x| |newProplist| |e|)))))))) -;addBinding(var,proplist,e is [[curContour,:tailContour],:tailEnv]) == -;--if CONTAINED('PART,proplist) then foobar proplist -; EQ(proplist,getProplist(var,e)) => e -; $InteractiveMode => addBindingInteractive(var,proplist,e) -; if curContour is [[ =var,:.],:.] then curContour:= rest curContour -; --Previous line should save some space -; [[[lx,:curContour],:tailContour],:tailEnv] where lx:= [var,:proplist] - -;;; *** |addBinding| REDEFINED - -(DEFUN |addBinding| (|var| |proplist| |e|) - (PROG (|tailContour| |tailEnv| |ISTMP#1| |curContour| |lx|) - (RETURN - (PROGN - (SPADLET |curContour| (CAAR |e|)) - (SPADLET |tailContour| (CDAR |e|)) - (SPADLET |tailEnv| (CDR |e|)) - (COND - ((EQ |proplist| (|getProplist| |var| |e|)) |e|) - (|$InteractiveMode| - (|addBindingInteractive| |var| |proplist| |e|)) - ('T - (COND - ((AND (PAIRP |curContour|) - (PROGN - (SPADLET |ISTMP#1| (QCAR |curContour|)) - (AND (PAIRP |ISTMP#1|) - (EQUAL (QCAR |ISTMP#1|) |var|)))) - (SPADLET |curContour| (CDR |curContour|)))) - (SPADLET |lx| (CONS |var| |proplist|)) - (CONS (CONS (CONS |lx| |curContour|) |tailContour|) - |tailEnv|))))))) - ;--====================================================================== ;-- From define.boot ;--======================================================================