From dfe367903f66c566f9f2b2e075d6c65e7126cb3a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 3 Oct 2017 05:46:34 +0200 Subject: Minor refactoring to simplify interfacing. --- src/ghdldrv/ghdllocal.adb | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'src/ghdldrv/ghdllocal.adb') diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb index 75ececd4f..1b34af41e 100644 --- a/src/ghdldrv/ghdllocal.adb +++ b/src/ghdldrv/ghdllocal.adb @@ -55,46 +55,54 @@ package body Ghdllocal is Compile_Init; end Init; - procedure Decode_Option (Cmd : in out Command_Lib; - Option : String; - Arg : String; - Res : out Option_Res) + function Decode_Driver_Option (Option : String) return Boolean is - pragma Unreferenced (Cmd); - pragma Unreferenced (Arg); - Opt : constant String (1 .. Option'Length) := Option; + subtype Opt_String is String (1 .. Option'Length); + Opt : Opt_String renames Option; begin - Res := Option_Bad; if Opt = "-v" and then Flag_Verbose = False then Flag_Verbose := True; - Res := Option_Ok; + return True; elsif Opt'Length > 9 and then Opt (1 .. 9) = "--PREFIX=" then Switch_Prefix_Path := new String'(Opt (10 .. Opt'Last)); - Res := Option_Ok; + return True; elsif Opt = "--ieee=synopsys" then Flag_Ieee := Lib_Synopsys; - Res := Option_Ok; + return True; elsif Opt = "--ieee=mentor" then Flag_Ieee := Lib_Mentor; - Res := Option_Ok; + return True; elsif Opt = "--ieee=none" then Flag_Ieee := Lib_None; - Res := Option_Ok; + return True; elsif Opt = "--ieee=standard" then Flag_Ieee := Lib_Standard; - Res := Option_Ok; + return True; elsif Opt = "-m32" then Flag_32bit := True; - Res := Option_Ok; + return True; elsif Opt'Length >= 2 and then (Opt (2) = 'g' or Opt (2) = 'O') then -- Silently accept -g and -O. + return True; + else + return Options.Parse_Option (Opt); + end if; + end Decode_Driver_Option; + + procedure Decode_Option (Cmd : in out Command_Lib; + Option : String; + Arg : String; + Res : out Option_Res) + is + pragma Unreferenced (Cmd); + pragma Unreferenced (Arg); + begin + if Decode_Driver_Option (Option) then Res := Option_Ok; else - if Options.Parse_Option (Opt) then - Res := Option_Ok; - end if; + Res := Option_Bad; end if; end Decode_Option; -- cgit v1.2.3