aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/net.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-12-27 02:20:07 +0000
committerdos-reis <gdr@axiomatics.org>2008-12-27 02:20:07 +0000
commitfdc64c2abcdf53d9afee4541503d1d17763ee92c (patch)
treef15a829314e96145be04e1eeeee3a16049faa572 /src/algebra/net.spad.pamphlet
parentfb209a840dc764bdfa285ad3cb7575df21a43289 (diff)
downloadopen-axiom-fdc64c2abcdf53d9afee4541503d1d17763ee92c.tar.gz
* algebra/net.spad.pamphlet (readBytes!$InputByteConduit): Set
length of buffer to count of bytes read. * algebra/si.spad.pamphlet (SingleInteger): Now formally subdomain of Integer.
Diffstat (limited to 'src/algebra/net.spad.pamphlet')
-rw-r--r--src/algebra/net.spad.pamphlet9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/algebra/net.spad.pamphlet b/src/algebra/net.spad.pamphlet
index efde9e0d..d2b7cb03 100644
--- a/src/algebra/net.spad.pamphlet
+++ b/src/algebra/net.spad.pamphlet
@@ -33,7 +33,7 @@ Conduit(): Category == with
)abbrev category INBCON InputByteConduit
++ Author: Gabriel Dos Reis
++ Date Created: August 24, 2008
-++ Date Last Modified: August 24, 2008
+++ Date Last Modified: December 26, 2008
++ Description:
++ This category describes input byte stream conduits.
InputByteConduit(): Category == Conduit with
@@ -47,15 +47,15 @@ InputByteConduit(): Category == Conduit with
readBytes!: (%,ByteBuffer) -> SingleInteger
++ readBytes!(c,b) reads byte sequences from conduit `c' into
++ the byte buffer `b'. The actual number of bytes written
- ++ is returned.
+ ++ is returned, and the length of `b' is set to that amount.
add
readBytes!(cond,buf) ==
- count: SingleInteger := 0
+ count: NonNegativeInteger := 0
b : SingleInteger
while count < capacity buf and ((b := readByteIfCan! cond) >= 0) repeat
qsetelt!(buf,count,b : Byte)
count := count + 1
- count
+ setLength!(buf,count)::SingleInteger
@
@@ -136,6 +136,7 @@ InputBinaryFile(): Public == Private where
++ position(f,p) sets the current byte-position to `i'.
Private == add
Rep == Record(stream: SExpression, filename: FileName, eof: Boolean)
+
inputBinaryFile(f: FileName) ==
per [openBinaryFile(f::String,input$IOMode)$Lisp,f,false]
inputBinaryFile(f: String) ==