text
stringlengths 0
234
|
|---|
procedure Append (Pos : String_Lists.Cursor) is
|
begin
|
if Result /= Null_Unbounded_String then
|
Result := Result & ", ";
|
end if;
|
Result := Result & "'" & String_Lists.Element (Pos) & "'";
|
end Append;
|
begin
|
Item.Iterate (Append'Access);
|
return To_String (Result);
|
end Join;
|
use type Ada.Containers.Count_Type;
|
begin
|
if Missing.Length = 1 then
|
return "Missing mandatory option " & Join (Missing);
|
else
|
return "Missing mandatory options: " & Join (Missing);
|
end if;
|
end Missing_Message;
|
function Collect_Parameters (Extra : String_Vectors.Vector)
|
return String_Vectors.Vector
|
is
|
Result : String_Vectors.Vector;
|
begin
|
for Idx in 1 .. Command_Line.Argument_Count loop
|
Result.Append (Command_Line.Argument (Idx));
|
end loop;
|
Result.Append (Extra);
|
return Result;
|
end Collect_Parameters;
|
Name : Unbounded_String;
|
Value : Unbounded_String;
|
use Name_To_Index_Maps;
|
Position : Name_To_Index_Maps.Cursor;
|
Param_Idx : Parameter_Index;
|
Arguments : constant String_Vectors.Vector := Collect_Parameters (Extend_By);
|
begin
|
for Pos in Arguments.First_Index .. Arguments.Last_Index loop
|
Split_Parameter (Arguments (Pos), Name, Value);
|
declare
|
N : String := To_S (Name);
|
V : constant String := To_S (Value);
|
Handler : Handler_Access;
|
This_Parameter : Parameter_Descriptor;
|
begin
|
Case_Normalize (N, Parser.Case_Sensitive);
|
Position := Parser.Name_Table.Find (N);
|
if Position = No_Element then
|
raise Bad_Command with "Option '" & To_S (Name) & "' unknown";
|
end if;
|
Param_Idx := Name_To_Index_Maps.Element (Position);
|
This_Parameter := Parser.Parameters (Param_Idx);
|
Handler := This_Parameter.Handler;
|
if Handler.Is_Set and not Handler.Reusable then
|
raise Bad_Command with "Option '" & N & "' given twice";
|
end if;
|
Handler.Receive (Name => (
|
if Parser.Normalize_Name then
|
To_S (This_Parameter.Standard_Name)
|
else
|
N
|
),
|
Value => V,
|
Position => Pos);
|
Function Definition: procedure Initialize is
|
Function Body: use Line_Parsers;
|
Parser : Line_Parser := Create (Case_Sensitive => False);
|
begin
|
Add_Parameter (Parser,
|
Name => "in,input",
|
If_Missing => Die,
|
Default => "",
|
Handler => Input_File'Access);
|
Add_Parameter (Parser,
|
Name => "p,proc,processor",
|
If_Missing => Ignore,
|
Default => "",
|
Handler => Processors'Access);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.