aboutsummaryrefslogtreecommitdiff
path: root/src/interp/cstream.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-05-29 00:58:58 +0000
committerdos-reis <gdr@axiomatics.org>2011-05-29 00:58:58 +0000
commit05f1dbf1e8564c316a4e0ed7146b4991162f8875 (patch)
treec909542d73594a47898ed440a7e4f13c256d3f07 /src/interp/cstream.boot
parentf274326c2d4e1912fd99105ce72298684f5ee0ab (diff)
downloadopen-axiom-05f1dbf1e8564c316a4e0ed7146b4991162f8875.tar.gz
* lisp/core.lisp.in (readExpr): New.
* interp/as.boot: Replace READLINE with readLine. * interp/br-data.boot: Likewise. * interp/br-saturn.boot: Likewise. * interp/br-search.boot: Likewise. * interp/c-doc.boot: Likewise. * interp/cstream.boot: Likewise. * interp/g-error.boot: Likewise. * interp/ht-root.boot: Likewise. * interp/htcheck.boot: Likewise. * interp/i-syscmd.boot: Likewise. * interp/msgdb.boot: Likewise. * interp/server.boot: Likewise. * interp/topics.boot: Likewise. * interp/compat.boot (READLINE): Remove. * interp/sys-macros.lisp (shoeConsole): Remove. (shoeInputFile): Likewise. (shoeread-line): Likewise. * boot/ast.boot (bfQ): %nothing only needs EQ. * algebra/files.spad.pamphlet (File) [read!, readIfCan!]: Use readExpr instead of VMREAD. Avoid PLACEP (TextFile) [readLine!, readLineIfCan!]: Likewise.
Diffstat (limited to 'src/interp/cstream.boot')
-rw-r--r--src/interp/cstream.boot111
1 files changed, 57 insertions, 54 deletions
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])