Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 54
Sample $CMON Program
! Blank the reply buffer for rejecting requests:
PROCESSCREATION^REJECT[0] ':=' " ";
PROCESSCREATION^REJECT[1] ':='
PROCESSCREATION^REJECT[0] FOR 63;
! Extract the group ID of the requesting TACL process:
REQUESTING^GROUPID := PROCESSCREATION^MSG.USERID.<0:7>;
! If shutting the system down, allow only requests from the
! operator group:
IF REFUSE^ALL AND (REQUESTING^GROUPID <> 255) THEN
BEGIN
PROCESSCREATION^REJECT.REPLYCODE := 1;
PROCESSCREATION^REJECT.REPLYTEXT ':='
SHUTDOWN^TEXT FOR 64;
CALL REPLYX(PROCESSCREATION^REJECT,
$LEN(PROCESSCREATION^REJECT));
END
ELSE
BEGIN
! Allow the request:
PROCESSCREATION^ACCEPT.REPLYCODE := 0;
! Accept process priority indicated in the input message:
PROCESSCREATION^ACCEPT.PRIORITY := 0;
! Allocate priority-response processor if priority over 150,
! otherwise allocate nonpriority-response processor:
IF PROCESSCREATION^MSG.PRIORITY > 150
THEN
BEGIN
DO
BEGIN
COUNT := 0;
PRIORITY^CPU := PRIORITY^CPU + 1;
IF PRIORITY^CPU = (TOP^CPU^NUMBER + 1)
THEN PRIORITY^CPU := 0;
COUNT := COUNT + 1;
IF COUNT = 16 THEN