diff options
author | Emmanuel Briot <briot@adacore.com> | 2011-08-04 09:44:38 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-04 11:44:38 +0200 |
commit | afab164f736e5d4e746f2832f58f838e797d3bca (patch) | |
tree | 64f11b7bbbad408ff1e22d79a79b4efa474ecd4c /gcc | |
parent | fe0ec02f9397eeb71a4ecb1a6fb2b67cfdb9378c (diff) | |
download | gcc-afab164f736e5d4e746f2832f58f838e797d3bca.zip gcc-afab164f736e5d4e746f2832f58f838e797d3bca.tar.gz gcc-afab164f736e5d4e746f2832f58f838e797d3bca.tar.bz2 |
g-comlin.adb, [...] (Add_Switch): Put back support for overriding the separator.
2011-08-04 Emmanuel Briot <briot@adacore.com>
* g-comlin.adb, g-comlin.ads (Add_Switch): Put back support for
overriding the separator.
From-SVN: r177345
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/g-comlin.adb | 17 | ||||
-rw-r--r-- | gcc/ada/g-comlin.ads | 27 |
3 files changed, 34 insertions, 15 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ed0bfd7..d8a2abe 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2011-08-04 Emmanuel Briot <briot@adacore.com> + + * g-comlin.adb, g-comlin.ads (Add_Switch): Put back support for + overriding the separator. + 2011-08-04 Robert Dewar <dewar@adacore.com> * sem_aggr.adb, par_sco.adb, sem_type.adb, exp_util.adb, exp_ch9.adb, diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb index b39c57a..0d75289 100644 --- a/gcc/ada/g-comlin.adb +++ b/gcc/ada/g-comlin.adb @@ -2113,7 +2113,7 @@ package body GNAT.Command_Line is (Cmd : in out Command_Line; Switch : String; Parameter : String := ""; - Separator : Character := ' '; + Separator : Character := ASCII.NUL; Section : String := ""; Add_Before : Boolean := False) is @@ -2132,16 +2132,14 @@ package body GNAT.Command_Line is (Cmd : in out Command_Line; Switch : String; Parameter : String := ""; - Separator : Character := ' '; + Separator : Character := ASCII.NUL; Section : String := ""; Add_Before : Boolean := False; Success : out Boolean) is - pragma Unreferenced (Separator); -- ??? Should be removed eventually - procedure Add_Simple_Switch (Simple : String; - Separator : String; + Sepa : String; Param : String; Index : Integer); -- Add a new switch that has had all its aliases expanded, and switches @@ -2153,7 +2151,7 @@ package body GNAT.Command_Line is procedure Add_Simple_Switch (Simple : String; - Separator : String; + Sepa : String; Param : String; Index : Integer) is @@ -2168,10 +2166,13 @@ package body GNAT.Command_Line is with "Invalid switch " & Simple; end if; - if Separator = "" then + if Separator /= ASCII.NUL then + Sep := Separator; + + elsif Sepa = "" then Sep := ASCII.NUL; else - Sep := Separator (Separator'First); + Sep := Sepa (Sepa'First); end if; if Cmd.Expanded = null then diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads index 590eab6..3b50894 100644 --- a/gcc/ada/g-comlin.ads +++ b/gcc/ada/g-comlin.ads @@ -599,9 +599,8 @@ package GNAT.Command_Line is -- format (trailing ':', '?', etc for defining a switch with parameters). -- -- Switch should also start with the leading '-' (or any other characters). - -- They should all start with the same character, though. If this - -- character is not '-', you will need to call Initialize_Option_Scan to - -- set the proper character for the parser. + -- If this character is not '-', you will need to call + -- Initialize_Option_Scan to set the proper character for the parser. -- -- The switches defined in the command_line_configuration object are used -- when ungrouping switches with more that one character after the prefix. @@ -812,7 +811,7 @@ package GNAT.Command_Line is (Cmd : in out Command_Line; Switch : String; Parameter : String := ""; - Separator : Character := ' '; + Separator : Character := ASCII.NUL; Section : String := ""; Add_Before : Boolean := False); -- Add a new switch to the command line, and combine/group it with existing @@ -839,8 +838,22 @@ package GNAT.Command_Line is -- added if not already present. For example, to add the -g switch into the -- -cargs section, you need to call (Cmd, "-g", Section => "-cargs"). -- - -- [Separator] is ignored, and kept for backward compatibility only. - -- ??? It might be removed in future versions. + -- [Separator], if specified, overrides the separator that was defined + -- through Define_Switch. For instance, if the switch was defined as + -- "-from:", the separator defaults to a space. But if your application + -- uses unusual separators not supported by GNAT.Command_Line (for instance + -- it requires ":"), you can specify this separator here. + -- For instance, + -- Add_Switch(Cmd, "-from", "bar", ':') + -- results in + -- -from:bar + -- rather than the default + -- -from bar + -- + -- Note however that Getopt doesn't know how to handle ":" as a separator. + -- So the recommendation is to declare the switch as "-from!" (ie no + -- space between the switch and its parameter). Then Getopt will return + -- ":bar" as the parameter, and you can trim the ":" in your application. -- -- Invalid_Section is raised if Section was not defined in the -- configuration of the command line. @@ -852,7 +865,7 @@ package GNAT.Command_Line is (Cmd : in out Command_Line; Switch : String; Parameter : String := ""; - Separator : Character := ' '; + Separator : Character := ASCII.NUL; Section : String := ""; Add_Before : Boolean := False; Success : out Boolean); |