Libraries |
|
Utf8 | Source Code |
|
|
utf8File
const type: utf8File
Variable Summary | |||||
utf8File |
| ||||
utf8File |
| ||||
utf8File |
|
Function Summary | |||||
file |
| ||||
void |
| ||||
char |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
|
Variable Detail |
STD_UTF8_IN
var utf8File: STD_UTF8_IN
-
UTF-8 version of the standard input file of the operating system. Reading from STD_UTF8_IN can be done with e.g.:
read(STD_UTF8_IN, aVariable);
It is also possible to redirect STD_UTF8_IN to the default input of read with:
IN := STD_UTF8_IN;
Afterwards
read(aVariable);
reads from STD_UTF8_IN.
STD_UTF8_OUT
var utf8File: STD_UTF8_OUT
-
UTF-8 version of the standard output file of the operating system. Writing to STD_UTF8_OUT can be done with e.g.:
write(STD_UTF8_OUT, something);
It is also possible to redirect the default output of write to STD_UTF8_OUT with:
OUT := STD_UTF8_OUT;
Afterwards
write(something);
writes to STD_UTF8_OUT.
STD_UTF8_ERR
var utf8File: STD_UTF8_ERR
-
UTF-8 version of the standard error file of the operating system. Writing to STD_UTF8_ERR can be done with e.g.:
write(STD_UTF8_ERR, something);
Function Detail |
openUtf8
const func file: openUtf8 (in string: path, in string: mode)
-
Opens an Unicode file which uses the UTF-8 encoding. The file is opened with the specified path and mode. There are text modes and binary modes:
- Binary modes:
- "r" Open file for reading.
- "w" Truncate to zero length or create file for writing.
- "a" Append; open or create file for writing at end-of-file.
- "r+" Open file for update (reading and writing).
- "w+" Truncate to zero length or create file for update.
- "a+" Append; open or create file for update, writing at end-of-file.
- Text modes:
- "rt" Open file for reading.
- "wt" Truncate to zero length or create file for writing.
- "at" Append; open or create file for writing at end-of-file.
- "rt+" Open file for update (reading and writing).
- "wt+" Truncate to zero length or create file for update.
- "at+" Append; open or create file for update, writing at end-of-file.
Note that this modes differ from the ones used by the C function fopen().
- Binary modes:
- Parameters:
- path - Path of the file to be opened. The path must use the standard path representation.
- mode - Mode of the file to be opened.
- Returns:
- the file opened, or STD_NULL if it could not be opened or if path refers to a directory.
- Raises:
- MEMORY_ERROR - Not enough memory to convert the path to the system path type.
- RANGE_ERROR - The mode is not one of the allowed values or path does not use the standard path representation or path cannot be converted to the system path type.
write
const proc: write (in utf8File: outFile, in string: stri)
-
Write a string to an UTF-8 file.
- Raises:
- FILE_ERROR - A system function returns an error.
getc
const func char: getc (in utf8File: inFile)
-
Read a character from an UTF-8 file.
- Returns:
- the character read, or EOF at the end of the file.
- Raises:
- RANGE_ERROR - The file contains an invalid encoding.
gets
const func string: gets (in utf8File: inFile, in integer: maxLength)
-
Return a string read with a maximum length from an UTF-8 file.
- Returns:
- the string read.
- Raises:
- RANGE_ERROR - The parameter maxLength is negative, or the file contains an invalid encoding.
getwd
const func string: getwd (inout utf8File: inFile)
-
Read a word from an UTF-8 file. Before reading the word it skips spaces and tabs. The function accepts words ending with ' ', '\t', '\n', "\r\n" or EOF. The word ending characters are not copied into the string. That means that the '\r' of a "\r\n" sequence is silently removed. When the function is left inFile.bufferChar contains ' ', '\t', '\n' or EOF.
- Returns:
- the word read.
- Raises:
- RANGE_ERROR - The file contains an invalid encoding.
- MEMORY_ERROR - Not enough memory to represent the result.
- FILE_ERROR - A system function returns an error.
getln
const func string: getln (inout utf8File: inFile)
-
Read a line from an UTF-8 file. The function accepts lines ending with '\n', "\r\n" or EOF. The line ending characters are not copied into the string. That means that the '\r' of a "\r\n" sequence is silently removed. When the function is left inFile.bufferChar contains '\n' or EOF.
- Returns:
- the line read.
- Raises:
- RANGE_ERROR - The file contains an invalid encoding.
- MEMORY_ERROR - Not enough memory to represent the result.
- FILE_ERROR - A system function returns an error.
seek
const proc: seek (in utf8File: aFile, in integer: position)
-
Set the current file position. The file position is measured in bytes from the start of the file. The first byte in the file has the position 1. If the file position would be in the middle of an UTF-8 encoded character the position is advanced to the beginning of the next UTF-8 character.
- Raises:
- RANGE_ERROR - The file position is negative or zero or the file position is not representable in the system file position type.
- FILE_ERROR - A system function returns an error.
|
|