From 14d6d7d837636f1589bc2ef1a5e27a9423ec6e24 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 23 Feb 2014 18:38:18 +0100 Subject: ghdlsimul: set argv0 earlier. --- translate/ghdldrv/ghdlsimul.adb | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'translate/ghdldrv') diff --git a/translate/ghdldrv/ghdlsimul.adb b/translate/ghdldrv/ghdlsimul.adb index 3db83cc83..9cc36717e 100644 --- a/translate/ghdldrv/ghdlsimul.adb +++ b/translate/ghdldrv/ghdlsimul.adb @@ -19,7 +19,6 @@ with Ada.Text_IO; with Ada.Command_Line; -with Ghdlmain; with Ghdllocal; use Ghdllocal; with GNAT.OS_Lib; use GNAT.OS_Lib; @@ -88,8 +87,16 @@ package body Ghdlsimul is -- Set options. procedure Set_Run_Options (Args : Argument_List) is + use Grt.Options; + use Types; Arg : String_Access; + Status : Decode_Option_Status; + Argv0 : String_Acc; begin + -- Set progname (used for grt error messages) + Argv0 := new String'(Ada.Command_Line.Command_Name & ASCII.Nul); + Grt.Options.Progname := Grt.Types.To_Ghdl_C_String (Argv0.all'Address); + for I in Args'Range loop Arg := Args (I); if Arg.all = "--disp-tree" then @@ -103,8 +110,18 @@ package body Ghdlsimul is elsif Arg.all = "--trace-simu" then Simulation.Trace_Simulation := True; else - Ghdlmain.Error ("unknown run options '" & Arg.all & "'"); - raise Option_Error; + Decode_Option (Arg.all, Status); + case Status is + when Decode_Option_Last => + exit; + when Decode_Option_Help => + -- FIXME: is that correct ? + exit; + when Decode_Option_Ok => + null; + end case; + -- Ghdlmain.Error ("unknown run options '" & Arg.all & "'"); + -- raise Option_Error; end if; end loop; end Set_Run_Options; @@ -117,12 +134,7 @@ package body Ghdlsimul is First_Id : Name_Id; Sec_Id : Name_Id; Top_Conf : Iir; - Argv0 : String_Acc; begin - -- Set progname (used for grt error messages) - Argv0 := new String'(Ada.Command_Line.Command_Name & ASCII.Nul); - Grt.Options.Progname := Grt.Types.To_Ghdl_C_String (Argv0.all'Address); - First_Id := Get_Identifier (Prim_Name.all); if Sec_Name = null then Sec_Id := Null_Identifier; @@ -137,6 +149,9 @@ package body Ghdlsimul is Grtlink.Flag_String := Flags.Flag_String; Simulation.Simulation_Entity (Top_Conf); + exception + when Errorout.Execution_Constraint_Error => + null; end Run; function Decode_Option (Option : String) return Boolean -- cgit v1.2.3