Printing Input and Output Objects

For debugging purposes, it's useful to be able to print the contents of an lpar. The DevKit provides the following function that prints to a file stream:

void lpar_fprintf( FILE *stream, lpar_t lpar, int nicechar );

The object parameter can be any type of lpar. The function operates recursively, printing the contents of any nested list structures. Indentation is used to depict nesting relationships.

The nicechar parameter controls how the content of byte blocks is printed. If nicechar is nonnegative, every non-printable byte (as defined by the C standard library function isprint) is replaced with (unsigned char) nicechar in the printed output. If nicechar is negative, this replacement is not done, which can cause trouble for some terminal emulation programs. However, if you are outputting UTF-8 encoded data nicechar must always be negative as the isprint function might interpret bytes of the UTF-8 character as non-printable.

Note: To view the output your terminal or viewer must be configured to handle UTF-8 encoded text.