Trailing-Edge
-
PDP-10 Archives
-
bb-l014w-bm_tops20_v7_0_atpch_23
-
autopatch/tbl.r36
There are 14 other files named tbl.r36 in the archive. Click here to see a list.
! COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1985, 1989.
! 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.
!++
! The following macro initializes a tbluk table. It may be
! used in the following manner:
!
! STACKLOCAL !or OWN
! tbl: tbluk_table(100);
!
! This case allocates space for a tbluk_table capable of
! holding 100 elements.
!
! STACKLOCAL
! tbl: tbluk_table(0, !Size is 0 (minimum size)
! 'Abort',0,(), !key='Abort', Data=0, No flags
! 'Bomb',1,(INV), !Key='Bomb', Data=1, INVisible
! 'Cr',-1,(NOR,INV), !Key='Cr', Invisible,Norec
! 'Crash,2,() !key='Crash', Data=2, No flags
! );
! This form reserves a table with only those four entries.
! INV, NOR, and ABR are defined as flags which set the
! appropriate bits in the argument block. If the size field had
! been greater than 0, then the table would have been allocated
! to hold that many entries instead of the minimum size. This
! allows tbluk_tables to have room for expansion if desired.
!
!--
COMPILETIME
args_ = 0,
siz_ = 0;
MACRO
tbluk_table(siz)[] =
%ASSIGN(args_,(%LENGTH - 1) / 3)
%IF siz LEQ 0
%THEN
%ASSIGN(siz_,args_)
%ELSE
%ASSIGN(siz_,siz) %FI
tbl[siz_] INITIAL(args_ ^ 18 + siz_,
%IF NOT %NULL(%REMAINING)
%THEN tblent(%REMAINING) , %FI
REP (siz_ - args_) OF (0)) %;
MACRO
tblent(key,val,flgs)[] = !Used by TBLUK_TABLE macro
UPLIT(tblflg(%remove(flgs))
%ASCIZ key) ^ 18 + val
%IF NOT %NULL(%REMAINING) %THEN ,tblent(%REMAINING) %FI %;
MACRO
tblflg(flg)[] = !Used by TBLENT macro
%IF NOT %NULL(flg)
%THEN
%IF %COUNT EQL 0 %THEN cm_fw %FI
%IF %IDENTICAL(flg,INV) %THEN OR cm_inv %ELSE
%IF %IDENTICAL(flg,NOR) %THEN OR cm_nor %ELSE
%IF %IDENTICAL(flg,ABR) %THEN OR cm_abr %ELSE
OR flg %FI %FI %FI
%IF %NULL(%REMAINING) %THEN , %FI
tblflg(%REMAINING)
%FI %;
!++
! The following fields and macros describe the bits and
! fields in a TBLUK table ENTry, and in the ARGument block.
!--
FIELD
arg_fields =
SET
ARG_INV = [0,0,1,0], !cm%inv
ARG_NOREC= [0,1,1,0], !cm%nor
ARG_ABR = [0,2,1,0], !cm%abr
ARG_FLAG = [0,28,8,0] !cm%fw
TES,
ent_fields =
SET
ENT_WORD = [0,0,36,0], !The whole word
ENT_KEY = [0,18,18,0], !The key address
ENT_DATA = [0,0,18,0] !The data field
TES;
MACRO
tbl_arg_block =
BLOCK[1] FIELD(arg_fields) %,
tbl_entry =
BLOCK[1] FIELD(ent_fields) %;
!++
! The following macro describes the fields used in the TBL
! data structure.
!--
MACRO
tbl_maximum_entries = 0,0,18 %,
tbl_actual_entries = 0,18,18 %,
tbl_word = 0,36 %,
tbl_key = 18,18 %,
tbl_data = 0,18 %;
!++
! The following structure defines a tbluk table
!--
LITERAL
def_tbl_siz = 50;
STRUCTURE
tbl [i,j,k; tbl_siz=def_tbl_siz] =
[tbl_siz + 1]
(tbl + i)<j,k,0>;
!++
! Return codes for TBL_LOOKUP, TBL_ADD, and TBL_DELETE
!--
LITERAL
tbl_nomatch = 0, !Tbl_lookup
tbl_exactmatch = 1,
tbl_ambiguous = 2,
tbl_abreviation = 3,
tbl_full = 0, !Tbl_add
tbl_entry_exists = 2,
tbl_empty = 0, !Tbl_delete
tbl_invalid_index = 2,
tbl_ok = 1, !Tbl_ok can be returned by both
!TBL_ADD and TBL_DELETE
tbl_lessthan = -1, !Only used internally
tbl_equalto = 0,
tbl_greaterthan = 1;
!++
! KEY$ returns the address of the ASCIZ key string from the
! tbluk_table. It knows about the ARG_FLAG and the two
! different formats for the argument block.
!
! TT: The address of the tbluk table.
! II: The value of the index.
! FLG: The address to return the flags in (May be omitted)
!--
MACRO
key$(tt,ii,flg) =
BEGIN
LOCAL
argument: REF tbl_arg_block;
argument = .tt[ii, TBL_KEY];
IF .argument[ARG_FLAG] EQL 1
THEN
BEGIN
%IF NOT %NULL(flg) %THEN flg = .argument[ARG_NOREC]; %FI
.argument + 1
END
ELSE
BEGIN
%IF NOT %NULL(flg) %THEN flg = 0; %FI
.argument
END
END %;
!++
! SEQ generates a sequence of integers
!
! min, min+1, min+2, ... max
!
! It is used to generate the UpperCase translation TABle.
!--
MACRO
seq(min,max)[] =
min
%IF min LSS max %THEN , seq(min + 1, max) %FI %;