Commit 56aed8f1 authored by Maxime Perrotin's avatar Maxime Perrotin

Complete command line parser

parent 6694e07b
......@@ -35,7 +35,7 @@ endif
#[ $(ARCH) == 64 ] && EXTRAFLAG="--target=x86_64-linux" ; \
OCARINA_PATH=`ocarina-config --prefix` \
$(gnatpath)gprbuild -x -g $(exec) -p -P aadl_parser.gpr -XBUILD="debug" $$EXTRAFLAG
$(gnatpath)gprbuild -j0 -x -g $(exec) -p -P aadl_parser.gpr -XBUILD="debug" $$EXTRAFLAG
install:
$(MAKE)
......
This diff is collapsed.
......@@ -37,9 +37,8 @@ package body Parser_Utils is
Put_Line (The_Banner);
end Banner;
function Parse_Command_Line return Taste_Configuration is
procedure Parse_Command_Line (Result : out Taste_Configuration) is
Config : Command_Line_Configuration;
Result : Taste_Configuration;
begin
Define_Switch (Config, Output => Result.Interface_View'Access,
Switch => "-i:", Long_Switch => "--interfaceview=",
......@@ -67,7 +66,7 @@ package body Parser_Utils is
Switch => "-p", Long_Switch => "--polyorb-hi-c",
Help => "Use PolyORB-HI-C runtime in place of Ada");
Define_Switch (Config, Output => Result.Timer_Resolution'Access,
Switch => "-x", Long_Switch => "--timer",
Switch => "-x:", Long_Switch => "--timer=",
Help => "Specify timer resolution (default 100 ms)");
Define_Switch (Config, Output => Result.Debug_Flag'Access,
Switch => "-g", Long_Switch => "--debug",
......@@ -76,30 +75,39 @@ package body Parser_Utils is
Switch => "-v", Long_Switch => "--version",
Help => "Display tool version");
Getopt (Config);
loop
declare
S : constant String := Get_Argument;
begin
exit when S'Length = 0;
Put_Line ("File argument : " & S);
Result.Other_Files.Append (S);
end;
end loop;
-- Dump (Debug)
Put_Line ("Command line:");
Put_Line (" |_ Interface View : " & Result.Interface_View.all);
Put_Line (" |_ Deployment View : " & Result.Deployment_View.all);
Put_Line (" |_ Data View : " & Result.Data_View.all);
Put_Line (" |_ Output Dir : " & Result.Output_Dir.all);
Put_Line (" |_ Use POHIC : " & Result.Use_POHIC'Img);
Put_Line (" |_ Glue : " & Result.Use_POHIC'Img);
Put_Line (" |_ Skeletons : " & Result.Skeletons'Img);
Put_Line (" |_ Timer Res : " & Result.Timer_Resolution'Img);
Put_Line (" |_ Version : " & Result.Version'Img);
Put_Line (" |_ Debug : " & Result.Debug_Flag'Img);
return Result;
if Result.Version then
raise Exit_From_Command_Line;
end if;
end Parse_Command_Line;
procedure Dump_Configuration (Config : Taste_Configuration) is
begin
Put_Line ("Command line:");
Put_Line (" |_ Interface View : " & Config.Interface_View.all);
Put_Line (" |_ Deployment View : " & Config.Deployment_View.all);
Put_Line (" |_ Data View : " & Config.Data_View.all);
Put_Line (" |_ Output Dir : " & Config.Output_Dir.all);
Put_Line (" |_ Use POHIC : " & Config.Use_POHIC'Img);
Put_Line (" |_ Glue : " & Config.Use_POHIC'Img);
Put_Line (" |_ Skeletons : " & Config.Skeletons'Img);
Put_Line (" |_ Timer Res : " & Config.Timer_Resolution'Img);
Put_Line (" |_ Version : " & Config.Version'Img);
Put_Line (" |_ Debug : " & Config.Debug_Flag'Img);
for Each of Config.Other_Files loop
Put_Line (" |_ Other file : " & Each);
end loop;
end Dump_Configuration;
-----------------------
-- Get_APLC_Binding --
-----------------------
......
......@@ -26,6 +26,10 @@ use Ocarina,
package Parser_Utils is
Default_Interface_View : aliased String := "InterfaceView.aadl";
Default_Deployment_View : aliased String := "DeploymentView.aadl";
Default_Data_View : aliased String := "DataView.aadl";
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
function US (Source : String) return Unbounded_String renames
......@@ -103,8 +107,13 @@ package Parser_Utils is
Timer_Resolution : aliased Integer := 100;
Debug_Flag : aliased Boolean := False;
Version : aliased Boolean := False;
Other_Files : String_Vectors.Vector;
end record;
function Parse_Command_Line return Taste_Configuration;
Current_Config : Taste_Configuration;
procedure Parse_Command_Line (Result : out Taste_Configuration);
procedure Dump_Configuration (Config : Taste_Configuration);
end Parser_Utils;
package Parser_Version is
Parser_Release : constant String :=
"553b2d9 ; Commit Date: Sun Dec 17 22:21:17 2017 ";
"5b38c95 ; Commit Date: Thu Dec 21 10:41:52 2017 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from r0b92ed3)";
end Parser_Version;
\ No newline at end of file
......@@ -3,11 +3,11 @@ AADL_PARSER=../../aadl_parser
all: test-parse
test-parse:
$(AADL_PARSER) -glue -i interfaceview.aadl \
-c deploymentview.aadl \
-d dataview.aadl \
../common/ocarina_components.aadl \
../common/TASTE_DV_Properties.aadl \
$(AADL_PARSER) --glue -i interfaceview.aadl \
-c deploymentview.aadl \
-d dataview.aadl \
../common/ocarina_components.aadl \
../common/TASTE_DV_Properties.aadl \
2>&1 | tail -2 | diff expected -
clean:
......
......@@ -3,8 +3,8 @@ AADL_PARSER=../../aadl_parser
all: test-parse
test-parse:
$(AADL_PARSER) -gw \
-glue \
$(AADL_PARSER) --gw \
--glue \
-i InterfaceView.aadl \
-c DeploymentView.aadl \
-d DataView.aadl \
......
......@@ -3,8 +3,8 @@ AADL_PARSER=../../aadl_parser
all: test-parse
test-parse:
$(AADL_PARSER) -gw \
-glue \
$(AADL_PARSER) --gw \
--glue \
-i InterfaceView.aadl \
-c DeploymentView.aadl \
-d DataView.aadl \
......
......@@ -3,8 +3,8 @@ AADL_PARSER=../../aadl_parser
all: test-parse
test-parse:
$(AADL_PARSER) -gw \
-glue \
$(AADL_PARSER) --gw \
--glue \
-i InterfaceView.aadl \
-c DeploymentView.aadl \
-d DataView.aadl \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment