diff options
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/algebra/exposed.lsp.pamphlet | 1 | ||||
-rw-r--r-- | src/algebra/files.spad.pamphlet | 106 |
3 files changed, 5 insertions, 107 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 434c3c3f..54405e7a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2008-10-22 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/exposed.lsp.pamphlet: Unexpose BinaryFile. + * algebra/files.spad.pamphlet (BinaryFile): Remove. + +2008-10-22 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/net.spad.pamphlet (InputOutputBinaryFile): New. (position$InputBinaryFile): New. (position!$InputBinaryFile): Likewise. diff --git a/src/algebra/exposed.lsp.pamphlet b/src/algebra/exposed.lsp.pamphlet index 9d54ae9c..615657c9 100644 --- a/src/algebra/exposed.lsp.pamphlet +++ b/src/algebra/exposed.lsp.pamphlet @@ -69,7 +69,6 @@ (|BasicOperator| . BOP) (|BasicOperatorFunctions1| . BOP1) (|BinaryExpansion| . BINARY) - (|BinaryFile| . BINFILE) (|BinarySearchTree| . BSTREE) (|BinaryTournament| . BTOURN) (|BinaryTree| . BTREE) diff --git a/src/algebra/files.spad.pamphlet b/src/algebra/files.spad.pamphlet index 630b19af..43336496 100644 --- a/src/algebra/files.spad.pamphlet +++ b/src/algebra/files.spad.pamphlet @@ -274,112 +274,7 @@ TextFile: Cat == Def where false @ -\section{domain BINFILE BinaryFile} -<<domain BINFILE BinaryFile>>= -)abbrev domain BINFILE BinaryFile -++ Author: Barry M. Trager -++ Date Created: 1993 -++ Date Last Updated: -++ Basic Operations: writeByte! readByte! readByteIfCan! -++ Related Constructors: -++ Also See: -++ AMS Classifications: -++ Keywords: -++ References: -++ Description: -++ This domain provides an implementation of binary files. Data is -++ accessed one byte at a time as a small integer. - -BinaryFile: Cat == Def where - - Cat == FileCategory(FileName, SingleInteger) with - readIfCan_!: % -> Union(SingleInteger, "failed") - ++ readIfCan!(f) returns a value from the file f, if possible. - ++ If f is not open for reading, or if f is at the end of file - ++ then \spad{"failed"} is the result. - --- "#": % -> SingleInteger --- ++ #(f) returns the length of the file f in bytes. - - position: % -> SingleInteger - ++ position(f) returns the current byte-position in the file f. - - position_!: (%, SingleInteger) -> SingleInteger - ++ position!(f, i) sets the current byte-position to i. - - Def == File(SingleInteger) add - FileState ==> SExpression - - Rep := Record(fileName: FileName, _ - fileState: FileState, _ - fileIOmode: String) - --- direc : Symbol := INTERN("DIRECTION","KEYWORD")$Lisp --- input : Symbol := INTERN("INPUT","KEYWORD")$Lisp --- output : Symbol := INTERN("OUTPUT","KEYWORD")$Lisp --- eltype : Symbol := INTERN("ELEMENT-TYPE","KEYWORD")$Lisp --- bytesize : SExpression := LIST(QUOTE(UNSIGNED$Lisp)$Lisp,8)$Lisp - - - defstream(fn: FileName, mode: String): FileState == - mode = "input" => - not readable? fn => error ["File is not readable", fn] - BINARY__OPEN__INPUT(fn::String)$Lisp --- OPEN(fn::String, direc, input, eltype, bytesize)$Lisp - mode = "output" => - not writable? fn => error ["File is not writable", fn] - BINARY__OPEN__OUTPUT(fn::String)$Lisp --- OPEN(fn::String, direc, output, eltype, bytesize)$Lisp - error ["IO mode must be input or output", mode] - - open(fname, mode) == - fstream := defstream(fname, mode) - [fname, fstream, mode] - - reopen_!(f, mode) == - fname := f.fileName - f.fileState := defstream(fname, mode) - f.fileIOmode:= mode - f - - close_! f == - f.fileIOmode = "output" => - BINARY__CLOSE__OUTPUT()$Lisp - f - f.fileIOmode = "input" => - BINARY__CLOSE__INPUT()$Lisp - f - error "file must be in read or write state" - - read! f == - f.fileIOmode ~= "input" => error "File not in read state" - BINARY__SELECT__INPUT(f.fileState)$Lisp - BINARY__READBYTE()$Lisp --- READ_-BYTE(f.fileState)$Lisp - readIfCan_! f == - f.fileIOmode ~= "input" => error "File not in read state" - BINARY__SELECT__INPUT(f.fileState)$Lisp - n:SingleInteger:=BINARY__READBYTE()$Lisp - n = -1 => "failed" - n::Union(SingleInteger,"failed") --- READ_-BYTE(f.fileState,NIL$Lisp, --- "failed"::Union(SingleInteger,"failed"))$Lisp - write_!(f, x) == - f.fileIOmode ~= "output" => error "File not in write state" - x < 0 or x>255 => error "integer cannot be represented as a byte" - BINARY__PRINBYTE(x)$Lisp --- WRITE_-BYTE(x, f.fileState)$Lisp - x - --- # f == FILE_-LENGTH(f.fileState)$Lisp - position f == - f.fileIOmode ~= "input" => error "file must be in read state" - FILE_-POSITION(f.fileState)$Lisp - position_!(f,i) == - f.fileIOmode ~= "input" => error "file must be in read state" - (FILE_-POSITION(f.fileState,i)$Lisp ; i) -@ \section{domain KAFILE KeyedAccessFile} <<domain KAFILE KeyedAccessFile>>= )abbrev domain KAFILE KeyedAccessFile @@ -589,7 +484,6 @@ Library(): TableAggregate(String, Any) with <<category FILECAT FileCategory>> <<domain FILE File>> <<domain TEXTFILE TextFile>> -<<domain BINFILE BinaryFile>> <<domain KAFILE KeyedAccessFile>> <<domain LIB Library>> @ |