SOMOutCharRoutine: Difference between revisions
Appearance
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..." |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This function prints a character. This function is replaceable. | This function prints a character. This function is replaceable. | ||
==Syntax== | ==Syntax== | ||
Line 11: | Line 10: | ||
==Parameters== | ==Parameters== | ||
; c (char) : The character to be output. | ; c (char) : The character to be output. | ||
==Return Code== | ==Return Code== | ||
; rc (int) : | ; rc (int) : | ||
0 Returns 0 if an error occurs. | |||
0 Returns 0 if an error occurs. | 1 Returns 1 if no error occurs. | ||
1 Returns 1 if no error occurs. | |||
==Remarks== | ==Remarks== | ||
This function is a replaceable character output routine. It is invoked by SOM whenever a character is generated by one of the SOM | 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. | 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. | 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== | ==Example Code== | ||
Line 40: | Line 38: | ||
</PRE> | </PRE> | ||
==Related | ==Related Functions== | ||
* [[somVprintf]] | |||
* [[somVprintf]] | * [[somPrefixLevel]] | ||
* [[somPrefixLevel]] | * [[somLPrintf]] | ||
* [[somLPrintf]] | * [[somPrintf]] | ||
* [[ | * [[somSetOutChar]] | ||
* [[somSetOutChar]] | |||
[[Category:SOM Kernel]] | [[Category:SOM Kernel]] |
Latest revision as of 16:22, 12 October 2022
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;