Libraries
Stritext Source Code
 previous   up   next 

Types
striText
Text implementation type for files stored in an array string.

striText

const type: striText

Text implementation type for files stored in an array string.


Function Summary
file
openStriText (in array string: content)
Open a striText with the given array string content.
void
write (inout striText: outStriText, in string: stri)
Write the string stri to outStriText.
char
getc (inout striText: inStriText)
Read a character from inStriText.
string
gets (inout striText: inStriText, in var integer: maxLength)
Read a string with a maximum length from inStriText.
string
getln (inout striText: inStriText)
Read a line from inStriText.
boolean
eof (in striText: inStriText)
Determine the end-of-file indicator.
boolean
hasNext (in striText: inStriText)
Determine if at least one character can be read successfully.
integer
length (in striText: aStriText)
Obtain the length of a aStriText.
integer
tell (in striText: aStriText)
Obtain the current file position of aStriText.
integer
height (in striText: aStriText)
Get the height of aStriText.
integer
width (in striText: aStriText)
Get the width of aStriText.
integer
line (in striText: aStriText)
Determine the current line of aStriText.
integer
column (in striText: aStriText)
Determine the current column of aStriText.
void
setPos (inout striText: aStriText, in integer: line, in integer: column)
Set the current position of aStriText to line and column.
void
setLine (inout striText: aStriText, in integer: line)
Set the line of the current position of aStriText.
void
setColumn (inout striText: aStriText, in integer: column)
Set the column of the current position of aStriText.

Function Detail

openStriText

const func file: openStriText (in array string: content)

Open a striText with the given array string content.

Returns:
the file opened.

write

const proc: write (inout striText: outStriText, in string: stri)

Write the string stri to outStriText.


getc

const func char: getc (inout striText: inStriText)

Read a character from inStriText.

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

gets

const func string: gets (inout striText: inStriText, in var integer: maxLength)

Read a string with a maximum length from inStriText.

Returns:
the string read.
Raises:
RANGE_ERROR - The parameter maxLength is negative.

getln

const func string: getln (inout striText: inStriText)

Read a line from inStriText. A striText works as if all lines end with '\n'. The line ending character is not copied into the string. When the function is left inStriText.bufferChar contains '\n' or EOF.

Returns:
the line read.

eof

const func boolean: eof (in striText: inStriText)

Determine the end-of-file indicator. The end-of-file indicator is set if at least one request to read from the file failed.

Returns:
TRUE if the end-of-file indicator is set, FALSE otherwise.

hasNext

const func boolean: hasNext (in striText: inStriText)

Determine if at least one character can be read successfully. This function allows a file to be handled like an iterator.

Returns:
FALSE if 'getc' would return EOF, TRUE otherwise.

length

const func integer: length (in striText: aStriText)

Obtain the length of a aStriText. The file length is measured in characters.

Returns:
the length of a file.

tell

const func integer: tell (in striText: aStriText)

Obtain the current file position of aStriText. The file position is measured in characters from the start of the file. The first character in the file has the position 1.

Returns:
the current file position.

height

const func integer: height (in striText: aStriText)

Get the height of aStriText.

Returns:
the height of aStriText.

width

const func integer: width (in striText: aStriText)

Get the width of aStriText.

Returns:
the width of aStriText.

line

const func integer: line (in striText: aStriText)

Determine the current line of aStriText.

Returns:
the current line of aStriText.

column

const func integer: column (in striText: aStriText)

Determine the current column of aStriText.

Returns:
the current column of aStriText.

setPos

const proc: setPos (inout striText: aStriText, in integer: line, in integer: column)

Set the current position of aStriText to line and column.


setLine

const proc: setLine (inout striText: aStriText, in integer: line)

Set the line of the current position of aStriText.


setColumn

const proc: setColumn (inout striText: aStriText, in integer: column)

Set the column of the current position of aStriText.



 previous   up   next