pragma Source_File_Name (ada_main, Spec_File_Name => "b~gnatlink.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b~gnatlink.adb");

package body ada_main is
   pragma Warnings (Off);

   procedure Do_Finalize;
   pragma Import (C, Do_Finalize, "system__standard_library__adafinal");

   procedure adainit is
      E048 : Boolean; pragma Import (Ada, E048, "gnat__strings_E");
      E004 : Boolean; pragma Import (Ada, E004, "system__standard_library_E");
      E010 : Boolean; pragma Import (Ada, E010, "system__secondary_stack_E");
      E021 : Boolean; pragma Import (Ada, E021, "ada__exceptions_E");
      E038 : Boolean; pragma Import (Ada, E038, "system__exceptions_E");
      E014 : Boolean; pragma Import (Ada, E014, "system__soft_links_E");
      E028 : Boolean; pragma Import (Ada, E028, "system__exception_table_E");
      E026 : Boolean; pragma Import (Ada, E026, "system__assertions_E");
      E002 : Boolean; pragma Import (Ada, E002, "gnatlink_E");
      E050 : Boolean; pragma Import (Ada, E050, "gnatvsn_E");
      E067 : Boolean; pragma Import (Ada, E067, "types_E");
      E057 : Boolean; pragma Import (Ada, E057, "fmap_E");
      E077 : Boolean; pragma Import (Ada, E077, "opt_E");
      E055 : Boolean; pragma Import (Ada, E055, "osint_E");
      E087 : Boolean; pragma Import (Ada, E087, "sdefault_E");
      E073 : Boolean; pragma Import (Ada, E073, "tree_io_E");
      E061 : Boolean; pragma Import (Ada, E061, "namet_E");
      E075 : Boolean; pragma Import (Ada, E075, "widechar_E");

      Restrictions : constant String :=
        "nnvvnnnvnnnnnnvnvnvvnvnvvnvnnnnvnnnvnvnnnnnnnvvvvnnnvvnv" &
        "nnnnnnnnnnnnnn" & ASCII.Nul;

      Interrupt_States : constant String :=
        "";

      procedure Set_Globals
        (Main_Priority            : Integer;
         Time_Slice_Value         : Integer;
         WC_Encoding              : Character;
         Locking_Policy           : Character;
         Queuing_Policy           : Character;
         Task_Dispatching_Policy  : Character;
         Restrictions             : System.Address;
         Interrupt_States         : System.Address;
         Num_Interrupt_States     : Integer;
         Unreserve_All_Interrupts : Integer;
         Exception_Tracebacks     : Integer;
         Zero_Cost_Exceptions     : Integer);
      pragma Import (C, Set_Globals, "__gnat_set_globals");

      procedure Install_Handler;
      pragma Import (C, Install_Handler, "__gnat_install_handler");

      Handler_Installed : Integer;
      pragma Import (C, Handler_Installed, "__gnat_handler_installed");
   begin
      Set_Globals
        (Main_Priority            => -1,
         Time_Slice_Value         => -1,
         WC_Encoding              => 'b',
         Locking_Policy           => ' ',
         Queuing_Policy           => ' ',
         Task_Dispatching_Policy  => ' ',
         Restrictions             => Restrictions'Address,
         Interrupt_States         => Interrupt_States'Address,
         Num_Interrupt_States     => 0,
         Unreserve_All_Interrupts => 0,
         Exception_Tracebacks     => 0,
         Zero_Cost_Exceptions     => 0);

      if Handler_Installed = 0 then
         Install_Handler;
      end if;

      E048 := True;
      System.Standard_Library'Elab_Spec;
      Ada.Exceptions'Elab_Spec;
      System.Exceptions'Elab_Spec;
      E038 := True;
      System.Soft_Links'Elab_Body;
      E014 := True;
      System.Secondary_Stack'Elab_Body;
      E010 := True;
      System.Exception_Table'Elab_Body;
      E028 := True;
      System.Assertions'Elab_Spec;
      E026 := True;
      E004 := True;
      Ada.Exceptions'Elab_Body;
      E021 := True;
      E050 := True;
      Types'Elab_Spec;
      E067 := True;
      Opt'Elab_Spec;
      Osint'Elab_Spec;
      Sdefault'Elab_Body;
      E087 := True;
      Tree_Io'Elab_Spec;
      E073 := True;
      E077 := True;
      E002 := True;
      Namet'Elab_Spec;
      Osint'Elab_Body;
      E055 := True;
      Fmap'Elab_Body;
      E057 := True;
      E075 := True;
      E061 := True;
   end adainit;

   procedure adafinal is
   begin
      Do_Finalize;
   end adafinal;

   function main
     (argc : Integer;
      argv : System.Address;
      envp : System.Address)
      return Integer
   is
      procedure initialize;
      pragma Import (C, initialize, "__gnat_initialize");

      procedure finalize;
      pragma Import (C, finalize, "__gnat_finalize");


      procedure Ada_Main_Program;
      pragma Import (Ada, Ada_Main_Program, "_ada_gnatlink");

      Ensure_Reference : System.Address := Ada_Main_Program_Name'Address;

   begin
      gnat_argc := argc;
      gnat_argv := argv;
      gnat_envp := envp;

      Initialize;
      adainit;
      Break_Start;
      Ada_Main_Program;
      Do_Finalize;
      Finalize;
      return (gnat_exit_status);
   end;

--  BEGIN Object file/option list
   --   .\ada.o
   --   .\gnat.o
   --   .\g-string.o
   --   .\interfac.o
   --   .\system.o
   --   .\s-addope.o
   --   .\s-casuti.o
   --   .\g-casuti.o
   --   .\s-htable.o
   --   .\g-htable.o
   --   .\s-maccod.o
   --   .\s-parame.o
   --   .\s-crtl.o
   --   .\i-cstrea.o
   --   .\s-stoele.o
   --   .\s-carun8.o
   --   .\a-comlin.o
   --   .\s-stache.o
   --   .\s-strops.o
   --   .\s-sopco3.o
   --   .\s-sopco4.o
   --   .\s-traceb.o
   --   .\s-traent.o
   --   .\s-except.o
   --   .\s-soflin.o
   --   .\a-elchha.o
   --   .\s-secsta.o
   --   .\s-exctab.o
   --   .\g-os_lib.o
   --   .\s-assert.o
   --   .\s-memory.o
   --   .\s-mastop.o
   --   .\s-stalib.o
   --   .\s-unstyp.o
   --   .\a-except.o
   --   .\s-wchcon.o
   --   .\s-wchjis.o
   --   .\s-wchcnv.o
   --   .\alloc.o
   --   .\debug.o
   --   .\gnatvsn.o
   --   .\hostparm.o
   --   .\types.o
   --   .\output.o
   --   .\sdefault.o
   --   .\tree_io.o
   --   .\opt.o
   --   .\table.o
   --   .\gnatlink.o
   --   .\osint.o
   --   .\fmap.o
   --   .\widechar.o
   --   .\namet.o
   --   -L.\
   --   -LC:\gnatpro\bindings\GNATCOM\bindings\
   --   -LC:\gnatpro\adagraph\
   --   -LC:\gnatpro\cs110\
   --   -LC:\gnatpro\feldman\
   --   -Lc:\GNATPRO\lib\gcc-lib\pentium-mingw32msv\3.2.3\adalib\
   --   -LC:\GNATPRO\Bindings\Win32Ada\
   --   -LC:\GNATPRO\lib\win32\
   --   -Lc:\gnatpro\bindings\gnatcom\
   --   -Lc:\gnatpro\adagraph\
   --   -static
   --   -lgnat
   --   -Wl,--stack=0x2000000
--  END Object file/option list   

end ada_main;
