[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] 20090410.02.tpd.patch (bookvol5 add more interpreter c
From: |
daly |
Subject: |
[Axiom-developer] 20090410.02.tpd.patch (bookvol5 add more interpreter code) |
Date: |
Fri, 10 Apr 2009 23:45:26 -0500 |
Pick up more interpreter code from other files, translate them to lisp,
and move them to bookvol5
=======================================================================
diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet
index beb7755..66f7caa 100644
--- a/books/bookvol5.pamphlet
+++ b/books/bookvol5.pamphlet
@@ -851,6 +851,110 @@ this is what the current code does so I won't change it.
@
+\defdollar{frameAlist}
+<<initvars>>=
+(defvar |$frameAlist| nil)
+
+@
+\defdollar{frameNumber}
+<<initvars>>=
+(defvar |$frameNumber| 0)
+
+@
+\defdollar{currentFrameNum}
+<<initvars>>=
+(defvar |$currentFrameNum| 0)
+
+@
+\defdollar{EndServerSession}
+<<initvars>>=
+(defvar |$EndServerSession| nil)
+
+@
+\defdollar{NeedToSignalSessionManager}
+<<initvars>>=
+(defvar |$NeedToSignalSessionManager| nil)
+
+@
+\defdollar{sockBufferLength}
+<<initvars>>=
+(defvar |$sockBufferLength| 9217)
+
+@
+
+\defun{serverReadLine}{serverReadLine}
+<<defun serverReadLine>>=
+(defun |serverReadLine| (stream)
+ "used in place of READ-LINE in a scratchpad server system."
+ (let (in-stream *eof* l framename currentframe form stringbuf line)
+ (declare (special in-stream *eof* |$SpadServer| |$EndServerSession|
+ |$NeedToSignalSessionManager| |$SessionManager| |$EndOfOutput|
+ |$CallInterp| |$CreateFrame| |$frameAlist| |$frameNumber|
+ |$currentFrameNum| |$CreateFrameAnswer| |$SwitchFrames| |$EndSession|
+ |$EndServerSession| |$LispCommand| |$sockBufferLength| |$MenuServer|
+ |$QuietSpadCommand| |$SpadCommand| |$NonSmanSession| |$KillLispSystem|))
+ (force-output)
+ (if (or (null |$SpadServer|) (null (is-console stream)))
+ (|read-line| stream)
+ (progn
+ (setq in-stream stream)
+ (setq *eof* nil)
+ (setq line
+ (do ()
+ ((null (and (null |$EndServerSession|) (null *eof*))) nil)
+ (when |$NeedToSignalSessionManager|
+ (|sockSendInt| |$SessionManager| |$EndOfOutput|))
+ (setq |$NeedToSignalSessionManager| nil)
+ (case (|serverSwitch|)
+ (|$CallInterp|
+ (setq l (|read-line| stream))
+ (setq |$NeedToSignalSessionManager| t)
+ (return l))
+ (|$CreateFrame|
+ (setq framename (gentemp "frame"))
+ (|addNewInterpreterFrame| framename)
+ (setq |$frameAlist|
+ (cons (cons |$frameNumber| framename) |$frameAlist|))
+ (setq |$currentFrameNum| |$frameNumber|)
+ (|sockSendInt| |$SessionManager| |$CreateFrameAnswer|)
+ (|sockSendInt| |$SessionManager| |$frameNumber|)
+ (setq |$frameNumber| (plus |$frameNumber| 1))
+ (|sockSendString| |$SessionManager| (mkprompt)))
+ (|$SwitchFrames|
+ (setq |$currentFrameNum| (|sockGetInt| |$SessionManager|))
+ (setq currentframe (lassoc |$currentFrameNum| |$frameAlist|))
+ (|changeToNamedInterpreterFrame| currentframe))
+ (|$EndSession|
+ (setq |$EndServerSession| t))
+ (|$LispCommand|
+ (setq |$NeedToSignalSessionManager| t)
+ (setq stringbuf (make-string |$sockBufferLength|))
+ (|sockGetString| |$MenuServer| stringbuf |$sockBufferLength|)
+ (setq form
+ (|unescapeStringsInForm| (read-from-string stringbuf)))
+ (|protectedEVAL| form))
+ (|$QuietSpadCommand|
+ (setq |$NeedToSignalSessionManager| t)
+ (|executeQuietCommand|))
+ (|$SpadCommand|
+ (setq |$NeedToSignalSessionManager| t)
+ (setq stringbuf (make-string 512))
+ (|sockGetString| |$MenuServer| stringbuf 512)
+ (catch '|coerceFailure|
+ (catch '|top_level|
+ (catch 'spad_reader
+ (|parseAndInterpret| stringbuf))))
+ (princ (mkprompt))
+ (finish-output))
+ (|$NonSmanSession| (setq |$SpadServer| nil))
+ (|$KillLispSystem| (bye))
+ (t nil))))
+ (cond
+ (line line)
+ (t '||))))))
+
+@
+
\defun{intloopInclude}{Include a file into the stream}
<<defun intloopInclude>>=
(defun |intloopInclude| (name n)
@@ -894,6 +998,295 @@ this is what the current code does so I won't change it.
@
+\defun{incLude}{incLude}
+<<defun incLude>>=
+(defun |incLude| (eb ss ln ufos states)
+ (|Delay| (function |incLude1|) (list eb ss ln ufos states)))
+
+@
+
+\defmacro{Rest}
+<<defmacro Rest>>=
+(defmacro |Rest| (s)
+ "used in incLude1 for parsing; s is not used."
+ '(|incLude| eb (cdr ss) lno ufos states))
+
+@
+
+\defvar{Top}
+<<initvars>>=
+(defvar |Top| 1 "used in incLude1 for parsing")
+
+@
+\defvar{IfSkipToEnd}
+<<initvars>>=
+(defvar |IfSkipToEnd| 10 "used in incLude1 for parsing")
+
+@
+\defvar{IfKeepPart}
+<<initvars>>=
+(defvar |IfKeepPart| 11 "used in incLude1 for parsing")
+
+@
+\defvar{IfSkipPart}
+<<initvars>>=
+(defvar |IfSkipPart| 12 "used in incLude1 for parsing")
+
+@
+\defvar{ElseifSkipToEnd}
+<<initvars>>=
+(defvar |ElseifSkipToEnd| 20 "used in incLude1 for parsing")
+
+@
+\defvar{ElseifKeepPart}
+<<initvars>>=
+(defvar |ElseifKeepPart| 21 "used in incLude1 for parsing")
+
+@
+\defvar{ElseifSkipPart}
+<<initvars>>=
+(defvar |ElseifSkipPart| 22 "used in incLude1 for parsing")
+
+@
+\defvar{ElseSkipToEnd}
+<<initvars>>=
+(defvar |ElseSkipToEnd| 30 "used in incLude1 for parsing")
+
+@
+\defvar{ElseKeepPart}
+<<initvars>>=
+(defvar |ElseKeepPart| 31 "used in incLude1 for parsing")
+
+@
+
+\defvar{Top?}
+<<defun Top?>>=
+(defun |Top?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (quotient |st| 10) 0))
+
+@
+\defvar{If?}
+<<defun If?>>=
+(defun |If?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (quotient |st| 10) 1))
+
+@
+\defvar{Elseif?}
+<<defun Elseif?>>=
+(defun |Elseif?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (quotient |st| 10) 2))
+
+@
+\defvar{Else?}
+<<defun Else?>>=
+(defun |Else?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (quotient |st| 10) 3))
+
+@
+\defvar{SkipEnd?}
+<<defun SkipEnd?>>=
+(defun |SkipEnd?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (remainder |st| 10) 0))
+
+@
+\defvar{KeepPart?}
+<<defun KeepPart?>>=
+(defun |KeepPart?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (remainder |st| 10) 1))
+
+@
+\defvar{SkipPart?}
+<<defun SkipPart?>>=
+(defun |SkipPart?| (|st|)
+ "used in incLude1 for parsing"
+ (eql (remainder |st| 10) 2))
+
+@
+\defvar{Skipping?}
+<<defun Skipping?>>=
+(defun |Skipping?| (|st|)
+ "used in incLude1 for parsing"
+ (null (|KeepPart?| |st|)))
+
+@
+
+\defun{incLude1}{incLude1}
+<<defun incLude1>>=
+(defun |incLude1| (&rest z)
+(let (pred s1 n tail head includee fn1 info str state lno states ufos ln ss eb)
+ (setq eb (car z))
+ (setq ss (cadr . (z)))
+ (setq ln (caddr . (z)))
+ (setq ufos (cadddr . (z)))
+ (setq states (car (cddddr . (z))))
+ (setq lno (+ ln 1))
+ (setq state (elt states 0))
+ (cond
+ ((|StreamNull| ss)
+ (cond
+ ((null (|Top?| state))
+ (cons (|xlPrematureEOF| eb ")--premature end" lno ufos)
+ |StreamNil|))
+ (t |StreamNil|)))
+ (t
+ (progn
+ (setq str (expand-tabs (car ss)))
+ (setq info (|incClassify| str))
+ (cond
+ ((null (elt info 0))
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkip| eb str lno (elt ufos 0)) (|Rest| |s|)))
+ (t
+ (cons (|xlOK| eb str lno (elt ufos 0)) (|Rest| |s|)))))
+ ((equal (elt info 2) "other")
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkip| eb str lno (elt ufos 0)) (|Rest| |s|)))
+ (t
+ (cons
+ (|xlOK1| eb str (concat ")command" str) lno (elt ufos 0))
+ (|Rest| |s|)))))
+ ((equal (elt info 2) "say")
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkip| eb str lno (elt ufos 0)) (|Rest| |s|)))
+ (t
+ (progn
+ (setq str (|incCommandTail| str info))
+ (cons (|xlSay| eb str lno ufos str)
+ (cons (|xlOK| eb str lno (ELT ufos 0)) (|Rest| |s|)))))))
+ ((equal (elt info 2) "include")
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkip| eb str lno (elt ufos 0)) (|Rest| |s|)))
+ (t
+ (progn
+ (setq fn1 (|inclFname| str info))
+ (cond
+ ((null fn1)
+ (cons (|xlNoSuchFile| eb str lno ufos |fn|) (|Rest| |s|)))
+ ((null (probe-file fn1))
+ (cons (|xlCannotRead| eb str lno ufos fn1) (|Rest| |s|)))
+ ((|incActive?| fn1 ufos)
+ (cons (|xlFileCycle| eb str lno ufos fn1) (|Rest| |s|)))
+ (t
+ (progn
+ (setq includee
+ (|incLude| (+ eb (elt info 1))
+ (|incFileInput| fn1)
+ 0
+ (cons fn1 ufos)
+ (cons |Top| states)))
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incAppend| includee (|Rest| |s|))))))))))
+ ((equal (elt info 2) "console")
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkip| eb str lno (elt ufos 0)) (|Rest| |s|)))
+ (t
+ (progn
+ (setq head
+ (|incLude| (+ eb (elt info 1))
+ (|incConsoleInput|)
+ 0
+ (cons "console" ufos)
+ (cons |Top| states)))
+ (setq tail (|Rest| |s|))
+ (setq n (|incNConsoles| ufos))
+ (cond
+ ((< 0 n)
+ (setq head
+ (cons (|xlConActive| eb str lno ufos n) head))
+ (setq tail
+ (cons (|xlConStill| eb str lno ufos n) tail))))
+ (setq head (cons (|xlConsole| eb str lno ufos) head))
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incAppend| head tail))))))
+ ((equal (elt info 2) "fin")
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkippingFin| eb str lno ufos) (|Rest| |s|)))
+ ((null (|Top?| state))
+ (cons (|xlPrematureFin| eb str lno ufos) |StreamNil|))
+ (t
+ (cons (|xlOK| eb str lno (elt ufos 0)) |StreamNil|))))
+ ((equal (elt info 2) "assert")
+ (cond
+ ((|Skipping?| state)
+ (cons (|xlSkippingFin| eb str lno ufos) (|Rest| |s|)))
+ (t
+ (progn
+ (|assertCond| str info)
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incAppend| includee (|Rest| |s|)))))))
+ ((equal (elt info 2) "if")
+ (progn
+ (setq s1
+ (cond
+ ((|Skipping?| state) |IfSkipToEnd|)
+ (t
+ (cond
+ ((|ifCond| str info) |IfKeepPart|)
+ (t |IfSkipPart|)))))
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incLude| eb (cdr ss) lno ufos (cons s1 states)))))
+ ((equal (elt info 2) "elseif")
+ (cond
+ ((and (null (|If?| state)) (null (|Elseif?| state)))
+ (cons (|xlIfSyntax| eb str lno ufos info states)
+ |StreamNil|))
+ (t
+ (cond
+ ((or (|SkipEnd?| state)
+ (|KeepPart?| state)
+ (|SkipPart?| state))
+ (setq s1
+ (cond
+ ((|SkipPart?| state)
+ (setq pred (|ifCond| str info))
+ (cond
+ (pred |ElseifKeepPart|)
+ (t |ElseifSkipPart|)))
+ (t |ElseifSkipToEnd|)))
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incLude| eb (cdr ss) lno ufos (cons s1 (cdr states)))))
+ (t
+ (cons (|xlIfBug| eb str lno ufos) |StreamNil|))))))
+ ((equal (elt info 2) "else")
+ (cond
+ ((and (null (|If?| state)) (null (|Elseif?| state)))
+ (cons (|xlIfSyntax| eb str lno ufos info states)
+ |StreamNil|))
+ (t
+ (cond
+ ((or (|SkipEnd?| state)
+ (|KeepPart?| state)
+ (|SkipPart?| state))
+ (setq s1
+ (cond ((|SkipPart?| state) |ElseKeepPart|) (t |ElseSkipToEnd|)))
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incLude| eb (cdr ss) lno ufos (cons s1 (cdr states)))))
+ (t
+ (cons (|xlIfBug| eb str lno ufos) |StreamNil|))))))
+ ((equal (elt info 2) "endif")
+ (cond
+ ((|Top?| state)
+ (cons (|xlIfSyntax| eb str lno ufos info states)
+ |StreamNil|))
+ (t
+ (cons (|xlOK| eb str lno (elt ufos 0))
+ (|incLude| eb (cdr ss) lno ufos (cdr states))))))
+ (t (cons (|xlCmdBug| eb str lno ufos) |StreamNil|))))))))
+
+@
+
\defun{incRgen}{incRgen}
Note that incRgen1 recursively calls this function.
<<defun incRgen>>=
@@ -6228,9 +6621,9 @@ Also used in the output routines.
(|sayMSG| (list " [" |ind| "] " (car vec)))
(progn
(|sayMSG| (list " [" |ind| "] "))
- (do ((tmp0 l (cdr tmp0)) (|ln| nil))
- ((or (atom tmp0) (progn (setq |ln| (car tmp0)) nil)) nil)
- (|sayMSG| (list " " |ln|))))))))
+ (do ((tmp0 l (cdr tmp0)) (ln nil))
+ ((or (atom tmp0) (progn (setq ln (car tmp0)) nil)) nil)
+ (|sayMSG| (list " " ln))))))))
@
\defun{showInOut}{showInOut}
@@ -16598,17 +16991,17 @@ $traceletflag
\begin{verbatim}
currenttime
error
-|incLude|
|incRenumber|
|incRgen1|
|insertpile|
-|ncloopEchoParse|
-|ncloopProcess|
+|intloopEchoParse|
+|intloopProcess|
|intloopProcessString|
|intnplisp|
|lineoftoks|
+|ncloopEchoParse|
+|ncloopProcess|
|resetStackLimits|
-|serverReadLine|
|shoeread-line|
stringimage
\end{verbatim}
@@ -16620,6 +17013,7 @@ stringimage
<<defmacro funfind>>
<<defmacro identp>>
+<<defmacro Rest>>
<<defun abbQuery>>
<<defun abbreviations>>
@@ -16702,6 +17096,8 @@ stringimage
<<defun edit>>
<<defun editSpad2Cmd>>
+<<defun Else?>>
+<<defun Elseif?>>
<<defun emptyInterpreterFrame>>
<<defun eofp>>
@@ -16749,8 +17145,11 @@ stringimage
<<defun history>>
<<defun historySpad2Cmd>>
+<<defun If?>>
<<defun importFromFrame>>
<<defun incBiteOff>>
+<<defun incLude>>
+<<defun incLude1>>
<<defun incFileName>>
<<defun incRgen>>
<<defun incRgen1>>
@@ -16774,6 +17173,8 @@ stringimage
<<defun isTraceGensym>>
<<defun isUncompiledMap>>
+<<defun KeepPart?>>
+
<<defun lassocSub>>
<<defun leaveScratchpad>>
<<defun letPrint>>
@@ -16864,6 +17265,7 @@ stringimage
<<defun ScanOrPairVec,ScanOrInner>>
<<defun selectOption>>
<<defun selectOptionLC>>
+<<defun serverReadLine>>
<<defun set>>
<<defun set1>>
<<defun setAsharpArgs>>
@@ -16898,6 +17300,9 @@ stringimage
<<defun showInOut>>
<<defun showInput>>
<<defun shut>>
+<<defun SkipEnd?>>
+<<defun SkipPart?>>
+<<defun Skipping?>>
<<defun spad>>
<<defun spadClosure?>>
<<defun SpadInterpretStream>>
@@ -16919,6 +17324,7 @@ stringimage
<<defun summary>>
<<defun ?t>>
+<<defun Top?>>
<<defun trace>>
<<defun trace1>>
<<defun traceDomainConstructor>>
diff --git a/changelog b/changelog
index 2278c93..678a43a 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,7 @@
+20090410 tpd src/axiom-website/patches.html 20090410.02.tpd.patch
+20090410 tpd src/interp/server.boot move interpreter code into bookvol5
+20090410 tpd src/interp/incl.boot move interpreter code into bookvol5
+20090410 tpd books/bookvol5 move more interpreter code
20090410 tpd src/axiom-website/patches.html 20090410.01.tpd.patch
20090410 tpd src/input/mappkg1.input removed, moved to algebra books
20090410 tpd src/input/parabola.input fix regress format
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index 96c30db..c91f8b2 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -1060,5 +1060,7 @@ bookvol5 collect help files<br/>
src/algebra/Makefile egrep -> grep -E<br/>
<a href="patches/20090410.01.tpd.patch">20090410.01.tpd.patch</a>
fix regress format<br/>
+<a href="patches/20090410.02.tpd.patch">20090410.02.tpd.patch</a>
+bookvol5 add more interpreter code<br/>
</body>
</html>
diff --git a/src/interp/incl.boot.pamphlet b/src/interp/incl.boot.pamphlet
index bac8b6f..89c4a56 100644
--- a/src/interp/incl.boot.pamphlet
+++ b/src/interp/incl.boot.pamphlet
@@ -144,25 +144,6 @@ incNConsoles ufos==
a:=MEMBER('"console",ufos)
if a then 1+incNConsoles CDR a else 0
-Top := 01
-IfSkipToEnd := 10
-IfKeepPart := 11
-IfSkipPart := 12
-ElseifSkipToEnd:= 20
-ElseifKeepPart := 21
-ElseifSkipPart := 22
-ElseSkipToEnd := 30
-ElseKeepPart := 31
-
-Top? (st) == QUOTIENT(st,10) = 0
-If? (st) == QUOTIENT(st,10) = 1
-Elseif? (st) == QUOTIENT(st,10) = 2
-Else? (st) == QUOTIENT(st,10) = 3
-SkipEnd? (st) == REMAINDER(st,10) = 0
-KeepPart?(st) == REMAINDER(st,10) = 1
-SkipPart?(st) == REMAINDER(st,10) = 2
-Skipping?(st) == not KeepPart? st
-
--% Message Handling
incHandleMessage(xl) ==
xl.1.1 = "none" =>
@@ -251,135 +232,7 @@ xlIfSyntax(eb, str, lno,ufos,info,sts) ==
--% This is it
-incLude(eb, ss, ln, ufos, states) ==
- Delay(function incLude1,[eb, ss, ln, ufos, states])
-
-Rest s==>incLude (eb,CDR ss,lno,ufos,states)
-
-incLude1 (:z) ==
- [eb, ss, ln, ufos, states]:=z
- lno := ln+1
- state := states.0
-
- StreamNull ss =>
- not Top? state =>
- cons(xlPrematureEOF(eb,
- '")--premature end", lno,ufos), StreamNil)
- StreamNil
-
- str := EXPAND_-TABS CAR ss
- info := incClassify str
-
- not info.0 =>
- Skipping? state => cons(xlSkip(eb,str,lno,ufos.0), Rest s)
- cons(xlOK(eb, str, lno, ufos.0),Rest s)
-
- info.2 = '"other" =>
- Skipping? state => cons(xlSkip(eb,str,lno,ufos.0), Rest s)
- cons(xlOK1(eb, str,CONCAT('")command",str), lno, ufos.0),
- Rest s)
-
- info.2 = '"say" =>
- Skipping? state => cons(xlSkip(eb,str,lno,ufos.0), Rest s)
- str := incCommandTail(str, info)
- cons(xlSay(eb, str, lno, ufos, str),
- cons(xlOK(eb,str,lno,ufos.0), Rest s))
-
- info.2 = '"include" =>
- Skipping? state =>
- cons(xlSkip(eb,str,lno,ufos.0), Rest s)
- fn1 := inclFname(str, info)
- not fn1 =>
- cons(xlNoSuchFile(eb, str, lno,ufos,fn),Rest s)
- not PROBE_-FILE fn1 =>
- cons(xlCannotRead(eb, str, lno,ufos,fn1),Rest s)
- incActive?(fn1,ufos) =>
- cons(xlFileCycle (eb, str, lno,ufos,fn1),Rest s)
- Includee :=
- incLude(eb+info.1,incFileInput fn1,0,
- cons(fn1,ufos), cons(Top,states))
- cons(
- xlOK(eb,str,lno,ufos.0),
- incAppend(Includee, Rest s))
-
- info.2 = '"console" =>
- Skipping? state => cons(xlSkip(eb,str,lno,ufos.0), Rest s)
- Head :=
- incLude(eb+info.1,incConsoleInput(),0,
- cons('"console",ufos),cons(Top,states) )
- Tail := Rest s
-
- n := incNConsoles ufos
- if n > 0 then
- Head := cons(xlConActive(eb, str, lno,ufos,n),Head)
- Tail :=
- cons(xlConStill (eb, str, lno,ufos,n),Tail)
-
- Head := cons (xlConsole(eb, str, lno,ufos), Head)
- cons(xlOK(eb,str,lno,ufos.0),incAppend(Head,Tail))
-
- info.2 = '"fin" =>
- Skipping? state =>
- cons(xlSkippingFin(eb, str, lno,ufos), Rest s)
- not Top? state =>
- cons(xlPrematureFin(eb, str, lno,ufos), StreamNil)
- cons(xlOK(eb,str,lno,ufos.0), StreamNil)
-
- info.2 = '"assert" =>
- Skipping? state =>
- cons(xlSkippingFin(eb, str, lno,ufos), Rest s)
- assertCond(str, info)
- cons(xlOK(eb,str,lno,ufos.0), incAppend(Includee, Rest s))
-
- info.2 = '"if" =>
- s1 :=
- Skipping? state => IfSkipToEnd
- if ifCond(str,info) then IfKeepPart else IfSkipPart
- cons(xlOK(eb,str,lno,ufos.0),
- incLude(eb,CDR ss,lno,ufos,cons(s1,states)))
- info.2 = '"elseif" =>
- not If? state and not Elseif? state =>
- cons(xlIfSyntax(eb, str,lno,ufos,info,states),
- StreamNil)
-
- if SkipEnd? state or KeepPart? state or SkipPart? state
- then
- s1:=if SkipPart? state
- then
- pred := ifCond(str,info)
- if pred
- then ElseifKeepPart
- else ElseifSkipPart
- else ElseifSkipToEnd
- cons(xlOK(eb,str,lno,ufos.0),
- incLude(eb,CDR ss,lno,ufos,cons(s1,rest states)))
- else
- cons(xlIfBug(eb, str, lno,ufos), StreamNil)
-
- info.2 = '"else" =>
- not If? state and not Elseif? state =>
- cons(xlIfSyntax(eb, str,lno,ufos,info,states),
- StreamNil)
- if SkipEnd? state or KeepPart? state or SkipPart? state
- then
- s1 :=if SkipPart? state
- then ElseKeepPart
- else ElseSkipToEnd
- cons(xlOK(eb,str,lno,ufos.0),
- incLude(eb,CDR ss,lno,ufos,cons(s1,rest states)))
- else
- cons(xlIfBug(eb, str, lno,ufos), StreamNil)
-
- info.2 = '"endif" =>
- Top? state =>
- cons(xlIfSyntax(eb, str,lno,ufos,info,states),
- StreamNil)
- cons(xlOK(eb,str,lno,ufos.0),
- incLude(eb,CDR ss,lno,ufos,rest states))
-
- cons(xlCmdBug(eb, str, lno,ufos), StreamNil)
-
---% Message handling for the source includer
+ --% Message handling for the source includer
-- SMW June 88
inclHandleError(pos, [key, args]) ==
diff --git a/src/interp/server.boot.pamphlet b/src/interp/server.boot.pamphlet
index 901d4ba..b243c3e 100644
--- a/src/interp/server.boot.pamphlet
+++ b/src/interp/server.boot.pamphlet
@@ -50,70 +50,6 @@
-- Assoc list of interpreter frame names and unique integer identifiers
-SETANDFILEQ($frameAlist, nil)
-SETANDFILEQ($frameNumber, 0)
-SETANDFILEQ($currentFrameNum, 0)
-SETANDFILEQ($EndServerSession, false)
-SETANDFILEQ($NeedToSignalSessionManager, false)
-SETANDFILEQ($sockBufferLength, 9217)
-
-serverReadLine(stream) ==
--- used in place of READ-LINE in a scratchpad server system.
- FORCE_-OUTPUT()
- not $SpadServer or not IS_-CONSOLE stream =>
- READ_-LINE(stream)
- IN_-STREAM: fluid := stream
- _*EOF_*: fluid := NIL
- line :=
- while not $EndServerSession and not _*EOF_* repeat
- if $NeedToSignalSessionManager then
- sockSendInt($SessionManager, $EndOfOutput)
- $NeedToSignalSessionManager := false
- action := serverSwitch()
- action = $CallInterp =>
- l := READ_-LINE(stream)
- $NeedToSignalSessionManager := true
- return l
- action = $CreateFrame =>
- frameName := GENTEMP('"frame")
- addNewInterpreterFrame(frameName)
- $frameAlist := [[$frameNumber,:frameName], :$frameAlist]
- $currentFrameNum := $frameNumber
- sockSendInt($SessionManager, $CreateFrameAnswer)
- sockSendInt($SessionManager, $frameNumber)
- $frameNumber := $frameNumber + 1
- sockSendString($SessionManager, MKPROMPT())
- action = $SwitchFrames =>
- $currentFrameNum := sockGetInt($SessionManager)
- currentFrame := LASSOC($currentFrameNum, $frameAlist)
- changeToNamedInterpreterFrame currentFrame
- action = $EndSession =>
- $EndServerSession := true
- action = $LispCommand =>
- $NeedToSignalSessionManager := true
- stringBuf := MAKE_-STRING $sockBufferLength
- sockGetString($MenuServer, stringBuf, $sockBufferLength)
- form := unescapeStringsInForm READ_-FROM_-STRING stringBuf
- protectedEVAL form
- action = $QuietSpadCommand =>
- $NeedToSignalSessionManager := true
- executeQuietCommand()
- action = $SpadCommand =>
- $NeedToSignalSessionManager := true
- stringBuf := MAKE_-STRING 512
- sockGetString($MenuServer, stringBuf, 512)
- CATCH('coerceFailure,CATCH('top__level, CATCH('SPAD__READER,
- parseAndInterpret stringBuf)))
- PRINC MKPROMPT()
- FINISH_-OUTPUT()
- action = $NonSmanSession =>
- $SpadServer := nil
- action = $KillLispSystem =>
- BYE()
- NIL
- line => line
- ""
-
parseAndInterpret str ==
$InteractiveMode :fluid := true
$BOOT: fluid := NIL
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Axiom-developer] 20090410.02.tpd.patch (bookvol5 add more interpreter code),
daly <=