aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/algebra/net.spad.pamphlet4
-rw-r--r--src/boot/ast.boot2
-rw-r--r--src/boot/strap/translator.clisp24
-rw-r--r--src/boot/translator.boot24
-rw-r--r--src/interp/as.boot4
-rw-r--r--src/interp/ax.boot2
-rw-r--r--src/interp/br-saturn.boot2
-rw-r--r--src/interp/br-search.boot6
-rw-r--r--src/interp/cstream.boot2
-rw-r--r--src/interp/i-syscmd.boot4
-rw-r--r--src/interp/int-top.boot4
-rw-r--r--src/interp/lisplib.boot4
-rw-r--r--src/interp/spad.lisp7
-rw-r--r--src/interp/sys-utility.boot9
-rw-r--r--src/lisp/core.lisp.in4
16 files changed, 66 insertions, 48 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 769aaf65..8697f58e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,17 @@
2011-05-28 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/sys-utility.boot (displayTextFile): New.
+ * interp/i-syscmd.boot (summary): Use it.
+ (copyright): Likewise.
+ * algebra/net.spad.pamphlet: Replace closeFile with closeStream.
+ * boot/translator.boot: Likewise.
+ * interp/as.boot: Likewise.
+ * interp/ax.boot: Likewise.
+ * interp/br-saturn.boot: Likewise.
+ * interp/br-search.boot: Likewise.
+
+2011-05-28 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* lisp/core.lisp.in (readExpr): New.
* interp/as.boot: Replace READLINE with readLine.
* interp/br-data.boot: Likewise.
diff --git a/src/algebra/net.spad.pamphlet b/src/algebra/net.spad.pamphlet
index 29b5e704..590cf345 100644
--- a/src/algebra/net.spad.pamphlet
+++ b/src/algebra/net.spad.pamphlet
@@ -219,7 +219,7 @@ InputBinaryFile(): Public == Private where
error "file is not open"
close! ifile ==
if isOpen? ifile then
- rep(ifile).stream := closeFile(rep(ifile).stream)$Lisp
+ rep(ifile).stream := closeStream(rep(ifile).stream)$Foreign(Builtin)
rep(ifile).eof := true
ifile
position ifile ==
@@ -268,7 +268,7 @@ OutputBinaryFile(): Public == Private where
error "file is not open"
close! ifile ==
if isOpen? ifile then
- rep(ifile).stream := closeFile(rep(ifile).stream)$Lisp
+ rep(ifile).stream := closeStream(rep(ifile).stream)$Foreign(Builtin)
ifile
coerce(ifile: %): OutputForm ==
rep(ifile).filename::OutputForm
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index 6327d8fa..3201d249 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -104,7 +104,7 @@ structure %Ast ==
%Leave(%Ast) -- leave x
%Throw(%Ast) -- throw OutOfRange 3
%Catch(%Signature,%Ast) -- catch(x: OutOfRange) => print x
- %Finally(%Ast) -- finally closeFile f
+ %Finally(%Ast) -- finally closeStream f
%Try(%Ast,%Sequence) -- try x / y catch DivisionByZero
%Where(%Ast,%Sequence) -- e where f x == y
%Structure(%Ast,%Sequence) -- structure Foo == ...
diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp
index b7170014..54c28449 100644
--- a/src/boot/strap/translator.clisp
+++ b/src/boot/strap/translator.clisp
@@ -151,7 +151,7 @@
(PROGN
(SETQ |a| (|inputTextFile| (|shoeAddbootIfNec| |fn|)))
(|shoeClLines| |a| |fn| |lines| |outfn|))
- (|closeFile| |a|)))))
+ (|closeStream| |a|)))))
(DEFUN |shoeClLines| (|a| |fn| |lines| |outfn|)
(PROG (|stream|)
@@ -173,7 +173,7 @@
(|shoeFileTrees| (|shoeTransformStream| |a|) |stream|)
(|genModuleFinalization| |stream|)
|outfn|)
- (|closeFile| |stream|)))))))
+ (|closeStream| |stream|)))))))
(DEFUN BOOTTOCLC (|fn| |out|)
(UNWIND-PROTECT
@@ -190,7 +190,7 @@
(PROGN
(SETQ |a| (|inputTextFile| (|shoeAddbootIfNec| |fn|)))
(|shoeClCLines| |a| |fn| |lines| |outfn|))
- (|closeFile| |a|)))))
+ (|closeStream| |a|)))))
(DEFUN |shoeClCLines| (|a| |fn| |lines| |outfn|)
(PROG (|stream|)
@@ -216,7 +216,7 @@
|stream|)
(|genModuleFinalization| |stream|)
|outfn|)
- (|closeFile| |stream|)))))))
+ (|closeStream| |stream|)))))))
(DECLAIM (FTYPE (FUNCTION (|%String|) |%Thing|) BOOTTOMC))
@@ -231,7 +231,7 @@
(SETQ |a| (|inputTextFile| (|shoeAddbootIfNec| |fn|)))
(|shoeMc| |a| |fn|))
(PROGN
- (|closeFile| |a|)
+ (|closeStream| |a|)
(|setCurrentPackage| |callingPackage|)))))))
(DEFUN |shoeMc| (|a| |fn|)
@@ -254,7 +254,7 @@
(PROGN
(SETQ |a| (|inputTextFile| |infn|))
(|shoeClLines| |a| |infn| NIL |outfn|))
- (PROGN (|closeFile| |a|) (|setCurrentPackage| |b|)))
+ (PROGN (|closeStream| |a|) (|setCurrentPackage| |b|)))
(LOAD |outfn|)))))
(DECLAIM (FTYPE (FUNCTION (|%String|) |%Thing|) BO))
@@ -269,7 +269,7 @@
(PROGN
(SETQ |a| (|inputTextFile| (|shoeAddbootIfNec| |fn|)))
(|shoeToConsole| |a| |fn|))
- (PROGN (|closeFile| |a|) (|setCurrentPackage| |b|)))))))
+ (PROGN (|closeStream| |a|) (|setCurrentPackage| |b|)))))))
(DEFUN BOCLAM (|fn|)
(PROG (|$bfClamming| |a| |callingPackage|)
@@ -284,7 +284,7 @@
(SETQ |a| (|inputTextFile| (|shoeAddbootIfNec| |fn|)))
(|shoeToConsole| |a| |fn|))
(PROGN
- (|closeFile| |a|)
+ (|closeStream| |a|)
(|setCurrentPackage| |callingPackage|)))))))
(DEFUN |shoeToConsole| (|a| |fn|)
@@ -795,7 +795,7 @@
(PROGN
(SETQ |a| (|inputTextFile| (CONCAT |fn| ".boot")))
(|shoeDfu| |a| |fn|))
- (|closeFile| |a|)))))
+ (|closeStream| |a|)))))
(DEFPARAMETER |$bootDefined| NIL)
@@ -825,7 +825,7 @@
(SETQ |stream|
(|outputTextFile| (CONCAT |fn| ".defuse")))
(|shoeReport| |stream|))
- (|closeFile| |stream|)))))))
+ (|closeStream| |stream|)))))))
(DEFUN |shoeReport| (|stream|)
(PROG (|b| |a|)
@@ -1104,7 +1104,7 @@
(PROGN
(SETQ |a| (|inputTextFile| (CONCAT |fn| ".boot")))
(|shoeXref| |a| |fn|))
- (|closeFile| |a|)))))
+ (|closeStream| |a|)))))
(DEFUN |shoeXref| (|a| |fn|)
(PROG (|$bfClamming| |$bootUsed| |$bootDefined| |$lispWordTable|
@@ -1127,7 +1127,7 @@
(SETQ |stream| (|outputTextFile| |out|))
(|shoeXReport| |stream|)
|out|)
- (|closeFile| |stream|)))))))
+ (|closeStream| |stream|)))))))
(DEFUN |shoeXReport| (|stream|)
(PROG (|a| |c|)
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index 89a4059a..e606da82 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -105,7 +105,7 @@ BOOTTOCLLINES(lines, fn, outfn)==
try
a := inputTextFile shoeAddbootIfNec fn
shoeClLines(a,fn,lines,outfn)
- finally closeFile a
+ finally closeStream a
shoeClLines(a,fn,lines,outfn)==
a=nil => shoeNotFound fn
@@ -117,7 +117,7 @@ shoeClLines(a,fn,lines,outfn)==
shoeFileTrees(shoeTransformStream a,stream)
genModuleFinalization stream
outfn
- finally closeFile stream
+ finally closeStream stream
++ (boottoclc "filename") translates the file "filename.boot" to
++ the common lisp file "filename.clisp" with the original boot
@@ -133,7 +133,7 @@ BOOTTOCLCLINES(lines, fn, outfn)==
try
a := inputTextFile shoeAddbootIfNec fn
shoeClCLines(a,fn,lines,outfn)
- finally closeFile a
+ finally closeStream a
shoeClCLines(a,fn,lines,outfn)==
a=nil => shoeNotFound fn
@@ -146,7 +146,7 @@ shoeClCLines(a,fn,lines,outfn)==
shoeInclude bAddLineNumber(bRgen a,bIgen 0)),stream)
genModuleFinalization(stream)
outfn
- finally closeFile stream
+ finally closeStream stream
++ (boottomc "filename") translates the file "filename.boot"
++ to machine code and loads it one item at a time
@@ -158,7 +158,7 @@ BOOTTOMC fn==
a := inputTextFile shoeAddbootIfNec fn
shoeMc(a,fn)
finally
- closeFile a
+ closeStream a
setCurrentPackage callingPackage
shoeMc(a,fn)==
@@ -175,7 +175,7 @@ evalBootFile fn ==
a := inputTextFile infn
shoeClLines(a,infn,[],outfn)
finally
- closeFile a
+ closeStream a
setCurrentPackage b
LOAD outfn
@@ -189,7 +189,7 @@ BO fn==
a := inputTextFile shoeAddbootIfNec fn
shoeToConsole(a,fn)
finally
- closeFile a
+ closeStream a
setCurrentPackage b
BOCLAM fn==
@@ -200,7 +200,7 @@ BOCLAM fn==
a := inputTextFile shoeAddbootIfNec fn
shoeToConsole(a,fn)
finally
- closeFile a
+ closeStream a
setCurrentPackage callingPackage
shoeToConsole(a,fn)==
@@ -501,7 +501,7 @@ DEFUSE fn==
try
a := inputTextFile strconc(fn,'".boot")
shoeDfu(a,fn)
- finally closeFile a
+ finally closeStream a
--%
$bootDefined := nil
@@ -521,7 +521,7 @@ shoeDfu(a,fn)==
try
stream := outputTextFile strconc(fn,'".defuse")
shoeReport stream
- finally closeFile stream
+ finally closeStream stream
shoeReport stream==
shoeFileLine('"DEFINED and not USED",stream)
@@ -623,7 +623,7 @@ XREF fn==
try
a := inputTextFile strconc(fn,'".boot")
shoeXref(a,fn)
- finally closeFile a
+ finally closeStream a
shoeXref(a,fn)==
a = nil => shoeNotFound fn
@@ -638,7 +638,7 @@ shoeXref(a,fn)==
stream := outputTextFile out
shoeXReport stream
out
- finally closeFile stream
+ finally closeStream stream
shoeXReport stream==
diff --git a/src/interp/as.boot b/src/interp/as.boot
index 42939edb..c7533f8b 100644
--- a/src/interp/as.boot
+++ b/src/interp/as.boot
@@ -46,7 +46,7 @@ asList() ==
OBEY '"ls as/*.asy > temp.text"
instream := inputTextFile '"temp.text"
lines := [line := readLine instream while line ~= %nothing]
- closeFile instream
+ closeStream instream
lines
asAll lines ==
@@ -429,7 +429,7 @@ asytran fn ==
asytranDeclaration(d,'(top),nil,false)
if null name then hohohoho()
tableValue($docHash,name) := $docHashLocal
- closeFile inStream
+ closeStream inStream
'done
mkNiladics u ==
diff --git a/src/interp/ax.boot b/src/interp/ax.boot
index 9a2d774a..e3728a78 100644
--- a/src/interp/ax.boot
+++ b/src/interp/ax.boot
@@ -73,7 +73,7 @@ makeAxFile(filename, constructors) ==
['Import, [], 'AxiomLib], ['Import, [], 'Boolean], :axForms]
st := MAKE_-OUTSTREAM(filename)
PPRINT(axForm,st)
- closeFile st
+ closeStream st
makeAxExportForm(filename, constructors) ==
$defaultFlag : local := false
diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot
index 2b0d4755..9af0e238 100644
--- a/src/interp/br-saturn.boot
+++ b/src/interp/br-saturn.boot
@@ -92,7 +92,7 @@ off()==
-- '"/windows/temp/browser.text"
-- $saturn =>
-- saturnEvalToFile(x, fn)
--- runCommand '"cat /tmp/sat.text"
+-- displayTextFile '"/tmp/sat.text"
-- eval x
diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot
index 45c22ee4..ed3c9a19 100644
--- a/src/interp/br-search.boot
+++ b/src/interp/br-search.boot
@@ -228,7 +228,7 @@ grepSplit(lines,doc?) ==
kind = char "o" => ops := insert(line,ops)
kind = char "-" => 'skip --for now
systemError 'kind
- if doc? then closeFile instream2
+ if doc? then closeStream instream2
[['"attribute",:reverse! atts],
['"operation",:reverse! ops],
['"category",:reverse! cats],
@@ -930,7 +930,7 @@ dbWriteLines(s, :options) ==
dbReadLines target == --AIX only--called by grepFile
instream := inputTextFile target
lines := [line := readLine instream while line ~= %nothing]
- closeFile instream
+ closeStream instream
lines
dbGetCommentOrigin line ==
@@ -943,7 +943,7 @@ dbGetCommentOrigin line ==
instream := inputTextFile grepSource key --this always returns libdb now
FILE_-POSITION(instream,readInteger address)
line := readLine instream
- closeFile instream
+ closeStream instream
line
grepSource key ==
diff --git a/src/interp/cstream.boot b/src/interp/cstream.boot
index 5e158877..76a96ca2 100644
--- a/src/interp/cstream.boot
+++ b/src/interp/cstream.boot
@@ -58,7 +58,7 @@ incRgen s ==
incRgen1 s==
a := readLine s
- a = %nothing => (closeFile s;StreamNil)
+ a = %nothing => (closeStream s;StreamNil)
[a,:incRgen s]
incIgen n ==
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index a9ed2364..1e995c05 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -877,10 +877,10 @@ withAsharpCmd args ==
--% )copyright -- display copyright notice
summary l ==
- runCommand strconc('"cat _"", systemRootDirectory(),'"/lib/summary_"")
+ displayTextFile strconc(systemRootDirectory(),'"/lib/summary")
copyright () ==
- runCommand strconc('"cat _"", systemRootDirectory(),'"/lib/copyright_"")
+ displayTextFile strconc(systemRootDirectory(),'"/lib/copyright")
--% )credits -- display credit list
diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot
index cc7edb7b..94e83572 100644
--- a/src/interp/int-top.boot
+++ b/src/interp/int-top.boot
@@ -215,7 +215,7 @@ intloopInclude(name, n) ==
try
st := inputTextFile name
intloopInclude0(st, name, n)
- finally (if st ~= nil then closeFile st)
+ finally (if st ~= nil then closeStream st)
intloopInclude1(name,n) ==
a:=ncloopIncFileName name
@@ -352,7 +352,7 @@ ncloopInclude(name, n) ==
try
st := inputTextFile name
ncloopInclude0(st, name, n)
- finally (if st ~= nil then closeFile st)
+ finally (if st ~= nil then closeStream st)
ncloopInclude1(name,n) ==
a:=ncloopIncFileName name
diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot
index 8e6aa7a3..06daed68 100644
--- a/src/interp/lisplib.boot
+++ b/src/interp/lisplib.boot
@@ -848,10 +848,10 @@ getIndexTable dir ==
try
stream := inputTextFile indexFile
GET_-INDEX_-TABLE_-FROM_-STREAM stream
- finally (if stream ~= nil then closeFile stream)
+ finally (if stream ~= nil then closeStream stream)
-- index file doesn't exist but mark this directory as a Lisplib.
try stream := outputTextFile indexFile
- finally (if stream ~= nil then closeFile stream)
+ finally (if stream ~= nil then closeStream stream)
--%
compDefineExports(form,ops,sig,e) ==
diff --git a/src/interp/spad.lisp b/src/interp/spad.lisp
index b81fea44..02c9c87f 100644
--- a/src/interp/spad.lisp
+++ b/src/interp/spad.lisp
@@ -157,11 +157,6 @@
; SYSTEM COMMANDS
;************************************************************************
-(defun CLEARDATABASE () (|runCommand| "ERASE MODEMAP DATABASE"))
-
-(defun erase (FN FT)
- (|runCommand| (STRCONC "ERASE " (STRINGIMAGE FN) " " (STRINGIMAGE FT))))
-
(defun READLISP (UPPER_CASE_FG)
(let (v expr val )
(setq EXPR (READ-FROM-STRING
@@ -203,8 +198,6 @@
('T (/RQ-LIB)))
(|terminateSystemCommand|))
-(defun CPSAY (X) (let (n) (if (EQ 0 (setq N (|runCommand| X))) NIL (PRINT N))))
-
(defun |fin| ()
(SETQ *EOF* 'T)
(THROW 'SPAD_READER NIL))
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index 2fa38afa..53114135 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -41,6 +41,7 @@ namespace BOOT
module sys_-utility where
probeReadableFile : %String -> %Maybe %String
remove!: (%List %Thing,%Thing) -> %List %Thing
+ displayTextFile: %Thing -> %Void
--%
$COMBLOCKLIST := nil
@@ -379,3 +380,11 @@ remove!(l,x) ==
return l
p := rest p
+--%
+displayTextFile f ==
+ try
+ stream := inputTextFile f
+ while (line := readLine stream) ~= %nothing repeat
+ writeLine(line,$OutputStream)
+ finally
+ stream ~= nil => closeStream stream
diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in
index 6b57b73a..303ad074 100644
--- a/src/lisp/core.lisp.in
+++ b/src/lisp/core.lisp.in
@@ -98,6 +98,7 @@
"inputTextFile"
"outputTextFile"
"closeFile"
+ "closeStream"
"prettyPrint"
"readLine"
"readExpr"
@@ -506,6 +507,9 @@
(defun |closeFile| (f)
(close f))
+(defmacro |closeStream| (s)
+ `(close ,s))
+
;; Read a line from the input text file. Quietly return
;; %nothing at end of file.
(defmacro |readLine| (f)