Trailing-Edge
-
PDP-10 Archives
-
bb-r775e-bm_tops20_ks_upd_5
-
sources/edt/chmparen.bli
There are 11 other files named chmparen.bli in the archive. Click here to see a list.
%TITLE 'CHMPAREN - handle parentheses'
MODULE CHMPAREN ( ! Handle parentheses
IDENT = '3-003' ! File: CHMPAREN.BLI Edit: GB3003
) =
BEGIN
!
! COPYRIGHT (c) 1981, 1985 BY
! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
! ALL RIGHTS RESERVED.
!
! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
! TRANSFERRED.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
! CORPORATION.
!
! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
!
!++
! FACILITY: EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
! This module implements a parenthesized string of commands.
!
! ENVIRONMENT: Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 1-001 - Original. DJS 04-Feb-1981. This module was created by
! extracting the routine EDT$$PARENT from module CHANGE.BLI.
! 1-002 - Regularize headers. JBS 03-Mar-1981
! 1-003 - Use new message codes. JBS 04-Aug-1981
! 1-004 - Add return values. JBS 02-Oct-1981
! 1-005 - Add an entry point so that this module can be loaded back into
! memory after calling the change mode parser. Also, use a different
! symbol for the name of the change mode parser so the call can be
! ignored by the overlay analyzer (and so that the call can be
! intercepted by a routine which will load us back into memory).
! JBS 02-Apr-1982
! 1-006 - Set a flag if control C actually aborts something. JBS 24-May-1982
! 1-007 - If an error occurs in processing the commands inside parens, such
! as string not found, continue after the right paren. JBS 23-Feb-1983
! 3-001 - Change all occurrences of CMD_BUF to CMD_PTR. GB 07-Apr-1983
! 3-002 - Don't need overlay code. CJG 17-Apr-1983
! 3-003 - Add updates from V3 source kit. GB 27-Apr-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$PARENT; ! Collect and execute a parenthesized string of commands
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$PARENT - handle parentheses'
GLOBAL ROUTINE EDT$$PARENT ( ! Handle parentheses
COUNT, ! Number of times to execute
EXECUTE ! 1 = execute the commands
) =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine implements a parenthesized string of commands. The
! string is analyzed without execution in order to verify it syntactically,
! and find the end of the string. It is then executed COUNT times, or until
! a command in the string fails. In either case, CMD_PTR is left pointing
! at the first character after the parenthesized command list.
!
! FORMAL PARAMETERS:
!
! COUNT Number of times to execute
!
! EXECUTE 1 = execute the commands
!
! IMPLICIT INPUTS:
!
! CMD_PTR
!
! IMPLICIT OUTPUTS:
!
! CC_DONE
!
! ROUTINE VALUE:
!
! 1 = ok, 0 = control C , 2 = end of journal file
!
! SIDE EFFECTS:
!
! NONE
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$MSG_BELL : NOVALUE, ! Output a message to the terminal with a warning bell
EDT$$CHK_CC, ! Check to see if a CTRL/C has been typed
EDT$$CHM_PAREXE; ! Parse and execute a change mode command string
EXTERNAL
CMD_PTR, ! Command string pointer
CC_DONE; ! Set to 1 if control C actually aborts something
MESSAGES ((PARENMIS));
LOCAL
SUCCEED,
COM_END,
COM_START;
CMD_PTR = COM_START = CH$PLUS (.CMD_PTR, 1);
!+
! Check syntax and find the end of the command.
!-
SUCCEED = EDT$$CHM_PAREXE (0);
IF (.SUCCEED NEQ 1) THEN RETURN (.SUCCEED);
COM_END = .CMD_PTR;
!+
! If we are not positioned on the right paren we have a syntax error.
!-
IF (CH$RCHAR (.COM_END) NEQ %C')')
THEN
BEGIN
EDT$$MSG_BELL (EDT$_PARENMIS);
RETURN (0);
END;
IF .EXECUTE
THEN
DECR I FROM .COUNT - 1 TO 0 DO
BEGIN
IF EDT$$CHK_CC ()
THEN
BEGIN
CC_DONE = 1;
RETURN (0);
END;
CMD_PTR = .COM_START;
SUCCEED = EDT$$CHM_PAREXE (1);
IF (.SUCCEED NEQ 1) THEN EXITLOOP;
END;
CMD_PTR = CH$PLUS (.COM_END, 1);
!+
! Don't indicate an error in executing the command within parens as an error
! in executing this command. This allows multiple commands to be executed
! terminated by search failures.
!-
IF (.SUCCEED EQL 0) THEN SUCCEED = 1;
RETURN (.SUCCEED);
END; ! of routine EDT$PARENT
END
ELUDOM