From dc5f09ca9fe80896ec7fd8677a3e517ce9213285 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 4 Jul 2011 04:39:13 +0000 Subject: * interp/vmlisp.lisp (PRINTEXP): Remove. * interp/br-data.boot: Use writeString, writeChar, and writeLine. * interp/c-util.boot: Likewise. * interp/diagnostics.boot: Likewise. * interp/fortcall.boot: Likewise. * interp/i-output.boot: Likewise. * interp/i-syscmd.boot: Likewise. * interp/i-util.boot: Likewise. * interp/lisplib.boot: Likewise. * interp/msgdb.boot: Likewise. * interp/newfort.boot: Likewise. * interp/record.boot: Likewise. * interp/g-opt.boot ($VMsideEffectFreeOperators): Include %writeString, %writeNewline, %writeLine. * interp/lisp-backend.boot: Translate them. --- src/ChangeLog | 18 ++++++++++ src/algebra/files.spad.pamphlet | 9 +++-- src/algebra/fortran.spad.pamphlet | 7 ++-- src/algebra/mathml.spad.pamphlet | 4 +-- src/boot/tokens.boot | 1 + src/interp/br-data.boot | 73 ++++++++++++++++++--------------------- src/interp/br-saturn.boot | 36 +++++++++---------- src/interp/br-util.boot | 2 +- src/interp/c-util.boot | 2 +- src/interp/debug.lisp | 42 ++-------------------- src/interp/diagnostics.boot | 10 +++--- src/interp/fortcall.boot | 10 +++--- src/interp/g-opt.boot | 3 +- src/interp/i-output.boot | 26 +++++++------- src/interp/i-syscmd.boot | 3 +- src/interp/i-util.boot | 2 +- src/interp/lisp-backend.boot | 7 +++- src/interp/lisplib.boot | 2 +- src/interp/msgdb.boot | 6 ++-- src/interp/newfort.boot | 4 +-- src/interp/record.boot | 21 +++++------ src/interp/vmlisp.lisp | 2 -- 22 files changed, 135 insertions(+), 155 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a62f2e1d..2363b4ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2011-07-03 Gabriel Dos Reis + + * interp/vmlisp.lisp (PRINTEXP): Remove. + * interp/br-data.boot: Use writeString, writeChar, and writeLine. + * interp/c-util.boot: Likewise. + * interp/diagnostics.boot: Likewise. + * interp/fortcall.boot: Likewise. + * interp/i-output.boot: Likewise. + * interp/i-syscmd.boot: Likewise. + * interp/i-util.boot: Likewise. + * interp/lisplib.boot: Likewise. + * interp/msgdb.boot: Likewise. + * interp/newfort.boot: Likewise. + * interp/record.boot: Likewise. + * interp/g-opt.boot ($VMsideEffectFreeOperators): Include + %writeString, %writeNewline, %writeLine. + * interp/lisp-backend.boot: Translate them. + 2011-07-03 Gabriel Dos Reis * boot/tokens.boot: flushOutput, writeNewline, writeString diff --git a/src/algebra/files.spad.pamphlet b/src/algebra/files.spad.pamphlet index 98543b32..efc90616 100644 --- a/src/algebra/files.spad.pamphlet +++ b/src/algebra/files.spad.pamphlet @@ -185,7 +185,7 @@ File(S:SetCategory): FileCategory(FileName, S) with f.fileIOmode ~= "output" => error "File not in write state" z := PRINT_-FULL(x, f.fileState)$Lisp - TERPRI(f.fileState)$Lisp + %writeNewline(f.fileState)$Foreign(Builtin) x @ @@ -260,16 +260,15 @@ TextFile: Cat == Def where "failed" write!(f, x) == f.fileIOmode ~= "output" => error "File not in write state" - PRINTEXP(x, f.fileState)$Lisp + %writeString(x, f.fileState)$Foreign(Builtin) x writeLine! f == f.fileIOmode ~= "output" => error "File not in write state" - TERPRI(f.fileState)$Lisp + %writeNewline(f.fileState)$Foreign(Builtin) "" writeLine!(f, x) == f.fileIOmode ~= "output" => error "File not in write state" - PRINTEXP(x, f.fileState)$Lisp - TERPRI(f.fileState)$Lisp + %writeLine(x,f.fileState)$Foreign(Builtin) x endOfFile? f == f.fileIOmode = "output" => false diff --git a/src/algebra/fortran.spad.pamphlet b/src/algebra/fortran.spad.pamphlet index 59de4cb1..050960e0 100644 --- a/src/algebra/fortran.spad.pamphlet +++ b/src/algebra/fortran.spad.pamphlet @@ -1342,14 +1342,13 @@ FortranTemplate() : specification == implementation where Rep := TextFile fortranLiteralLine(s:String):Void == - PRINTEXP(s,_$fortranOutputStream$Lisp)$Lisp - TERPRI(_$fortranOutputStream$Lisp)$Lisp + %writeLine(s,_$fortranOutputStream$Lisp)$Foreign(Builtin) fortranLiteral(s:String):Void == - PRINTEXP(s,_$fortranOutputStream$Lisp)$Lisp + %writeString(s,_$fortranOutputStream$Lisp)$Foreign(Builtin) fortranCarriageReturn():Void == - TERPRI(_$fortranOutputStream$Lisp)$Lisp + %writeNewline(_$fortranOutputStream$Lisp)$Foreign(Builtin) writePassiveLine!(line:String):Void == -- We might want to be a bit clever here and look for new SubPrograms etc. diff --git a/src/algebra/mathml.spad.pamphlet b/src/algebra/mathml.spad.pamphlet index 086d0d0f..b40ed836 100644 --- a/src/algebra/mathml.spad.pamphlet +++ b/src/algebra/mathml.spad.pamphlet @@ -258,8 +258,8 @@ mathmlFormat expr == formatFn := getFunctionFromDomain("coerce",mml,[$OutputForm]) displayFn := getFunctionFromDomain("display",mml,[mmlrep]) SPADCALL(SPADCALL(expr,formatFn),displayFn) - TERPRI $mathmlOutputStream - FORCE_-OUTPUT $mathmlOutputStream + writeNewline $mathmlOutputStream + flushOutput $mathmlOutputStream NIL \end{verbatim} diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot index e9fde37d..925d8689 100644 --- a/src/boot/tokens.boot +++ b/src/boot/tokens.boot @@ -328,6 +328,7 @@ for i in [ _ ["vectorRef", "SVREF"] , _ ["writeByte", "WRITE-BYTE"], _ ["writeChar", "WRITE-CHAR"], _ + ["writeInteger", "PRINC"], _ ["writeLine", "WRITE-LINE"], _ ["writeNewline", "TERPRI"], _ ["writeString", "WRITE-STRING"], _ diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot index d3f06250..25245655 100644 --- a/src/interp/br-data.boot +++ b/src/interp/br-data.boot @@ -152,9 +152,8 @@ concatWithBlanks r == writedb(u) == not string? u => nil --skip if not a string - PRINTEXP(addPatchesToLongLines(u,500),$outStream) --positions for tick(1), dashes(2), and address(9), i.e. 12 - TERPRI $outStream + writeLine(addPatchesToLongLines(u,500),$outStream) addPatchesToLongLines(s,n) == #s > n => strconc(subString(s,0,n), @@ -272,30 +271,29 @@ dbSplitLibdb() == instream := MAKE_-INSTREAM '"olibdb.text" outstream:= MAKE_-OUTSTREAM '"libdb.text" comstream:= MAKE_-OUTSTREAM '"comdb.text" - PRINTEXP(0, comstream) - PRINTEXP($tick,comstream) - PRINTEXP('"", comstream) - TERPRI(comstream) + writeInteger(0, comstream) + writeChar($tick,comstream) + writeLine('"", comstream) while (line := readLine instream) ~= %nothing repeat outP := FILE_-POSITION outstream comP := FILE_-POSITION comstream [prefix,:comments] := dbSplit(line,6,1) - PRINTEXP(prefix,outstream) - PRINTEXP($tick ,outstream) + PRINC(prefix,outstream) + writeChar($tick ,outstream) null comments => - PRINTEXP(0,outstream) - TERPRI(outstream) - PRINTEXP(comP,outstream) - TERPRI(outstream) - PRINTEXP(outP ,comstream) - PRINTEXP($tick ,comstream) - PRINTEXP(first comments,comstream) - TERPRI(comstream) + writeInteger(0,outstream) + writeNewline outstream + PRINC(comP,outstream) + writeNewline outstream + PRINC(outP ,comstream) + writeChar($tick ,comstream) + PRINC(first comments,comstream) + writeNewline comstream for c in rest comments repeat - PRINTEXP(outP ,comstream) - PRINTEXP($tick ,comstream) - PRINTEXP(c, comstream) - TERPRI(comstream) + PRINC(outP ,comstream) + writeChar($tick ,comstream) + PRINC(c, comstream) + writeNewline comstream SHUT instream SHUT outstream SHUT comstream @@ -336,30 +334,27 @@ buildGloss() == --called by buildDatabase (database.boot) defpath := '"glossdef.text" defstream:= MAKE_-OUTSTREAM defpath pairs := getGlossLines instream - PRINTEXP('"\begin{page}{GlossaryPage}{G l o s s a r y}\beginscroll\beginmenu",htstream) + writeString('"\begin{page}{GlossaryPage}{G l o s s a r y}\beginscroll\beginmenu",htstream) for [name,:line] in pairs repeat outP := FILE_-POSITION outstream defP := FILE_-POSITION defstream lines := spreadGlossText transformAndRecheckComments(name,[line]) - PRINTEXP(name, outstream) - PRINTEXP($tick,outstream) - PRINTEXP(defP, outstream) - TERPRI(outstream) --- PRINTEXP('"\item\newline{\em \menuitemstyle{}}\tab{0}{\em ",htstream) - PRINTEXP('"\item\newline{\em \menuitemstyle{}}{\em ",htstream) - PRINTEXP(name, htstream) - PRINTEXP('"}\space{}",htstream) - TERPRI(htstream) + PRINC(name, outstream) + writeChar($tick,outstream) + PRINC(defP, outstream) + writeNewline outstream + writeString('"\item\newline{\em \menuitemstyle{}}{\em ",htstream) + PRINC(name, htstream) + writeLine('"}\space{}",htstream) for x in lines repeat - PRINTEXP(outP, defstream) - PRINTEXP($tick,defstream) - PRINTEXP(x, defstream) - TERPRI defstream - PRINTEXP(strconc/lines,htstream) - TERPRI htstream - PRINTEXP('"\endmenu\endscroll",htstream) - PRINTEXP('"\lispdownlink{Search}{(|htGloss| _"\stringvalue{pattern}_")} for glossary entry matching \inputstring{pattern}{24}{*}",htstream) - PRINTEXP('"\end{page}",htstream) + PRINC(outP, defstream) + writeChar($tick,defstream) + PRINC(x, defstream) + writeNewline defstream + writeLine(strconc/lines,htstream) + writeString('"\endmenu\endscroll",htstream) + writeString('"\lispdownlink{Search}{(|htGloss| _"\stringvalue{pattern}_")} for glossary entry matching \inputstring{pattern}{24}{*}",htstream) + writeString('"\end{page}",htstream) SHUT instream SHUT outstream SHUT defstream diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot index 3c697f46..ad1871e3 100644 --- a/src/interp/br-saturn.boot +++ b/src/interp/br-saturn.boot @@ -333,11 +333,11 @@ writeSaturnPrint s == saturnTERPRI() saturnPRINTEXP s == - $browserOutputStream => PRINTEXP(s,$browserOutputStream) - PRINTEXP s + $browserOutputStream => PRINC(s,$browserOutputStream) + PRINC s saturnTERPRI() == - $browserOutputStream => TERPRI($browserOutputStream) + $browserOutputStream => writeNewline $browserOutputStream TERPRI() writeSaturnTable line == @@ -1563,9 +1563,9 @@ mkButtonBox n == strconc('"\buttonbox{", STRINGIMAGE n, '"}") -- key := nil --dummy first key -- instream := MAKE_-INSTREAM '"libdb.text" -- comstream := MAKE_-OUTSTREAM '"comdb.text" --- PRINTEXP(0, comstream) --- PRINTEXP($tick,comstream) --- PRINTEXP('"", comstream) +-- PRINC(0, comstream) +-- PRINC($tick,comstream) +-- PRINC('"", comstream) -- TERPRI(comstream) -- while (line := readLine instream) ~= %nothing repeat -- comP := FILE_-POSITION comstream @@ -1575,23 +1575,23 @@ mkButtonBox n == strconc('"\buttonbox{", STRINGIMAGE n, '"}") -- outstream := MAKE_-OUTSTREAM strconc(STRINGIMAGE key,'"libdb.text") -- outP := FILE_-POSITION outstream -- [prefix,:comments] := dbSplit(line,6,1) --- PRINTEXP(prefix,outstream) --- PRINTEXP($tick ,outstream) +-- PRINC(prefix,outstream) +-- PRINC($tick ,outstream) -- null comments => --- PRINTEXP(0,outstream) +-- PRINC(0,outstream) -- TERPRI(outstream) --- PRINTEXP(comP,outstream) +-- PRINC(comP,outstream) -- TERPRI(outstream) --- PRINTEXP(key, comstream) --identifies file the backpointer is to --- PRINTEXP(outP ,comstream) --- PRINTEXP($tick ,comstream) --- PRINTEXP(first comments,comstream) +-- PRINC(key, comstream) --identifies file the backpointer is to +-- PRINC(outP ,comstream) +-- PRINC($tick ,comstream) +-- PRINC(first comments,comstream) -- TERPRI(comstream) -- for c in rest comments repeat --- PRINTEXP(key, comstream) --identifies file the backpointer is to --- PRINTEXP(outP ,comstream) --- PRINTEXP($tick ,comstream) --- PRINTEXP(c, comstream) +-- PRINC(key, comstream) --identifies file the backpointer is to +-- PRINC(outP ,comstream) +-- PRINC($tick ,comstream) +-- PRINC(c, comstream) -- TERPRI(comstream) -- SHUT instream -- SHUT outstream diff --git a/src/interp/br-util.boot b/src/interp/br-util.boot index 0512cd45..c918690f 100644 --- a/src/interp/br-util.boot +++ b/src/interp/br-util.boot @@ -50,7 +50,7 @@ browserAutoloadOnceTrigger() == nil ----------------------> Global Variables <----------------------- $includeUnexposed? := true --default setting -$tick := char "`" --field separator for database files +$tick == char "`" --field separator for database files $charUnderscore := ('__) --needed because of parser bug $wild1 := '"[^`]*" --phrase used to convert keys to grep strings $browseCountThreshold := 10 --the maximum number of names that will display diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 7ee3f3f9..b1ac64ed 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -923,7 +923,7 @@ stackAndThrow(msg, args == nil) == $compErrorMessageStack:= [msg,:$compErrorMessageStack] THROW("compOrCroak",nil) -printString x == PRINTEXP (string? x => x; PNAME x) +printString x == PRINC (string? x => x; PNAME x) printAny x == if atom x then printString x else PRIN1 x diff --git a/src/interp/debug.lisp b/src/interp/debug.lisp index 7e409ff3..49927594 100644 --- a/src/interp/debug.lisp +++ b/src/interp/debug.lisp @@ -199,9 +199,6 @@ " " (STRINGIMAGE $LINENUMBER))) (SHUT INPUTSTREAM) - ;(COND - ; ( (EQ (READ |$InputStream|) 'ABORTPROCESS) - ; (RETURN 'ABORT) ) ) ;;%% next is done in case the diskmode changed ;;(SETQ INFILE (|pathname| (IFCAR ;; (QSORT ($LISTFILE INFILE))))) @@ -215,7 +212,6 @@ (RETURN NIL))) ;; next is done in case the diskmode changed (SHUT INPUTSTREAM) )) - ;;(SETQ INFILE (|pathname| (IFCAR ($LISTFILE INFILE)))) (SETQ INFILE (make-input-filename INFILE)) (MAKEPROP /FN 'DEFLOC (CONS RECNO INFILE)) @@ -234,19 +230,8 @@ (SETQ DEF (COND ( SFN - ;(+VOL 'METABASE) (POINT RECNO INPUTSTREAM) - ;(SETQ CHR (CAR INPUTSTREAM)) - ;(SETQ ERRCOL 0) - ;(SETQ COUNT 0) - ;(SETQ COLUMN 0) - ;(SETQ TRAPFLAG NIL) (SETQ OK 'T) - ;(NXTTOK) - ;(SETQ LINE (CURINPUTLINE)) - ;(SETQ SPADERRORSTREAM CUROUTSTREAM) - ;(AND /ECHO (SETQ |$echo| 'T) (PRINTEXP LINE) (TERPRI)) - ;(SFN) (SETQ DEF (BOOT-PARSE-1 INPUTSTREAM)) (SETQ DEBUGMODE 'YES) (COND @@ -342,11 +327,11 @@ EXAMINE (SETQ RECNO (NOTE |$InputStream|)) (SETQ /UPDATESTREAM (open (strconc "/tmp/update." FILENAME) :direction :output :if-exists :append :if-does-not-exist :create))) - (PRINTEXP + (PRINC " Function Name Filename Date Time" /UPDATESTREAM) (TERPRI /UPDATESTREAM) - (PRINTEXP + (PRINC " --------------------------- ----------------------- -------- -----" /UPDATESTREAM) (TERPRI /UPDATESTREAM) ) @@ -393,35 +378,15 @@ EXAMINE (SETQ RECNO (NOTE |$InputStream|)) ;;;If /UPDATESTREAM not set or current /UPDATES file doesnt exist, initialize. (PROG (IFT KEY RECNO ORECNO DATE TIME DATETIME) -; (if (EQ 0 /VERSION) (RETURN NIL)) (if (EQ 'INPUT FT) (RETURN NIL)) (if (NOT |$createUpdateFiles|) (RETURN NIL)) -; (COND ((/= 0 (directory "A"))) -; ((SAY "A disk is not read-write. Update file not modified") -; (RETURN NIL))) (if (OR (NOT (BOUNDP '/UPDATESTREAM)) (NOT (STREAMP /UPDATESTREAM))) (/INITUPDATES /VERSION)) -; (SETQ IFT (INTERN (STRINGIMAGE /VERSION))) -; (SETQ INPUTSTREAM (open (strconc IFT /WSNAME) :direction :input)) -; (NEXT INPUTSTREAM) -; (SETQ KEY (if (NOT FUN) -; (STRCONC " QUAD " -; (PNAME FN)) -; (PNAME FUN))) -; (SETQ RECNO (/LOCATE KEY (LIST 'FROMWRITEUPDATE /WSNAME) 1)) -; (SETQ COUNT (COND -; ((NOT (NUMBERP RECNO)) 1) -; ((POINT RECNO INPUTSTREAM) -; (do ((i 1 (1+ i))) ((> i 4)) (read inputstream)) -; (1+ (READ INPUTSTREAM)) ))) -; (COND ((NUMBERP RECNO) -; (SETQ ORECNO (NOTE /UPDATESTREAM)) -; (POINTW RECNO /UPDATESTREAM) )) (SETQ DATETIME (|getDateAndTime|)) (SETQ DATE (CAR DATETIME)) (SETQ TIME (CDR DATETIME)) - (PRINTEXP (STRCONC + (PRINC (STRCONC (COND ((NOT FUN) " QUAD ") ((STRINGPAD (PNAME FUN) 28))) " " (STRINGIMAGE FM) @@ -429,7 +394,6 @@ EXAMINE (SETQ RECNO (NOTE |$InputStream|)) " " DATE " " TIME) /UPDATESTREAM) (TERPRI /UPDATESTREAM) -; (if (NUMBERP RECNO) (POINTW ORECNO /UPDATESTREAM)) )) (defun |getDateAndTime| () diff --git a/src/interp/diagnostics.boot b/src/interp/diagnostics.boot index d91e3679..fd5c5e09 100644 --- a/src/interp/diagnostics.boot +++ b/src/interp/diagnostics.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis +-- Copyright (C) 2007-2011, Gabriel Dos Reis -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -81,19 +81,19 @@ MESSAGEPRINT x == MESSAGEPRINT_-1 x == cons? x => - PRINC '"(" + writeString '"(" MESSAGEPRINT_-1 first x MESSAGEPRINT_-2 rest x - PRINC '")" + writeString '")" x = "%l" or x is '"%l" => TERPRI() PRINC x MESSAGEPRINT_-2 x == atom x => not null x => - PRINC '" . " + writeString '" . " MESSAGEPRINT_-1 x - PRINC '" " + writeString '" " MESSAGEPRINT_-1 first x MESSAGEPRINT_-2 rest x diff --git a/src/interp/fortcall.boot b/src/interp/fortcall.boot index 8abd1f77..2c40d76e 100644 --- a/src/interp/fortcall.boot +++ b/src/interp/fortcall.boot @@ -131,7 +131,7 @@ writeCFile(name,args,fortranArgs,dummies,decls,results,returnType,asps,fp) == if first fortranArgs then printCName(first fortranArgs,isPointer?(first fortranArgs,decls),asps,fp) for a in rest fortranArgs repeat - PRINC('",",fp) + writeString('",",fp) printCName(a,isPointer?(a,decls),asps,fp) writeStringLengths(fortranArgs,decls,fp) writeLine('");",fp) @@ -160,8 +160,10 @@ isPointer?(u,decls) == printCName(u,ispointer,asps,fp) == member(u,asps) => PRINC(u,fp) - if $addUnderscoreToFortranNames then PRINC(charString abstractChar 95,fp) - if not ispointer then PRINC('"&",fp) + if $addUnderscoreToFortranNames then + writeString(charString abstractChar 95,fp) + if not ispointer then + writeString('"&",fp) PRINC(u,fp) getFortranType(u,decls) == @@ -241,7 +243,7 @@ writeMalloc(name,type,dims,fp) == wl (l,fp) == for u in l repeat PRINC(u,fp) - TERPRI(fp) + writeNewline fp wt (l,fp) == for u in l repeat PRINC(u,fp) diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 4346120d..8dfff858 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -427,7 +427,8 @@ $VMsideEffectFreeOperators == %bitvector %bitvecnot %bitvecand %bitvecnand %bivecor %bitvecnor %bitvecxor %bitveccopy %bitvecconc %bitveclength %bitvecref %bitveceq %bitveclt - %before? %equal %sptreq %ident? %property %tref) + %before? %equal %sptreq %ident? %property %tref + %writeString %writeNewline %writeLine) ++ List of simple VM operators $simpleVMoperators == diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index baaf707f..f79112b2 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -388,7 +388,7 @@ $collectOutput := false ++ Start a a new line if we are in 2-d ASCII art display mode. newlineIfDisplaying() == if not $collectOutput then - TERPRI $algebraOutputStream + writeNewline $algebraOutputStream specialChar(symbol) == @@ -1576,7 +1576,8 @@ output(expr,domain) == if $formulaFormat then formulaFormat x if $fortranFormat then dispfortexp x - if not $collectOutput then TERPRI $fortranOutputStream + if not $collectOutput then + writeNewline $fortranOutputStream flushOutput $fortranOutputStream if $algebraFormat then mathprintWithNumber(x,domain) @@ -1674,9 +1675,9 @@ printMap1(x,initialFlag) == printBasic second x printBasic x == - x=$One => PRIN1(1,$algebraOutputStream) - x=$Zero => PRIN1(0,$algebraOutputStream) - IDENTP x => PRINTEXP(symbolName x,$algebraOutputStream) + x=$One => writeInteger(1,$algebraOutputStream) + x=$Zero => writeInteger(0,$algebraOutputStream) + IDENTP x => writeString(symbolName x,$algebraOutputStream) atom x => PRIN1(x,$algebraOutputStream) PRIN1(x,$algebraOutputStream) @@ -1850,8 +1851,8 @@ scylla(n,v) == if $collectOutput then $outputLines := [y, :$outputLines] else - PRINTEXP(y,$algebraOutputStream) - TERPRI $algebraOutputStream + PRINC(y,$algebraOutputStream) + writeNewline $algebraOutputStream nil keyp(u) == @@ -2355,12 +2356,12 @@ prnd(start, op) == $testOutputLineFlag => string := strconc(fillerSpaces MAX(0,start - 1),op) $testOutputLineList := [string,:$testOutputLineList] - PRINTEXP(fillerSpaces MAX(0,start - 1),$algebraOutputStream) + writeString(fillerSpaces MAX(0,start - 1),$algebraOutputStream) $collectOutput => string := strconc(fillerSpaces MAX(0,start - 1),op) $outputLines := [string, :$outputLines] - PRINTEXP(op,$algebraOutputStream) - TERPRI $algebraOutputStream + PRINC(op,$algebraOutputStream) + writeNewline $algebraOutputStream qTSub(u) == subspan second u @@ -2587,10 +2588,11 @@ maPrin u == u is ['EQUATNUM,num,form] or u is [['EQUATNUM,:.],num,form] => charybdis(['EQUATNUM,num], $MARGIN, $LINELENGTH) if not $collectOutput then - TERPRI $algebraOutputStream + writeNewline $algebraOutputStream PRETTYPRINT(form,$algebraOutputStream) form - if not $collectOutput then PRETTYPRINT(u,$algebraOutputStream) + if not $collectOutput then + PRETTYPRINT(u,$algebraOutputStream) nil diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index fd565e94..11eef822 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -717,8 +717,7 @@ CREDITS := '( credits() == for i in CREDITS repeat - PRINC(i) - TERPRI() + writeLine i --% )display diff --git a/src/interp/i-util.boot b/src/interp/i-util.boot index 9d582213..6971bca7 100644 --- a/src/interp/i-util.boot +++ b/src/interp/i-util.boot @@ -78,7 +78,7 @@ MKPROMPT() == printPrompt(flush? == false) == - PRINC(MKPROMPT(), $OutputStream) + writeString(MKPROMPT(), $OutputStream) if flush? then flushOutput $OutputStream diff --git a/src/interp/lisp-backend.boot b/src/interp/lisp-backend.boot index a6fe5da7..7bbbb22f 100644 --- a/src/interp/lisp-backend.boot +++ b/src/interp/lisp-backend.boot @@ -602,7 +602,12 @@ for x in [ ['%leave, :'RETURN], ['%otherwise,:'T], ['%funcall, :'FUNCALL], - ['%when, :'COND] + ['%when, :'COND], + + -- I/O stream functions + ['%writeString, :'WRITE_-STRING], + ['%writeNewline, :'TERPRI], + ['%writeLine, :'WRITE_-LINE] ] repeat property(first x,'%Rename) := rest x ++ Table of opcode-expander pairs. diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index 51210ea0..053fdf0d 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -343,7 +343,7 @@ loadLibNoUpdate(cname, libName, fullLibName) == sayKeyedMsg("S2IL0002",[namestring fullLibName,kind,cname]) if CATCH('VERSIONCHECK,loadModule(fullLibName,cname)) = -1 then - PRINC('" wrong library version...recompile ") + writeString('" wrong library version...recompile ") PRINC(fullLibName) TERPRI() TOPLEVEL() diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index 61d4dcb3..3aa2dbfe 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -543,14 +543,14 @@ sayMessage msg == sayMSG mkMessage msg sayNewLine(out == $OutputStream, margin == nil) == -- Note: this function should *always* be used by sayBrightly and -- friends rather than TERPRI -- see bindSayBrightly - TERPRI(out) + writeNewline out if margin ~= nil then BLANKS(margin,out) nil sayString(x,out == $OutputStream) == -- Note: this function should *always* be used by sayBrightly and - -- friends rather than PRINTEXP -- see bindSayBrightly - PRINTEXP(x,out) + -- friends rather than PRINC -- see bindSayBrightly + PRINC(x,out) spadStartUpMsgs() == -- messages displayed when the system starts up diff --git a/src/interp/newfort.boot b/src/interp/newfort.boot index f9f388ac..cc137f0a 100644 --- a/src/interp/newfort.boot +++ b/src/interp/newfort.boot @@ -400,8 +400,8 @@ getfortexp1 x == displayLines1 lines == for l in lines repeat - PRINTEXP(l,$fortranOutputStream) - TERPRI($fortranOutputStream) + PRINC(l,$fortranOutputStream) + writeNewline $fortranOutputStream displayLines lines == if not $fortError then displayLines1 lines diff --git a/src/interp/record.boot b/src/interp/record.boot index 594a6131..e334d210 100644 --- a/src/interp/record.boot +++ b/src/interp/record.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis. +-- Copyright (C) 2007-2011, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -182,11 +182,9 @@ testInput2Output(lines,n) == evaluateLines lines == file := MAKE_-OUTSTREAM '"/tmp/temp.input" for line in lines repeat --- stringPrefix?('")read ",line) => 'skip stringPrefix?('")r",line) => 'skip stringPrefix?('")undo )redo",line) => 'skip - PRINTEXP(line, file) - TERPRI file + writeLine(line, file) SHUT file _/EDITFILE: local := '"/tmp/temp.input" _/RF() @@ -223,15 +221,14 @@ htFile2InputFile(pathname,:option) == SHUT $htStream outStream := MAKE_-OUTSTREAM opathname for [pageName,:commands] in alist repeat - PRINTEXP('"-- ",outStream) - PRINTEXP(pageName,outStream) - TERPRI outStream - PRINTEXP('")cl all",outStream) - TERPRI outStream + writeString('"-- ",outStream) + PRINC(pageName,outStream) + writeNewline outStream + writeLine('")cl all",outStream) for x in commands repeat - PRINTEXP(htCommandToInputLine x,outStream) - TERPRI outStream - TERPRI outStream + PRINC(htCommandToInputLine x,outStream) + writeNewline outStream + writeNewline outStream SHUT outStream opathname diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp index 0f3d1f2f..24e904c1 100644 --- a/src/interp/vmlisp.lisp +++ b/src/interp/vmlisp.lisp @@ -1261,8 +1261,6 @@ (define-function 'prin2cvec #'princ-to-string) (define-function 'stringimage #'princ-to-string) -(define-function 'printexp #'princ) - (defun |F,PRINT-ONE| (form &optional (stream |$OutputStream|)) (declare (ignore stream)) (let ((*print-level* 4) (*print-length* 4)) -- cgit v1.2.3