Trailing-Edge
-
PDP-10 Archives
-
BB-H138F-BM_1988
-
7-sources/chmkeywrd.bli
There are 11 other files named chmkeywrd.bli in the archive. Click here to see a list.
%TITLE 'CHMKEYWRD - look for a keyword'
MODULE CHMKEYWRD ( ! Look for a keyword
IDENT = '3-002' ! File: CHMKEYWRD.BLI Edit: GB3002
) =
BEGIN
!COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1981, 1988. 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 THAT IS NOT SUPPLIED BY DIGITAL.
!
!
!++
! FACILITY: EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
! This module compares the command buffer contents to a table
! of keywords.
!
! 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$$KWORD from module CHANGE.BLI.
! 1-002 - Regularize headers. JBS 03-Mar-1981
! 1-004 - Change to a table arranged alphabetically. STS 21-Sep-1982
! 1-005 - Move the keywords here from EDT$CHMPARSE, to reduce the program
! size on the PDP-11. Also, put an underscore in the entry point name. JBS 29-Sep-1982
! 1-006 - Accept lower case letters as equivalent to upper case, and improve error
! checking. JBS 01-Oct-1982
! 1-007 - Make this routine position-independent. JBS 01-Oct-1982
! 1-008 - Add conditionals for WPS and VT220. JBS 10-Feb-1983
! 1-009 - Don't forget the SUPPORTS library. JBS 11-Feb-1983
! 3-002 - Remove VT220 conditional to speed up code. CJG 25-Nov-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$KEY_WORD : NOVALUE; ! Compare the command buffer contents to a table of keywords
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
LIBRARY 'EDTSRC:TRANSLATE';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
FIELD
KEY_WORD_FIELD =
SET
KEY_WORD_NEXT = [0, 0, 18, 0],
KEY_WORD_NUM = [0, 18, 9, 0],
KEY_WORD_LEN = [0, 27, 9, 0],
KEY_WORD_POINTER = [1, 0, 36, 0]
TES;
LITERAL
V_FIELD = %O'1000000',
L_FIELD = %O'1000000000';
!
! OWN STORAGE:
!
!+
! Define the keywords used to make up change mode sub-commands.
!
! Each record in this table contains a address pointer to the next keyword
! with this alphabetic character the value of the keyword, its length,
! and the ASCII characters which comprise it.
!
! The table is a concatenation of keyword entries. Each
! consists of a pointer to the next keyword to examine if
! this one should fail, a keyword number byte, length byte,
! and the ASCII text for the keyword. A 0 length byte
! marks the end of the table. Letters in keywords are
! all upper case.
!-
BIND
ADDR_BASE = UPLIT (0),
END_VERBS = UPLIT (0, 0),
ASC_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_ASC) + L_FIELD * (3), CH$PTR (UPLIT ('ASC'))),
ADV_VERB = UPLIT (
ASC_VERB - ADDR_BASE + V_FIELD * (VERB_K_ADV) + L_FIELD * (3), CH$PTR (UPLIT ('ADV'))),
A_VERBS = UPLIT (
ADV_VERB - ADDR_BASE + V_FIELD * (VERB_K_APPEND) + L_FIELD * (6), CH$PTR (UPLIT ('APPEND'))),
BELL_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_BELL) + L_FIELD * (4), CH$PTR (UPLIT ('BELL'))),
B_VERBS = UPLIT (
BELL_VERB - ADDR_BASE + V_FIELD * (VERB_K_BACK) + L_FIELD * (4), CH$PTR (UPLIT ('BACK'))),
CUT_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_CUT) + L_FIELD * (3), CH$PTR (UPLIT ('CUT'))),
CLSS_VERB = UPLIT (
CUT_VERB - ADDR_BASE + V_FIELD * (VERB_K_CLSS) + L_FIELD * (4), CH$PTR (UPLIT ('CLSS'))),
CHGL_VERB = UPLIT (
CLSS_VERB - ADDR_BASE + V_FIELD * (VERB_K_CHGL) + L_FIELD * (4), CH$PTR (UPLIT ('CHGL'))),
CHGU_VERB = UPLIT (
CHGL_VERB - ADDR_BASE + V_FIELD * (VERB_K_CHGU) + L_FIELD * (4), CH$PTR (UPLIT ('CHGU'))),
C_VERBS = UPLIT (
CHGU_VERB - ADDR_BASE + V_FIELD * (VERB_K_CHGC) + L_FIELD * (4), CH$PTR (UPLIT ('CHGC'))),
D_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_DELETE) + L_FIELD * (1), CH$PTR (UPLIT ('D'))),
DUPC_VERB = UPLIT (
D_VERB - ADDR_BASE + V_FIELD * (VERB_K_DUPC) + L_FIELD * (4), CH$PTR (UPLIT ('DUPC'))),
DMOV_VERB = UPLIT (
DUPC_VERB - ADDR_BASE + V_FIELD * (VERB_K_DMOV) + L_FIELD * (4), CH$PTR (UPLIT ('DMOV'))),
DLWC_VERB = UPLIT (
DMOV_VERB - ADDR_BASE + V_FIELD * (VERB_K_DLWC) + L_FIELD * (4), CH$PTR (UPLIT ('DLWC'))),
DEFK_VERB = UPLIT (
DLWC_VERB - ADDR_BASE + V_FIELD * (VERB_K_DEFK) + L_FIELD * (4), CH$PTR (UPLIT ('DEFK'))),
DATE_VERB = UPLIT (
DEFK_VERB - ADDR_BASE + V_FIELD * (VERB_K_DATE) + L_FIELD * (4), CH$PTR (UPLIT ('DATE'))),
D_VERBS = UPLIT (
DATE_VERB - ADDR_BASE + V_FIELD * (VERB_K_DESEL) + L_FIELD * (5), CH$PTR (UPLIT ('DESEL'))),
EX_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_EXIT) + L_FIELD * (2), CH$PTR (UPLIT ('EX'))),
E_VERBS = UPLIT (
EX_VERB - ADDR_BASE + V_FIELD * (VERB_K_EXT) + L_FIELD * (3), CH$PTR (UPLIT ('EXT'))),
F_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_FILL) + L_FIELD * (4), CH$PTR (UPLIT ('FILL'))),
H_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_HELP) + L_FIELD * (4), CH$PTR (UPLIT ('HELP'))),
I_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_INSERT) + L_FIELD * (1), CH$PTR (UPLIT ('I'))),
K_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_KS) + L_FIELD * (2), CH$PTR (UPLIT ('KS'))),
P_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_PASTE) + L_FIELD * (5), CH$PTR (UPLIT ('PASTE'))),
Q_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_QUIT) + L_FIELD * (4), CH$PTR (UPLIT ('QUIT'))),
R_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_REPLACE) + L_FIELD * (1), CH$PTR (UPLIT ('R'))),
R_VERBS = UPLIT (
R_VERB - ADDR_BASE + V_FIELD * (VERB_K_REF) + L_FIELD * (3), CH$PTR (UPLIT ('REF'))),
S_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_SUBS) + L_FIELD * (1), CH$PTR (UPLIT ('S'))),
SN_VERB = UPLIT (
S_VERB - ADDR_BASE + V_FIELD * (VERB_K_SN) + L_FIELD * (2), CH$PTR (UPLIT ('SN'))),
SHR_VERB = UPLIT (
SN_VERB - ADDR_BASE + V_FIELD * (VERB_K_SHR) + L_FIELD * (3), CH$PTR (UPLIT ('SHR'))),
SHL_VERB = UPLIT (
SHR_VERB - ADDR_BASE + V_FIELD * (VERB_K_SHL) + L_FIELD * (3), CH$PTR (UPLIT ('SHL'))),
SEL_VERB = UPLIT (
SHL_VERB - ADDR_BASE + V_FIELD * (VERB_K_SEL) + L_FIELD * (3), CH$PTR (UPLIT ('SEL'))),
S_VERBS = UPLIT (
SEL_VERB - ADDR_BASE + V_FIELD * (VERB_K_SSEL) + L_FIELD * (4), CH$PTR (UPLIT ('SSEL'))),
TI_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_TI) + L_FIELD * (2), CH$PTR (UPLIT ('TI'))),
TD_VERB = UPLIT (
TI_VERB - ADDR_BASE + V_FIELD * (VERB_K_TD) + L_FIELD * (2), CH$PTR (UPLIT ('TD'))),
TC_VERB = UPLIT (
TD_VERB - ADDR_BASE + V_FIELD * (VERB_K_TC) + L_FIELD * (2), CH$PTR (UPLIT ('TC'))),
TOP_VERB = UPLIT (
TC_VERB - ADDR_BASE + V_FIELD * (VERB_K_TOP) + L_FIELD * (3), CH$PTR (UPLIT ('TOP'))),
TAB_VERB = UPLIT (
TOP_VERB - ADDR_BASE + V_FIELD * (VERB_K_TAB) + L_FIELD * (3), CH$PTR (UPLIT ('TAB'))),
TADJ_VERB = UPLIT (
TAB_VERB - ADDR_BASE + V_FIELD * (VERB_K_TADJ) + L_FIELD * (4), CH$PTR (UPLIT ('TADJ'))),
T_VERBS = UPLIT (
TADJ_VERB - ADDR_BASE + V_FIELD * (VERB_K_TGSEL) + L_FIELD * (5), CH$PTR (UPLIT ('TGSEL'))),
UNDW_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_UNDW) + L_FIELD * (4), CH$PTR (UPLIT ('UNDW'))),
UNDL_VERB = UPLIT (
UNDW_VERB - ADDR_BASE + V_FIELD * (VERB_K_UNDL) + L_FIELD * (4), CH$PTR (UPLIT ('UNDL'))),
U_VERBS = UPLIT (
UNDL_VERB - ADDR_BASE + V_FIELD * (VERB_K_UNDC) + L_FIELD * (4), CH$PTR (UPLIT ('UNDC'))),
X_VERBS = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_XLATE) + L_FIELD * (5), CH$PTR (UPLIT ('XLATE'))),
CARET_VERB = UPLIT (
END_VERBS - ADDR_BASE + V_FIELD * (VERB_K_CC) + L_FIELD * (1), CH$PTR (UPLIT ('^')));
BIND
VERB_TABLE = UPLIT (
A_VERBS - ADDR_BASE,
B_VERBS - ADDR_BASE,
C_VERBS - ADDR_BASE,
D_VERBS - ADDR_BASE,
E_VERBS - ADDR_BASE,
F_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
H_VERBS - ADDR_BASE,
I_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
K_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
P_VERBS - ADDR_BASE,
Q_VERBS - ADDR_BASE,
R_VERBS - ADDR_BASE,
S_VERBS - ADDR_BASE,
T_VERBS - ADDR_BASE,
U_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
X_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
END_VERBS - ADDR_BASE,
CARET_VERB - ADDR_BASE);
!+
! The following are keywords which are entities.
!
! The values must be separated by two so we can add the direction to
! the entity for use as a case index.
!-
BIND
END_ENTITY = UPLIT (0, 0),
BW_ENT = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_BW) + L_FIELD * (2), CH$PTR (UPLIT ('BW'))),
BR_ENT = UPLIT (
BW_ENT - ADDR_BASE + V_FIELD * (ENT_K_BR) + L_FIELD * (2), CH$PTR (UPLIT ('BR'))),
BL_ENT = UPLIT (
BR_ENT - ADDR_BASE + V_FIELD * (ENT_K_BL) + L_FIELD * (2), CH$PTR (UPLIT ('BL'))),
BPAR_ENT = UPLIT (
BL_ENT - ADDR_BASE + V_FIELD * (ENT_K_BPAR) + L_FIELD * (4), CH$PTR (UPLIT ('BPAR'))),
BSEN_ENT = UPLIT (
BPAR_ENT - ADDR_BASE + V_FIELD * (ENT_K_BSEN) + L_FIELD * (4), CH$PTR (UPLIT ('BSEN'))),
B_ENTS = UPLIT (
BSEN_ENT - ADDR_BASE + V_FIELD * (ENT_K_BPAGE) + L_FIELD * (5), CH$PTR (UPLIT ('BPAGE'))),
C_ENTS = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_CHAR) + L_FIELD * (1), CH$PTR (UPLIT ('C'))),
EW_ENT = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_EW) + L_FIELD * (2), CH$PTR (UPLIT ('EW'))),
EL_ENT = UPLIT (
EW_ENT - ADDR_BASE + V_FIELD * (ENT_K_EL) + L_FIELD * (2), CH$PTR (UPLIT ('EL'))),
ER_ENT = UPLIT (
EL_ENT - ADDR_BASE + V_FIELD * (ENT_K_ER) + L_FIELD * (2), CH$PTR (UPLIT ('ER'))),
EPAR_ENT = UPLIT (
ER_ENT - ADDR_BASE + V_FIELD * (ENT_K_EPAR) + L_FIELD * (4), CH$PTR (UPLIT ('EPAR'))),
ESEN_ENT = UPLIT (
EPAR_ENT - ADDR_BASE + V_FIELD * (ENT_K_ESEN) + L_FIELD * (4), CH$PTR (UPLIT ('ESEN'))),
E_ENTS = UPLIT (
ESEN_ENT - ADDR_BASE + V_FIELD * (ENT_K_EPAGE) + L_FIELD * (5), CH$PTR (UPLIT ('EPAGE'))),
L_ENTS = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_LINE) + L_FIELD * (1), CH$PTR (UPLIT ('L'))),
N_ENTS = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_NL) + L_FIELD * (2), CH$PTR (UPLIT ('NL'))),
PAR_ENT = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_PAR) + L_FIELD * (3), CH$PTR (UPLIT ('PAR'))),
P_ENTS = UPLIT (
PAR_ENT - ADDR_BASE + V_FIELD * (ENT_K_PAGE) + L_FIELD * (4), CH$PTR (UPLIT ('PAGE'))),
SR_ENT = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_SR) + L_FIELD * (2), CH$PTR (UPLIT ('SR'))),
S_ENTS = UPLIT (
SR_ENT - ADDR_BASE + V_FIELD * (ENT_K_SEN) + L_FIELD * (3), CH$PTR (UPLIT ('SEN'))),
V_ENTS = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_VERT) + L_FIELD * (1), CH$PTR (UPLIT ('V'))),
W_ENTS = UPLIT (
END_ENTITY - ADDR_BASE + V_FIELD * (ENT_K_WORD) + L_FIELD * (1), CH$PTR (UPLIT ('W')));
BIND
ENTITY_TABLE = UPLIT (
B_ENTS - ADDR_BASE,
C_ENTS - ADDR_BASE,
END_ENTITY - ADDR_BASE,
E_ENTS - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
L_ENTS - ADDR_BASE,
END_ENTITY - ADDR_BASE,
N_ENTS - ADDR_BASE,
END_ENTITY - ADDR_BASE,
P_ENTS - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
S_ENTS - ADDR_BASE,
END_ENTITY - ADDR_BASE,
END_ENTITY - ADDR_BASE,
V_ENTS - ADDR_BASE,
W_ENTS - ADDR_BASE);
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$KEY_WORD - look for a key word'
GLOBAL ROUTINE EDT$$KEY_WORD ( ! Look for a key word
TABLE_NO, ! 1 = verb table, 2 = entity table
KEY_NUM ! Key number
) : NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine scans a table of keywords, attempting to find a match
! in the current command buffer pointed to by CMD_PTR .
! The comparison is case blind.
!
! FORMAL PARAMETERS:
!
! TABLE_NO The number of the keyword table to use. 1 = use the
! verb table, 2 = use the entity table.
!
! KEY_NUM The returned value for the number of the entity or
! verb which matched from the table. Zero indicates
! no match.
!
!
! IMPLICIT INPUTS:
!
! CMD_END
! CMD_PTR
!
! IMPLICIT OUTPUTS:
!
! CMD_PTR
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS:
!
! NONE
!
!--
BEGIN
EXTERNAL
CHAR_INFO : BLOCKVECTOR [256, 1], !Information about each character
CMD_END, ! End of command pointer
CMD_PTR; ! Command string pointer
LOCAL
KW_POINTER,
FIRST_CHAR,
TABLE_OFFSET,
FOUND,
TABLE,
TABLE_PTR : REF BLOCK [ ] FIELD (KEY_WORD_FIELD),
C_POINTER;
.KEY_NUM = 0;
C_POINTER = .CMD_PTR;
FIRST_CHAR = CH$RCHAR_A (C_POINTER);
IF .CHAR_INFO [.FIRST_CHAR, CI_LC] THEN FIRST_CHAR = .FIRST_CHAR - %C'a' + %C'A';
CASE .TABLE_NO FROM 1 TO 2 OF
SET
[1] :
BEGIN
IF ((.FIRST_CHAR LSS %C'A') OR (.FIRST_CHAR GTR %C'^')) THEN RETURN;
TABLE = VERB_TABLE;
TABLE_OFFSET = (.FIRST_CHAR - %C'A');
TABLE_PTR = .(.TABLE + .TABLE_OFFSET) + ADDR_BASE;
END;
[2] :
BEGIN
IF ((.FIRST_CHAR LSS %C'B') OR (.FIRST_CHAR GTR %C'W')) THEN RETURN;
TABLE = ENTITY_TABLE;
TABLE_OFFSET = (.FIRST_CHAR - %C'B');
TABLE_PTR = .(.TABLE + .TABLE_OFFSET) + ADDR_BASE;
END;
[OUTRANGE] :
ASSERT (0,0);
TES;
WHILE (.TABLE_PTR [KEY_WORD_LEN] NEQ 0) DO
BEGIN
KW_POINTER = .TABLE_PTR [KEY_WORD_POINTER];
C_POINTER = .CMD_PTR;
FOUND = 1;
IF CH$PTR_LEQ (CH$PLUS (.C_POINTER, .TABLE_PTR [KEY_WORD_LEN]), .CMD_END)
THEN
BEGIN
INCR I FROM 1 TO .TABLE_PTR [KEY_WORD_LEN] DO
BEGIN
LOCAL
CHAR;
CHAR = CH$RCHAR_A (C_POINTER);
IF .CHAR_INFO [.CHAR, CI_LC] THEN CHAR = .CHAR - %C'a' + %C'A';
IF (.CHAR NEQ CH$RCHAR_A (KW_POINTER)) THEN FOUND = 0;
END;
IF .FOUND
THEN
BEGIN
.KEY_NUM = .TABLE_PTR [KEY_WORD_NUM];
!+
! Skip over the keyword.
!-
CMD_PTR = CH$PLUS (.CMD_PTR, .TABLE_PTR [KEY_WORD_LEN]);
RETURN;
END;
END;
TABLE_PTR = .TABLE_PTR [KEY_WORD_NEXT] + ADDR_BASE;
END;
RETURN;
END;
END
ELUDOM