aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2014-11-25 23:43:43 +0000
committerdos-reis <gdr@axiomatics.org>2014-11-25 23:43:43 +0000
commit4cb56790e13ad56cf6926d33d6595023a70ef247 (patch)
tree28902a1a87f45ed1b19415ee58175400ad7d640c /src
parentec6a4e8f924d972e02803e8a963123a0c1cc36d2 (diff)
downloadopen-axiom-4cb56790e13ad56cf6926d33d6595023a70ef247.tar.gz
Replace FILE-POSITION with builtin getFileCursor and setFileCursor.
Diffstat (limited to 'src')
-rw-r--r--src/interp/br-data.boot16
-rw-r--r--src/interp/br-saturn.boot4
-rw-r--r--src/interp/br-search.boot4
-rw-r--r--src/interp/ht-root.boot2
-rw-r--r--src/lisp/core.lisp.in8
5 files changed, 21 insertions, 13 deletions
diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot
index a8930890..1014fbd0 100644
--- a/src/interp/br-data.boot
+++ b/src/interp/br-data.boot
@@ -222,7 +222,7 @@ buildLibAttr(name,argl,pred) ==
dbAugmentConstructorDataTable() ==
instream := MAKE_-INSTREAM '"libdb.text"
while not eof? instream repeat
- fp := FILE_-POSITION instream
+ fp := getFileCursor instream
line := readLine instream
cname := makeSymbol dbName line
entry := getCDTEntry(cname,true) => --skip over Mapping, Union, Record
@@ -245,7 +245,7 @@ dbHasExamplePage conname ==
dbRead(n) ==
instream := MAKE_-INSTREAM strconc(systemRootDirectory(), '"/algebra/libdb.text")
- FILE_-POSITION(instream,n)
+ setFileCursor(instream,n)
line := readLine instream
SHUT instream
line ~= %nothing => line
@@ -254,7 +254,7 @@ dbRead(n) ==
dbReadComments(n) ==
n = 0 => '""
instream := MAKE_-INSTREAM strconc(systemRootDirectory(),'"/algebra/comdb.text")
- FILE_-POSITION(instream,n)
+ setFileCursor(instream,n)
line := readLine instream
k := dbTickIndex(line,1,1)
line := subString(line,k + 1)
@@ -262,7 +262,7 @@ dbReadComments(n) ==
(k := maxIndex x) and (j := dbTickIndex(x,1,1)) and (j < k) and
x.(j := j + 1) = char "-" and x.(j := j + 1) = char "-" repeat
xtralines := [subString(x,j + 1),:xtralines]
- SHUT instream
+ closeFile instream
strconc(line, strconc/reverse! xtralines)
dbSplitLibdb() ==
@@ -273,8 +273,8 @@ dbSplitLibdb() ==
writeChar($tick,comstream)
writeLine('"", comstream)
while (line := readLine instream) ~= %nothing repeat
- outP := FILE_-POSITION outstream
- comP := FILE_-POSITION comstream
+ outP := getFileCursor outstream
+ comP := getFileCursor comstream
[prefix,:comments] := dbSplit(line,6,1)
PRINC(prefix,outstream)
writeChar($tick ,outstream)
@@ -334,8 +334,8 @@ buildGloss() == --called by buildDatabase (database.boot)
pairs := getGlossLines instream
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
+ outP := getFileCursor outstream
+ defP := getFileCursor defstream
lines := spreadGlossText transformAndRecheckComments(name,[line])
PRINC(name, outstream)
writeChar($tick,outstream)
diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot
index 6f55c992..4d0987ce 100644
--- a/src/interp/br-saturn.boot
+++ b/src/interp/br-saturn.boot
@@ -1568,12 +1568,12 @@ mkButtonBox n == strconc('"\buttonbox{", STRINGIMAGE n, '"}")
-- PRINC('"", comstream)
-- finishLine(comstream)
-- while (line := readLine instream) ~= %nothing repeat
--- comP := FILE_-POSITION comstream
+-- comP := getFileCursor comstream
-- if key ~= line.0 then
-- if outstream then SHUT outstream
-- key := line . 0
-- outstream := MAKE_-OUTSTREAM strconc(STRINGIMAGE key,'"libdb.text")
--- outP := FILE_-POSITION outstream
+-- outP := getFileCursor outstream
-- [prefix,:comments] := dbSplit(line,6,1)
-- PRINC(prefix,outstream)
-- PRINC($tick ,outstream)
diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot
index f1b336fe..78b17437 100644
--- a/src/interp/br-search.boot
+++ b/src/interp/br-search.boot
@@ -215,7 +215,7 @@ grepSplit(lines,doc?) ==
if doc? then
N:=readInteger dbPart(line,1,-1)
if integer? N then
- FILE_-POSITION(instream2,N)
+ setFileCursor(instream2,N)
line := readLine instream2
kind := dbKind line
not $includeUnexposed? and not dbExposed?(line,kind) => 'skip
@@ -940,7 +940,7 @@ dbGetCommentOrigin line ==
key := makeSymbol subString(firstPart,0,1) --extract this and throw away
address := subString(firstPart, 1) --address in libdb
instream := inputTextFile grepSource key --this always returns libdb now
- FILE_-POSITION(instream,readInteger address)
+ setFileCursor(instream,readInteger address)
line := readLine instream
closeStream instream
line
diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot
index 231d9096..00b98472 100644
--- a/src/interp/ht-root.boot
+++ b/src/interp/ht-root.boot
@@ -169,7 +169,7 @@ gatherGlossLines(results,defstream) ==
n := charPosition($tick,keyline,0)
keyAndTick := subString(keyline,0,n + 1)
byteAddress := string2Integer subString(keyline,n + 1)
- FILE_-POSITION(defstream,byteAddress)
+ setFileCursor(defstream,byteAddress)
line := readLine defstream
k := charPosition($tick,line,1)
pointer := subString(line,0,k)
diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in
index dece602f..61877e29 100644
--- a/src/lisp/core.lisp.in
+++ b/src/lisp/core.lisp.in
@@ -113,6 +113,8 @@
"closeFile"
"closeStream"
"eof?"
+ "getFileCursor"
+ "setFileCursor"
"forkStreamByName"
"prettyPrint"
"readLine"
@@ -608,6 +610,12 @@
(defmacro |eof?| (s)
`(null (peek-char nil ,s nil nil nil)))
+(defmacro |getFileCursor| (s)
+ `(file-position ,s))
+
+(defmacro |setFileCursor| (s n)
+ `(file-position ,s ,n))
+
;; Make a new stream object, duplicate of the denotation of argument.
(defmacro |forkStreamByName| (s)
`(make-synonym-stream ,s))