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
b071b066
Commit
b071b066
authored
Nov 25, 2019
by
Maxime Perrotin
Browse files
Improve code quality
Add missing includes, use more consistent interfaces
parent
83fd6478
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/taste-aadl_parser.adb
View file @
b071b066
...
...
@@ -758,15 +758,21 @@ package body TASTE.AADL_Parser is
loop
Need_Timer_Manager
:=
True
;
declare
Func_Language
:
constant
String
:=
TASTE
.
Backend
.
Language_Spelling
(
Model
.
Interface_View
.
Flat_Functions
(
Function_Name
));
Name_In_Manager
:
constant
String
:=
Function_Name
&
"_"
&
Timer_Name
;
Manager_As_Remote
:
constant
Remote_Entity
:=
(
Function_Name
=>
Timer_Manager
.
Name
,
Language
=>
US
(
"C"
),
Interface_Name
=>
US
(
Name_In_Manager
));
Function_As_Remote
:
constant
Remote_Entity
:=
(
Function_Name
=>
US
(
Function_Name
),
Language
=>
US
(
Func_Language
),
Interface_Name
=>
US
(
Timer_Name
));
Timer_PI
:
constant
Taste_Interface
:=
...
...
@@ -813,6 +819,7 @@ package body TASTE.AADL_Parser is
Language
=>
US
(
"Timer_Manager"
),
Remote_Interfaces
=>
Remote_Entities
.
Empty_Vector
&
(
Function_Name
=>
US
(
Function_Name
),
Language
=>
US
(
Func_Language
),
Interface_Name
=>
US
(
Set_Name_In_Function
)),
Params
=>
Parameters
.
Empty_Vector
&
(
Name
=>
US
(
"Val"
),
...
...
@@ -832,6 +839,7 @@ package body TASTE.AADL_Parser is
Language
=>
US
(
"Timer_Manager"
),
Remote_Interfaces
=>
Remote_Entities
.
Empty_Vector
&
(
Function_Name
=>
US
(
Function_Name
),
Language
=>
US
(
Func_Language
),
Interface_Name
=>
US
(
Reset_Name_In_Function
)),
Params
=>
Parameters
.
Empty_Vector
,
RCM
=>
Protected_Operation
,
...
...
@@ -846,6 +854,7 @@ package body TASTE.AADL_Parser is
(
Function_Name
).
Language
,
Remote_Interfaces
=>
Remote_Entities
.
Empty_Vector
&
(
Function_Name
=>
US
(
Manager_Name
),
Language
=>
US
(
"C"
),
-- manager is in C
Interface_Name
=>
US
(
Set_Name_In_Manager
)),
Params
=>
Parameters
.
Empty_Vector
&
(
Name
=>
US
(
"Val"
),
...
...
@@ -868,6 +877,7 @@ package body TASTE.AADL_Parser is
(
Function_Name
).
Language
,
Remote_Interfaces
=>
Remote_Entities
.
Empty_Vector
&
(
Function_Name
=>
US
(
Manager_Name
),
Language
=>
US
(
"C"
),
-- manager is in C
Interface_Name
=>
US
(
Reset_Name_In_Manager
)),
Params
=>
Parameters
.
Empty_Vector
,
RCM
=>
Protected_Operation
,
...
...
src/taste-interface_view.adb
View file @
b071b066
...
...
@@ -513,7 +513,8 @@ package body TASTE.Interface_View is
else
(
if
not
Going_Out
then
From
else
Parent_Context
(
From
)));
Source
:
constant
String
:=
(
if
Context
/=
From
then
From
else
"_env"
);
Result
:
Remote_Entity
:=
(
US
(
"Not found!"
),
US
(
"Not found!"
));
Result
:
Remote_Entity
:=
(
US
(
"Not found!"
),
US
(
"Not found!"
),
US
(
"Not found!"
));
Connections
:
Channels
.
Vector
;
Set_Going_Out
:
Boolean
:=
False
;
begin
...
...
@@ -539,6 +540,9 @@ package body TASTE.Interface_View is
Result
:=
(
if
Functions
.
Contains
(
Key
=>
To_String
(
Each
.
Callee
))
then
(
Function_Name
=>
Each
.
Callee
,
Language
=>
US
(
Language_Spelling
(
Functions
(
To_String
(
Each
.
Callee
)))),
Interface_Name
=>
Each
.
PI_Name
)
else
Rec_Jump
(
From
=>
(
if
not
Set_Going_Out
then
To_String
(
Each
.
Callee
)
...
...
@@ -843,8 +847,10 @@ package body TASTE.Interface_View is
Remote
.
Interface_Name
=
PI
.
Name
then
PI
.
Remote_Interfaces
.
Append
(
Remote_Entity
'(
Function_Name
=>
Fn
.
Name
,
Interface_Name
=>
RI
.
Name
));
(
Remote_Entity
'(
Function_Name
=>
Fn
.
Name
,
Language
=>
US
(
Language_Spelling
(
Fn
)),
Interface_Name
=>
RI
.
Name
));
end
if
;
end
loop
;
end
loop
;
...
...
@@ -1272,7 +1278,8 @@ package body TASTE.Interface_View is
Property_Names
,
Property_Values
,
Remote_Function_Names
,
Remote_Interface_Names
:
Vector_Tag
;
Remote_Interface_Names
,
Remote_Languages
:
Vector_Tag
;
begin
for
Each
of
TI
.
Params
loop
Param_Names
:=
Param_Names
&
Each
.
Name
;
...
...
@@ -1291,6 +1298,7 @@ package body TASTE.Interface_View is
Remote_Function_Names
:=
Remote_Function_Names
&
Each
.
Function_Name
;
Remote_Interface_Names
:=
Remote_Interface_Names
&
Each
.
Interface_Name
;
Remote_Languages
:=
Remote_Languages
&
Each
.
Language
;
end
loop
;
return
+
Assoc
(
"Name"
,
TI
.
Name
)
...
...
@@ -1309,6 +1317,7 @@ package body TASTE.Interface_View is
&
Assoc
(
"IF_Property_Values"
,
Property_Values
)
&
Assoc
(
"Remote_Function_Names"
,
Remote_Function_Names
)
&
Assoc
(
"Remote_Interface_Names"
,
Remote_Interface_Names
)
&
Assoc
(
"Remote_Languages"
,
Remote_Languages
)
&
Assoc
(
"Is_Timer"
,
TI
.
Is_Timer
);
end
Interface_To_Template
;
...
...
src/taste-interface_view.ads
View file @
b071b066
...
...
@@ -96,7 +96,8 @@ package TASTE.Interface_View is
type
Remote_Entity
is
record
Function_Name
,
Interface_Name
:
Unbounded_String
;
Interface_Name
,
Language
:
Unbounded_String
;
end
record
;
package
Remote_Entities
is
new
Indefinite_Vectors
(
Natural
,
Remote_Entity
);
...
...
templates/concurrency_view/pohic_wrappers_body/pi.tmplt
View file @
b071b066
...
...
@@ -19,9 +19,9 @@ void pro_@_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
const char
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
void
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
char
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
...
...
templates/concurrency_view/pohic_wrappers_body/ri.tmplt
View file @
b071b066
...
...
@@ -11,11 +11,25 @@
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Remote_Function_Names_@ : List of callees
@@-- @_Remote_Interface_Names_@ : |_ callee's interface name
@@-- @_Remote_Languages_@ : |_ callee's function language
@@-- @_Calling_Threads_@ : Calling threads of the containing block
// Required interface @_Name_@ in function @_Parent_Function_@
@@IF@@ @_Param_Names'Length_@ = 0
@@SET@@ No_Param=True
@@END_IF@@
@@INLINE@@ @@-- Include the relevant header file to call synchronous RIs
@@IF@@ @_Kind_@ = PROTECTED_OPERATION or @_Kind_@ = UNPROTECTED_OPERATION
@@TABLE@@
@@IF@@ @_Remote_Languages_@ = Blackbox_C
#include "@_LOWER:Remote_Function_Names_@.h"
@@ELSIF@@ @_Remote_Languages_@ = SIMULINK
#include "@_Name_@_SIMULINK.Simulink.h"
@@ELSE@@
#include "@_LOWER:Remote_Function_Names_@_vm_if.h" // Remote language: @_Remote_Languages_@
@@END_IF@@
@@END_TABLE@@
@@END_IF@@
@@END_INLINE@@
@@IF@@ @_No_Param_@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@(void)
@@ELSE@@
...
...
@@ -23,9 +37,9 @@ void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
const char
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
void
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
char
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
...
...
@@ -42,7 +56,7 @@ void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
__po_hi_request_t request;
__po_hi_copy_array(&(request.vars.@_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@.@_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@.buffer),
@@TABLE@@
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@);
(void *)
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@);
@@END_TABLE@@
request.vars.@_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@.@_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@.length =
@@TABLE@@
...
...
@@ -70,13 +84,23 @@ size_IN_buf_@_LOWER:Param_Names_@;
@@ELSE@@
@_LOWER:Remote_Function_Names_@_@_Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@IF@@ @_Remote_Languages_@ = SIMULINK @@-- Simulink interfaces use void* instead of const char */char*
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
(void *)IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
(void *)OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@ELSE@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_IF@@
@@END_INLINE@@
@@END_IF@@
@@END_TABLE@@
...
...
@@ -88,13 +112,23 @@ size_IN_buf_@_LOWER:Param_Names_@;
@@ELSE@@
pro_@_Remote_Function_Names_@_@_Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@IF@@ @_Remote_Languages_@ = SIMULINK @@-- Simulink interfaces use void* instead of const char */char*
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
(void *)IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
(void *)OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@ELSE@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_IF@@
@@END_INLINE@@
@@END_IF@@
@@END_TABLE@@
...
...
templates/concurrency_view/pohic_wrappers_header/pi.tmplt
View file @
b071b066
...
...
@@ -19,9 +19,9 @@
@@INLINE( \()(,\n )(\);)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
const char
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
void
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
char
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
...
...
templates/concurrency_view/pohic_wrappers_header/ri.tmplt
View file @
b071b066
...
...
@@ -20,9 +20,9 @@ void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
const char
*IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
void
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
char
*OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
...
...
templates/glue/language_wrappers/invoke_ri-body/interface.tmplt
View file @
b071b066
...
...
@@ -57,7 +57,7 @@ void @_LOWER:Parent_Function_@_RI_@_Name_@(void)
static char IN_buf_@_LOWER:Param_Names_@[sizeof(asn1Scc@_REPLACE_ALL(-/_):Param_Types_@)] = {0};
int size_IN_buf_@_LOWER:Param_Names_@ =
Encode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@
(IN_buf_@_LOWER:Param_Names_@, sizeof(asn1Scc@_REPLACE_ALL(-/_):Param_Types_@), IN_@_LOWER:Param_Names_@);
(
(void *)
IN_buf_@_LOWER:Param_Names_@, sizeof(asn1Scc@_REPLACE_ALL(-/_):Param_Types_@),
(asn1Scc@_REPLACE_ALL(-/_):Param_Types_@ *)
IN_@_LOWER:Param_Names_@);
if (-1 == size_IN_buf_@_LOWER:Param_Names_@) {
#ifdef __unix__
puts ("[ERROR] ASN.1 Encoding failed in @_LOWER:Parent_Function_@_RI_@_Name_@, parameter @_Param_Names_@");
...
...
templates/glue/language_wrappers/vm_if-body/interface.tmplt
View file @
b071b066
...
...
@@ -16,9 +16,9 @@ void @_LOWER:Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void
*IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
const char
*IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@
void
*OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
char
*OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
...
...
@@ -38,7 +38,7 @@ void @_LOWER:Parent_Function_@_@_Name_@
@@END_IF@@
#endif
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
if (0 != Decode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@ (&IN_@_UPPER:Param_Names_@, IN_@_LOWER:Param_Names_@, IN_@_LOWER:Param_Names_@_len)) {
if (0 != Decode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@ (&IN_@_UPPER:Param_Names_@,
(void *)
IN_@_LOWER:Param_Names_@, IN_@_LOWER:Param_Names_@_len)) {
#ifdef __unix__
puts("Error decoding @_Param_Types_@ in function @_Parent_Function_@_@_Name_@");
#endif
...
...
@@ -73,7 +73,7 @@ void @_LOWER:Parent_Function_@_@_Name_@
@@TABLE@@ @@-- encode output parameters
@@IF@@ @_Param_Directions_@ = "PARAM_OUT"
*OUT_@_LOWER:Param_Names_@_len = Encode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@ (OUT_@_LOWER:Param_Names_@, sizeof (asn1Scc@_REPLACE_ALL(-/_):Param_Types_@), &OUT_@_UPPER:Param_Names_@);
*OUT_@_LOWER:Param_Names_@_len = Encode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@ (
(void *)
OUT_@_LOWER:Param_Names_@, sizeof (asn1Scc@_REPLACE_ALL(-/_):Param_Types_@), &OUT_@_UPPER:Param_Names_@);
@@END_IF@@
@@END_TABLE@@
}
...
...
templates/glue/language_wrappers/vm_if-header/interface.tmplt
View file @
b071b066
...
...
@@ -17,9 +17,9 @@ void @_LOWER:Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void
*IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
const char
*IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@
void
*OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
char
*OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
...
...
test/Demo_PeekPoke_Linux/.gitignore
View file @
b071b066
peekpoke_dataview.asn
InterfaceView.aadl
function1.zip
function2.zip
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