Libraries
Editline Source Code
 previous   up   next 

Types
editLineFile
File implementation type for linewise editing with history.

editLineFile

const type: editLineFile

File implementation type for linewise editing with history. The possibilities of editing are described in the documentation of the function getln.


Function Summary
file
openEditLine (in file: inFile, in file: outFile)
Open an Unicode filter file for linewise editing with history.
file
openEditLineLatin1 (in file: inFile, in file: outFile)
Open a Latin-1 filter file for linewise editing with history.
string
getln (inout editLineFile: inEditLine)
Read a line from inEditLine.
char
getc (inout editLineFile: inEditLine)
Read a character from inEditLine.
string
gets (inout editLineFile: inEditLine, in integer: maxLength)
Read a string with maximum length from inEditLine.
boolean
eof (in editLineFile: inEditLine)
Determine the end-of-file indicator.
boolean
hasNext (in editLineFile: inEditLine)
Determine if at least one character can be read successfully.

Function Detail

openEditLine

const func file: openEditLine (in file: inFile, in file: outFile)

Open an Unicode filter file for linewise editing with history. Unicode characters and editing keys are read from inFile. All Unicode characters are accepted and written to outFile. To avoid RANGE_ERROR use an Unicode capable file as outFile. The following editing keys are accepted: Backspace, delete, home, end and the cursor keys. The history is accessed with the vertical cursor keys. Ctrl-C and ctrl-T allow terminating the program. Other keys (e.g. function keys) are ignored. Call openEditLine with

IN := openEditLine(KEYBOARD, OUT);

to allow editing standard console input.

Returns:
the file opened.

openEditLineLatin1

const func file: openEditLineLatin1 (in file: inFile, in file: outFile)

Open a Latin-1 filter file for linewise editing with history. Unicode characters and editing keys are read from inFile. Only Latin-1 characters are accepted and written to outFile. Unicode characters beyond ISO Latin-1 (ISO-8859-1) are ignored. This allows that a normal byte file is used as outFile. The following editing keys are accepted: Backspace, delete, home, end and the cursor keys. The history is accessed with the vertical cursor keys. Ctrl-C and ctrl-T allow terminating the program. Other keys (e.g. function keys) are ignored. Call openEditLine with

IN := openEditLineLatin1(KEYBOARD, OUT);

to allow editing standard console input.

Returns:
the file opened.

getln

const func string: getln (inout editLineFile: inEditLine)

Read a line from inEditLine. Before the line is sent it can be edited. It is possible to move the cursor with horizontal cursor keys. The home key and the end key move the cursor to the beginning respectively end of the input line. Characters can be inserted at the current cursor position. Backspace and delete can be used to remove characters. Vertical cursor keys allow browsing the history of input lines. Sending the line is done with enter/return ('\n'). The line ending character is not copied into the string. When the function is left inEditLine.bufferChar contains '\n' or EOF.

Returns:
the line read.

getc

const func char: getc (inout editLineFile: inEditLine)

Read a character from inEditLine.

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

gets

const func string: gets (inout editLineFile: inEditLine, in integer: maxLength)

Read a string with maximum length from inEditLine.

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

eof

const func boolean: eof (in editLineFile: inEditLine)

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 editLineFile: inEditLine)

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.


 previous   up   next