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
42a71ec9
Commit
42a71ec9
authored
Jun 28, 2019
by
Maxime Perrotin
Browse files
Complete dump of interface view in xml
parent
5bd95b51
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/taste-dump.adb
View file @
42a71ec9
...
...
@@ -6,12 +6,14 @@ with Ada.Directories,
Ada
.
Text_IO
,
Ada
.
Characters
.
Latin_1
,
Ada
.
Exceptions
,
Ada
.
Strings
.
Unbounded
,
Templates_Parser
,
TASTE
.
Parser_Utils
,
TASTE
.
Backend
.
Code_Generators
;
use
Ada
.
Directories
,
Ada
.
Text_IO
,
Ada
.
Strings
.
Unbounded
,
Templates_Parser
,
TASTE
.
Parser_Utils
,
TASTE
.
Backend
.
Code_Generators
;
...
...
@@ -21,8 +23,11 @@ package body TASTE.Dump is
Newline
:
Character
renames
Ada
.
Characters
.
Latin_1
.
LF
;
-- iterate over template folders
procedure
Dump_Everything
(
Model
:
TASTE_Model
;
dummy_IV
:
IV_As_Template
)
procedure
Dump_Everything
(
Model
:
TASTE_Model
)
is
IV
:
constant
IV_As_Template
:=
Interface_View_Template
(
Model
.
Interface_View
);
-- Everything will be generated under output/Dump
-- There may be subfolders inside, set by the templates
Output_Prefix
:
constant
String
:=
...
...
@@ -37,7 +42,7 @@ package body TASTE.Dump is
Current
:
Directory_Entry_Type
;
Filter
:
constant
Filter_Type
:=
(
Directory
=>
True
,
others
=>
False
);
dummy_
Output_File
:
File_Type
;
Output_File
:
File_Type
;
-- output path will be determined by the templates
-- CV_Out_Dir : constant String :=
...
...
@@ -99,25 +104,62 @@ package body TASTE.Dump is
(
if
Check
then
Strip_String
(
Parse
(
File_Template
))
else
""
);
Trigger
:
constant
Boolean
:=
(
Check
and
then
(
Strip_String
(
Parse
(
Trig_Template
))
=
"TRUE"
));
IV_Tags
:
Translate_Set
;
Output_Tags
:
Translate_Set
;
Functions
:
Unbounded_String
;
function
Process_Interfaces
(
Interfaces
:
St_Interfaces
.
Vector
)
return
Unbounded_String
is
Result
:
Unbounded_String
;
begin
for
I
of
Interfaces
loop
Result
:=
Result
&
String
'(
Parse
(
IF_Template
,
I
))
&
Newline
;
end
loop
;
return
Result
;
end
Process_Interfaces
;
begin
if
not
Check
or
not
Trigger
then
Put_Info
(
"Nothing generated from "
&
Path
);
return
;
else
Put_Info
(
"Generating Dump from "
&
Path
);
Put_Info
(
Output_Prefix
&
Newline
&
Output_Path
&
Filename
);
for
F
of
IV
.
Funcs
loop
declare
Func_Map
:
constant
Translate_Set
:=
F
.
Header
&
Assoc
(
"Provided_Interfaces"
,
Process_Interfaces
(
F
.
Provided
))
&
Assoc
(
"Required_Interfaces"
,
Process_Interfaces
(
F
.
Required
));
Result
:
constant
String
:=
Parse
(
Func_Template
,
Func_Map
);
begin
Functions
:=
Functions
&
Result
&
Newline
;
end
;
end
loop
;
end
if
;
IV_Tags
:=
+
Assoc
(
"Functions"
,
Functions
);
Output_Tags
:=
+
Assoc
(
"Interface_View"
,
String
'(
Parse
(
IV_Template
,
IV_Tags
)));
Create_Path
(
Output_Prefix
&
"/"
&
Output_Path
);
Create
(
File
=>
Output_File
,
Mode
=>
Out_File
,
Name
=>
Output_Prefix
&
"/"
&
Output_Path
&
"/"
&
Filename
);
Put_Line
(
Output_File
,
Parse
(
Out_Template
,
Output_Tags
));
Close
(
Output_File
);
end
;
<<continue>>
end
loop
;
End_Search
(
ST
);
end
Dump_Everything
;
procedure
Dump_Input_Model
(
Model
:
TASTE_Model
)
is
IV
:
constant
IV_As_Template
:=
Interface_View_Template
(
Model
.
Interface_View
);
begin
Dump_Everything
(
Model
,
IV
);
Dump_Everything
(
Model
);
exception
when
Error
:
others
=>
Put_Error
(
"Dump : "
...
...
templates/dump/interface_view_xml/function.tmplt
View file @
42a71ec9
...
...
@@ -23,23 +23,16 @@
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
<Function name=@_Name_@ language=@_Language_@ is_type=@_YES_NO:Is_Type_@ instance_of=@_Instance_Of_@>
<Function name="@_Name_@" language="@_Language_@" is_type="@_YES_NO:Is_Type_@" instance_of="@_Instance_Of_@">
@@TABLE@@
<Timer name=@_Timers_@/>
<Timer name=
"
@_Timers_@
"
/>
@@END_TABLE@@
@@TABLE@@
<Context_Parameter name=@_CP_Names_@ type=@_WEB_ENCODE:CP_Types_@ value=@_WEB_ENCODE:CP_Values_@ asn1module=@_WEB_ENCODE:CP_Asn1Modules_@ asn1file=@_WEB_ENCODE:CP_Asn1Filenames_@/>
<Context_Parameter name=
"
@_CP_Names_@
"
type=
"
@_WEB_ENCODE:CP_Types_@
"
value=
"
@_WEB_ENCODE:CP_Values_@
"
asn1module=
"
@_WEB_ENCODE:CP_Asn1Modules_@
"
asn1file=
"
@_WEB_ENCODE:CP_Asn1Filenames_@
"
/>
@@END_TABLE@@
@@TABLE@@
<Property name=@_WEB_ENCODE:Property_Names_@ value=@_WEB_ENCODE:Property_Values_@/>
<Property name="@_WEB_ENCODE:Property_Names_@" value="@_WEB_ENCODE:Property_Values_@"/>
@@END_TABLE@@
@_Provided_Interfaces'Indent_@
@_Required_Interfaces'Indent_@
</Function>
templates/dump/interface_view_xml/interface.tmplt
View file @
42a71ec9
...
...
@@ -11,19 +11,19 @@
@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : Properties of the interface
@@-- @_IF_Property_Names_@, _Values_@ : User-defined properties (vector tag)
@@IF@@ @_Direction_@ = "PI"
<Provided_Interface name=@_Name_@ kind=@_Kind_@ period=@_Period_@ wcet=@_WCET_@ queue_size=@_Queue_Size_@>
<Provided_Interface name=
"
@_Name_@
"
kind=
"
@_Kind_@
"
period=
"
@_Period_@
"
wcet=
"
@_WCET_@
"
queue_size=
"
@_Queue_Size_@
"
>
@@ELSE@@
<Required_Interface name=@_Name_@ kind=@_Kind_@>
<Required_Interface name=
"
@_Name_@
"
kind=
"
@_Kind_@
"
>
@@END_IF@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
<Input_Parameter name=@_Param_Names_@ type=@_WEB_ENCODE:Param_Types_@ encoding=@_Param_Encodings_@/>
<Input_Parameter name=
"
@_Param_Names_@
"
type=
"
@_WEB_ENCODE:Param_Types_@
"
encoding=
"
@_Param_Encodings_@
"
/>
@@ELSE@@
<Output_Parameter name=@_Param_Names_@ type=@_WEB_ENCODE:Param_Types_@ encoding=@_Param_Encodings_@/>
<Output_Parameter name=
"
@_Param_Names_@
"
type=
"
@_WEB_ENCODE:Param_Types_@
"
encoding=
"
@_Param_Encodings_@
"
/>
@@END_IF@@
@@END_TABLE@@
@@TABLE@@
<Property name=@_WEB_ENCODE:IF_Property_Names_@ value=@_WEB_ENCODE:IF_Property_Values_@/>
<Property name=
"
@_WEB_ENCODE:IF_Property_Names_@
"
value=
"
@_WEB_ENCODE:IF_Property_Values_@
"
/>
@@END_TABLE@@
@@IF@@ @_Direction_@ = "PI"
</Provided_Interface>
...
...
templates/dump/interface_view_xml/interfaceview.tmplt
View file @
42a71ec9
<InterfaceView>
@_Functions'Indent_@
</InterfaceView>
templates/dump/interface_view_xml/output.tmplt
View file @
42a71ec9
@_InterfaceView_@
@_Interface
_
View_@
templates/dump/interface_view_xml/path.tmplt
View file @
42a71ec9
@_OUTPUT_DIR_@/Debug
XML
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