aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-10-03 05:46:34 +0200
committerTristan Gingold <tgingold@free.fr>2017-10-03 05:46:34 +0200
commitdfe367903f66c566f9f2b2e075d6c65e7126cb3a (patch)
tree66efe2544a463a63716b706a4c9fb0abcd631cf2 /src/ghdldrv
parent1c1cdc4f5f7420f88a1ac4bc2df35a31cf45a892 (diff)
downloadghdl-dfe367903f66c566f9f2b2e075d6c65e7126cb3a.tar.gz
ghdl-dfe367903f66c566f9f2b2e075d6c65e7126cb3a.tar.bz2
ghdl-dfe367903f66c566f9f2b2e075d6c65e7126cb3a.zip
Minor refactoring to simplify interfacing.
Diffstat (limited to 'src/ghdldrv')
-rw-r--r--src/ghdldrv/ghdllocal.adb44
-rw-r--r--src/ghdldrv/ghdllocal.ads7
2 files changed, 31 insertions, 20 deletions
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;
diff --git a/src/ghdldrv/ghdllocal.ads b/src/ghdldrv/ghdllocal.ads
index 0809035b1..3624543d8 100644
--- a/src/ghdldrv/ghdllocal.ads
+++ b/src/ghdldrv/ghdllocal.ads
@@ -23,13 +23,16 @@ package Ghdllocal is
-- Init procedure for the functionnal interface.
procedure Compile_Init;
+ -- Handle:
+ -- --std=xx, --work=xx, -Pxxx, --workdir=x, --ieee=x, -Px, and -v
+ function Decode_Driver_Option (Option : String) return Boolean;
+
type Command_Lib is abstract new Command_Type with null record;
-- Setup GHDL. Same as Compile_Init.
procedure Init (Cmd : in out Command_Lib);
- -- Handle:
- -- --std=xx, --work=xx, -Pxxx, --workdir=x, --ieee=x, -Px, and -v
+ -- Handle driver options.
procedure Decode_Option (Cmd : in out Command_Lib;
Option : String;
Arg : String;