comparison gcc/ada/libgnat/g-comlin.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
4 -- -- 4 -- --
5 -- G N A T . C O M M A N D _ L I N E -- 5 -- G N A T . C O M M A N D _ L I N E --
6 -- -- 6 -- --
7 -- B o d y -- 7 -- B o d y --
8 -- -- 8 -- --
9 -- Copyright (C) 1999-2017, Free Software Foundation, Inc. -- 9 -- Copyright (C) 1999-2018, Free Software Foundation, Inc. --
10 -- -- 10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under -- 11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- -- 12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- 13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
1472 Def.String_Output := Output.all'Unchecked_Access; 1472 Def.String_Output := Output.all'Unchecked_Access;
1473 Add (Config, Def); 1473 Add (Config, Def);
1474 end if; 1474 end if;
1475 end Define_Switch; 1475 end Define_Switch;
1476 1476
1477 -------------------
1478 -- Define_Switch --
1479 -------------------
1480
1481 procedure Define_Switch
1482 (Config : in out Command_Line_Configuration;
1483 Callback : not null Value_Callback;
1484 Switch : String := "";
1485 Long_Switch : String := "";
1486 Help : String := "";
1487 Section : String := "";
1488 Argument : String := "ARG")
1489 is
1490 Def : Switch_Definition (Switch_Callback);
1491 begin
1492 if Switch /= "" or else Long_Switch /= "" then
1493 Initialize_Switch_Def
1494 (Def, Switch, Long_Switch, Help, Section, Argument);
1495 Def.Callback := Callback;
1496 Add (Config, Def);
1497 end if;
1498 end Define_Switch;
1499
1477 -------------------- 1500 --------------------
1478 -- Define_Section -- 1501 -- Define_Section --
1479 -------------------- 1502 --------------------
1480 1503
1481 procedure Define_Section 1504 procedure Define_Section
3401 when Switch_String => 3424 when Switch_String =>
3402 Free (Local_Config.Switches (Index).String_Output.all); 3425 Free (Local_Config.Switches (Index).String_Output.all);
3403 Local_Config.Switches (Index).String_Output.all := 3426 Local_Config.Switches (Index).String_Output.all :=
3404 new String'(Parameter); 3427 new String'(Parameter);
3405 return; 3428 return;
3429
3430 when Switch_Callback =>
3431 Local_Config.Switches (Index).Callback (Switch, Parameter);
3432 return;
3406 end case; 3433 end case;
3407 end if; 3434 end if;
3408 3435
3409 -- Otherwise calls the user callback if one was defined 3436 -- Otherwise calls the user callback if one was defined
3410 3437
3469 3496
3470 -- Initialize output values for automatically handled switches 3497 -- Initialize output values for automatically handled switches
3471 3498
3472 for S in Local_Config.Switches'Range loop 3499 for S in Local_Config.Switches'Range loop
3473 case Local_Config.Switches (S).Typ is 3500 case Local_Config.Switches (S).Typ is
3474 when Switch_Untyped => 3501 when Switch_Untyped | Switch_Callback =>
3475 null; -- Nothing to do 3502 null; -- Nothing to do
3476 3503
3477 when Switch_Boolean => 3504 when Switch_Boolean =>
3478 Local_Config.Switches (S).Boolean_Output.all := 3505 Local_Config.Switches (S).Boolean_Output.all :=
3479 not Local_Config.Switches (S).Boolean_Value; 3506 not Local_Config.Switches (S).Boolean_Value;