When using a tty-based interface (available only on UNIX platforms), IDL sends its output to the screen for the user to see. When using a GUI-based interface (any platform), the output goes to the IDL log window. The default output function is automatically installed by IDL at startup. To divert IDL output to a function of your own design, use IDL_ToutPush() and IDL_ToutPop() to change the output function called by IDL.

Internally, IDL maintains a stack of output functions and provides two functions (IDL_ToutPush() and IDL_ToutPop()) to manage them. The most recently pushed output function is called to output each line of text. Output functions of your own design should have the following type definition:

typedef void (* IDL_TOUT_OUTF)(int flags, char *buf, int n);

The arguments to an output function are:

flags


A bitmask of flag values that specify how the text should be output. The allowed bit values are:

IDL_TOUT_F_STDERR

Send the text to stderr rather than stdout, if that distinction means anything to your output device.

IDL_TOUT_F_NLPOST

After outputting the text, start a new output line. On a tty this is equivalent to sending a newline ('\n') character.

buf


The text to be output. There may or may not be a NULL termination, so the character count provided by n must be used to move only the specified number of characters.

n


The number of characters in buf to be output.

IDL_ToutPush()


Use IDL_ToutPush() to push a new output function onto the stack. The most recently pushed function is the one used by IDL for output.

void IDL_ToutPush(IDL_TOUT_OUTF outf);

IDL_ToutPop()


IDL_ToutPop() removes the most recently pushed output function. The removed function pointer is returned.

IDL_TOUT_OUTF IDL_ToutPop(void);

Note: Do not pop an output function you did not push. It is an error to attempt to remove the last remaining function.