Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 40
Sample $CMON Program
BEGIN
INT VOLUME[0:3];
INT SUBVOL[0:3];
END;
STRUCT INFILE;
BEGIN
INT VOLUME[0:3];
INT SUBVOL[0:3];
INT FILEID[0:3];
END;
STRUCT OUTFILE;
BEGIN
INT VOLUME[0:3];
INT SUBVOL[0:3];
INT FILEID[0:3];
END;
STRING PARAM[0:529];
END;
INT MESSAGE^LEN;
?NOLIST, SOURCE $SYSTEM.SYSTEM.EXTDECS0(INITIALIZER,
? FILE_OPEN_,WRITEX,FILE_GETINFO_,READUPDATEX,WRITEREADX,
? REPLYX,DNUMOUT,PROCESS_GETINFO_,PROCESS_STOP_,
? OLDFILENAME_TO_FILENAME_)
?LIST
!------------------------------------------------------------
! Here are some DEFINEs to help formatting and printing
! messages.
!------------------------------------------------------------
! Initialize for a new line:
DEFINE START^LINE = @S^PTR := @SBUFFER #;
! Put a string into the line:
DEFINE PUT^STR(S) = S^PTR ':=' S -> @S^PTR #;
! Put an integer into the line:
DEFINE PUT^INT(N) =
@S^PTR := @S^PTR '+' DNUMOUT(S^PTR,$DBL(N),10) #;
! Print the line:
DEFINE PRINT^LINE =
CALL WRITE^LINE(SBUFFER,@S^PTR '-' @SBUFFER) #;
! Print a blank line:
DEFINE PRINT^BLANK =
CALL WRITE^LINE(SBUFFER,0); #;