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
e27fb2ef
Commit
e27fb2ef
authored
Jan 24, 2018
by
Maxime Perrotin
Browse files
Generate skeletons in files
parent
89bf5a8b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/taste-aadl_parser.adb
View file @
e27fb2ef
...
...
@@ -166,6 +166,7 @@ package body TASTE.AADL_Parser is
|
No_RCM_Error
|
Deployment_View_Error
|
Data_View_Error
|
TASTE
.
Backend
.
Skeletons
.
Skeleton_Error
|
Device_Driver_Error
=>
Put
(
Red_Bold
&
"[ERROR] "
&
White_Bold
);
Put_Line
(
Exception_Message
(
Error
)
&
No_Color
);
...
...
src/taste-backend-skeletons.adb
View file @
e27fb2ef
with
Text_IO
;
use
Text_IO
;
with
Ada
.
Strings
.
Unbounded
,
Ada
.
Characters
.
Handling
,
Ada
.
Exceptions
,
Ada
.
Directories
;
use
Ada
.
Characters
.
Handling
,
Ada
.
Exceptions
,
Ada
.
Directories
;
-- This package covers the generation of skeletons for all supported languages
...
...
@@ -103,21 +105,48 @@ package body TASTE.Backend.Skeletons is
else
""
);
Output_Src
:
constant
String
:=
Model
.
Configuration
.
Output_Dir
.
all
&
"/"
&
To_String
(
Each
.
Name
)
&
"/"
&
To_Lower
(
To_String
(
Each
.
Name
)
)
&
"/"
&
Language
&
"/"
&
"src"
;
&
"/"
&
"src"
&
"/"
;
-- Get header and body filenames from templates
Header_File
:
constant
String
:=
(
if
Proceed
then
Parse
(
Path
&
"header-filename.tmplt"
,
Hdr_Tmpl
)
else
""
);
Body_File
:
constant
String
:=
(
if
Proceed
then
Parse
(
Path
&
"body-filename.tmplt"
,
Hdr_Tmpl
)
else
""
);
Output
:
File_Type
;
begin
if
Proceed
then
-- Create directory tree (output/function/language/src)
Create_Path
(
Output_Src
);
Put
(
"*** Generating "
);
Put_Line
(
Parse
(
Path
&
"header-filename.tmplt"
,
Hdr_Tmpl
));
Put_Line
(
Header_Text
);
Put
(
"*** Generating "
);
Put_Line
(
Parse
(
Path
&
"body-filename.tmplt"
,
Hdr_Tmpl
));
Put_Line
(
Body_Text
);
Put_Line
(
"*** Generating "
&
Header_File
);
Create
(
File
=>
Output
,
Mode
=>
Out_File
,
Name
=>
Output_Src
&
Header_File
);
Put_Line
(
Output
,
Header_Text
);
Close
(
Output
);
if
not
Exists
(
Output_Src
&
Body_File
)
then
Put_Line
(
"*** Generating "
&
Body_File
);
Create
(
File
=>
Output
,
Mode
=>
Out_File
,
Name
=>
Output_Src
&
Body_File
);
Put_Line
(
Output
,
Body_Text
);
Close
(
Output
);
end
if
;
else
Put_Line
(
"Ignoring function "
&
To_String
(
Each
.
Name
));
end
if
;
exception
when
E
:
End_Error
=>
if
Is_Open
(
Output
)
then
Close
(
Output
);
end
if
;
raise
Skeleton_Error
with
"Generation of skeleton for function "
&
To_String
(
Each
.
Name
)
&
" failed : "
&
Exception_Message
(
E
);
end
;
end
loop
;
end
Generate
;
...
...
src/taste-backend-skeletons.ads
View file @
e27fb2ef
...
...
@@ -9,6 +9,7 @@ use Ada.Containers,
package
TASTE
.
Backend
.
Skeletons
is
procedure
Generate
(
Model
:
TASTE_Model
);
Skeleton_Error
:
exception
;
private
package
Template_Vectors
is
new
Indefinite_Vectors
(
Natural
,
Translate_Set
);
...
...
src/taste-parser_version.ads
View file @
e27fb2ef
package
TASTE
.
Parser_Version
is
Parser_Release
:
constant
String
:=
"
d47249d
; Commit Date:
Tue
Jan 2
3 22:13:30
2018 "
;
"
89bf5a8
; Commit Date:
Wed
Jan 2
4 10:54:55
2018 "
;
Ocarina_Version
:
constant
String
:=
"Ocarina 2017.x (Working Copy from r0b92ed3)"
;
end
TASTE
.
Parser_Version
;
\ No newline at end of file
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