1
0
mirror of https://github.com/PDP-10/stacken.git synced 2026-03-07 11:17:06 +00:00
Files
Lars Brinkhoff 6e18f5ebef Extract files from tape images.
Some tapes could not be extracted.
2021-01-29 10:47:33 +01:00

184 lines
5.2 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!++
! 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 %;
!++
! CH$LEN finds the length of an ASCIZ string
!--
MACRO
ch$len(zptr) =
CH$DIFF(CH$FIND_CH(132,zptr,%O'0'), zptr) %;
!++
! 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 %;