Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 58
Sample Program
!------------------------------------------------------------
! Integer procedure edits the command buffer and returns 1
! if edited command should be executed. This procedure
! allows the user a change of mind about editing the command
! by returning 0.
!------------------------------------------------------------
INT PROC FC(COMMAND,LAST^COMMAND,NUM,SAVE^NUM);
STRING .COMMAND;
STRING .LAST^COMMAND;
INT .NUM;
INT .SAVE^NUM;
BEGIN
STRING .TEMPLATE^ARRAY[0:71]; !template used for edit
! changes
INT TEMPLATE^LENGTH; !length of template
INT MAX^LEN := 8; !maximum length of edited
! command
STRING .BUFFER[0:71]; !I/O buffer
STRING .S^PTR; !pointer to end of text
! string
! Set command prompt to "< ":
COMMAND[-2] ':=' "< ";
! Set NUM equal to size of previous command:
NUM := SAVE^NUM;
! Put previous command in command buffer:
COMMAND ':=' LAST^COMMAND FOR NUM;
! Edit the command each time through the loop. The loop
! enables the user to check the results of an edit and then
! edit again if necessary:
DO
BEGIN
! Write the command to be edited to the terminal:
CALL WRITEX(TERM^NUM,COMMAND[-2],NUM + 2);
IF <> THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);