Libraries
Enable_io Source Code
 previous   up   next 

Operator Summary
string
(in aType: aValue) lpad (in integer: leng)
Convert aValue to string and pad it with spaces at the left side.
string
(in aType: aValue) rpad (in integer: leng)
Convert aValue to string and pad it with spaces at the right side.
string
(in string: stri) <& (in aType: aValue)
Convert aValue to string and append it to stri.
string
(in aType: aValue) <& (in string: stri)
Convert aValue to string and append stri to it.

Function Summary
void
enable_input (in type: aType)
Template function to define input functions for aType.
void
read (inout file: inFile, inout aType: aVar)
Read aVar from a word read from inFile.
void
read (inout file: inFile, inout aType: aVar, in aType: defaultValue)
Read aVar from a word read from inFile or use defaultValue.
void
readln (inout file: inFile, inout aType: aVar)
Read aVar from a line read from inFile.
void
readln (inout file: inFile, inout aType: aVar, in aType: defaultValue)
Read aVar from a line read from inFile or use defaultValue.
void
read (inout aType: aVar)
Read aVar from a word read from the standard input file IN.
void
read (inout aType: aVar, in aType: defaultValue)
Read aVar from a word read from standard input (IN) or use defaultValue.
void
readln (inout aType: aVar)
Read aVar from a line read from the standard input file IN.
void
readln (inout aType: aVar, in aType: defaultValue)
Read aVar from a line read from standard input (IN) or use defaultValue.
void
enable_output (in type: aType)
Template function to define output functions for aType.
void
write (inout file: outFile, in aType: aValue)
Write aValue to the file outFile.
void
writeln (inout file: outFile, in aType: aValue)
Write aValue followed by end-of-line to the file outFile.
void
write (in aType: aValue)
Write aValue to the standard output file OUT.
void
writeln (in aType: aValue)
Write aValue followed by end-of-line to the standard output file OUT.
void
enable_io (in type: aType)
Template function to define I/O functions for aType.

Operator Detail

lpad

const func string: (in aType: aValue) lpad (in integer: leng)

Convert aValue to string and pad it with spaces at the left side. The string is padded up to a given length.

Returns:
aValue converted to string and left padded with spaces.

rpad

const func string: (in aType: aValue) rpad (in integer: leng)

Convert aValue to string and pad it with spaces at the right side. The string is padded up to a given length.

Returns:
aValue converted to string and right padded with spaces.

<&

const func string: (in string: stri) <& (in aType: aValue)

Convert aValue to string and append it to stri. This operator is intended for write statements.

Returns:
the result of the concatenation.

<&

const func string: (in aType: aValue) <& (in string: stri)

Convert aValue to string and append stri to it. This operator is intended for write statements.

Returns:
the result of the concatenation.

Function Detail

enable_input

const proc: enable_input (in type: aType)

Template function to define input functions for aType. It defines the functions read and readln. The functions read a whitespace terminated word respectively a line as string. Afterwards the parse operator is used to convert the string to an aType value. The functions read and readln are defined with file argument and without file argument. The functions without file argument use the standard input file IN.

const type: myType is ...
const func myType is (attr myType) parse (in string: stri) is ...
enable_input(myType);

Afterwards it is possible to read myType values from a file.


read

const proc: read (inout file: inFile, inout aType: aVar)

Read aVar from a word read from inFile. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. The conversion to the type aType is done with the parse operator. When the function is left inFile.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the word to the type aType.

read

const proc: read (inout file: inFile, inout aType: aVar, in aType: defaultValue)

Read aVar from a word read from inFile or use defaultValue. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. If the word is empty defaultValue is assigned to aVar. The conversion to the type aType is done with the parse operator. When the function is left inFile.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the word to the type aType.

readln

const proc: readln (inout file: inFile, inout aType: aVar)

Read aVar from a line read from inFile. The function reads a string up to end-of-line or EOF. The conversion to the type aType is done with the parse operator. When the function is left inFile.bufferChar contains the line ending character ('\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the line to the type aType.

readln

const proc: readln (inout file: inFile, inout aType: aVar, in aType: defaultValue)

Read aVar from a line read from inFile or use defaultValue. The function reads a string up to end-of-line or EOF. If the line is empty defaultValue is assigned to aVar. The conversion to the type aType is done with the parse operator. When the function is left inFile.bufferChar contains the line ending character ('\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the line to the type aType.

read

const proc: read (inout aType: aVar)

Read aVar from a word read from the standard input file IN. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. The conversion to the type aType is done with the parse operator. When the function is left IN.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the word to the type aType.

read

const proc: read (inout aType: aVar, in aType: defaultValue)

Read aVar from a word read from standard input (IN) or use defaultValue. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. If the word is empty defaultValue is assigned to aVar. The conversion to the type aType is done with the parse operator. When the function is left IN.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the word to the type aType.

readln

const proc: readln (inout aType: aVar)

Read aVar from a line read from the standard input file IN. The function reads a string up to end-of-line or EOF. The conversion to the type aType is done with the parse operator. When the function is left IN.bufferChar contains the line ending character ('\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the line to the type aType.

readln

const proc: readln (inout aType: aVar, in aType: defaultValue)

Read aVar from a line read from standard input (IN) or use defaultValue. The function reads a string up to end-of-line or EOF. If the line is empty defaultValue is assigned to aVar. The conversion to the type aType is done with the parse operator. When the function is left IN.bufferChar contains the line ending character ('\n' or EOF).

Raises:
RANGE_ERROR - If the parse operator cannot convert the line to the type aType.

enable_output

const proc: enable_output (in type: aType)

Template function to define output functions for aType. It defines the functions write and writeln and the operators lpad, rpad and <&. The functions and operators use the str function to convert the aType value to a string. Afterwards they call the corresponding function respectively operator for string values. The functions write and writeln are defined with file argument and without file argument. The functions without file argument write to the standard output file OUT.

const type: myType is ...
const func string: str (in myType: myTypeValue) is ...
enable_output(myType);

Afterwards it is possible to write myType values to a file.


write

const proc: write (inout file: outFile, in aType: aValue)

Write aValue to the file outFile.


writeln

const proc: writeln (inout file: outFile, in aType: aValue)

Write aValue followed by end-of-line to the file outFile.


write

const proc: write (in aType: aValue)

Write aValue to the standard output file OUT.


writeln

const proc: writeln (in aType: aValue)

Write aValue followed by end-of-line to the standard output file OUT.


enable_io

const proc: enable_io (in type: aType)

Template function to define I/O functions for aType. It defines the functions read, readln, write and writeln and the operators lpad, rpad and <&. To do this it calls the templates enable_input and enable_output.

const type: myType is ...
const func myType is (attr myType) parse (in string: stri) is ...
const func string: str (in myType: myTypeValue) is ...
enable_io(myType);

Afterwards it is possible to read and write myType values.



 previous   up   next