diff options
author | dos-reis <gdr@axiomatics.org> | 2010-12-11 23:15:24 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-12-11 23:15:24 +0000 |
commit | dd14d434d1d7d06cd90a5a8a0fd1bef6cfffda8f (patch) | |
tree | 8ace9889673d5e3c8fceaf306b124dd388f216a6 | |
parent | a07faca18a3f5f7435cfc21f0a66a183d2c0cd05 (diff) | |
download | open-axiom-dd14d434d1d7d06cd90a5a8a0fd1bef6cfffda8f.tar.gz |
* interp/i-syscmd.boot: Use try-finally expression instead of Lisp
primitive UNWIND-PROJECT.
* interp/int-top.boot: Likewise.
* interp/lisplib.boot: Likewise.
* interp/server.boot: Likewise.
* boot/parser.boot (bpHandler): Allow semicolon separation.
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/boot/parser.boot | 2 | ||||
-rw-r--r-- | src/boot/strap/parser.clisp | 4 | ||||
-rw-r--r-- | src/interp/i-syscmd.boot | 21 | ||||
-rw-r--r-- | src/interp/int-top.boot | 2 | ||||
-rw-r--r-- | src/interp/lisplib.boot | 12 | ||||
-rw-r--r-- | src/interp/server.boot | 6 |
7 files changed, 34 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9957bae3..67c2e3a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2010-12-11 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/i-syscmd.boot: Use try-finally expression instead of Lisp + primitive UNWIND-PROJECT. + * interp/int-top.boot: Likewise. + * interp/lisplib.boot: Likewise. + * interp/server.boot: Likewise. + * boot/parser.boot (bpHandler): Allow semicolon separation. + +2010-12-11 Gabriel Dos Reis <gdr@cs.tamu.edu> + * boot/tokens.boot: `finally' is now a keyword. * boot/parser.boot (bpMissing): Use a BootParserException exception. (bpTrap): Likewise. diff --git a/src/boot/parser.boot b/src/boot/parser.boot index 8212b965..4d475238 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -728,7 +728,7 @@ bpFinally() == bpHandler key == s := bpState() - bpEqKey "BACKSET" and bpEqKey key => true + (bpEqKey "BACKSET" or bpEqKey "SEMICOLON") and bpEqKey key => true bpRestore s false diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp index 9cdd72cb..77744484 100644 --- a/src/boot/strap/parser.clisp +++ b/src/boot/strap/parser.clisp @@ -803,7 +803,9 @@ (PROGN (SETQ |s| (|bpState|)) (COND - ((AND (|bpEqKey| 'BACKSET) (|bpEqKey| |key|)) T) + ((AND (OR (|bpEqKey| 'BACKSET) (|bpEqKey| 'SEMICOLON)) + (|bpEqKey| |key|)) + T) (T (|bpRestore| |s|) NIL)))))) (DEFUN |bpLeave| () diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index d1674279..b5441fef 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -903,8 +903,7 @@ compilerDoitWithScreenedLisplib(constructor, fun) == VALUE) ((NOT NIL) (RWRITE KEY VALUE STREAM)))) ) - UNWIND_-PROTECT(compilerDoit(constructor,fun), - SEQ(UNEMBED 'RWRITE)) + (try compilerDoit(constructor,fun); finally SEQ(UNEMBED 'RWRITE)) withAsharpCmd args == @@ -1653,7 +1652,7 @@ setHistoryCore inCore == -- actually put something in there l := # RKEYIDS histFileName() for i in 1..l repeat - vec:= UNWIND_-PROTECT(readHiFi(i),disableHist()) + vec:= (try readHiFi(i); finally disableHist()) $internalHistoryTable := [[i,:vec],:$internalHistoryTable] histFileErase histFileName() $useInternalHistoryTable := true @@ -1733,7 +1732,7 @@ updateHist() == startTimingProcess 'history updateInCoreHist() if $HiFiAccess then - UNWIND_-PROTECT(writeHiFi(),disableHist()) + (try writeHiFi(); finally disableHist()) $HistRecord:= NIL $IOindex:= $IOindex+1 updateCurrentInterpreterFrame() @@ -1796,7 +1795,7 @@ undoInCore(n) == n:= $IOindex-n-1 n>0 and $HiFiAccess => - vec:= rest UNWIND_-PROTECT(readHiFi(n),disableHist()) + vec:= rest (try readHiFi(n); finally disableHist()) val:= ( p:= ASSQ('%,vec) ) and ( p1:= ASSQ('value,rest p) ) and rest p1 sayKeyedMsg("S2IH0019",[n]) @@ -1821,7 +1820,7 @@ undoFromFile(n) == if $HiFiAccess then recordNewValue(x,prop,val) p.rest := NIL for i in 1..n repeat - vec:= UNWIND_-PROTECT(rest readHiFi(i),disableHist()) + vec:= (try rest readHiFi(i); finally disableHist()) for p1 in vec repeat x:= first p1 for p2 in rest p1 repeat @@ -1877,7 +1876,7 @@ restoreHistory(fn) == $useInternalHistoryTable := NIL if oldInternal then $internalHistoryTable := NIL for i in 1..l repeat - vec:= UNWIND_-PROTECT(readHiFi(i),disableHist()) + vec:= (try readHiFi(i); finally disableHist()) if oldInternal then $internalHistoryTable := [[i,:vec],:$internalHistoryTable] LINE:= first vec @@ -1935,7 +1934,7 @@ showHistory(arg) == mini:= $IOindex-n maxi:= $IOindex-1 showInputOrBoth = 'both => - UNWIND_-PROTECT(showInOut(mini,maxi),setIOindex(maxi+1)) + (try showInOut(mini,maxi); finally setIOindex(maxi+1)) showInput(mini,maxi) setIOindex(n) == @@ -1945,7 +1944,7 @@ setIOindex(n) == showInput(mini,maxi) == -- displays all input lines from mini to maxi for ind in mini..maxi repeat - vec:= UNWIND_-PROTECT(readHiFi(ind),disableHist()) + vec:= (try readHiFi(ind); finally disableHist()) if ind<10 then TAB 2 else if ind<100 then TAB 1 l := first vec string? l => @@ -1957,7 +1956,7 @@ showInput(mini,maxi) == showInOut(mini,maxi) == -- displays all steps from mini to maxi for ind in mini..maxi repeat - vec:= UNWIND_-PROTECT(readHiFi(ind),disableHist()) + vec:= (try readHiFi(ind); finally disableHist()) sayMSG [first vec] Alist:= ASSQ('%,rest vec) => triple:= rest ASSQ('value,rest Alist) @@ -1973,7 +1972,7 @@ fetchOutput(n) == n n >= $IOindex => throwKeyedMsg("S2IH0001",[n]) n < 1 => throwKeyedMsg("S2IH0002",[n]) - vec:= UNWIND_-PROTECT(readHiFi(n),disableHist()) + vec:= (try readHiFi(n); finally disableHist()) Alist:= ASSQ('%,rest vec) => val:= rest ASSQ('value,rest Alist) => val throwKeyedMsg("S2IH0003",[n]) diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot index 000c96fe..0c1c6a0b 100644 --- a/src/interp/int-top.boot +++ b/src/interp/int-top.boot @@ -408,7 +408,7 @@ ncConversationPhase(fn, args) == $ncMsgList: local := [] $convPhase: local := 'NoPhase - UNWIND_-PROTECT( apply(fn, args), wrapup(carrier) ) where + (try apply(fn, args); finally wrapup(carrier)) where wrapup(carrier) == for m in $ncMsgList repeat ncPutQ(carrier, 'messages, [m, :ncEltQ(carrier, 'messages)]) diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index 6c774ff5..adb03fe6 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -369,12 +369,12 @@ compDefineLisplib(df:=["DEF",[op,:.],:.],m,e,prefix,fal,fn) == -- finalizeLisplib libName -- following guarantee's compiler output files get closed. ok := false; - UNWIND_-PROTECT( - PROGN(res:= FUNCALL(fn,df,m,e,prefix,fal), - leaveIfErrors(libName), - sayMSG ['" finalizing ",$spadLibFT,:bright libName], - ok := finalizeLisplib libName), - RSHUT $libFile) + try + res:= FUNCALL(fn,df,m,e,prefix,fal) + leaveIfErrors(libName) + sayMSG ['" finalizing ",$spadLibFT,:bright libName] + ok := finalizeLisplib libName + finally RSHUT $libFile if ok then lisplibDoRename(libName) filearg := $FILEP(libName,$spadLibFT,$libraryDirectory) RPACKFILE filearg diff --git a/src/interp/server.boot b/src/interp/server.boot index 17e884e9..39efd26b 100644 --- a/src/interp/server.boot +++ b/src/interp/server.boot @@ -158,6 +158,8 @@ parseAndEvalStr1 string == protectedEVAL x == error := true val := NIL - UNWIND_-PROTECT((val := eval x; error := NIL), - error => (resetStackLimits(); sendHTErrorSignal())) + try + val := eval x + error := false + finally (error => (resetStackLimits(); sendHTErrorSignal())) val |