Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Wildcard Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Null_file Source Code
 previous   up   next 

Types
null_file
Base implementation type for the file interface.

null_file

const type: null_file

Base implementation type for the file interface. A null_file discards all data written to it. Reads from a null_file always yield EOF immediately. A null_file is not seekable. The functions length, seek and tell raise FILE_ERROR. The functions getc, getwd and getln are written such that a derived type can use them. Derived types of null_file need to override the functions write, gets, eof and hasNext. A derived type, which represents a seekable file, needs to override the functions length, seek and tell.


Variable Summary
null_file
STD_NULL
Standard null file.

Function Summary
void
write (in null_file: outFile, in string: stri)
Write a string to a null_file.
void
writeln (inout null_file: outFile)
Write end-of-line to outFile.
void
writeln (inout null_file: outFile, in string: stri)
Write a string followed by end-of-line to outFile.
string
gets (in null_file: inFile, in integer: maxLength)
Read a string with a maximum length from a null_file.
char
getc (inout null_file: inFile)
Read a character from a null_file.
string
getwd (inout null_file: inFile)
Read a word from a null_file.
string
getln (inout null_file: inFile)
Read a line from a null_file.
boolean
eof (in null_file: inFile)
Determine the end-of-file indicator.
boolean
hasNext (in null_file: inFile)
Determine if at least one character can be read successfully.
integer
length (in null_file: aFile)
Obtain the length of a file.
void
seek (in null_file: aFile, in integer: position)
Set the current file position.
integer
tell (in null_file: aFile)
Obtain the current file position.
void
close (in null_file: aFile)
Close a null_file.
void
flush (in null_file: aFile)
Forces that all buffered data is sent to its destination.

Variable Detail

STD_NULL

var null_file: STD_NULL

Standard null file. The file STD_NULL is used to initialize file variables and as result of open, when a file cannot be opened.


Function Detail

write

const proc: write (in null_file: outFile, in string: stri)

Write a string to a null_file. The parameter stri is just ignored. Derived types of null_file need to override this function.


writeln

const proc: writeln (inout null_file: outFile)

Write end-of-line to outFile. This function writes the end-of-line marker '\n'. Derived types can use this function. When a derived type does not use '\n' as end-of-line marker it needs to override this function.


writeln

const proc: writeln (inout null_file: outFile, in string: stri)

Write a string followed by end-of-line to outFile. This function is based on write and writeln. Derived types can use this function. This function must be overridden, when it is necessary to write stri and '\n' together.


gets

const string: gets (in null_file: inFile, in integer: maxLength)

Read a string with a maximum length from a null_file. Derived types of null_file need to override this function.

Returns:
the empty string ("").

getc

const func char: getc (inout null_file: inFile)

Read a character from a null_file. This function is based on the gets function. Therefore it is useable for derived types of null_file. For the null_file itself it always returns EOF.

Returns:
the character read, or EOF at the end of the file.

getwd

const func string: getwd (inout null_file: inFile)

Read a word from a null_file. Before reading the word it skips spaces and tabs. The function accepts words ending with ' ', '\t', '\n' or EOF. The word ending characters are not copied into the string. When the function is left inFile.bufferChar contains ' ', '\t', '\n' or EOF. This function is based on the gets function. Therefore it is useable for derived types of null_file. For the null_file itself it always returns "" and assigns EOF to inFile.bufferChar.

Returns:
the word read.

getln

const func string: getln (inout null_file: inFile)

Read a line from a null_file. The function accepts lines ending with '\n' or EOF. The line ending characters are not copied into the string. When the function is left inFile.bufferChar contains '\n' or EOF. This function is based on the gets function. Therefore it is useable for derived types of null_file. For the null_file itself it always returns "" and assigns EOF to inFile.bufferChar.

Returns:
the line read.

eof

const boolean: eof (in null_file: inFile)

Determine the end-of-file indicator. Derived types of null_file need to override this function.

Returns:
TRUE, since a null_file is always at end-of-file.

hasNext

const boolean: hasNext (in null_file: inFile)

Determine if at least one character can be read successfully. Derived types of null_file need to override this function.

Returns:
FALSE, since the next getc will always return EOF.

length

const func integer: length (in null_file: aFile)

Obtain the length of a file. A null_file is not seekable, therefore FILE_ERROR is raised. Derived types of null_file need to override this function.

Returns:
nothing, because FILE_ERROR is always raised.
Raises:
FILE_ERROR - Is always raised, because a null_file is not seekable.

seek

const proc: seek (in null_file: aFile, in integer: position)

Set the current file position. A null_file is not seekable, therefore FILE_ERROR is raised. When a derived type is seekable it needs to override this function.

Raises:
FILE_ERROR - Is always raised, because a null_file is not seekable.

tell

const func integer: tell (in null_file: aFile)

Obtain the current file position. A null_file is not seekable, therefore FILE_ERROR is raised. When a derived type is seekable it needs to override this function.

Returns:
nothing, because FILE_ERROR is always raised.
Raises:
FILE_ERROR - Is always raised, because a null_file is not seekable.

close

const proc: close (in null_file: aFile)

Close a null_file. Closing a null_file has no effect.


flush

const proc: flush (in null_file: aFile)

Forces that all buffered data is sent to its destination. Flushing a null_file has no effect.



 previous   up   next