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

Ulm's Modula-2 Library:


P - formatted output to stdout


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

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

(* output *) PROCEDURE rintf0 (fmt : ARRAY OF CHAR); PROCEDURE rintf1 (fmt : ARRAY OF CHAR; i1 : ARRAY OF BYTE); PROCEDURE rintf2 (fmt : ARRAY OF CHAR; i1,i2 : ARRAY OF BYTE); (* ... *) PROCEDURE rintf8 (fmt : ARRAY OF CHAR; i1, i2, i3, i4, i5, i6, i7 , i8 : ARRAY OF BYTE);


P.rintf0 .. P.rintf8 (the procedures are intended to be called qualified, that explains their strange names) convert their parameters i1 .. i8, instantiate them into the format string fmt and output the resulting text on StdIO.stdout. Refer to Printf for a detailed description of formatting capabilities.

Output of P is echoed to all echo files defined for stdout by means of LongStrings.Echo.

done returns TRUE if the last call of P.rintf0 .. P.rintf8 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.


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

In case of errors P.rintf0 .. P.rintf8 do not produce any output. Errors may result from illegal format strings or from problems when writing to stdout (error code CannotWriteStdout).

Error message issued by P will contain information about their reason and the affected procedure call:

[fatal] P.rintf1("%*u",...);
        Bad Format: too many format elements.
[a.out] Exit code 201. Stop.


Printf, LongStrings, StdIO


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