SPI Programming Manual (G06.24+, H06.03+, J06.03+)

SPI Programming Examples
SPI Programming Manual427506-006
E-86
Example E-20: Routines for C Requesters and
Servers
Example E-20. C File: SECRUTLC Supporting Code (page 1 of 4)
/* File name: secrutlc
* SPI EXAMPLE C Requester Utility procedures.
*/
#pragma PAGE "report_newprocess_error"
/*
*========================================================================
* Proc : report_newprocess_error =
* Function : This procedure will format a NEWPROCESS error and write =
* it to the home term. =
*========================================================================
*/
void report_newprocess_error (short* p_program_fname, short p_error)
{
short l_len;
char l_err_sbuf [80];
printf ("NEWPROCESS ERROR # %d, %d\n",
((p_error & 0xFF00) >> 8) /* Bits 0-7 */,
(p_error & 0x00FF) /* Bits 8-15 */);
switch (((p_error & 0xFF00) >> 8) /* Bits 0-7 */)
{
case 0 : printf ("No error");
break;
case 1 : printf ("Undefined Externals");
break;
case 2 : printf ("No PCB Available");
break;
case 3 : printf ("File System Error on Program File ");
l_len = FNAMECOLLAPSE (p_program_fname, l_err_sbuf);
l_err_sbuf [l_len] = 0;
printf ("%s", l_err_sbuf);
printf (" (ERROR %d)", (p_error & 0x00FF) /* Bits 8-15 */);
break;
case 4 : printf ("Unable to Allocate Map");
break;
case 5 : printf ("File System Error on Swap File ");
printf (" (ERROR %d)", (p_error & 0x00FF) /* Bits 8-15 */);
break;
case 6 : printf ("Illegal File Format for ");
l_len = FNAMECOLLAPSE (p_program_fname, l_err_sbuf);
l_err_sbuf [l_len] = 0;
printf ("%s", l_err_sbuf);
break;
case 7 : printf ("Unlicensed PRIV program ");
l_len = FNAMECOLLAPSE (p_program_fname, l_err_sbuf);
l_err_sbuf [l_len] = 0;
printf ("%s", l_err_sbuf);
break;
case 8 : printf ("Process Name Error ");
printf (" (ERROR %d)", (p_error & 0x00FF) /* Bits 8-15 */);
break;
case 9 : printf ("Library Conflict");
break;
case 10 : printf ("Unable to communicate with System Monitor");
break;