diff options
author | dos-reis <gdr@axiomatics.org> | 2011-07-03 16:53:30 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-07-03 16:53:30 +0000 |
commit | 67a9b503724a4390abf08baa367959713483f363 (patch) | |
tree | 6380b619a86bb58768d8bb3e37387acd808ed6f6 | |
parent | cd75300236a7e0bd4b2ba0818721deb92c522aa7 (diff) | |
download | open-axiom-67a9b503724a4390abf08baa367959713483f363.tar.gz |
* boot/tokens.boot: flushOutput, writeNewline, writeString
are new builtin library functions.
* boot/utility.boot (finishLine): New exported function.
* interp/i-output.boot (formulaFormat): Use it.
(texFormat): Likewise.
(texFormat1): Likewise.
(mathmlFormat): Likewise.
(output): Remove case for TextWriter.
-rw-r--r-- | src/ChangeLog | 11 | ||||
-rw-r--r-- | src/boot/strap/tokens.clisp | 10 | ||||
-rw-r--r-- | src/boot/strap/utility.clisp | 7 | ||||
-rw-r--r-- | src/boot/tokens.boot | 8 | ||||
-rw-r--r-- | src/boot/utility.boot | 10 | ||||
-rw-r--r-- | src/interp/i-output.boot | 21 | ||||
-rw-r--r-- | src/interp/i-util.boot | 2 | ||||
-rw-r--r-- | src/interp/server.boot | 2 |
8 files changed, 46 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 48682b48..a62f2e1d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2011-07-03 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * boot/tokens.boot: flushOutput, writeNewline, writeString + are new builtin library functions. + * boot/utility.boot (finishLine): New exported function. + * interp/i-output.boot (formulaFormat): Use it. + (texFormat): Likewise. + (texFormat1): Likewise. + (mathmlFormat): Likewise. + (output): Remove case for TextWriter. + 2011-07-02 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/macros.lisp (sayALGEBRA): Remove as duplicate of sayMSG. diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp index 41ae0b5d..703b4263 100644 --- a/src/boot/strap/tokens.clisp +++ b/src/boot/strap/tokens.clisp @@ -215,8 +215,9 @@ (LIST '|croak| 'CROAK) (LIST '|digit?| 'DIGIT-CHAR-P) (LIST '|drop| 'DROP) (LIST '|exit| 'EXIT) (LIST '|false| 'NIL) (LIST '|first| 'CAR) - (LIST '|float?| 'FLOATP) (LIST '|fourth| 'CADDDR) - (LIST '|function| 'FUNCTION) + (LIST '|float?| 'FLOATP) + (LIST '|flushOutput| 'FORCE-OUTPUT) + (LIST '|fourth| 'CADDDR) (LIST '|function| 'FUNCTION) (LIST '|function?| 'FUNCTIONP) (LIST '|gensym| 'GENSYM) (LIST '|genvar| 'GENVAR) (LIST '|integer?| 'INTEGERP) (LIST 'LAST '|last|) (LIST '|list| 'LIST) @@ -255,7 +256,10 @@ (LIST '|vector?| 'SIMPLE-VECTOR-P) (LIST '|vectorRef| 'SVREF) (LIST '|writeByte| 'WRITE-BYTE) - (LIST '|writeLine| 'WRITE-LINE) (LIST 'PLUS '+) + (LIST '|writeChar| 'WRITE-CHAR) + (LIST '|writeLine| 'WRITE-LINE) + (LIST '|writeNewline| 'TERPRI) + (LIST '|writeString| 'WRITE-STRING) (LIST 'PLUS '+) (LIST 'MINUS '-) (LIST 'TIMES '*) (LIST 'POWER 'EXPT) (LIST 'REM 'REM) (LIST 'QUO 'TRUNCATE) (LIST 'SLASH '/) (LIST 'LT '<) (LIST 'GT '>) (LIST 'LE '<=) diff --git a/src/boot/strap/utility.clisp b/src/boot/strap/utility.clisp index a832a3ce..75416004 100644 --- a/src/boot/strap/utility.clisp +++ b/src/boot/strap/utility.clisp @@ -11,7 +11,7 @@ |reverse!| |lastNode| |append| |append!| |copyList| |substitute| |substitute!| |setDifference| |applySubst| |applySubst!| |applySubstNQ| |remove| |removeSymbol| - |atomic?|))) + |atomic?| |finishLine|))) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Thing|) |%Thing|) |substitute|)) @@ -44,6 +44,8 @@ (DECLAIM (FTYPE (FUNCTION (|%Thing|) |%Boolean|) |atomic?|)) +(DECLAIM (FTYPE (FUNCTION (|%Thing|) |%Void|) |finishLine|)) + (DEFUN |atomic?| (|x|) (OR (NOT (CONSP |x|)) (EQ (CAR |x|) 'QUOTE))) (DEFUN |objectMember?| (|x| |l|) @@ -318,3 +320,6 @@ ((CHAR= (SCHAR |s| |k|) |c|) (RETURN |k|)) (T (SETQ |k| (+ |k| 1))))))))) +(DEFUN |finishLine| (|out|) + (PROGN (TERPRI |out|) (FORCE-OUTPUT |out|))) + diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot index c0b8134e..e9fde37d 100644 --- a/src/boot/tokens.boot +++ b/src/boot/tokens.boot @@ -270,6 +270,7 @@ for i in [ _ ["false", 'NIL] , _ ["first", "CAR"] , _ ["float?", "FLOATP"] , _ + ["flushOutput", "FORCE-OUTPUT"], _ ["fourth", "CADDDR"] , _ ["function","FUNCTION"] , _ ["function?","FUNCTIONP"] , _ @@ -325,8 +326,11 @@ for i in [ _ ["valueEq?", "EQUAL"] , _ ["vector?", "SIMPLE-VECTOR-P"], _ ["vectorRef", "SVREF"] , _ - ["writeByte", "WRITE-BYTE"], _ - ["writeLine", "WRITE-LINE"], _ + ["writeByte", "WRITE-BYTE"], _ + ["writeChar", "WRITE-CHAR"], _ + ["writeLine", "WRITE-LINE"], _ + ["writeNewline", "TERPRI"], _ + ["writeString", "WRITE-STRING"], _ ["PLUS", "+"] , _ ["MINUS", "-"] , _ ["TIMES", "*"] , _ diff --git a/src/boot/utility.boot b/src/boot/utility.boot index 8410b790..0eca52d2 100644 --- a/src/boot/utility.boot +++ b/src/boot/utility.boot @@ -37,7 +37,7 @@ module utility (objectMember?, symbolMember?, stringMember?, charMember?, scalarMember?, listMember?, reverse, reverse!, lastNode, append, append!, copyList, substitute, substitute!, setDifference, applySubst, applySubst!, applySubstNQ, - remove,removeSymbol,atomic?) where + remove,removeSymbol,atomic?,finishLine) where substitute: (%Thing,%Thing,%Thing) -> %Thing substitute!: (%Thing,%Thing,%Thing) -> %Thing append: (%List %Thing,%List %Thing) -> %List %Thing @@ -47,6 +47,7 @@ module utility (objectMember?, symbolMember?, stringMember?, removeSymbol: (%List %Thing, %Symbol) -> %List %Thing remove: (%List %Thing, %Thing) -> %List %Thing atomic?: %Thing -> %Boolean + finishLine: %Thing -> %Void --% @@ -267,3 +268,10 @@ charPosition(c,s,k) == k >= n => return nil stringChar(s,k) = c => return k k := k + 1 + +--% I/O + +++ Add a newline character and flush the output stream. +finishLine out == + writeNewline out + flushOutput out diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index 1b914f97..baaf707f 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -1530,8 +1530,7 @@ formulaFormat expr == displayFn := getFunctionFromDomain("display",sff,[sff]) SPADCALL(SPADCALL(expr,formatFn),displayFn) if not $collectOutput then - TERPRI $algebraOutputStream - FORCE_-OUTPUT $formulaOutputStream + finishLine $algebraOutputStream nil texFormat expr == @@ -1540,8 +1539,7 @@ texFormat expr == getFunctionFromDomain("convert",tf,[$OutputForm,$Integer]) displayFn := getFunctionFromDomain("display",tf,[tf]) SPADCALL(SPADCALL(expr,$IOindex,formatFn),displayFn) - TERPRI $texOutputStream - FORCE_-OUTPUT $texOutputStream + finishLine $texOutputStream nil texFormat1 expr == @@ -1549,8 +1547,7 @@ texFormat1 expr == formatFn := getFunctionFromDomain("coerce",tf, [$OutputForm]) displayFn := getFunctionFromDomain("display",tf,[tf]) SPADCALL(SPADCALL(expr,formatFn),displayFn) - TERPRI $texOutputStream - FORCE_-OUTPUT $texOutputStream + finishLine $texOutputStream nil mathmlFormat expr == @@ -1559,8 +1556,7 @@ mathmlFormat expr == formatFn := getFunctionFromDomain("coerce",mml,[$OutputForm]) displayFn := getFunctionFromDomain("display",mml,[mmlrep]) SPADCALL(SPADCALL(expr,formatFn),displayFn) - TERPRI $mathmlOutputStream - FORCE_-OUTPUT $mathmlOutputStream + finishLine $mathmlOutputStream nil output(expr,domain) == @@ -1581,18 +1577,11 @@ output(expr,domain) == if $fortranFormat then dispfortexp x if not $collectOutput then TERPRI $fortranOutputStream - FORCE_-OUTPUT $fortranOutputStream + flushOutput $fortranOutputStream if $algebraFormat then mathprintWithNumber(x,domain) if $texFormat then texFormat x if $mathmlFormat then mathmlFormat x - (function?(opOf domain)) and - (printfun := compiledLookup("<<",'(TextWriter TextWriter $), evalDomain domain)) - and (textwrit := compiledLookup("print", '($), TextWriter())) => - sayMSGNT [:bright '"AXIOM-XL",'"output: "] - SPADCALL(SPADCALL textwrit, expr, printfun) - sayMSGNT '"%l" - sayMSG [:bright '"LISP",'"output:",'"%l",expr or '"NIL"] outputNumber(start,linelength,num) == diff --git a/src/interp/i-util.boot b/src/interp/i-util.boot index e51a5702..9d582213 100644 --- a/src/interp/i-util.boot +++ b/src/interp/i-util.boot @@ -80,7 +80,7 @@ MKPROMPT() == printPrompt(flush? == false) == PRINC(MKPROMPT(), $OutputStream) if flush? then - FORCE_-OUTPUT $OutputStream + flushOutput $OutputStream ++ Return the name of a text editor, if possible. textEditor() == diff --git a/src/interp/server.boot b/src/interp/server.boot index 6455f880..3b0daff5 100644 --- a/src/interp/server.boot +++ b/src/interp/server.boot @@ -48,7 +48,7 @@ $sockBufferLength := 9217 serverReadLine(stream) == -- used in place of READ-LINE in a scratchpad server system. - FORCE_-OUTPUT() + flushOutput() not $SpadServer or not IS_-CONSOLE stream => line := readLine stream line ~= %nothing => line |