Commit ca620c5b authored by Maxime Perrotin's avatar Maxime Perrotin

Fix and improve templates

parent 2167e8a4
...@@ -56,7 +56,11 @@ size_IN_buf_@_LOWER:Param_Names_@; ...@@ -56,7 +56,11 @@ size_IN_buf_@_LOWER:Param_Names_@;
@@END_TABLE@@ @@END_TABLE@@
// calling threads: @_Calling_Threads_@ partition: @_Partition_Name_@ // calling threads: @_Calling_Threads_@ partition: @_Partition_Name_@
@@ELSIF@@ @_Kind_@ = UNPROTECTED_OPERATION @@ELSIF@@ @_Kind_@ = UNPROTECTED_OPERATION
// Unprotected call
@@TABLE@@ @@TABLE@@
@@IF@@ not @_EXIST:Param_Names_@
@_LOWER:Remote_Function_Names_@_@_LOWER:Remote_Interface_Names_@();
@@ELSE@@
@_LOWER:Remote_Function_Names_@_@_LOWER:Remote_Interface_Names_@ @_LOWER:Remote_Function_Names_@_@_LOWER:Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@ @@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@ @@TABLE@@
...@@ -67,7 +71,7 @@ size_IN_buf_@_LOWER:Param_Names_@; ...@@ -67,7 +71,7 @@ size_IN_buf_@_LOWER:Param_Names_@;
@@END_IF@@ @@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
@@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
@@ELSE@@ @@-- Protected call @@ELSE@@ @@-- Protected call
// puts("[TASTE] Protected call of @_Name_@"); // puts("[TASTE] Protected call of @_Name_@");
......
...@@ -10,10 +10,18 @@ ...@@ -10,10 +10,18 @@
@@-- @_Param_Directions_@ : |_ Corresponding direction @@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN) @@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_Direction_@ = "PI" @@IF@@ @_Direction_@ = "PI"
@@IF@@ @_Param_Names'Length_@ = 0
void @_LOWER:Parent_Function_@_@_LOWER:Name_@(void);
@@ELSE@@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@END_IF@@
@@ELSE@@
@@IF@@ @_Param_Names'Length_@ = 0
extern void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@(void);
@@ELSE@@ @@ELSE@@
extern void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@ extern void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@END_IF@@ @@END_IF@@
@@END_IF@@
@@INLINE( \()(,\n )(\);\n)@@ @@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@ @@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN" @@IF@@ @_Param_Directions_@ = "PARAM_IN"
......
...@@ -8,29 +8,29 @@ ...@@ -8,29 +8,29 @@
@@-- @_CP_Sort_@ : ... corresponding ASN.1 type @@-- @_CP_Sort_@ : ... corresponding ASN.1 type
@@-- @_CP_ASN1_Module_@ : ... in ASN.1 module @@-- @_CP_ASN1_Module_@ : ... in ASN.1 module
@@-- @_CP_Value_@ : ... with default value @@-- @_CP_Value_@ : ... with default value
Context-@_REPLACE((_)/-):LOWER:Name_@ DEFINITIONS ::= Context-@_REPLACE_ALL(_/-):LOWER:Name_@ DEFINITIONS ::=
BEGIN BEGIN
IMPORTS IMPORTS
@@INLINE( )(\n )(;\n)@@ @@INLINE( )(\n )(;\n)@@
@@TABLE@@ @@TABLE@@
@_Sort_Set_@ FROM @_Module_Set_@ @_REPLACE_ALL(_/-):Sort_Set_@ FROM @_REPLACE_ALL(_/-):Module_Set_@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
-- Group all context parameters of this function in a record -- Group all context parameters of this function in a record
Context-@_REPLACE((_)/-):LOWER:Name_@ ::= SEQUENCE { Context-@_REPLACE_ALL(_/-):LOWER:Name_@ ::= SEQUENCE {
@@INLINE( )(,\n )(\n)@@ @@INLINE( )(,\n )(\n)@@
@@TABLE@@ @@TABLE@@
@_REPLACE((_)/-):LOWER:CP_Name_@ @_CP_Sort_@ @_REPLACE_ALL((_)/-):LOWER:CP_Name_@ @_REPLACE_ALL(_/-):CP_Sort_@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
} }
-- Declare a constant with the values set by the user in the interface view -- Declare a constant with the values set by the user in the interface view
@_REPLACE((_)/-):LOWER:Name_@-ctxt Context-@_REPLACE((_)/-):LOWER:Name_@ ::= { @_REPLACE_ALL(_/-):LOWER:Name_@-ctxt Context-@_REPLACE_ALL(_/-):LOWER:Name_@ ::= {
@@INLINE( )(,\n )(\n)@@ @@INLINE( )(,\n )(\n)@@
@@TABLE@@ @@TABLE@@
@_REPLACE((_)/-):LOWER:CP_Name_@ @_CP_Value_@ @_REPLACE_ALL(_/-):LOWER:CP_Name_@ @_CP_Value_@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
} }
......
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
#include "queue_manager.h" #include "queue_manager.h"
#include "@_LOWER:Name_@.h" #include "@_LOWER:Name_@.h"
#include "@_LOWER:Name_@_enums_def.h" #include "@_Name_@_enums_def.h"
typedef struct _PI_Messages { typedef struct _PI_Messages {
T_@_LOWER:Name_@_PI_list msg_id; T_@_Name_@_PI_list msg_id;
union { union {
@@TABLE@@ @@TABLE@@
@@IF@@ @_ASync_PI_Param_Type_@ /= "" @@IF@@ @_ASync_PI_Param_Type_@ /= ""
...@@ -50,7 +50,7 @@ typedef struct _PI_Messages { ...@@ -50,7 +50,7 @@ typedef struct _PI_Messages {
} PI_Messages; } PI_Messages;
typedef struct _RI_Messages { typedef struct _RI_Messages {
T_@_LOWER:Name_@_RI_list msg_id; T_@_Name_@_RI_list msg_id;
union { union {
@@TABLE@@ @@TABLE@@
@@IF@@ @_ASync_RI_Param_Type_@ /= "" @@IF@@ @_ASync_RI_Param_Type_@ /= ""
...@@ -132,7 +132,7 @@ void @_LOWER:Name_@_PI_poll(void) ...@@ -132,7 +132,7 @@ void @_LOWER:Name_@_PI_poll(void)
struct mq_attr msgq_attr; struct mq_attr msgq_attr;
char* msgcontent = NULL; char* msgcontent = NULL;
T_@_LOWER:Name_@_RI_list message_recieved_type; T_@_Name_@_RI_list message_received_type;
if ((msgcontent = (char*)malloc(sizeof(RI_Messages))) == NULL) { if ((msgcontent = (char*)malloc(sizeof(RI_Messages))) == NULL) {
perror("Error when allocating memory in GUI polling function"); perror("Error when allocating memory in GUI polling function");
...@@ -144,8 +144,8 @@ void @_LOWER:Name_@_PI_poll(void) ...@@ -144,8 +144,8 @@ void @_LOWER:Name_@_PI_poll(void)
while (!retrieve_message_from_queue(@_LOWER:Name_@_RI_queue_id, while (!retrieve_message_from_queue(@_LOWER:Name_@_RI_queue_id,
sizeof(RI_Messages), sizeof(RI_Messages),
msgcontent, msgcontent,
(int *)&message_recieved_type)) { (int *)&message_received_type)) {
switch(message_recieved_type) { switch(message_received_type) {
@@TABLE@@ @@TABLE@@
case i_@_List_Of_ASync_RIs_@: case i_@_List_Of_ASync_RIs_@:
@_LOWER:Name_@_RI_@_LOWER:List_Of_ASync_RIs_@((asn1Scc@_REPLACE_ALL(-/_):ASync_RI_Param_Type_@ *)msgcontent); @_LOWER:Name_@_RI_@_LOWER:List_Of_ASync_RIs_@((asn1Scc@_REPLACE_ALL(-/_):ASync_RI_Param_Type_@ *)msgcontent);
......
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
@@-- @_Name_@ : The name of the function @@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type @@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string @@-- @_Instance_Of_@ : Name of instance or empty string
@_LOWER:Name_@_enums_def.h @@-- Don't use LOWER because the enums_def.h is also included by DMT's gui_api.c
@_Name_@_enums_def.h
...@@ -40,7 +40,7 @@ typedef enum { ...@@ -40,7 +40,7 @@ typedef enum {
@@END_IF@@ @@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
} T_@_LOWER:Name_@_PI_list; } T_@_Name_@_PI_list;
typedef enum { typedef enum {
@@INLINE( )(,\n )()@@ @@INLINE( )(,\n )()@@
...@@ -48,4 +48,4 @@ typedef enum { ...@@ -48,4 +48,4 @@ typedef enum {
i_@_List_Of_ASync_RIs_@ i_@_List_Of_ASync_RIs_@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
} T_@_LOWER:Name_@_RI_list; } T_@_Name_@_RI_list;
...@@ -85,18 +85,18 @@ int create_exchange_queue(char* queue_name, ...@@ -85,18 +85,18 @@ int create_exchange_queue(char* queue_name,
// queue_id : [in] Handle to the queue adressed as returned by // queue_id : [in] Handle to the queue adressed as returned by
// max_message_length : [in] Maximum size of an element to be stored in the queue // max_message_length : [in] Maximum size of an element to be stored in the queue
// (functional data plus discriminant) in bytes // (functional data plus discriminant) in bytes
// message_data_recieved: [out] Pointer on the functional data retrieved in the queue // message_data_received: [out] Pointer on the functional data retrieved in the queue
// Note that this buffer only contains the functional part // Note that this buffer only contains the functional part
// of the message and not the first field allowing to identify // of the message and not the first field allowing to identify
// the message type. // the message type.
// message_recieved_type: [out] Identifier of the type of message recieved. // message_received_type: [out] Identifier of the type of message received.
// //
// Returns : 0 on success, -1 otherwise // Returns : 0 on success, -1 otherwise
// //
int retrieve_message_from_queue(mqd_t queue_id, int retrieve_message_from_queue(mqd_t queue_id,
long max_message_length, long max_message_length,
void* message_data_recieved, void* message_data_received,
int* message_recieved_type); int* message_received_type);
// //
//This function writes a single message from a queue create_exchange_queue //This function writes a single message from a queue create_exchange_queue
...@@ -107,7 +107,7 @@ int retrieve_message_from_queue(mqd_t queue_id, ...@@ -107,7 +107,7 @@ int retrieve_message_from_queue(mqd_t queue_id,
// Note that this buffer only contains the functional part // Note that this buffer only contains the functional part
// of the message and not the first field allowing to identify // of the message and not the first field allowing to identify
// the message type. // the message type.
// message_recieved_type: [in] Identifier of the type of message to be sent // message_received_type: [in] Identifier of the type of message to be sent
// //
// Returns : 0 on success, -1 otherwise // Returns : 0 on success, -1 otherwise
// //
......
...@@ -125,8 +125,11 @@ dataview/Python/built: dataview/C/built ...@@ -125,8 +125,11 @@ dataview/Python/built: dataview/C/built
cp dataview/C/timeInMS.[ch] dataview/C/debug_messages.c @_LOWER:Function_Names_@/GUI/wrappers/python cp dataview/C/timeInMS.[ch] dataview/C/debug_messages.c @_LOWER:Function_Names_@/GUI/wrappers/python
cd @_LOWER:Function_Names_@/GUI/wrappers/python && \ cd @_LOWER:Function_Names_@/GUI/wrappers/python && \
gcc -g -fPIC -c `python-config --cflags` gui_api.c ../../src/queue_manager.c timeInMS.c debug_messages.c -I. -I../../src && \ gcc -g -fPIC -c `python-config --cflags` gui_api.c ../../src/queue_manager.c timeInMS.c debug_messages.c -I. -I../../src && \
gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt && mv * .. && cd .. && rmdir python gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt
mkdir -p binaries/@_LOWER:Function_Names_@_GUI && cp -f @_LOWER:Function_Names_@/GUI/wrappers/* binaries/@_LOWER:Function_Names_@_GUI mkdir -p binaries/@_LOWER:Function_Names_@_GUI
cp -f @_LOWER:Function_Names_@/GUI/wrappers/python/* binaries/@_LOWER:Function_Names_@_GUI
cp -f @_LOWER:Function_Names_@/GUI/wrappers/*.py binaries/@_LOWER:Function_Names_@_GUI
cp -f @_LOWER:Function_Names_@/GUI/wrappers/*.ui binaries/@_LOWER:Function_Names_@_GUI
@@END_IF@@ @@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
touch $@ touch $@
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment