(******************************************************************************)
(*                                                                            *)
(*   Copyright (1985) by Metanic Aps., Denmark                                *)
(*                                                                            *)
(*   Author: Lars Gregers Jakobsen.                                           *)
(*                                                                            *)
(******************************************************************************)

   PROCEDURE Pass1(VAR Status: StatusType
                  ;VAR TargetFile: FileType
                  ;VAR LogFile: LogFileType
                  );

      (* Pass1 of the linker performs the gathering of export and
         import information from the input files as well as calculation
         of final memory map and all operations on the symbol table
         including reporting to the log file.
            The following statusvalues may be returned:
         Success: ok. All other parameters meaningful.

      *)


      VAR
         SymbolTable: SymbolTableType;
         LatestInsert: SymbolTableIndexType; (*Points to SBT entry of latest insert*)
         CurrentSymbolCount: SymbolTableIndexType; (*Number of SBT entries currently used*)

         NameTable: NameTableType;
         CurrentNameTableIndex: NameTableIndexType; (*Least index vacant  -
                                                      NOT count of strings*)


         (* MISC. VARIABLES *)

         SBTSubInx: SymbolTableSubIndexType;

(*#B#(*$I B:LnkDF3.pas   Definitions    of pass1 local test output primitives *)
(*$I B:LnkDF4.pas   Definitions    of pass1 local access primitives           *)

(*$I B:lnkp1-1.pas  getinputfiles                                             *)
(*$I B:lnkp1-2.pas  putmodule                                                 *)

     BEGIN (*PASS1*)

      (* Initialize local data structures *)
      FOR SBTSubInx := 1 TO MaxNooSymbols DO
         SymbolTable(.SBTSubInx.).NameReference := 0;
      LatestInsert := 0;
      CurrentSymbolCount := 0;
      CurrentNameTableIndex := 0;

      GetInputFiles(Status, LogFile);
      IF Status = (..) THEN
        BEGIN
         PutTargetFile(Status, TargetFile, LogFile);
        END;
     END;  (*PASS1*)

(*                                                                            *)
(*                                                                            *)
(******************************************************************************)
