public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Optional argument Concatenate for Getopt in GNAT.Command_Line
@ 2011-09-02  7:16 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-09-02  7:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Johannes Kanig

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

The high-level procedure Getopt did not expose a feature of its lowlevel
counterpart, namely the Concatenate option which modifies the behavior of the
command line parser. This patch adds this option to the high-level interface.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-02  Johannes Kanig  <kanig@adacore.com>

	* g-comlin.adb (Getopt): New optional argument Concatenate to have
	similar interface as the other Getopt function.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 2141 bytes --]

Index: g-comlin.adb
===================================================================
--- g-comlin.adb	(revision 178435)
+++ g-comlin.adb	(working copy)
@@ -3236,9 +3236,10 @@
    ------------
 
    procedure Getopt
-     (Config   : Command_Line_Configuration;
-      Callback : Switch_Handler := null;
-      Parser   : Opt_Parser     := Command_Line_Parser)
+     (Config      : Command_Line_Configuration;
+      Callback    : Switch_Handler := null;
+      Parser      : Opt_Parser := Command_Line_Parser;
+      Concatenate : Boolean := True)
    is
       Getopt_Switches : String_Access;
       C               : Character := ASCII.NUL;
@@ -3373,7 +3374,7 @@
 
       loop
          C := Getopt (Switches    => Getopt_Switches.all,
-                      Concatenate => True,
+                      Concatenate => Concatenate,
                       Parser      => Parser);
 
          if C = '*' then
Index: g-comlin.ads
===================================================================
--- g-comlin.ads	(revision 178435)
+++ g-comlin.ads	(working copy)
@@ -703,9 +703,10 @@
    --  switch.
 
    procedure Getopt
-     (Config   : Command_Line_Configuration;
-      Callback : Switch_Handler := null;
-      Parser   : Opt_Parser := Command_Line_Parser);
+     (Config      : Command_Line_Configuration;
+      Callback    : Switch_Handler := null;
+      Parser      : Opt_Parser := Command_Line_Parser;
+      Concatenate : Boolean := True);
    --  Similar to the standard Getopt function.
    --  For each switch found on the command line, this calls Callback, if the
    --  switch is not handled automatically.
@@ -716,6 +717,9 @@
    --  variable). This function will in fact never call [Callback] if all
    --  switches were handled automatically and there is nothing left to do.
    --
+   --  The option Concatenate is identical to the one of the standard Getopt
+   --  function.
+   --
    --  This procedure automatically adds -h and --help to the valid switches,
    --  to display the help message and raises Exit_From_Command_Line.
    --  If an invalid switch is specified on the command line, this procedure

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-02  7:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02  7:16 [Ada] Optional argument Concatenate for Getopt in GNAT.Command_Line Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).