printf






 6 "IRIT Version 8.0"

PRINTF



 PRINTF( StringType CtrlStr, ListType Data )

A formatted printing routine, following the concepts of the
C programming language’s printf routine. CtrlStr is a string
object for which the following special ’%’ commands are
supported:

    %d, %i, %u      Prints the numeric object as an integer
or unsigned integer.
    %o, %x, %X      Prints the numeric object as an octal or
hexadecimal integer.
    %e, %f, %g,     Prints the numeric object in several
formats of
    %E, %F          floating point numbers.
    %s              Prints the string object as a string.
    %pe, %pf, %pg   Prints the three coordinates of the
point object.
    %ve, %vf, %vg   Prints the three coordinates of the
vector object.
    %Pe, %Pf, %Pg,  Prints the four coordinates of the plane
object.
    %De, %Df, %Dg,  Prints the given object in IRIT’s data
file format.


All the ’%’ commands can include any modifier that is valid
in the C programming language printf routine, including l
(long), prefix character(s), size, etc. The point, vector,
plane, and object commands can also be modified in a similar
way, to set the format of the numeric data printed.

Also supported are the newline and tab using the backslash
escape character:

 PRINTF("\tThis is the char

Backslashes should be escaped themselves as can be seen in
the above example.  Here are few more examples:

 PRINTF("this is a string
       list("STRING", 1987));
 PRINTF("this is a vector [%8.5lvf]\n",
list(vector(1,2,3)));
 IritState("DumpLevel", 9);
 PRINTF("this is a object %8.6lDf...\n", list(axes));
 PRINTF("this is a object %10.8lDg...\n", list(axes));

This implementation of PRINTF is somewhat different than the









                             ‐2‐


C programming language’s version, because the backslash
always escapes the next character during the processing
stage of IRIT’s parser. That is, the string

        ’\tThis is the char

is actually parsed by the IRIT’s parser into

        ’This is the char ""0

because this is the way the IRIT parser processes strings.
The latter string is the one that PRINTF actually see.