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
307b2398
Commit
307b2398
authored
Jan 03, 2018
by
Maxime Perrotin
Browse files
Move template test to proper Dump function
parent
fdfcaa93
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/aadl_parser.adb
View file @
307b2398
with
GNAT
.
OS_Lib
,
Text_IO
;
use
Text_IO
;
with
TASTE
,
TASTE
.
AADL_Parser
,
TASTE
.
Templates
;
use
TASTE
.
AADL_Parser
,
TASTE
.
Templates
;
with
Templates_Parser
;
use
Templates_Parser
;
with
GNAT
.
OS_Lib
,
TASTE
,
TASTE
.
AADL_Parser
;
use
TASTE
.
AADL_Parser
;
procedure
AADL_Parser
is
Model
:
TASTE_Model
;
procedure
Dump_With_Templates
(
Model
:
TASTE_Model
)
is
Vec
:
Tag
;
begin
New_Set
;
Map
(
"Interface_View"
,
Model
.
Configuration
.
Interface_View
.
all
);
Map
(
"Deployment_View"
,
Model
.
Configuration
.
Deployment_View
.
all
);
Map
(
"Data_View"
,
Model
.
Configuration
.
Data_View
.
all
);
Map
(
"Output_Dir"
,
Model
.
Configuration
.
Output_Dir
.
all
);
for
Each
of
Model
.
Configuration
.
Other_Files
loop
Vec
:=
Vec
&
Each
;
end
loop
;
Map
(
"Other_Files"
,
Vec
);
Map
(
"Skeletons"
,
Model
.
Configuration
.
Skeletons
);
Map
(
"Glue"
,
Model
.
Configuration
.
Glue
);
Map
(
"Use_POHIC"
,
Model
.
Configuration
.
Use_POHIC
);
Map
(
"Debug_Flag"
,
Model
.
Configuration
.
Debug_Flag
);
Map
(
"Version"
,
Model
.
Configuration
.
Version
);
Map
(
"Timer_Resolution"
,
Model
.
Configuration
.
Timer_Resolution
);
Put_Line
(
"=== Template-generated debug output ==="
);
Put_Line
(
Generate
(
Model
.
Configuration
.
Binary_Path
.
all
&
"templates/configuration.tmplt"
));
end
Dump_With_Templates
;
begin
Model
:=
Parse_Project
;
-- Model.Dump;
Dump_With_Templates
(
Model
);
Model
.
Dump
;
exception
when
TASTE
.
Quit_TASTE
=>
GNAT
.
OS_Lib
.
OS_Exit
(
1
);
...
...
src/taste-parser_utils.adb
View file @
307b2398
...
...
@@ -7,11 +7,13 @@ with Ada.Text_IO,
GNAT
.
Directory_Operations
,
GNAT
.
OS_Lib
,
GNAT
.
Command_Line
,
Templates_Parser
,
Ocarina
.
AADL_Values
,
Ocarina
.
Configuration
,
Ocarina
.
FE_AADL
.
Parser
,
Ocarina
.
Instances
.
Queries
,
TASTE
.
Parser_Version
;
TASTE
.
Parser_Version
,
TASTE
.
Templates
;
package
body
TASTE
.
Parser_Utils
is
...
...
@@ -19,8 +21,10 @@ package body TASTE.Parser_Utils is
GNAT
.
Directory_Operations
,
GNAT
.
OS_Lib
,
GNAT
.
Command_Line
,
Templates_Parser
,
Ocarina
.
Instances
.
Queries
,
Ocarina
.
ME_AADL
;
Ocarina
.
ME_AADL
,
TASTE
.
Templates
;
procedure
Banner
is
The_Banner
:
constant
String
:=
...
...
@@ -92,8 +96,9 @@ package body TASTE.Parser_Utils is
end
Parse_Command_Line
;
procedure
Debug_Dump
(
Config
:
Taste_Configuration
)
is
Vec
:
Tag
;
begin
Put_Line
(
"Command line:"
);
Put_Line
(
"Command line
(raw dump)
:"
);
Put_Line
(
" |_ Interface View : "
&
Config
.
Interface_View
.
all
);
Put_Line
(
" |_ Deployment View : "
&
Config
.
Deployment_View
.
all
);
Put_Line
(
" |_ Data View : "
&
Config
.
Data_View
.
all
);
...
...
@@ -107,6 +112,25 @@ package body TASTE.Parser_Utils is
for
Each
of
Config
.
Other_Files
loop
Put_Line
(
" |_ Other file : "
&
Each
);
end
loop
;
Put_Line
(
"Dump generated from a template file:"
);
New_Set
;
Tmpl_Map
(
"Interface_View"
,
Config
.
Interface_View
.
all
);
Tmpl_Map
(
"Deployment_View"
,
Config
.
Deployment_View
.
all
);
Tmpl_Map
(
"Data_View"
,
Config
.
Data_View
.
all
);
Tmpl_Map
(
"Output_Dir"
,
Config
.
Output_Dir
.
all
);
for
Each
of
Config
.
Other_Files
loop
Vec
:=
Vec
&
Each
;
end
loop
;
Tmpl_Map
(
"Other_Files"
,
Vec
);
Tmpl_Map
(
"Skeletons"
,
Config
.
Skeletons
);
Tmpl_Map
(
"Glue"
,
Config
.
Glue
);
Tmpl_Map
(
"Use_POHIC"
,
Config
.
Use_POHIC
);
Tmpl_Map
(
"Debug_Flag"
,
Config
.
Debug_Flag
);
Tmpl_Map
(
"Version"
,
Config
.
Version
);
Tmpl_Map
(
"Timer_Resolution"
,
Config
.
Timer_Resolution
);
Put_Line
(
Generate
(
Config
.
Binary_Path
.
all
&
"templates/configuration.tmplt"
));
end
Debug_Dump
;
-----------------------
...
...
src/taste-parser_version.ads
View file @
307b2398
package
TASTE
.
Parser_Version
is
Parser_Release
:
constant
String
:=
"
e9c639e
; Commit Date:
Mon
Jan
1
1
7:22:01
2018 "
;
"
fdfcaa9
; Commit Date:
Tue
Jan
2
1
1:03:26
2018 "
;
Ocarina_Version
:
constant
String
:=
"Ocarina 2017.x (Working Copy from rd078c54)"
;
end
TASTE
.
Parser_Version
;
\ No newline at end of file
src/taste-templates.adb
View file @
307b2398
...
...
@@ -5,30 +5,30 @@ package body TASTE.Templates is
Tmpl_Set
:=
Null_Set
;
end
New_Set
;
procedure
Map
(
Name
:
String
;
Value
:
String
)
is
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
String
)
is
begin
Tmpl_Set
:=
Tmpl_Set
&
Assoc
(
Name
,
Value
);
end
Map
;
end
Tmpl_
Map
;
procedure
Map
(
Name
:
String
;
Value
:
Boolean
)
is
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Boolean
)
is
begin
Tmpl_Set
:=
Tmpl_Set
&
Assoc
(
Name
,
Value
);
end
Map
;
end
Tmpl_
Map
;
procedure
Map
(
Name
:
String
;
Value
:
Unbounded_String
)
is
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Unbounded_String
)
is
begin
Tmpl_Set
:=
Tmpl_Set
&
Assoc
(
Name
,
Value
);
end
Map
;
end
Tmpl_
Map
;
procedure
Map
(
Name
:
String
;
Value
:
Integer
)
is
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Integer
)
is
begin
Tmpl_Set
:=
Tmpl_Set
&
Assoc
(
Name
,
Value
);
end
Map
;
end
Tmpl_
Map
;
procedure
Map
(
Name
:
String
;
Value
:
Tag
)
is
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Tag
)
is
begin
Tmpl_Set
:=
Tmpl_Set
&
Assoc
(
Name
,
Value
);
end
Map
;
end
Tmpl_
Map
;
function
Generate
(
Template_File
:
String
)
return
String
is
(
Parse
(
Template_File
,
Tmpl_Set
));
...
...
src/taste-templates.ads
View file @
307b2398
...
...
@@ -7,11 +7,11 @@ package TASTE.Templates is
procedure
New_Set
;
procedure
Map
(
Name
:
String
;
Value
:
String
);
procedure
Map
(
Name
:
String
;
Value
:
Boolean
);
procedure
Map
(
Name
:
String
;
Value
:
Unbounded_String
);
procedure
Map
(
Name
:
String
;
Value
:
Integer
);
procedure
Map
(
Name
:
String
;
Value
:
Tag
);
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
String
);
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Boolean
);
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Unbounded_String
);
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Integer
);
procedure
Tmpl_
Map
(
Name
:
String
;
Value
:
Tag
);
function
Generate
(
Template_File
:
String
)
return
String
;
private
...
...
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