|
|
DataMuseum.dkPresents historical artifacts from the history of: Bogika Butler |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Bogika Butler Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 11392 (0x2c80)
Types: TextFile
Names: »LNKDF4.BAK«
└─⟦d36b687c5⟧ Bits:30009789/_.ft.Ibm2.50007363.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »LNKDF4.BAK«
(******************************************************************************)
(* *)
(* Copyright (1985) by Metanic Aps., Denmark *)
(* *)
(* Author: Lars Gregers Jakobsen. *)
(* *)
(******************************************************************************)
(* This include file contains the declarations for access
procedures used by pass one.
*)
PROCEDURE NMTP(VAR Status: StatusType
;VAR NameReference: NameTableIndexType
; SymbolName: SymbolNameType
);
VAR
I: SymbolNameIndexType;
BEGIN (*NMTP*)
WITH SymbolName DO
BEGIN
IF CurrentNameTableIndex + Length > MaxNameTableIndex THEN
Status := Status + (.NameTableOverFlow.)
ELSE
BEGIN
Namereference := CurrentNameTableIndex;
NameTable(.CurrentNameTableIndex.) := Length;
FOR I := 1 TO Length DO
NameTable(.CurrentNameTableIndex + I.) := Name(.I.);
CurrentNameTableIndex := CurrentNameTableIndex + Length + 1;
END;
IF test((.0,9.)) THEN
BEGIN
write(TestOut, 'NMTP '); TSTstat(Status); TSTindt;
writeln(TestOut, 'Length=', Length:1);
TSTindt; TSTindt; TSTindt; TSTnmt(NameReference);
END;
END
END; (*NMTP*)
FUNCTION NMTfail( NameReference: NameTableIndexType
; SymbolName: SymbolNameType
): boolean;
(* NMTfail returns one of the following values:
FALSE: If the exact same symbolname was found in NMT - i.e.
NameReference <> 0 AND
NMT(.NameReference.) = SymbolName.Length AND
FOR i = 1 TO length:
NMT(.NameReference+i.) = SymbolName.Name(.i.)
OR If an empty entry was found in NMT - i.e.
NameReference = 0.
TRUE: In all other cases.
*)
VAR
I: SymbolNameIndexType;
BEGIN (*NMTS*)
WITH SymbolName DO
BEGIN
IF NameReference = 0 THEN
NMTfail := false
ELSE
IF length <> NameTable(.NameReference.) THEN
NMTfail := true
ELSE
BEGIN
I := 1;
WHILE (I <= length) and
( Name(.I.) = NameTable(.NameReference + I.) ) DO
I := I + 1;
NMTfail := I <= Length
END;
IF test((.0,9.)) THEN
BEGIN
writeln(TestOut, 'NMTfail ', 'NameRef=', NameReference:1);
TSTindt; TSTindt; TSTindt; TSTsymbol(SymbolName);
TSTindt; TSTindt; TSTindt; TSTnmt(NameReference);
TSTindt; TSTindt; TSTindt; write(TestOut, '(I <= Length)=');
TSTbool(I<=Length); TSTln;
END;
END
END; (*NMTS*)
PROCEDURE NMTG( NameReference: NameTableIndexType
;VAR SymbolName: SymbolNameType
);
VAR
I: SymbolNameIndexType;
BEGIN (*NMTG*)
WITH SymbolName DO
BEGIN
Length := NameTable(.NameReference.);
FOR I := 1 TO Length DO
Name(.I.) := NameTable(. NameReference + I .);
IF test((.0,9,13.)) THEN
BEGIN
write(TestOut, 'NMTG '); TSTindt;
write(TestOut, 'NameRef=', NameReference:1); TSTindt;
TSTsymbol(SymbolName);
END;
END
END; (*NMTG*)
PROCEDURE Hash(VAR SymbolName: SymbolNameType
;VAR SBTInx: SymbolTableIndexType
);
BEGIN (*HASH*)
SBTInx := 1
END; (*HASH*)
PROCEDURE SBTS(VAR Status: StatusType
;VAR SBTInx: SymbolTableIndexType
; SymbolName: SymbolNameType
);
(* SBTS returns one of the following Status codes:
Success: SymbolName found in SBT. SBTInx reflects
SymbolName.
NotFound: SymbolName NOT found in SBT. SBTInx
indicates the entry into which Symbol should be
registered.
SymbolTableOverFlow: SymbolName NOT found in SBT.
SBTInx is not valid. There
is no room in SBT for further updates.
Search SBT to find the Entry for SYMBOLNAME retaining the index
of the first vacant record as SYMBOLTABLEENTRYNO if the search
fails. Otherwise return found index. Set Status to Success or
NotFound according to outcome. Set Status to SBTOverFlow if
no vacant is available and symbol is not found.
A SBT record is vacant if Namereference = 0.
A SBT record referring to section 0 holds an absolute symbol if
namreference is non zero.
*)
BEGIN (*SBTS*)
(* Assume existence of entry in SBT with NameReference = 0 *)
Hash(SymbolName, SBTInx);
IF test((.0,9.)) THEN
BEGIN
write(TestOut, 'SBTS-1 '); TSTstat(Status); TSTln;
TSTindt; TSTindt; TSTindt; TSTsbt(SBTInx); TSTln;
END;
WHILE NMTfail(Symboltable(.SBTInx.).NameReference, SymbolName) DO
BEGIN
(* HASH NEXT TRY *)
IF MaxNooSymbols <= SBTInx THEN
SBTInx := 0;
SBTInx := SBTInx + 1;
IF test((.0,9.)) THEN
BEGIN
write(TestOut, 'SBTS-2 '); TSTstat(Status); TSTln;
TSTindt; TSTindt; TSTindt; TSTsbt(SBTInx); TSTln;
END;
END;
IF SymbolTable(.SBTInx.).NameReference = 0 THEN
IF CurrentSymbolCount >= MaxNooSymbols - 1 THEN
Status := Status + (.SymbolTableOverFlow.)
ELSE
Status := Status + (.NotFound.);
IF test((.0,10.)) THEN
BEGIN
write(TestOut, 'SBTS-3 '); TSTstat(Status); TSTln;
TSTindt; TSTindt; TSTindt; TSTsbt(SBTInx); TSTln;
END;
END; (*SBTS*)
PROCEDURE SBTEX(VAR Status: StatusType
;VAR SymbolTableEntryNo: SymbolTableIndexType
; SymbolName: SymbolNameType
; P_ModuleNo: ModuleTableIndexType
(* ; SCTBase: SectionTableIndexType *)
; P_SegmentNo: SegmentNoType
; Item: i32
);
VAR
LocalNameReference: NameTableIndexType;
(* LocalSectionNo: ModuleSectionReferenceType; *)
BEGIN (*SBTEX*)
(* IF SectionNo = 0 THEN
LocalSectionNo := - ModuleNo
ELSE
LocalSectionNo := SectionNo + SCTBase - 1;
*)
SBTS(Status, SymbolTableEntryNo, SymbolName);
IF SymbolTableOverFlow IN Status THEN
BEGIN END
ELSE IF NotFound IN Status THEN
BEGIN (*Symbol is NOT in SBT and thus not resolved*)
Status := Status - (.NotFound.);
NMTP(Status, LocalNameReference, SymbolName);
IF not (NameTableOverFlow IN Status) THEN
BEGIN
CurrentSymbolCount := CurrentSymbolCount + 1;
WITH SymbolTable(.SymbolTableEntryNo.)
,ValueTable(.SymbolTableEntryNo.) DO
BEGIN
ModuleNo := P_ModuleNo;
(* Section := LocalSectionNo;*)
NameReference := LocalNameReference;
IF LatestInsert <> 0 THEN
SymbolTable(.LatestInsert.).SortLink := SymbolTableEntryNo;
LatestInsert := SymbolTableEntryNo;
SortLink := SymbolTableEntryNo;
SegmentNo := P_SegmentNo;
(* Resolved := true; *)
CurrentUrsCount := CurrentUrsCount - 1;
Value := Item
END (*WITH ... DO*)
END
END
ELSE (* SUCCESS: Symbol is in SBT*)
WITH SymbolTable(.SymbolTableEntryNo.)
,ValueTable(.SymbolTableEntryNo.) DO
BEGIN
IF SegmentNo > UnResolved THEN
Status := Status + (.DuplicateExportSymbol.)
ELSE (*Symbol NOT previously resolved i.e. imported only*)
BEGIN
ModuleNo := P_ModuleNo;
(* Section := LocalSectionNo;*)
IF LatestInsert <> 0 THEN
SymbolTable(.LatestInsert.).SortLink := SymbolTableEntryNo;
LatestInsert := SymbolTableEntryNo;
SortLink := SymbolTableEntryNo;
SegmentNo := P_SegmentNo;
(* Resolved := true; *)
CurrentUrsCount := CurrentUrsCount - 1;
Value := Item
END
END; (*WITH ... DO*)
IF test((.0,10.)) THEN
BEGIN
write(TestOut, 'SBTEX '); TSTstat(Status);
TSTindt; TSTsymbol(SymbolName);
TSTindt; TSTindt; TSTindt; TSTsbt(SymbolTableEntryNo); TSTln;
TSTindt; TSTindt; TSTindt; TSTvlt(SymbolTableEntryNo); TSTln;
END;
END; (*SBTEX*)
PROCEDURE SBTIM(VAR Status: StatusType
;VAR SymbolTableEntryNo: SymbolTableIndexType
;VAR SymbolName: SymbolNameType
; P_ModuleNo: ModuleTableIndexType
);
VAR
LocalNameReference: NameTableIndexType;
BEGIN (*SBTIM*)
SBTS(Status, SymbolTableEntryNo, SymbolName);
IF SymbolTableOverFlow IN Status THEN
BEGIN END
ELSE
BEGIN
IF NotFound IN Status THEN
BEGIN
Status := Status - (.NotFound.);
NMTP(Status, LocalNameReference, SymbolName);
IF not (NameTableOverFlow IN Status) THEN
BEGIN
CurrentSymbolCount := CurrentSymbolCount + 1;
WITH SymbolTable(.SymbolTableEntryNo.)
,ValueTable(.SymbolTableEntryNo.) DO
BEGIN
ModuleNo := P_ModuleNo;
(* Section := - ModuleNo;*)
NameReference := LocalNameReference;
SortLink := 0;
SegmentNo := UnResolved;
(* Resolved := false; *)
CurrentUrsCount := CurrentUrsCount + 1;
Value := 0;
END
END
END;
EITP(Status,SymbolTableEntryNo)
END;
IF test((.0,10.)) THEN
BEGIN
write(TestOut, 'SBTIM '); TSTstat(Status); TSTln;
TSTindt; TSTindt; TSTindt; TSTsbt(SymbolTableEntryNo); TSTln;
TSTindt; TSTindt; TSTindt; TSTvlt(SymbolTableEntryNo); TSTln;
END;
END; (*SBTIM*)
«eof»