Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
W


NAME

W - formatted output to windows

SYNOPSIS

(* diagnostic *)
PROCEDURE done () : BOOLEAN;
PROCEDURE success() : FmtExitCode;


(* error handling *) PROCEDURE setmode (mode : BITSET); PROCEDURE getmode (VAR mode : BITSET);

(* output *) PROCEDURE printf0 (win : Window; line, col : CARDINAL; fmt : ARRAY OF CHAR); PROCEDURE printf1 (win : Window; line, col : CARDINAL; fmt : ARRAY OF CHAR; i1 : ARRAY OF BYTE); PROCEDURE printf2 (win : Window; line, col : CARDINAL; fmt : ARRAY OF CHAR; i1,i2 : ARRAY OF BYTE); (* ... *) PROCEDURE printf8 (win : Window; line, col : CARDINAL; fmt : ARRAY OF CHAR; i1,i2, i3, i4, i5, i6, i7, i8 : ARRAY OF BYTE);

PROCEDURE append0 (win : Window; fmt : ARRAY OF CHAR); PROCEDURE append1 (win : Window; fmt : ARRAY OF CHAR; i1 : ARRAY OF BYTE); PROCEDURE append2 (win : Window; fmt : ARRAY OF CHAR; i1,i2 : ARRAY OF BYTE); (* ... *) PROCEDURE append8 (win : Window; fmt : ARRAY OF CHAR; i1,i2, i3, i4, i5, i6, i7, i8 : ARRAY OF BYTE);

DESCRIPTION

printf0 .. printf8 and append0 .. append8 convert their parameters i1 .. i8, instantiate them into the format string fmt and write the resulting text into window win Refer to Printf for a detailed description of formatting capabilities.

printf0 .. printf8 always write the first output character to the window position given by (line,col), append0 .. append8 append the output to the current window position yield by Windows.GetWindowPos. Output is restricted to those characters, Windows.WindowWrite would accept. The rules concerning interpretation of newlines or carriage returns apply accordingly.

printf0 .. printf8 uses auto margin and scrolling capabilities if Windows.scroll is a current window attribute of win. Otherwise output must not exceed last column or last line of the window. No such restriction exists for append0 .. append8, which will always use auto margin and scrolling mechanisms.

All procedures will flush win at most one time. Flushing is performed if and only if Windows.flushalways is in the current attribute set of win.

done returns TRUE is the last output procedure call was successful, more detailed information can be obtained by success (FmtExitCode is imported from Printf).

setmode defines a new error handling mode mode which is by default set to Printf.Default. getmode yields the current mode.

DIAGNOSTICS

Diagnostic is unnecessary unless default error handling strategy has been explicitly modified by prior calls of setmode. See Printf for more details.

Some problems arise on the output of error messages if StdIO.stderr is associated with the same device than win. E.EnterInitProc and E.EnterExitProc provide a suitable feature to suspend and restore device by means of Windows.SuspendDevice and Windows.RestoreDevice.

Be careful of devices not reset on program termination in connection with errors on window operations.

Besides illegal format strings the following errors might occur using W: IllegalWindowOffset, WindowTooSmall (resulting from illegal arguments to printf0 .. printf8), CannotFlushWindow (failure of Windows.FlushWindow), CannotWriteWindow (illegal output character) CannotAccessWindow (other errors).

Error messages issued by W contain information about the their reason and the affected procedure:

[fatal] W.printf1(...,30,0,"%u",...);
        Illegal parameter values: offset out of window.
[a.out] Exit code 206. Stop.

SEE ALSO

Printf, Windows, E

AUTHOR

Werner Stanglow
Edited by: borchert, last change: 1997/02/25, revision: 1.2, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine