(******************************************************************************) (* *) (* Copyright (1985) by Metanic Aps., Denmark *) (* *) (* Author: Lars Gregers Jakobsen. *) (* *) (******************************************************************************) (* SEGMENT LnkDF2X; *) (* Segment LnkDF2X holds the access primitives used by the linker to access input and output files. *) (* On resetting (FILRST) the File sector number 0 (zero) is brought into F^ and sector number (S) is initialized to 0 (zero). The file pointer (P) is initialized to 0 too and it always points to the next byte to be read. If a read operation causes the file pointer to exceed maxsectorindex and no end of file condition exists a new sector will be fetched (renew) and P will be updated accordingly. If an end of file condition exists it will persist throughout (thus identifiable) and P will be set to 0 (zero). *) (* $I B:lnkDC0.pas Declarations of global constants, types, and commons *) (* $I A:PrTstExt.pas External Decl. of standard test procedures *) (* $I B:LnkDC1.pas External Decl. of global test output primitives *) (*$I B:LNKDF8.PAS Object file access primitives *) (*$I B:LNKDF7.PAS Log file access primitives *) FUNCTION OPTLFK: LogFileKindType; BEGIN (*OPTLFK*) optlfk := OptionTable.LogFileKind; END; (*OPTLFK*) PROCEDURE FNTP(VAR Status: StatusType ; FileName: FileNameType ); BEGIN (*FNTP*) IF CurFileNo < MaxNooInputFiles THEN BEGIN CurFileNo := CurFileNo + 1; FileNameTable(.CurFileNo.) := FileName; END ELSE Status := Status + (.FileNameTableOverFlow.); IF test((.0,6.)) THEN BEGIN write(TestOut, 'FNTP '); TSTstat(Status); TSTindt; TSTfnt(CurFileNo); TSTln END END; (*FNTP*) PROCEDURE FNTG(VAR Status: StatusType ; Inx: FileNameTableIndexType ;VAR FileName: FileNameType ); BEGIN (*FNTG*) IF test((.0,6.)) THEN BEGIN write(TestOut, 'FNTG '); TSTfnt(Inx); TSTln END; FileName := FileNameTable(.Inx.); END; (*FNTG*) PROCEDURE EITP(VAR Status: StatusType ; SymbolTableEntryNo: SymbolTableIndexType ); BEGIN (*EITP*) IF CurExternalImportSymbolNo < MaxNooExternalImportSymbols THEN BEGIN CurExternalImportSymbolNo := CurExternalImportSymbolNo + 1; ExternalImportTable(.CurExternalImportSymbolNo .).SymbolNo := SymbolTableEntryNo END ELSE Status := Status + (.ExternalImportTableOverFlow.); IF test((.0,7.)) THEN BEGIN write(TestOut, 'EITP '); TSTstat(Status); TSTln; TSTeit(CurExternalImportSymbolNo) END END; (*EITP*) (* ModuleTable *) PROCEDURE MDTA(VAR Status: StatusType ;VAR ModuleNo: ModuleTableIndexType ; ModuleCount: ModuleTableIndexType ); BEGIN (*MDTA*) IF CurModuleNo > MaxNooModules - ModuleCount THEN Status := Status + (.ModuleTableOverFlow.) ELSE BEGIN ModuleNo := CurModuleNo + 1; CurModuleNo := CurModuleNo + ModuleCount; END; END; (*MDTA*) (* SectionTable *) PROCEDURE SCTA(VAR Status: StatusType ;VAR SectionNo: SectionTableIndexType ; SectionCount: SectionTableIndexType ); BEGIN (*SCTA*) IF SCTOffset > MaxNooSections - SectionCount THEN Status := Status + (.SectionTableOverFlow.) ELSE BEGIN SectionNo := SCTOffset + 1; SCTOffset := SCTOffset + SectionCount; END END; (*SCTA*) PROCEDURE SCTP(VAR Status: StatusType ; P_ModuleNo: ModuleTableIndexType ; P_SegmentNo: SegmentNoType ; SGD_Record: ObjectRecordType ); BEGIN (*SCTP*) IF SCTOffset >= MaxNooSections THEN Status := Status + (.Sectiontableoverflow.) ELSE BEGIN SCTOffset := SCTOffset + 1; WITH SectionTable(.SCTOffset.), SGD_Record DO BEGIN ModuleNo := P_ModuleNo; SegmentNo := P_SegmentNo; ImageSize := SGD_Image; RldSize := SGD_Rld; NooInternalImportSymbols := SGD_NooIntImportSymbols; RelocationConstant := 0 END; END; IF test((.0,6.)) THEN BEGIN write(TestOut, 'SCTP '); TSTstat(Status); TSTindt; TSTsct(SCTOffset); END END; (*SCTP*) PROCEDURE SCTG(VAR Status: StatusType ; SectionNo: SectionTableIndexType ;VAR Section: SectionTableRecordType ); BEGIN (*SCTG*) Section := SectionTable(.SectionNo.) END; (*SCTG*) PROCEDURE SCTWB(VAR Status: StatusType ; SectionNo: SectionTableIndexType ; Section: SectionTableRecordType ); BEGIN (*SCTWB*) SectionTable(.SectionNo.) := Section; IF test((.0,6.)) THEN BEGIN write(TestOut, 'SCTWB '); TSTstat(Status); TSTln; TSTindt; TSTsct(SCTOffset); END END; (*SCTWB*) FUNCTION SCTGSG( SectionNo: SectionTableIndexType ): RelocationIndicatorType; BEGIN (*SCTGSG*) SCTGSG := SectionTable(.SectionNo.).SegmentNo END; (*SCTGSG*) FUNCTION SCTGRC( SectionNo: SectionTableIndexType ): SizeType; BEGIN (*SCTGRC*) SCTGRC := SectionTable(.SectionNo.).RelocationConstant END; (*SCTGRC*) (* BEGIN (*LNKDF2X SEGMENT*) (* END. (*LNKDF2X SEGMENT*)