tis - Text input stream
Module Description
The tis module implements a text input stream. It extends the str module,
so all words from the str module, can be used on the tis data structure.
There are seven basic methods: fetch = fetch the data, the stream pointer
is not updated; next = after a fetch, the stream pointer is updated; seek
= move the stream pointer; match = try to match data, if there is a match,
the stream pointer is updated, read = read data, if data is returned then
the stream pointer is updated; scan = scan for data, if the data is found
then the leading text is returned and the stream pointer is moved after
the scanned data; skip = move the stream pointer after the skipped data.
Module Words
Input stream structure
tis% ( - n )
Get the required space for the tis data structure
Input stream creation, initialisation and destruction
tis-init ( w:tis - )
Initialise the empty input stream
tis-create ( C: "name" - R: - w:tis )
Create a named input stream in the dictionary
tis-new ( - w:tis )
Create a new input stream on the heap
tis-free ( w:tis - )
Free the input stream from the heap
Stream words
tis-reset ( w:tis - )
Reset the input stream
tis-eof? ( w:tis - f )
Check if the end of the stream is reached
Fetch and next words
tis-fetch-char ( w:tis - false | c true )
Fetch the next character from the stream
tis-next-char ( w:tis - )
Move the stream pointer one character after fetch-char
tis-fetch-chars ( n w:tis - 0 | addr u )
Fetch maximum of n next characters from the stream
tis-next-chars ( n w:tis - )
Move the stream pointer n characters after fetch-chars
Set and get words
tis-set ( c-addr u w:tis - )
Set the string in the stream, reset the stream pointer
tis-get ( w:tis - 0 | addr u )
Get the remaining characters from the stream, stream pointer is not changed
Seek and tell words: position in the stream
tis-pntr@ ( w:tis - u )
Get the stream pointer
tis-pntr! ( n w:tis - f )
Set the stream pointer from start {>=0} or from end {<0}
tis-pntr+! ( n w:tis - f )
Add an offset to the stream pointer
Match words: check for starting data
tis-imatch-char ( c w:tis - f )
Match case-insensitive a character
tis-cmatch-char ( c w:tis - f )
Match case-sensitive a character
tis-cmatch-chars ( c-addr n w:tis - false | c true )
Match one of the characters case-sensitive
tis-cmatch-string ( c-addr n w:tis - f )
Match case-sensitive a string
tis-imatch-string ( c-addr n w:tis - f )
Match case-insensitive a string
Read data words
tis-read-char ( w:tis - false | c true )
Read character from the stream
tis-read-string ( n w:tis - 0 | c-addr n )
Read u characters from the stream
tis-read-line ( w:tis - 0 | c-addr n )
Read characters till cr and/or lf
tis-read-number ( w:tis - false | n true )
Read a cell number in the current base
tis-read-double ( w:tis - false | d true )
Read a double value in the current base
Scan words: look for data in the stream
tis-scan-char ( c w:tis - false | c-addr u true )
Read characters till c
tis-scan-chars ( c-addr n w:tis - false | c-addr u c true )
Read characters till one of characters
tis-scan-string ( c-addr n w:tis - false | c-addr u true )
Read characters till a string
tis-skip-spaces ( w:tis - n )
Skip whitespace in the stream
Inspection
tis-dump ( w:tis - )
Dump the text input stream
generated 09-Jan-2007 by ofcfrth-0.2.0