aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-05-28 07:00:13 +0000
committerdos-reis <gdr@axiomatics.org>2011-05-28 07:00:13 +0000
commitd4b55b57874770ebaf0bd0f79b91ff40a6d94b94 (patch)
tree1353d1fa1ca5adc163fa61ad8ce94018396a17be /src
parent414db62082f6e113d0898240887f53fc43d21ae7 (diff)
downloadopen-axiom-d4b55b57874770ebaf0bd0f79b91ff40a6d94b94.tar.gz
* lisp/core.lisp.in: Define and export readLine and readbyte.
* interp/sys-utility.boot (readByteFromFile): Remove. * boot/tokens.boot: Don't rename readLine and readByte. * boot/includer.boot (shoeReadLine): Remove. (bRgen1): Adjust. Use resdLine. * algebra/net.spad.pamphlet (InputBinaryFile): Use readByte from the runtime system.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/algebra/net.spad.pamphlet2
-rw-r--r--src/boot/includer.boot7
-rw-r--r--src/boot/strap/includer.clisp10
-rw-r--r--src/boot/strap/tokens.clisp2
-rw-r--r--src/boot/strap/translator.clisp4
-rw-r--r--src/boot/tokens.boot2
-rw-r--r--src/boot/translator.boot4
-rw-r--r--src/interp/database.boot2
-rw-r--r--src/interp/sys-utility.boot9
-rw-r--r--src/interp/word.boot2
-rw-r--r--src/lisp/core.lisp.in13
12 files changed, 37 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8435dbcb..54b8231d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
+2011-05-28 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * lisp/core.lisp.in: Define and export readLine and readbyte.
+ * interp/sys-utility.boot (readByteFromFile): Remove.
+ * boot/tokens.boot: Don't rename readLine and readByte.
+ * boot/includer.boot (shoeReadLine): Remove.
+ (bRgen1): Adjust. Use resdLine.
+ * algebra/net.spad.pamphlet (InputBinaryFile): Use readByte from
+ the runtime system.
+
2011-05-25 Gabriel Dos Reis <gdr@cs.tamu.edu>
* boot/ast.boot (shoeCompTran1): Translate arguments to vector
diff --git a/src/algebra/net.spad.pamphlet b/src/algebra/net.spad.pamphlet
index 6e9b3139..29b5e704 100644
--- a/src/algebra/net.spad.pamphlet
+++ b/src/algebra/net.spad.pamphlet
@@ -209,7 +209,7 @@ InputBinaryFile(): Public == Private where
not null? rep(ifile).stream
readByte! ifile ==
isOpen? ifile =>
- b: Maybe Byte := readByteFromFile(rep(ifile).stream)$Lisp
+ b: Maybe Byte := readByte(rep(ifile).stream)$Lisp
if b case nothing then
rep(ifile).eof := true
b
diff --git a/src/boot/includer.boot b/src/boot/includer.boot
index e286d843..a878844d 100644
--- a/src/boot/includer.boot
+++ b/src/boot/includer.boot
@@ -77,10 +77,6 @@ shoeReadLispString(s,n) ==
n >= l => nil
readLispFromString strconc('"(", subString(s,n,l-n) ,'")")
--- read a line from stream
-shoeReadLine stream ==
- readLine(stream, nil, nil)
-
-- write LINE to standard terminal I/O.
shoeConsole line ==
writeLine(line, _*TERMINAL_-IO_*)
@@ -174,7 +170,8 @@ bRgen s ==
bDelay(function bRgen1,[s])
bRgen1 s ==
- a := shoeReadLine s => [a,:bRgen s]
+ a := readLine s
+ a ~= %nothing => [a,:bRgen s]
["nullstream"]
bIgen n ==
diff --git a/src/boot/strap/includer.clisp b/src/boot/strap/includer.clisp
index ad66a280..e74c7ea1 100644
--- a/src/boot/strap/includer.clisp
+++ b/src/boot/strap/includer.clisp
@@ -24,8 +24,6 @@
(T (READ-FROM-STRING
(CONCAT "(" (|subString| |s| |n| (- |l| |n|)) ")"))))))))
-(DEFUN |shoeReadLine| (|stream|) (READ-LINE |stream| NIL NIL))
-
(DEFUN |shoeConsole| (|line|) (WRITE-LINE |line| *TERMINAL-IO*))
(DEFUN |shoeSpaces| (|n|) (|makeString| |n| (|char| '|.|)))
@@ -135,9 +133,11 @@
(DEFUN |bRgen1| (|s|)
(PROG (|a|)
(RETURN
- (COND
- ((SETQ |a| (|shoeReadLine| |s|)) (CONS |a| (|bRgen| |s|)))
- (T (LIST '|nullstream|))))))
+ (PROGN
+ (SETQ |a| (|readLine| |s|))
+ (COND
+ ((NOT (EQUAL |a| |%nothing|)) (CONS |a| (|bRgen| |s|)))
+ (T (LIST '|nullstream|)))))))
(DEFUN |bIgen| (|n|) (|bDelay| #'|bIgen1| (LIST |n|)))
diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp
index 7a5a473e..5465289e 100644
--- a/src/boot/strap/tokens.clisp
+++ b/src/boot/strap/tokens.clisp
@@ -235,9 +235,7 @@
(LIST '|not| 'NOT) (LIST '|null| 'NULL)
(LIST '|odd?| 'ODDP) (LIST '|or| 'OR)
(LIST '|otherwise| 'T) (LIST '|property| 'GET)
- (LIST '|readByte| 'READ-BYTE)
(LIST '|readInteger| 'PARSE-INTEGER)
- (LIST '|readLine| 'READ-LINE)
(LIST '|readLispFromString| 'READ-FROM-STRING)
(LIST '|readOnly?| 'CONSTANTP)
(LIST '|removeDuplicates| 'REMDUP)
diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp
index 63cd603a..b7170014 100644
--- a/src/boot/strap/translator.clisp
+++ b/src/boot/strap/translator.clisp
@@ -1221,7 +1221,7 @@
(PROG (|stream| |b| |a|)
(RETURN
(PROGN
- (SETQ |a| (READ-LINE))
+ (SETQ |a| (|readLine| *STANDARD-INPUT*))
(COND
((EQL (LENGTH |a|) 0)
(WRITE-LINE "Boot Loop; to exit type ] ") (BOOTLOOP))
@@ -1236,7 +1236,7 @@
(PROG (|stream| |b| |a|)
(RETURN
(PROGN
- (SETQ |a| (READ-LINE))
+ (SETQ |a| (|readLine| *STANDARD-INPUT*))
(COND
((EQL (LENGTH |a|) 0)
(WRITE-LINE "Boot Loop; to exit type ] ") (BOOTPO))
diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot
index 6a73af4c..c0b8134e 100644
--- a/src/boot/tokens.boot
+++ b/src/boot/tokens.boot
@@ -292,9 +292,7 @@ for i in [ _
["or", "OR"] , _
["otherwise", "T"] , _
["property", "GET"] , _
- ["readByte", "READ-BYTE"], _
["readInteger", "PARSE-INTEGER"], _
- ["readLine", "READ-LINE"], _
["readLispFromString", "READ-FROM-STRING"] , _
["readOnly?","CONSTANTP"], _
["removeDuplicates", "REMDUP"] , _
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index dd740929..89a4059a 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -679,7 +679,7 @@ PSTTOMC string==
shoePCompileTrees shoeTransformString string
BOOTLOOP() ==
- a := readLine()
+ a := readLine _*STANDARD_-INPUT_*
#a=0=>
writeLine '"Boot Loop; to exit type ] "
BOOTLOOP()
@@ -693,7 +693,7 @@ BOOTLOOP() ==
BOOTLOOP()
BOOTPO() ==
- a := readLine()
+ a := readLine _*STANDARD_-INPUT_*
#a=0=>
writeLine '"Boot Loop; to exit type ] "
BOOTPO()
diff --git a/src/interp/database.boot b/src/interp/database.boot
index c7c068b0..8211fd04 100644
--- a/src/interp/database.boot
+++ b/src/interp/database.boot
@@ -706,7 +706,7 @@ dropPrefix(fn) ==
--++ $globalExposureGroupAlist := nil
--++ egName := nil
--++ egFiles := nil
---++ while (not PLACEP (x:= readLine stream)) repeat
+--++ while (x:= readLine stream) ~= %nothing repeat
--++ x := DROPTRAILINGBLANKS x
--++ # x = 0 => 'iterate -- blank line
--++ (x.0 = char "#") or (x.0 = char "*") => 'iterate -- comment
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index 84dff4b9..2fa38afa 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -45,10 +45,6 @@ module sys_-utility where
--%
$COMBLOCKLIST := nil
-++ No value marker for the Maybe domain.
-%nothing == KEYWORD::%OpenAxiomNoValue
-
-
++ Constants describing byte order
%littleEndian == KEYWORD::%littleEndian
%bigEndian == KEYWORD::%bigEndian
@@ -310,11 +306,6 @@ openBinaryFile(file,mode) ==
KEYWORD::IF_-EXISTS,KEYWORD::SUPERSEDE,
KEYWORD::ELEMENT_-TYPE,"%Byte")
-++ Attemp to read a byte from input file `ifile'. If not end of
-++ file, return the read byte; %nothing.
-readByteFromFile ifile ==
- readByte(ifile,false,%nothing)
-
++ Write byte `b' to output binary file `ofile'.
writeByteToFile(ofile,b) ==
writeByte(b,ofile)
diff --git a/src/interp/word.boot b/src/interp/word.boot
index 40d01114..be576794 100644
--- a/src/interp/word.boot
+++ b/src/interp/word.boot
@@ -97,7 +97,7 @@ getListOfFunctionNames(fnames) ==
for fn in fnames repeat
null IOSTATE(fn,'DIRECT,'_*) => 'iterate
stream:= DEFIOSTREAM(['(MODE . INPUT),['FILE,fn,'DIRECT,'_*]],80,0)
- while (not PLACEP (x:= readLine stream)) repeat
+ while (x:= readLine stream) ~= %nothing repeat
(s := # x) < 26 => 'iterate
res:= [subString(x,26),:res]
SHUT stream
diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in
index f533a4a8..a46e14b4 100644
--- a/src/lisp/core.lisp.in
+++ b/src/lisp/core.lisp.in
@@ -99,6 +99,7 @@
"outputTextFile"
"closeFile"
"prettyPrint"
+ "readLine"
;; compiler data structures
"%Mode"
@@ -141,6 +142,7 @@
"%systemArguments"
"%basicSystemIsComplete"
"%algebraSystemIsComplete"
+ "%nothing"
"$hostPlatform"
"$buildPlatform"
@@ -419,6 +421,10 @@
(defconstant |$EditorProgram| "@oa_editor@")
+;; Token expression to indicate absence of value or bottom value.
+;; This is also the bottom value of the Maybe domain.
+(defconstant |%nothing| :|OpenAxiomNoValue|)
+
;; Base name of the native core runtime library
(defconstant |$CoreLibName|
"open-axiom-core")
@@ -499,6 +505,13 @@
(defun |closeFile| (f)
(close f))
+;; Read a line from the input text file. Quietly return
+;; %nothing at end of file.
+(defmacro |readLine| (f)
+ `(read-line ,f nil |%nothing|))
+
+(defmacro |readByte| (f)
+ `(read-byte ,f nil |%nothing|))
;; Pretty-print a lisp form on a given output stream.
(defun |prettyPrint| (x &optional (s |$OutputStream|))