Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 65
Sample $CMON Program
!------------------------------------------------------------
! Procedure to respond to a CPU^changestatus^message. This
! procedure extracts a processor number and status from the
! incoming message and updates the status of the processor
! accordingly in the CPU^LIST array.
!------------------------------------------------------------
PROC CHANGE^CPU^STATUS;
BEGIN
STRUCT MSG(*); !template for CPU^changestatus^message
BEGIN
INT MSGCODE;
INT PROCESSOR;
INT STATUS;
END;
INT .EXT CPU^CHANGESTATUS^MESSAGE(MSG) :=
$XADR(BUFFER); !structure pointer to I/O buffer
! Set the new processor status in the reply:
CPU^LIST[CPU^CHANGESTATUS^MESSAGE.PROCESSOR] :=
CPU^CHANGESTATUS^MESSAGE.STATUS;
CALL REPLYX;
END;
!------------------------------------------------------------
! Procedure to respond to an unexpected message. This
! procedure returns error 2 (invalid operation) to the TACL
! process.
!------------------------------------------------------------
PROC UNEXPECTED^MESSAGE;
BEGIN
INT ERROR;
ERROR := 2;
CALL REPLYX(!buffer!,
!write^count!,
!count^written!,
!message^tag!,
ERROR);
END;