From 05f1dbf1e8564c316a4e0ed7146b4991162f8875 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 29 May 2011 00:58:58 +0000 Subject: * 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. --- src/interp/cstream.boot | 111 +++++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 54 deletions(-) (limited to 'src/interp/cstream.boot') 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]) -- cgit v1.2.3