Mercurial > hg > CbC > CbC_gcc
diff gcc/ada/libgnat/g-comlin.ads @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/gcc/ada/libgnat/g-comlin.ads Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/ada/libgnat/g-comlin.ads Thu Oct 25 07:37:49 2018 +0900 @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2017, AdaCore -- +-- Copyright (C) 1999-2018, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -678,6 +678,20 @@ -- so that you can specify the default value directly in the declaration -- of the variable). The switch must accept an argument. + type Value_Callback is access procedure (Switch, Value : String); + + procedure Define_Switch + (Config : in out Command_Line_Configuration; + Callback : not null Value_Callback; + Switch : String := ""; + Long_Switch : String := ""; + Help : String := ""; + Section : String := ""; + Argument : String := "ARG"); + -- Call Callback for each instance of Switch. The callback is given the + -- actual switch and the corresponding value. The switch must accept + -- an argument. + procedure Set_Usage (Config : in out Command_Line_Configuration; Usage : String := "[switches] [arguments]"; @@ -689,7 +703,8 @@ -- automatically generated list of supported switches. procedure Display_Help (Config : Command_Line_Configuration); - -- Display the help for the tool (ie its usage, and its supported switches) + -- Display the help for the tool (i.e. its usage, and its supported + -- switches). function Get_Switches (Config : Command_Line_Configuration; @@ -829,9 +844,9 @@ -- -- This function can be used to reset Cmd by passing an empty string -- - -- If an invalid switch is found on the command line (ie wasn't defined in - -- the configuration via Define_Switch), and the configuration wasn't set - -- to accept all switches (by defining "*" as a valid switch), then an + -- If an invalid switch is found on the command line (i.e. wasn't defined + -- in the configuration via Define_Switch), and the configuration wasn't + -- set to accept all switches (by defining "*" as a valid switch), then an -- exception Invalid_Switch is raised. The exception message indicates the -- invalid switch. @@ -882,7 +897,7 @@ -- -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 + -- So the recommendation is to declare the switch as "-from!" (i.e. no -- space between the switch and its parameter). Then Getopt will return -- ":bar" as the parameter, and you can trim the ":" in your application. -- @@ -1111,7 +1126,8 @@ type Switch_Type is (Switch_Untyped, Switch_Boolean, Switch_Integer, - Switch_String); + Switch_String, + Switch_Callback); type Switch_Definition (Typ : Switch_Type := Switch_Untyped) is record Switch : GNAT.OS_Lib.String_Access; @@ -1135,6 +1151,8 @@ Integer_Default : Integer; when Switch_String => String_Output : access GNAT.Strings.String_Access; + when Switch_Callback => + Callback : Value_Callback; end case; end record; type Switch_Definitions is array (Natural range <>) of Switch_Definition;