-- Return True if the characters starting at Index in Type_Str are
-- equivalent to Substring.
+ generic
+ with function Callback (S : String; Index : Integer) return Boolean;
procedure Foreach_Switch
(Config : Command_Line_Configuration;
- Callback : access function (S : String; Index : Integer) return Boolean;
Section : String);
-- Iterate over all switches defined in Config, for a specific section.
-- Index is set to the index in Config.Switches
procedure Foreach_Switch
(Config : Command_Line_Configuration;
- Callback : access function (S : String; Index : Integer) return Boolean;
Section : String)
is
begin
Tmp : Boolean;
pragma Unreferenced (Tmp);
+ procedure Foreach is new Foreach_Switch (Add_Switch);
+
-- Start of processing for Get_Switches
begin
- Foreach_Switch (Config, Add_Switch'Access, Section => Section);
+ Foreach (Config, Section => Section);
-- Adding relevant aliases
return True;
end Analyze_Simple_Switch;
+ procedure Foreach is new Foreach_Switch (Analyze_Simple_Switch);
+
-- Start of processing for Group_Analysis
begin
while Idx <= Group'Last loop
Found := False;
- Foreach_Switch (Config, Analyze_Simple_Switch'Access, Section);
+ Foreach (Config, Section);
if not Found then
For_Each_Simple_Switch
return True;
end Starts_With;
+ procedure Foreach_In_Config is new Foreach_Switch (Is_In_Config);
+ procedure Foreach_Starts_With is new Foreach_Switch (Starts_With);
+
-- Start of processing for For_Each_Simple_Switch
begin
-- First determine if the switch corresponds to one belonging to the
-- configuration. If so, run callback and exit.
- Foreach_Switch (Config, Is_In_Config'Access, Section);
+ Foreach_In_Config (Config, Section);
if Found_In_Config then
return;
and then Config.Switches /= null
then
Found_In_Config := False;
- Foreach_Switch (Config, Starts_With'Access, Section);
+ Foreach_Starts_With (Config, Section);
if Found_In_Config then
return;
end if;