Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 44
Editing a Character String
! If the command is "FC" then call the FC procedure,
! returning 1 if the fix is accepted or 0 if it is not.
! If the command is EXIT, then stop the program.
! If the command is any other valid command, then process
! the command (this program simply displays the command
! name). If an illegal command, then print a diagnostic
! message:
IF COMMAND = "FC"
THEN REPEAT := FC(COMMAND,LAST^COMMAND,NUM,SAVE^NUM)
ELSE BEGIN
IF COMMAND = "EXIT" THEN CALL PROCESS_STOP_
ELSE IF COMMAND = "COMMAND1" THEN
CALL WRITEX(TERM^NUM,COMMAND,NUM)
ELSE IF COMMAND = "COMMAND2" THEN
CALL WRITEX(TERM^NUM,COMMAND,NUM)
ELSE BEGIN
BUFFER ':=' COMMAND FOR 8;
BUFFER[8] ':=' ": Illegal Command " -> @S^PTR;
CALL WRITEX(TERM^NUM,BUFFER,@S^PTR '-' @BUFFER);
IF <> THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
END;
! Reset the repeat flag:
REPEAT := 0;
END;
! If the command length is nonzero, then save it in the
! LAST^COMMAND array for possible editing by a subsequent
! FC command:
IF NUM THEN
BEGIN
SAVE^NUM := NUM;
LAST^COMMAND ':=' COMMAND FOR SAVE^NUM;
END;
END;
END;