diff options
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/Makefile.in | 2 | ||||
-rw-r--r-- | src/interp/as.boot | 2 | ||||
-rw-r--r-- | src/interp/br-data.boot | 17 | ||||
-rw-r--r-- | src/interp/br-saturn.boot | 3 | ||||
-rw-r--r-- | src/interp/br-search.boot | 6 | ||||
-rw-r--r-- | src/interp/c-doc.boot | 7 | ||||
-rw-r--r-- | src/interp/compat.boot | 5 | ||||
-rw-r--r-- | src/interp/cstream.boot | 111 | ||||
-rw-r--r-- | src/interp/g-error.boot | 4 | ||||
-rw-r--r-- | src/interp/ht-root.boot | 5 | ||||
-rw-r--r-- | src/interp/htcheck.boot | 3 | ||||
-rw-r--r-- | src/interp/i-syscmd.boot | 4 | ||||
-rw-r--r-- | src/interp/int-top.boot | 9 | ||||
-rw-r--r-- | src/interp/intfile.boot | 64 | ||||
-rw-r--r-- | src/interp/msgdb.boot | 5 | ||||
-rw-r--r-- | src/interp/server.boot | 8 | ||||
-rw-r--r-- | src/interp/sys-macros.lisp | 9 | ||||
-rw-r--r-- | src/interp/topics.boot | 8 |
18 files changed, 99 insertions, 173 deletions
diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in index 83999b59..aca72a48 100644 --- a/src/interp/Makefile.in +++ b/src/interp/Makefile.in @@ -91,7 +91,7 @@ OBJS= boot-pkg.$(FASLEXT) types.$(FASLEXT) \ i-output.$(FASLEXT) i-special.$(FASLEXT) \ i-syscmd.$(FASLEXT) i-toplev.$(FASLEXT) \ i-util.$(FASLEXT) incl.$(FASLEXT) \ - int-top.$(FASLEXT) intfile.$(FASLEXT) \ + int-top.$(FASLEXT) \ lisplib.$(FASLEXT) macex.$(FASLEXT) \ match.$(FASLEXT) monitor.$(FASLEXT) \ msg.$(FASLEXT) msgdb.$(FASLEXT) \ diff --git a/src/interp/as.boot b/src/interp/as.boot index 876e4d46..42939edb 100644 --- a/src/interp/as.boot +++ b/src/interp/as.boot @@ -45,7 +45,7 @@ asList() == removeFile '"temp.text" OBEY '"ls as/*.asy > temp.text" instream := inputTextFile '"temp.text" - lines := [READLINE instream while not EOFP instream] + lines := [line := readLine instream while line ~= %nothing] closeFile instream lines diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot index 96ff9ff7..aeb183ce 100644 --- a/src/interp/br-data.boot +++ b/src/interp/br-data.boot @@ -226,7 +226,7 @@ dbAugmentConstructorDataTable() == instream := MAKE_-INSTREAM '"libdb.text" while not EOFP instream repeat fp := FILE_-POSITION instream - line := READLINE instream + line := readLine instream cname := makeSymbol dbName line entry := getCDTEntry(cname,true) => --skip over Mapping, Union, Record [name,abb,:.] := entry @@ -249,18 +249,19 @@ dbHasExamplePage conname == dbRead(n) == instream := MAKE_-INSTREAM strconc(systemRootDirectory(), '"/algebra/libdb.text") FILE_-POSITION(instream,n) - line := READLINE instream + line := readLine instream SHUT instream - line + line ~= %nothing => line + nil dbReadComments(n) == n = 0 => '"" instream := MAKE_-INSTREAM strconc(systemRootDirectory(),'"/algebra/comdb.text") FILE_-POSITION(instream,n) - line := READLINE instream + line := readLine instream k := dbTickIndex(line,1,1) line := subString(line,k + 1) - while not EOFP instream and (x := READLINE instream) and + while (x := readLine instream) ~= %nothing and (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] @@ -275,8 +276,7 @@ dbSplitLibdb() == PRINTEXP($tick,comstream) PRINTEXP('"", comstream) TERPRI(comstream) - while not EOFP instream repeat - line := READLINE instream + while (line := readLine instream) ~= %nothing repeat outP := FILE_-POSITION outstream comP := FILE_-POSITION comstream [prefix,:comments] := dbSplit(line,6,1) @@ -390,8 +390,7 @@ getGlossLines instream == keys := nil text := nil lastLineHadTick := false - while not EOFP instream repeat - line := READLINE instream + while (line := readLine instream) ~= %nothing repeat #line = 0 => 'skip n := charPosition($tick,line,0) last := IFCAR text diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot index ab099d02..2b0d4755 100644 --- a/src/interp/br-saturn.boot +++ b/src/interp/br-saturn.boot @@ -1581,8 +1581,7 @@ mkButtonBox n == strconc('"\buttonbox{", STRINGIMAGE n, '"}") -- PRINTEXP($tick,comstream) -- PRINTEXP('"", comstream) -- TERPRI(comstream) --- while not EOFP instream repeat --- line := READLINE instream +-- while (line := readLine instream) ~= %nothing repeat -- comP := FILE_-POSITION comstream -- if key ~= line.0 then -- if outstream then SHUT outstream diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot index e4d2ba6b..45c22ee4 100644 --- a/src/interp/br-search.boot +++ b/src/interp/br-search.boot @@ -215,7 +215,7 @@ grepSplit(lines,doc?) == N:=readInteger dbPart(line,1,-1) if integer? N then FILE_-POSITION(instream2,N) - line := READLINE instream2 + line := readLine instream2 kind := dbKind line not $includeUnexposed? and not dbExposed?(line,kind) => 'skip (kind = char "a" or kind = char "o") and isDefaultOpAtt line => 'skip @@ -929,7 +929,7 @@ dbWriteLines(s, :options) == dbReadLines target == --AIX only--called by grepFile instream := inputTextFile target - lines := [READLINE instream while not EOFP instream] + lines := [line := readLine instream while line ~= %nothing] closeFile instream lines @@ -942,7 +942,7 @@ dbGetCommentOrigin line == address := subString(firstPart, 1) --address in libdb instream := inputTextFile grepSource key --this always returns libdb now FILE_-POSITION(instream,readInteger address) - line := READLINE instream + line := readLine instream closeFile instream line diff --git a/src/interp/c-doc.boot b/src/interp/c-doc.boot index 60fdb741..19ab4bd4 100644 --- a/src/interp/c-doc.boot +++ b/src/interp/c-doc.boot @@ -1247,11 +1247,10 @@ whoOwns(con) == quoteChar := char "_"" runCommand strconc('"awk '$2 == ",quoteChar,filename,quoteChar,'" {print $1}' whofiles > /tmp/temp") instream := MAKE_-INSTREAM '"/tmp/temp" - value := - EOFP instream => nil - READLINE instream + value := readLine instream SHUT instream - value + value ~= %nothing => value + nil --======================================================================= -- Report Documentation Error diff --git a/src/interp/compat.boot b/src/interp/compat.boot index 964d2dab..db897ff2 100644 --- a/src/interp/compat.boot +++ b/src/interp/compat.boot @@ -66,8 +66,3 @@ update() == makeBigFloat(mantissa,expon) == [$BFtag,mantissa,:expon] - -READLINE(:s) == - s => read_-line(first s) - read_-line($InputStream) - diff --git a/src/interp/cstream.boot b/src/interp/cstream.boot index ead84d1b..5e158877 100644 --- a/src/interp/cstream.boot +++ b/src/interp/cstream.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 @@ -37,78 +37,81 @@ namespace BOOT --% Stream Utilities -npNull x== StreamNull x +npNull x == + StreamNull x -StreamNull x== +StreamNull x == null x or x is ["nullstream",:.] => true - while x is ["nonnullstream",:.] repeat - st:=apply(second x,CDDR x) - x.first := first st - x.rest := rest st + while x is ["nonnullstream",f,:args] repeat + st := apply(f,args) + x.first := first st + x.rest := rest st x is ["nullstream",:.] Delay(f,x) == ["nonnullstream",:[f,:x]] -StreamNil:= ["nullstream"] +StreamNil == ["nullstream"] -incRgen s==Delay(function incRgen1,[s]) +incRgen s == + Delay(function incRgen1,[s]) -incRgen1(:z)== - [s]:=z - a:=shoeread_-line s - if null a - then (closeFile s;StreamNil) - - else [a,:incRgen s] +incRgen1 s== + a := readLine s + a = %nothing => (closeFile s;StreamNil) + [a,:incRgen s] -incIgen n==Delay(function incIgen1,[n]) -incIgen1(:z)== - [n]:=z - n:=n+1 - [n,:incIgen n] +incIgen n == + Delay(function incIgen1,[n]) + +incIgen1 n== + n:=n+1 + [n,:incIgen n] -incZip(g,f1,f2)==Delay(function incZip1,[g,f1,f2]) -incZip1(:z)== - [g,f1,f2]:=z - StreamNull f1 => StreamNil - StreamNull f2 => StreamNil - [FUNCALL(g,first f1,first f2),:incZip(g,rest f1,rest f2)] +incZip(g,f1,f2)== + Delay(function incZip1,[g,f1,f2]) + +incZip1(g,f1,f2) == + StreamNull f1 => StreamNil + StreamNull f2 => StreamNil + [FUNCALL(g,first f1,first f2),:incZip(g,rest f1,rest f2)] -incAppend(x,y)==Delay(function incAppend1,[x,y]) +incAppend(x,y) == + Delay(function incAppend1,[x,y]) -incAppend1(:z)== - [x,y]:=z - if StreamNull x - then if StreamNull y - then StreamNil - else y - else [first x,:incAppend(rest x,y)] +incAppend1(x,y)== + if StreamNull x + then if StreamNull y + then StreamNil + else y + else [first x,:incAppend(rest x,y)] -next(f,s)==Delay(function next1,[f,s]) -next1(:z)== - [f,s]:=z - StreamNull s=> StreamNil - h:= apply(f, [s]) - incAppend(first h,next(f,rest h)) +next(f,s) == + Delay(function next1,[f,s]) + +next1(f,s) == + StreamNull s=> StreamNil + h := apply(f, [s]) + incAppend(first h,next(f,rest h)) -nextown(f,g,s)==Delay(function nextown1,[f,g,s]) -nextown1 (:z)== - [f,g,s]:=z - StreamNull s=> - spadcall1 g - StreamNil - StreamNull s - h:=spadcall2 (f, s) - incAppend(first h,nextown(f,g,rest h)) +nextown(f,g,s) == + Delay(function nextown1,[f,g,s]) + +nextown1(f,g,s) == + StreamNull s=> + spadcall1 g + StreamNil + StreamNull s + h := spadcall2 (f, s) + incAppend(first h,nextown(f,g,rest h)) nextown2(f,g,e,x) == nextown([f,:e],[g,:e],x) spadcall1(g)== - [impl, :env] := g - apply(impl, [env]) + [impl, :env] := g + apply(impl, [env]) spadcall2(f,args) == - [impl, :env] := f - apply(impl, [args, env]) + [impl, :env] := f + apply(impl, [args, env]) diff --git a/src/interp/g-error.boot b/src/interp/g-error.boot index 06275781..718752fd 100644 --- a/src/interp/g-error.boot +++ b/src/interp/g-error.boot @@ -71,7 +71,9 @@ argumentDataError(argnum, condit, funname) == queryUser msg == -- display message and return reply sayBrightly msg - read_-line $InputStream + line := readLine $InputStream + line ~= %nothing => line + nil -- errorSupervisor is the old style error message trapper diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot index 290cf622..1976952c 100644 --- a/src/interp/ht-root.boot +++ b/src/interp/ht-root.boot @@ -166,17 +166,16 @@ htGlossPage(htPage,pattern,tryAgain?) == gatherGlossLines(results,defstream) == acc := nil for keyline in results repeat - --keyline := READLINE instream n := charPosition($tick,keyline,0) keyAndTick := subString(keyline,0,n + 1) byteAddress := string2Integer subString(keyline,n + 1) FILE_-POSITION(defstream,byteAddress) - line := READLINE defstream + line := readLine defstream k := charPosition($tick,line,1) pointer := subString(line,0,k) def := subString(line,k + 1) xtralines := nil - while not EOFP defstream and (x := READLINE defstream) and + while (x := readLine defstream) ~= %nothing and (j := charPosition($tick,x,1)) and (nextPointer := subString(x,0,j)) and (nextPointer = pointer) repeat xtralines := [subString(x,j + 1),:xtralines] diff --git a/src/interp/htcheck.boot b/src/interp/htcheck.boot index 36fc0b40..046ae387 100644 --- a/src/interp/htcheck.boot +++ b/src/interp/htcheck.boot @@ -88,8 +88,7 @@ buildHtMacroTable() == fn := strconc(systemRootDirectory(), '"/share/hypertex/pages/util.ht") if PROBE_-FILE(fn) then instream := MAKE_-INSTREAM fn - while not EOFP instream repeat - line := READLINE instream + while (line := readLine instream) ~= %nothing repeat getHtMacroItem line is [string,:numOfArgs] => tableValue($htMacroTable,string) := numOfArgs for [s,:n] in $primitiveHtCommands repeat tableValue($htMacroTable,s) := n diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index b206f23c..a9ed2364 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -1293,8 +1293,8 @@ newHelpSpad2Cmd args == filestream := MAKE_-INSTREAM(helpFile) repeat - line := read_-line(filestream,false) - null line => + line := readLine filestream + line = %nothing => SHUT filestream return true SAY line diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot index 053b0115..cc7edb7b 100644 --- a/src/interp/int-top.boot +++ b/src/interp/int-top.boot @@ -106,13 +106,14 @@ intloop () == resetStackLimits() mode := CATCH($intTopLevel, SpadInterpretStream(1, nil, true)) -++ If the interpreter is spwan by the session manager, then +++ If the interpreter is spawn by the session manager, then ++ each successful connection also creates its own frame. ++ In particular, the only time we get to do anything in the `initial' -++ frame is when we get the first connection. In that case, we would +++ frame is when we get the first connection. In that situation, we would ++ be asked by the session manager to create a frame. The client is -++ not aware of that, It is therefore confusing to display a prompt, -++ because all this horse-threading happens behind the client's back. +++ not aware of that discrete request made by the session manager. +++ It is utterly confusing to display a prompt, because all this +++ horse-threading happens behind the client's back. printFirstPrompt?() == $interpreterFrameName ~= "initial" or getOptionValue '"role" ~= '"server" diff --git a/src/interp/intfile.boot b/src/interp/intfile.boot deleted file mode 100644 index 34818377..00000000 --- a/src/interp/intfile.boot +++ /dev/null @@ -1,64 +0,0 @@ --- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. --- All rights reserved. --- Copyright (C) 2007-2011, Gabriel Dos Reis. --- All rights reserved. --- --- Redistribution and use in source and binary forms, with or without --- modification, are permitted provided that the following conditions are --- met: --- --- - Redistributions of source code must retain the above copyright --- notice, this list of conditions and the following disclaimer. --- --- - Redistributions in binary form must reproduce the above copyright --- notice, this list of conditions and the following disclaimer in --- the documentation and/or other materials provided with the --- distribution. --- --- - Neither the name of The Numerical Algorithms Group Ltd. nor the --- names of its contributors may be used to endorse or promote products --- derived from this software without specific prior written permission. --- --- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS --- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED --- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER --- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, --- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, --- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import cstream -namespace BOOT - -shoeInternFile(fn)== - a:=shoeInputFile fn - if null a - then writeLine (strconc(fn,'" not found"),$ErrorStream) - else shoeIntern incRgen a - -shoeIntern (s)== - StreamNull s => nil - f:=first s - # f < 8 => shoeIntern rest s - stringChar(f,0) = char " " =>shoeIntern rest s - a:=makeSymbol subString(f,0,8) - [b,c]:= shoeStrings rest s - GET(a,"MSGS") := b - shoeIntern c - -shoeStrings (stream)== - StreamNull stream => ['"",stream] - a:=first stream - if stringChar(a,0) ~= char " " - then ['"",stream] - else - [h,t]:=shoeStrings(rest stream) - [strconc(a,h),t] - ---fetchKeyedMsg(key,b)== GET(key,"MSGS") ---shoeInternFile '"/usr/local/scratchpad/cur/doc/msgs/co-eng.msgs" diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index 9f11e30e..c52bbf60 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -431,9 +431,10 @@ queryUserKeyedMsg(key,args) == -- display message and return reply conStream := DEFIOSTREAM ('((DEVICE . CONSOLE) (MODE . INPUT)),120,0) sayKeyedMsg(key,args) - ans := read_-line conStream + ans := readLine conStream SHUT conStream - ans + ans ~= %nothing => ans + nil flowSegmentedMsg(msg, len, offset) == -- tries to break a sayBrightly-type input msg into multiple diff --git a/src/interp/server.boot b/src/interp/server.boot index 3e46b28a..6455f880 100644 --- a/src/interp/server.boot +++ b/src/interp/server.boot @@ -50,7 +50,9 @@ serverReadLine(stream) == -- used in place of READ-LINE in a scratchpad server system. FORCE_-OUTPUT() not $SpadServer or not IS_-CONSOLE stream => - read_-line(stream) + line := readLine stream + line ~= %nothing => line + nil IN_-STREAM: local := stream _*EOF_*: local := nil line := @@ -60,7 +62,7 @@ serverReadLine(stream) == $NeedToSignalSessionManager := false action := serverSwitch() action = $CallInterp => - l := read_-line(stream) + l := readLine stream $NeedToSignalSessionManager := true return l action = $CreateFrame => @@ -96,7 +98,7 @@ serverReadLine(stream) == action = $KillLispSystem => coreQuit() nil - line => line + line ~= %nothing and line ~= nil => line "" parseAndInterpret str == diff --git a/src/interp/sys-macros.lisp b/src/interp/sys-macros.lisp index 7baf2a65..4b2d65d7 100644 --- a/src/interp/sys-macros.lisp +++ b/src/interp/sys-macros.lisp @@ -1114,15 +1114,6 @@ ;; -*- Input/Output -*- ;; -(defmacro |shoeConsole| (line) - `(write-line ,line |$OutputStream|)) - -(defmacro |shoeInputFile| (filespec) - `(open ,filespec :direction :input :if-does-not-exist nil)) - -(defmacro |shoeread-line| (st) - `(read-line ,st nil nil)) - (defmacro |report| (L) (SUBST (SECOND L) 'x '(COND ($reportFlag (sayBrightly x)) ((QUOTE T) NIL)))) diff --git a/src/interp/topics.boot b/src/interp/topics.boot index c3910973..ef7313aa 100644 --- a/src/interp/topics.boot +++ b/src/interp/topics.boot @@ -92,8 +92,8 @@ mkTopicHashTable() == --given $groupAssoc = ((extended . $conTopicHash := hashTable 'EQL --key is constructor name; value is instream := inputTextFile '"topics.data" while not EOFP instream repeat - line := READLINE instream - while blankLine? line repeat line := READLINE instream + line := readLine instream + while blankLine? line repeat line := readLine instream m := maxIndex line --file "topics.data" has form: m = -1 => 'skip --1 ConstructorName: stringChar(line,0) = char "-" => 'skip --2 constructorName or operation name @@ -101,8 +101,8 @@ mkTopicHashTable() == --given $groupAssoc = ((extended . m := maxIndex line -- (blank line) ... stringChar(line,m) ~= char ":" => systemError('"wrong heading") con := makeSymbol subString(line,0,m) - alist := [lst while not EOFP instream and - not (blankLine? (line := READLINE instream)) and + alist := [lst while (line := readLine instream) ~= %nothing and + not blankLine? line and stringChar(line,0) ~= char "-" for i in 1.. | lst := string2OpAlist line] alist => tableValue($conTopicHash,con) := alist |