Jump to content

SOMOutCharRoutine

From EDM2
Revision as of 19:33, 10 October 2017 by Martini (talk | contribs) (Created page with "This function prints a character. This function is replaceable. ==Syntax== <PRE> char c; int rc; rc = (*SOMOutCharRoutine)(c); </PRE> ==Parameters== ; c (char) : T...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function prints a character. This function is replaceable.


Syntax

char    c;
int     rc;

rc = (*SOMOutCharRoutine)(c);

Parameters

c (char)
The character to be output.

Return Code

rc (int)
0 Returns 0 if an error occurs. 
1 Returns 1 if no error occurs. 

Remarks

This function is a replaceable character output routine. It is invoked by SOM whenever a character is generated by one of the SOM error-handling or debugging macros. The default implementation outputs the specified character to stdout. To change the destination of character output, store the address of a user-written character output routine in global variable SOMOutCharRoutine.

Another function, somSetOutChar, may be preferred over the SOMOutCharRoutine function. The somSetOutChar function enables each application (or thread) to have a customized character output routine.

Example Code

#include <som.h>
#pragma linkage(myCharacterOutputRoutine, system)
/* Define a replacement routine: */
int SOMLINK myCharacterOutputRoutine (char c)
{
    (Customized code goes here)
}
...
/* After the next stmt all output */
/* will be sent to the new routine */
SOMOutCharRoutine = myCharacterOutputRoutine;

Related

Functions