Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
2d5f7ec6
Commit
2d5f7ec6
authored
Dec 06, 2017
by
Maxime Perrotin
Browse files
remove exit_on_error
parent
2db33c51
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/aadl_parser.adb
View file @
2d5f7ec6
...
...
@@ -223,8 +223,11 @@ procedure AADL_Parser is
else
Set_Str_To_Name_Buffer
(
Ada
.
Command_Line
.
Argument
(
J
));
FN
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
Exit_On_Error
(
FN
=
No_Name
,
"File not found: "
&
Ada
.
Command_Line
.
Argument
(
J
));
if
FN
=
No_Name
then
raise
AADL_Parser_Error
with
"File not found: "
&
Ada
.
Command_Line
.
Argument
(
J
);
end
if
;
B
:=
Ocarina
.
Files
.
Load_File
(
FN
);
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
B
);
...
...
@@ -255,11 +258,13 @@ procedure AADL_Parser is
-- packages and property sets.
declare
S
:
constant
GNAT
.
OS_Lib
.
String_Access
:=
GNAT
.
OS_Lib
.
Locate_Exec_On_Path
(
"ocarina"
);
S
:
constant
GNAT
.
OS_Lib
.
String_Access
:=
GNAT
.
OS_Lib
.
Locate_Exec_On_Path
(
"ocarina"
);
begin
Exit_On_Error
(
S
=
null
,
"Ocarina is not in your PATH"
);
if
S
=
null
then
raise
AADL_Parser_Error
with
"Ocarina is not in your PATH"
;
end
if
;
GNAT
.
OS_Lib
.
Setenv
(
"OCARINA_PATH"
,
S
.
all
(
S
'
First
..
S
'
Last
-
12
));
end
;
...
...
@@ -267,62 +272,66 @@ procedure AADL_Parser is
if
Ada
.
Command_Line
.
Argument_Count
=
0
then
Usage
;
OS_Exit
(
1
)
;
raise
AADL_Parser_Error
with
"Missing command line arguments"
;
end
if
;
Ocarina
.
Initialize
;
Ocarina
.
AADL_Version
:=
AADL_Version
;
Ocarina
.
Configuration
.
Init_Modules
;
-- Ocarina.FE_AADL.Parser.First_Parsing := True;
Ocarina
.
FE_AADL
.
Parser
.
Add_Pre_Prop_Sets
:=
True
;
AADL_Language
:=
Get_String_Name
(
"aadl"
);
Parse_Command_Line
;
if
Interface_View
=
0
then
-- Try default filename
Set_Str_To_Name_Buffer
(
"InterfaceView.aadl"
);
else
Set_Str_To_Name_Buffer
(
Ada
.
Command_Line
.
Argument
(
Interface_View
));
end
if
;
Exit_On_Error
(
Interface_View
=
0
,
"Missing Interface view!"
);
Set_Str_To_Name_Buffer
(
Ada
.
Command_Line
.
Argument
(
Interface_View
));
FN
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
Exit_On_Error
(
FN
=
No_Name
,
"Missing Interface view!"
);
if
FN
=
No_Name
then
raise
AADL_Parser_Error
with
"Interface View missing"
;
end
if
;
B
:=
Ocarina
.
Files
.
Load_File
(
FN
);
-- C_Set_Interfaceview
-- (Ada.Command_Line.Argument (Interface_View),
-- Ada.Command_Line.Argument (Interface_View)'Length);
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
B
);
if
Depl_View_Pos
=
0
and
Generate_Glue
then
Put_Line
(
"Fatal error: Missing Deployment view!"
);
Put_Line
(
"Use the '-c file.aadl' parameter."
);
Put_Line
(
"Note: the generation of glue code is invoked automatically"
);
Put_Line
(
"from the TASTE orchestrator. You should run taste-aadl-parser"
);
Put_Line
(
"only to generate your application skeletons ('-gw' flag)."
);
New_line
;
elsif
Depl_View_Pos
>
0
and
Generate_Glue
then
Set_Str_To_Name_Buffer
(
Ada
.
Command_Line
.
Argument
(
Depl_View_Pos
));
if
Generate_Glue
then
if
Depl_View_Pos
=
0
then
Set_Str_To_Name_Buffer
(
"DeploymentView.aadl"
);
else
Set_Str_To_Name_Buffer
(
Ada
.
Command_Line
.
Argument
(
Depl_View_Pos
));
end
if
;
FN
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
B
:=
Ocarina
.
Files
.
Load_File
(
FN
);
Deployment_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Deployment_Root
,
B
);
Exit_On_Error
(
Deployment_Root
=
No_Node
,
"Deployment view is incorrect"
);
if
Deployment_Root
=
No_Node
then
raise
AADL_Parser_Error
with
"Deployment View is incorrect"
;
end
if
;
end
if
;
-- Missing data view is actually not an error.
-- Systems can live with parameterless messages
-- Exit_On_Error (Data_view = 0, "Error: Missing Data view!");
if
Data_View
>
0
then
Set_Str_To_Name_Buffer
(
Ada
.
Command_Line
.
Argument
(
Data_View
));
FN
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
Exit_On_Error
(
FN
=
No_Name
,
"Cannot find Data View"
);
-- C_Set_Dataview
-- (Ada.Command_Line.Argument (Data_View),
-- Ada.Command_Line.Argument (Data_View)'Length);
if
FN
=
No_Name
then
raise
AADL_Parser_Error
with
"Cannot find the Data View file"
;
end
if
;
else
-- Try with default name
Set_Str_To_Name_Buffer
(
"DataView.aadl"
);
FN
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
end
if
;
if
FN
/=
No_Name
then
B
:=
Ocarina
.
Files
.
Load_File
(
FN
);
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
B
);
...
...
@@ -334,13 +343,16 @@ procedure AADL_Parser is
(
AADL_Language
,
Dataview_root
,
B
);
end
if
;
Exit_On_Error
(
No
(
Interface_Root
),
"AADL Parser Internal error"
);
if
No
(
Interface_Root
)
then
raise
AADL_Parser_Error
with
"Internal error - please report."
;
end
if
;
-- Analyze the tree
Success
:=
Ocarina
.
Analyzer
.
Analyze
(
AADL_Language
,
Interface_Root
);
Exit_On_Error
(
not
Success
,
"Cannot analyze model."
);
if
not
Success
then
raise
AADL_Parser_Error
with
"Could not analyse model"
;
end
if
;
end
Initialize
;
IV_Root
:
Node_Id
;
...
...
@@ -376,6 +388,9 @@ begin
exception
when
Error
:
AADL_Parser_Error
|
Interface_Error
|
Function_Error
|
No_RCM_Error
|
Deployment_View_Error
|
Device_Driver_Error
=>
Put
(
Red_Bold
&
"[ERROR] "
&
White_Bold
);
...
...
src/interface_view.adb
View file @
2d5f7ec6
...
...
@@ -162,7 +162,7 @@ package body Interface_View is
return
ACN
;
end
if
;
end
if
;
Exit_On
_Error
(
True
,
"ASN1 Encoding not set"
)
;
raise
Interface
_Error
with
"ASN1 Encoding not set"
;
return
Default
;
end
Get_ASN1_Encoding
;
...
...
@@ -228,7 +228,7 @@ package body Interface_View is
&
Get_Name_String
(
ASN1_Basic_Type_N
);
end
if
;
end
if
;
Exit_On
_Error
(
True
,
"ASN.1 Basic type undefined!"
)
;
raise
Interface
_Error
with
"ASN.1 Basic type undefined!"
;
return
ASN1_Unknown
;
end
Get_ASN1_Basic_Type
;
...
...
@@ -275,11 +275,12 @@ package body Interface_View is
begin
-- If RI_Name has no value it means the interface view misses the
-- AADL property "TASTE::InterfaceName". Not supported.
Exit_On_Error
(
RI_Name
=
No_Name
,
"Interface view contains errors "
&
"(Missing TASTE::InterfaceName properties)"
&
ASCII
.
CR
&
ASCII
.
LF
&
" Try updating it with taste-edit-project"
);
if
RI_Name
=
No_Name
then
raise
Interface_Error
with
"Interface view contains errors "
&
"(Missing TASTE::InterfaceName properties)"
&
ASCII
.
CR
&
ASCII
.
LF
&
" Try updating it with taste-edit-project"
;
end
if
;
-- Filter out connections if the PI is cyclic (not a connection!)
if
Get_RCM_Operation_Kind
...
...
@@ -580,18 +581,13 @@ package body Interface_View is
if
No
(
AIN
.
Subcomponents
(
CI
))
or
Is_Terminal
then
begin
Terminal_Fn
:=
Parse_Function
(
Prefix
=>
Prefix
,
Name
=>
Name
,
Inst
=>
CI
);
Terminal_Fn
.
Context
:=
US
(
Context
);
Functions
.
Insert
(
Key
=>
Name
,
New_Item
=>
Terminal_Fn
);
Is_Terminal
:=
False
;
exception
when
Error
:
Function_Error
=>
Exit_On_Error
(
True
,
Exception_Message
(
Error
));
end
;
Terminal_Fn
:=
Parse_Function
(
Prefix
=>
Prefix
,
Name
=>
Name
,
Inst
=>
CI
);
Terminal_Fn
.
Context
:=
US
(
Context
);
Functions
.
Insert
(
Key
=>
Name
,
New_Item
=>
Terminal_Fn
);
Is_Terminal
:=
False
;
end
if
;
when
others
=>
null
;
...
...
@@ -600,7 +596,9 @@ package body Interface_View is
return
Is_Terminal
;
end
Rec_Function
;
begin
Exit_On_Error
(
No
(
System
),
"Missing or erroneous interface view"
);
if
No
(
System
)
then
raise
Interface_Error
with
"Missing or erroneous interface view"
;
end
if
;
Current_Function
:=
AIN
.
First_Node
(
AIN
.
Subcomponents
(
System
));
-- Parse functions recursively
...
...
src/parser_utils.adb
View file @
2d5f7ec6
...
...
@@ -79,17 +79,6 @@ package body Parser_Utils is
end
Usage
;
-------------------
-- Exit_On_Error --
-------------------
procedure
Exit_On_Error
(
Error
:
Boolean
;
Reason
:
String
)
is
begin
if
Error
then
raise
AADL_Parser_Error
with
Reason
;
end
if
;
end
Exit_On_Error
;
-----------------------
-- Get_APLC_Binding --
-----------------------
...
...
src/parser_utils.ads
View file @
2d5f7ec6
...
...
@@ -51,8 +51,6 @@ package Parser_Utils is
AADL_Parser_Error
:
exception
;
procedure
Exit_On_Error
(
Error
:
Boolean
;
Reason
:
String
);
function
Get_APLC_Binding
(
E
:
Node_Id
)
return
List_Id
;
function
Get_Interface_Name
(
D
:
Node_Id
)
return
Name_Id
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment