Libraries
Upper case filter Source Code
 previous   up   next 

Types
upperFile
File implementation type which turns characters to upper case.

upperFile

const type: upperFile

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


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

Function Detail

openUpper

const func file: openUpper (in file: destFile)

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

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

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

KEYBOARD := openUpper(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 upperFile opened.

write

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

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


writeln

const proc: writeln (inout upperFile: outFile)

Write end-of-line to outFile.


writeln

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

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


gets

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

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

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


 previous   up   next