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
8248f43e
Commit
8248f43e
authored
Mar 14, 2018
by
Maxime Perrotin
Browse files
Dataview checker
parent
5a9ad95c
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/taste-aadl_parser.adb
View file @
8248f43e
...
...
@@ -27,46 +27,60 @@ use Ada.Text_IO,
package
body
TASTE
.
AADL_Parser
is
function
Initialize
return
Taste_Configuration
is
File_Name
:
Name_Id
;
File_Descr
:
Location
;
C
urrent_Config
:
Taste_Configuration
;
File_Name
:
Name_Id
;
File_Descr
:
Location
;
C
fg
:
Taste_Configuration
;
begin
Banner
;
-- Parse arguments before initializing Ocarina, otherwise Ocarina eats
-- some arguments (all file parameters).
Parse_Command_Line
(
C
urrent_Confi
g
);
Parse_Command_Line
(
C
f
g
);
Initialize_Ocarina
;
AADL_Language
:=
Get_String_Name
(
"aadl"
);
if
Current_Config
.
Interface_View
.
all
'
Length
=
0
then
Current_Config
.
Interface_View
:=
Default_Interface_View
'
Access
;
if
Cfg
.
Interface_View
.
all
'
Length
=
0
and
not
Cfg
.
Check_Data_View
then
-- Use "InterfaceView.aadl" by default, if nothing else is specified
-- and if the tool is not only called to check the data view
Cfg
.
Interface_View
:=
Default_Interface_View
'
Access
;
end
if
;
Set_Str_To_Name_Buffer
(
Current_Config
.
Interface_View
.
all
);
-- An interface view is expected, look for it and parse it
if
Cfg
.
Interface_View
.
all
'
Length
>
0
then
Set_Str_To_Name_Buffer
(
Cfg
.
Interface_View
.
all
);
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
if
File_Name
=
No_Name
then
raise
AADL_Parser_Error
with
"File not found : "
&
Current_Config
.
Interface_View
.
all
;
end
if
;
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
if
File_Name
=
No_Name
then
raise
AADL_Parser_Error
with
"File not found : "
&
Cfg
.
Interface_View
.
all
;
end
if
;
File_Descr
:=
Ocarina
.
Files
.
Load_File
(
File_Name
);
File_Descr
:=
Ocarina
.
Files
.
Load_File
(
File_Name
);
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
File_Descr
);
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
File_Descr
);
-- Parse TASTE_IV_Properties.aadl
Set_Str_To_Name_Buffer
(
"TASTE_IV_Properties.aadl"
);
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
File_Descr
:=
Ocarina
.
Files
.
Load_File
(
File_Name
);
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
File_Descr
);
end
if
;
if
Current_Config
.
Glue
then
if
Current_Config
.
Deployment_View
.
all
'
Length
=
0
then
Current_Config
.
Deployment_View
:=
Default_Deployment_View
'
Access
;
if
Cfg
.
Glue
then
-- Look for a deployment view (or DeploymentView.aadl by default)
-- if the glue generation is requested. Not needed for skeletons.
if
Cfg
.
Deployment_View
.
all
'
Length
=
0
then
Cfg
.
Deployment_View
:=
Default_Deployment_View
'
Access
;
end
if
;
Set_Str_To_Name_Buffer
(
C
urrent_Confi
g
.
Deployment_View
.
all
);
Set_Str_To_Name_Buffer
(
C
f
g
.
Deployment_View
.
all
);
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
if
File_Name
=
No_Name
then
raise
AADL_Parser_Error
with
"File not found : "
&
C
urrent_Confi
g
.
Deployment_View
.
all
;
with
"File not found : "
&
C
f
g
.
Deployment_View
.
all
;
end
if
;
File_Descr
:=
Ocarina
.
Files
.
Load_File
(
File_Name
);
...
...
@@ -78,7 +92,9 @@ package body TASTE.AADL_Parser is
end
if
;
end
if
;
for
Each
of
Current_Config
.
Other_Files
loop
for
Each
of
Cfg
.
Other_Files
loop
-- Add other files to the Interface and (if any) deployment roots
-- (List of files specified in the command line)
Set_Str_To_Name_Buffer
(
Each
);
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
if
File_Name
=
No_Name
then
...
...
@@ -86,7 +102,6 @@ package body TASTE.AADL_Parser is
end
if
;
File_Descr
:=
Ocarina
.
Files
.
Load_File
(
File_Name
);
-- Add other files to the Interface and (if any) deployment roots
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
File_Descr
);
if
Deployment_Root
/=
No_Node
then
...
...
@@ -95,29 +110,34 @@ package body TASTE.AADL_Parser is
end
if
;
end
loop
;
-- Missing data view is actually not an error.
-- Systems can live with parameterless messages
if
Current_Config
.
Data_View
.
all
'
Length
>
0
then
Set_Str_To_Name_Buffer
(
Current_Config
.
Data_View
.
all
);
if
Cfg
.
Data_View
.
all
'
Length
>
0
then
Set_Str_To_Name_Buffer
(
Cfg
.
Data_View
.
all
);
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
if
File_Name
=
No_Name
then
raise
AADL_Parser_Error
with
"C
an
not find
the
Data
View
file"
;
raise
AADL_Parser_Error
with
"C
ould
not find
"
&
Cfg
.
Data
_
View
.
all
;
end
if
;
else
-- Try with default name
-- Try with default name
(DataView.aadl)
Set_Str_To_Name_Buffer
(
Default_Data_View
);
File_Name
:=
Ocarina
.
Files
.
Search_File
(
Name_Find
);
if
File_Name
/=
No_Name
then
Current_Config
.
Data_View
:=
Default_Data_View
'
Access
;
Cfg
.
Data_View
:=
Default_Data_View
'
Access
;
elsif
Cfg
.
Check_Data_View
then
-- No dataview found, while user asked explicitly for a check
raise
AADL_Parser_Error
with
"Could not find DataView.aadl"
;
end
if
;
end
if
;
if
File_Name
/=
No_Name
then
Put_Info
(
"Parsing "
&
Cfg
.
Data_View
.
all
);
File_Descr
:=
Ocarina
.
Files
.
Load_File
(
File_Name
);
-- Add the Data View to the Interface View root
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
File_Descr
);
-- Add the Data View to the Interface View root, if any
if
Interface_Root
/=
No_Node
then
Interface_Root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Interface_Root
,
File_Descr
);
end
if
;
-- Add the Data View to the Deployment View root, if any
if
Deployment_Root
/=
No_Node
then
...
...
@@ -128,7 +148,7 @@ package body TASTE.AADL_Parser is
Dataview_root
:=
Ocarina
.
Parser
.
Parse
(
AADL_Language
,
Dataview_root
,
File_Descr
);
end
if
;
return
C
urrent_Confi
g
;
return
C
f
g
;
end
Initialize
;
function
Parse_Project
return
TASTE_Model
is
...
...
@@ -136,16 +156,19 @@ package body TASTE.AADL_Parser is
begin
Result
.
Configuration
:=
Initialize
;
begin
Result
.
Interface_View
:=
Parse_Interface_View
(
Interface_Root
);
exception
when
System
.
Assertions
.
Assert_Failure
=>
raise
AADL_Parser_Error
with
"Interface view parsing error"
;
end
;
if
Interface_Root
/=
No_Node
then
-- Parse Interface and Deployment View
begin
Result
.
Interface_View
:=
Parse_Interface_View
(
Interface_Root
);
exception
when
System
.
Assertions
.
Assert_Failure
=>
raise
AADL_Parser_Error
with
"Interface view parsing error"
;
end
;
if
Result
.
Configuration
.
Deployment_View
.
all
'
Length
>
0
then
AADL_Lib
.
Append
(
Result
.
Configuration
.
Interface_View
.
all
);
Result
.
Deployment_View
:=
Parse_Deployment_View
(
Deployment_Root
);
if
Result
.
Configuration
.
Deployment_View
.
all
'
Length
>
0
then
AADL_Lib
.
Append
(
Result
.
Configuration
.
Interface_View
.
all
);
Result
.
Deployment_View
:=
Parse_Deployment_View
(
Deployment_Root
);
end
if
;
end
if
;
if
Result
.
Configuration
.
Data_View
.
all
'
Length
>
0
then
...
...
@@ -161,6 +184,10 @@ package body TASTE.AADL_Parser is
Ocarina
.
Configuration
.
Reset_Modules
;
Ocarina
.
Reset
;
if
Result
.
Configuration
.
Check_Data_View
then
raise
Quit_Taste
;
end
if
;
return
Result
;
exception
when
Error
:
AADL_Parser_Error
...
...
src/taste-deployment_view.ads
View file @
8248f43e
...
...
@@ -34,6 +34,8 @@ package TASTE.Deployment_View is
-- List of Ocarina AADL models needed to parse the deployment view
AADL_Lib
:
String_Vectors
.
Vector
:=
Empty_Vector
&
"TASTE_DV_Properties.aadl"
&
"TASTE_IV_Properties.aadl"
&
"aadl_project.aadl"
&
"taste_properties.aadl"
&
"Cheddar_Properties.aadl"
&
...
...
src/taste-parser_utils.adb
View file @
8248f43e
...
...
@@ -63,40 +63,54 @@ package body TASTE.Parser_Utils is
begin
Result
.
Binary_Path
:=
new
String
'(
Get_Program_Directory
);
Define_Switch
(
Config
,
Output
=>
Result
.
Interface_View
'
Access
,
Switch
=>
"-i:"
,
Long_Switch
=>
"--interfaceview="
,
Help
=>
"Mandatory interface view (AADL model)"
,
Argument
=>
"InterfaceView.aadl"
);
Switch
=>
"-i:"
,
Long_Switch
=>
"--interfaceview="
,
Help
=>
"Mandatory interface view (AADL model)"
,
Argument
=>
"InterfaceView.aadl"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Deployment_View
'
Access
,
Switch
=>
"-c:"
,
Long_Switch
=>
"--deploymentview="
,
Help
=>
"Optional deployment view (AADL model)"
,
Argument
=>
"DeploymentView.aadl"
);
Switch
=>
"-c:"
,
Long_Switch
=>
"--deploymentview="
,
Help
=>
"Optional deployment view (AADL model)"
,
Argument
=>
"DeploymentView.aadl"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Data_View
'
Access
,
Switch
=>
"-d:"
,
Long_Switch
=>
"--dataview="
,
Help
=>
"Optional data view (AADL model)"
,
Argument
=>
"DataView.aadl"
);
Switch
=>
"-d:"
,
Long_Switch
=>
"--dataview="
,
Help
=>
"Optional data view (AADL model)"
,
Argument
=>
"DataView.aadl"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Check_Data_View
'
Access
,
Switch
=>
"-y"
,
Long_Switch
=>
"--check-dataview"
,
Help
=>
"Check Data View"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Output_Dir
'
Access
,
Switch
=>
"-o:"
,
Long_Switch
=>
"--output="
,
Help
=>
"Output directory (to be created if absent)"
,
Argument
=>
"Folder"
);
Switch
=>
"-o:"
,
Long_Switch
=>
"--output="
,
Help
=>
"Output directory (created if absent)"
,
Argument
=>
"Folder"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Skeletons
'
Access
,
Switch
=>
"-w"
,
Long_Switch
=>
"--gw"
,
Help
=>
"Generate models and code skeletons"
);
Switch
=>
"-w"
,
Long_Switch
=>
"--gw"
,
Help
=>
"Generate models and code skeletons"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Glue
'
Access
,
Switch
=>
"-l"
,
Long_Switch
=>
"--glue"
,
Help
=>
"Generate glue code"
);
Switch
=>
"-l"
,
Long_Switch
=>
"--glue"
,
Help
=>
"Generate glue code"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Use_POHIC
'
Access
,
Switch
=>
"-p"
,
Long_Switch
=>
"--polyorb-hi-c"
,
Help
=>
"Use PolyORB-HI-C runtime in place of Ada"
);
Switch
=>
"-p"
,
Long_Switch
=>
"--polyorb-hi-c"
,
Help
=>
"Use PolyORB-HI-C runtime"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Timer_Resolution
'
Access
,
Switch
=>
"-x:"
,
Long_Switch
=>
"--timer="
,
Initial
=>
100
,
Help
=>
"Specify timer resolution (default 100 ms)"
);
Switch
=>
"-x:"
,
Long_Switch
=>
"--timer="
,
Initial
=>
100
,
Help
=>
"Timer resolution (default 100 ms)"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Debug_Flag
'
Access
,
Switch
=>
"-g"
,
Long_Switch
=>
"--debug"
,
Help
=>
"Set debug mode"
);
Switch
=>
"-g"
,
Long_Switch
=>
"--debug"
,
Help
=>
"Set debug mode"
);
Define_Switch
(
Config
,
Output
=>
Result
.
Version
'
Access
,
Switch
=>
"-v"
,
Long_Switch
=>
"--version"
,
Help
=>
"Display tool version"
);
Switch
=>
"-v"
,
Long_Switch
=>
"--version"
,
Help
=>
"Display tool version"
);
Getopt
(
Config
);
loop
...
...
src/taste-parser_utils.ads
View file @
8248f43e
...
...
@@ -110,6 +110,7 @@ package TASTE.Parser_Utils is
Deployment_View
:
aliased
GNAT
.
Strings
.
String_Access
;
Data_View
:
aliased
GNAT
.
Strings
.
String_Access
;
Output_Dir
:
aliased
GNAT
.
Strings
.
String_Access
;
Check_Data_View
:
aliased
Boolean
:=
False
;
Skeletons
:
aliased
Boolean
:=
False
;
Glue
:
aliased
Boolean
:=
False
;
Use_POHIC
:
aliased
Boolean
:=
False
;
...
...
src/taste-parser_version.ads
View file @
8248f43e
package
TASTE
.
Parser_Version
is
Parser_Release
:
constant
String
:=
"
690de90
; Commit Date:
Mon
Mar 1
2 21:50:07
2018 "
;
"
5a9ad95
; Commit Date:
Wed
Mar 1
4 14:09:23
2018 "
;
Ocarina_Version
:
constant
String
:=
"Ocarina 2017.x (Working Copy from r
61c0f39
)"
;
"Ocarina 2017.x (Working Copy from r
957625a
)"
;
end
TASTE
.
Parser_Version
;
\ No newline at end of file
test/test7/DataView.asn
deleted
100644 → 0
View file @
5a9ad95c
DataView DEFINITIONS ::=
BEGIN
MyInteger ::= INTEGER (0..65535)
END
test/test7/Makefile
View file @
8248f43e
...
...
@@ -3,7 +3,7 @@ all: test-parse
test-parse
:
clean
$(AADL_PARSER)
-
o
output
-i
InterfaceView.aadl
-d
D
ata
V
iew
.aadl ../common/TASTE_IV_Properties.aadl
\
$(AADL_PARSER)
-
-check-d
ata
v
iew
\
2>&1 |
tail
-2
| diff expected -
clean
:
...
...
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