Commit 0760c66b authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Work on the templates

parent 2a73e83d
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
# @_Node_Name_@ @_CPU_Name_@ @_Ada_Runtime_@ # @_Node_Name_@ @_CPU_Name_@ @_Ada_Runtime_@
all: all:
@@TABLE@@ @@TABLE@@
gprbuild -p -P @_LOWER:Partition_Names_@.gpr gprbuild -p -P @_LOWER:Partition_Names_@.gpr -cargs:C -DSTATIC=static
@@END_TABLE@@ @@END_TABLE@@
...@@ -71,6 +71,7 @@ project @_CAPITALIZE:Name_@ is ...@@ -71,6 +71,7 @@ project @_CAPITALIZE:Name_@ is
package Linker renames PolyORB_HI.Linker; package Linker renames PolyORB_HI.Linker;
package Check renames PolyORB_HI.Check; package Check renames PolyORB_HI.Check;
package Prove renames PolyORB_HI.Prove; package Prove renames PolyORB_HI.Prove;
end @_CAPITALIZE:Name_@; end @_CAPITALIZE:Name_@;
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef __unix__ #ifdef __unix__
// #include <stdio.h> #include <stdio.h>
// #include "PrintTypesAsASN1.h" // #include "PrintTypesAsASN1.h"
// #include "timeInMS.h" // #include "timeInMS.h"
#endif #endif
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#include <stdbool.h> #include <stdbool.h>
#include "@_LOWER:Name_@_vm_if.h" #include "@_LOWER:Name_@_vm_if.h"
#include "C_ASN1_Types.h" #include "C_ASN1_Types.h"
#ifdef __unix__
#include <stdio.h>
#endif
void init_@_LOWER:Name_@() void init_@_LOWER:Name_@()
{ {
......
...@@ -16,27 +16,50 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@ ...@@ -16,27 +16,50 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@ @@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@ @@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN" @@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len void *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@ @@ELSE@@
char *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len void *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@ @@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
{ {
@@TABLE@@ @@-- decode input parameters into static variables @@TABLE@@ @@-- decode input parameters into static variables
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
static asn1Scc@_REPLACE_ALL(-/_):Param_Types_@ IN_@_UPPER:Param_Names_@; static asn1Scc@_REPLACE_ALL(-/_):Param_Types_@ IN_@_UPPER:Param_Names_@;
@@ELSE@@
static asn1Scc@_REPLACE_ALL(-/_):Param_Types_@ OUT_@_UPPER:Param_Names_@;
@@END_IF@@
#ifdef __unix__ #ifdef __unix__
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
asn1Scc@_REPLACE_ALL(-/_):Param_Types_@_Initialize(&IN_@_UPPER:Param_Names_@); asn1Scc@_REPLACE_ALL(-/_):Param_Types_@_Initialize(&IN_@_UPPER:Param_Names_@);
@@ELSE@@
asn1Scc@_REPLACE_ALL(-/_):Param_Types_@_Initialize(&OUT_@_UPPER:Param_Names_@);
@@END_IF@@
#endif #endif
if (0 != Decode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@ (&IN_@_UPPER:Param_Names_@, @_LOWER:Param_Names_@_len)) { @@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)) {
#ifdef __unix__ #ifdef __unix__
puts("Error decoding @_Param_Types_@ in function @_LOWER:Parent_Function_@_@_LOWER:Name_@"); puts("Error decoding @_Param_Types_@ in function @_LOWER:Parent_Function_@_@_LOWER:Name_@");
#endif #endif
return; return;
} }
@@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
// Call user code // Declare user code function as external (it may not have a .h if it is in Ada)
extern void @_LOWER:Parent_Function_@_PI_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const asn1Scc@_REPLACE_ALL(-/_):Param_Types_@ *
@@ELSE@@
asn1Scc@_REPLACE_ALL(-/_):Param_Types_@ *
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
// Call user code
@_LOWER:Parent_Function_@_PI_@_LOWER:Name_@ @_LOWER:Parent_Function_@_PI_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@ @@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@ @@TABLE@@
...@@ -53,6 +76,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@() ...@@ -53,6 +76,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@()
{ {
// Directly call user code, no parameters to pass // Directly call user code, no parameters to pass
// This could be done directly from the concurrency glue... // This could be done directly from the concurrency glue...
extern void @_LOWER:Parent_Function_@_PI_@_LOWER:Name_@();
@_LOWER:Parent_Function_@_PI_@_LOWER:Name_@(); @_LOWER:Parent_Function_@_PI_@_LOWER:Name_@();
// puts ("@_LOWER:Parent_Function_@_@_LOWER:Name_@ called"); // puts ("@_LOWER:Parent_Function_@_@_LOWER:Name_@ called");
} }
......
...@@ -17,7 +17,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@ ...@@ -17,7 +17,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@ @@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@ @@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN" @@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len void *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@ @@ELSE@@
void *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len void *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@ @@END_IF@@
......
Supports Markdown
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