Libraries
Lower case filter Source Code
 previous   up   next 

Types
lowerFile
File implementation type which turns characters to lower case.

lowerFile

const type: lowerFile

File implementation type which turns characters to lower case. All data that is written to a lowerFile is converted to lower case and forwarded to the destFile. All functions that read from lowerFile read from destFile instead and deliver the data after converting it to lower case.


Function Summary
file
openLower (in file: destFile)
Open a filter file which turns characters to lower case.
void
write (inout lowerFile: outFile, in string: stri)
Write the string stri to outFile.
void
writeln (inout lowerFile: outFile)
Write end-of-line to outFile.
void
writeln (inout lowerFile: outFile, in string: stri)
Write a string followed by end-of-line to outFile.
string
gets (inout lowerFile: inFile, in integer: maxLength)
Read a string with a maximum length from a file.

Function Detail

openLower

const func file: openLower (in file: destFile)

Open a filter file which turns characters to lower case. All data that is written to a lowerFile is converted to lower case and forwarded to the destFile. E.g.:

lowerOutput := openLower(OUT);
repeat
  write("Enter sentence: ");
  flush(OUT);
  readln(sentence);
  writeln(lowerOutput, sentence);
until sentence = "";

All functions that read from lowerFile read from destFile instead and deliver the data after converting it to lower case. This can be used to allow upper and lower case commands:

KEYBOARD := openLower(KEYBOARD);
repeat
  write("command: ");
  flush(OUT);
  command := getc(KEYBOARD);
  writeln;
  ...
until command = 'q';
Parameters:
destFile - File to which data is written or from which data is read.
Returns:
the lowerFile opened.

write

const proc: write (inout lowerFile: outFile, in string: stri)

Write the string stri to outFile. The characters are converted to lower case, before they are written.


writeln

const proc: writeln (inout lowerFile: outFile)

Write end-of-line to outFile.


writeln

const proc: writeln (inout lowerFile: outFile, in string: stri)

Write a string followed by end-of-line to outFile. The characters are converted to lower case, before they are written.


gets

const func string: gets (inout lowerFile: inFile, in integer: maxLength)

Read a string with a maximum length from a file. The characters read are converted to lower case.

Returns:
the string read and converted to lower case.
Raises:
RANGE_ERROR - The parameter maxLength is negative.


 previous   up   next