Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
385ead7e
Commit
385ead7e
authored
May 18, 2018
by
Maxime Perrotin
Browse files
Minor cleanup
parent
668becbe
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/aadl_parser.adb
View file @
385ead7e
...
...
@@ -13,7 +13,7 @@ begin
begin
Model
.
Dump
;
Model
.
Generate_Build_Script
;
Model
.
Generate_
Skeletons
;
Model
.
Generate_
Code
;
end
;
exception
when
TASTE
.
Quit_TASTE
=>
...
...
src/taste-aadl_parser.adb
View file @
385ead7e
...
...
@@ -17,7 +17,7 @@ with System.Assertions,
Ocarina
.
Parser
,
Ocarina
.
FE_AADL
.
Parser
,
TASTE
.
Backend
.
Build_Script
,
TASTE
.
Backend
.
Skele
to
n
s
,
TASTE
.
Backend
.
Code_Genera
to
r
s
,
TASTE
.
Semantic_Check
;
use
Ada
.
Text_IO
,
...
...
@@ -293,15 +293,15 @@ package body TASTE.AADL_Parser is
TASTE
.
Backend
.
Build_Script
.
Generate
(
Model
);
end
Generate_Build_Script
;
procedure
Generate_
Skeletons
(
Model
:
TASTE_Model
)
is
procedure
Generate_
Code
(
Model
:
TASTE_Model
)
is
begin
TASTE
.
Backend
.
Skele
to
n
s
.
Generate
(
Model
);
TASTE
.
Backend
.
Code_Genera
to
r
s
.
Generate
(
Model
);
exception
when
Error
:
TASTE
.
Backend
.
Skele
to
n
s
.
Skeleton
_Error
=>
when
Error
:
TASTE
.
Backend
.
Code_Genera
to
r
s
.
ACG
_Error
=>
Put_Error
(
Exception_Message
(
Error
));
raise
Quit_Taste
;
when
Error
:
others
=>
Errors
.
Display_Bug_Box
(
Error
);
raise
Quit_Taste
;
end
Generate_
Skeletons
;
end
Generate_
Code
;
end
TASTE
.
AADL_Parser
;
src/taste-aadl_parser.ads
View file @
385ead7e
...
...
@@ -37,7 +37,7 @@ package TASTE.AADL_Parser is
procedure
Dump
(
Model
:
TASTE_Model
);
procedure
Generate_Build_Script
(
Model
:
TASTE_Model
);
procedure
Generate_
Skeletons
(
Model
:
TASTE_Model
);
procedure
Generate_
Code
(
Model
:
TASTE_Model
);
private
function
Initialize
return
Taste_Configuration
;
...
...
src/taste-backend-
skele
to
n
s.adb
→
src/taste-backend-
code_genera
to
r
s.adb
View file @
385ead7e
...
...
@@ -17,12 +17,13 @@ use Ada.Characters.Handling,
-- skeleton-related template files are present. Then it fills the Template
-- mappings and generate the corresponding code.
package
body
TASTE
.
Backend
.
Skele
to
n
s
is
package
body
TASTE
.
Backend
.
Code_Genera
to
r
s
is
procedure
Generate
(
Model
:
TASTE_Model
)
is
All_CP_Files
:
Tag
;
-- List of Context Parameters ASN.1 files
Template
:
constant
IV_As_Template
:=
Interface_View_Template
(
Model
.
Interface_View
);
-- Path to the input templates files
Prefix
:
constant
String
:=
Model
.
Configuration
.
Binary_Path
.
all
&
"templates/"
;
...
...
@@ -55,13 +56,6 @@ package body TASTE.Backend.Skeletons is
return
Result
;
end
Get_ASN1_File_List
;
function
CP_To_ASN1
(
Content
:
Translate_Set
)
return
String
is
Tmplt_CP
:
constant
String
:=
Prefix_Skeletons
&
"context_parameters.tmplt"
;
begin
return
Parse
(
Tmplt_CP
,
Content
);
end
CP_To_ASN1
;
-- Generate a global Makefile (processing all functions)
procedure
Generate_Global_Makefile
is
package
Languages_Set
is
new
Ordered_Sets
(
Unbounded_String
);
...
...
@@ -77,7 +71,7 @@ package body TASTE.Backend.Skeletons is
&
"makefile.tmplt"
;
begin
if
not
Exists
(
Tmplt
)
then
raise
Skeleton
_Error
with
"Missing makefile.tmplt"
;
raise
ACG
_Error
with
"Missing makefile.tmplt"
;
end
if
;
for
Each
of
Model
.
Interface_View
.
Flat_Functions
loop
Languages
:=
Languages
or
To_Set
(
US
(
Language_Spelling
(
Each
)));
...
...
@@ -104,7 +98,7 @@ package body TASTE.Backend.Skeletons is
Close
(
Output_File
);
end
Generate_Global_Makefile
;
-- Render a
n
set (Tag) of interfaces by applying a template
-- Render a set (Tag) of interfaces by applying a template
function
Process_Interfaces
(
Interfaces
:
Interface_Vectors
.
Vector
;
Path
:
String
)
return
Tag
is
...
...
@@ -117,15 +111,15 @@ package body TASTE.Backend.Skeletons is
return
Result
;
end
Process_Interfaces
;
-- Generate the ASN.1 files that represent Context Parameters for
-- a function
-- Generate the ASN.1 files translating Context Parameters
procedure
Process_Context_Parameters
(
F
:
Taste_Terminal_Function
;
Output_Lang
:
String
)
is
Output_File
:
File_Type
;
CP_Tmpl
:
constant
Translate_Set
:=
CP_Template
(
F
=>
F
);
CP_Text
:
constant
String
:=
CP_To_ASN1
(
CP_Tmpl
);
CP_Text
:
constant
String
:=
(
Parse
(
Prefix_Skeletons
&
"context_parameters.tmplt"
,
CP_Tmpl
));
CP_File
:
constant
String
:=
"Context-"
&
To_Lower
(
To_String
(
F
.
Name
))
&
".asn"
;
...
...
@@ -147,9 +141,9 @@ package body TASTE.Backend.Skeletons is
if
Is_Open
(
Output_File
)
then
Close
(
Output_File
);
end
if
;
raise
Skeleton
_Error
with
"Generation of code for function "
&
To_String
(
F
.
Name
)
&
" failed : "
&
Exception_Message
(
E
);
raise
ACG
_Error
with
"Generation of code for function "
&
To_String
(
F
.
Name
)
&
" failed : "
&
Exception_Message
(
E
);
end
Process_Context_Parameters
;
-- Write a header or body file for a function, a corresponding
...
...
@@ -215,9 +209,9 @@ package body TASTE.Backend.Skeletons is
if
Is_Open
(
Output_File
)
then
Close
(
Output_File
);
end
if
;
raise
Skeleton
_Error
with
"Generation of code for function "
&
To_String
(
F
.
Name
)
&
" failed : "
&
Exception_Message
(
E
);
raise
ACG
_Error
with
"Generation of code for function "
&
To_String
(
F
.
Name
)
&
" failed : "
&
Exception_Message
(
E
);
end
Process_Template
;
-- Main loop generating skeletons for each function
...
...
@@ -487,7 +481,7 @@ package body TASTE.Backend.Skeletons is
when
Cyclic_Operation
|
Sporadic_Operation
=>
List_Of_ASync_RIs
:=
List_Of_ASync_RIs
&
Each
.
Name
;
when
others
=>
List_Of_Sync_RIs
:=
List_Of_Sync_RIs
&
Each
.
Name
;
List_Of_Sync_RIs
:=
List_Of_Sync_RIs
&
Each
.
Name
;
end
case
;
end
loop
;
...
...
@@ -498,7 +492,7 @@ package body TASTE.Backend.Skeletons is
-- Add all user-defined properties
for
Each
of
F
.
User_Properties
loop
Property_Names
:=
Property_Names
&
Each
.
Name
;
Property_Names
:=
Property_Names
&
Each
.
Name
;
Property_Values
:=
Property_Values
&
Each
.
Value
;
end
loop
;
...
...
@@ -532,4 +526,4 @@ package body TASTE.Backend.Skeletons is
end
loop
;
return
Result
;
end
Interface_View_Template
;
end
TASTE
.
Backend
.
Skele
to
n
s
;
end
TASTE
.
Backend
.
Code_Genera
to
r
s
;
src/taste-backend-
skele
to
n
s.ads
→
src/taste-backend-
code_genera
to
r
s.ads
View file @
385ead7e
...
...
@@ -7,9 +7,9 @@ use Ada.Containers,
Templates_Parser
,
TASTE
.
AADL_Parser
;
package
TASTE
.
Backend
.
Skele
to
n
s
is
package
TASTE
.
Backend
.
Code_Genera
to
r
s
is
procedure
Generate
(
Model
:
TASTE_Model
);
Skeleton
_Error
:
exception
;
ACG
_Error
:
exception
;
private
package
Template_Vectors
is
new
Indefinite_Vectors
(
Natural
,
Translate_Set
);
...
...
@@ -48,4 +48,4 @@ private
function
Interface_View_Template
(
IV
:
Complete_Interface_View
)
return
IV_As_Template
;
end
TASTE
.
Backend
.
Skele
to
n
s
;
end
TASTE
.
Backend
.
Code_Genera
to
r
s
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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