Guardian Programmer's Guide

Table Of Contents
Interfacing With the ERROR Program
Guardian Programmer’s Guide 421922-014
20 - 8
Using the ERROR Process: An Example
!------------------------------------------------------------
! Procedure to print error text on the home terminal. Runs
! and opens the error program, sends it an error number and
! receives the error-message text.
!------------------------------------------------------------
PROC PRINT^ERROR(FNUM);
INT FNUM; !file number of file with
! error against it
BEGIN
INT .PROCESS^HANDLE[0:9]; !process handle of ERROR
! process
STRING .OBJ^FNAME[0:MAXFLEN - 1];!object file name
INT NAME^OPTION := 2; !specifies a system-named
! process
STRING .PROC^DESCR[0:MAXPDLEN - 1];!process descriptor
INT PROC^DESCR^LEN; !length of process
! descriptor
INT PROCNUM; !process file number
INT ERROR^RETURN; !error return from
! PROCESS_CREATE_
INT EOF; !indicates end of message
! text
INT COUNT^READ;
INT ERROR^NUMBER; !number of file-system
! error to display!
INT ERROR; !local file-system error
! Get the file-system error to display:
CALL FILE_GETINFO_(FNUM,ERROR^NUMBER);
! Create the ERROR process:
OBJ^FNAME ':=' "$SYSTEM.SYSTEM.ERRORX" -> @S^PTR;
ERROR^RETURN := PROCESS_CREATE_(
OBJ^FNAME:@S^PTR '-' @OBJ^FNAME,
!library^filename:library^file^len!,
!swap^filename:swap^file^len!,
!ext^swap^file^name:ext^swap^len!,
!priority!,
!processor!,
PROCESS^HANDLE,
!error^detail!,
NAME^OPTION,
!name:length!,
PROC^DESCR:MAXPDLEN,
PROC^DESCR^LEN);