From ca5b4caf4c8065720de65f257b721e464ed89a13 Mon Sep 17 00:00:00 2001 From: Sven Robertz <sven@cs.lth.se> Date: Tue, 8 Nov 2011 09:28:47 +0100 Subject: [PATCH] added C encoder --- examples/simple_java/compile.sh | 5 +- examples/simple_java/example_encoder.c | 27 + test/gen/c/nested.c | 1213 ----------------- test/gen/c/nested.h | 350 ----- test/gen/c/simple.c | 913 ------------- test/gen/c/simple.h | 233 ---- test/gen/csharp/nested.cs | 1045 -------------- test/gen/csharp/simple.cs | 701 ---------- test/gen/csharp/test_nested.cs | 121 -- test/gen/csharp/test_simple.cs | 105 -- test/gen/java/nested/int_array_s.java | 122 -- test/gen/java/nested/int_array_t_s.java | 112 -- test/gen/java/nested/int_s.java | 62 - test/gen/java/nested/int_t_s.java | 62 - test/gen/java/nested/struct_array_s.java | 88 -- test/gen/java/nested/struct_array_ss.java | 194 --- test/gen/java/nested/struct_array_t.java | 35 - test/gen/java/nested/struct_array_t_s.java | 74 - test/gen/java/nested/struct_s.java | 82 -- test/gen/java/nested/struct_struct_s.java | 88 -- test/gen/java/nested/struct_struct_t.java | 33 - test/gen/java/nested/struct_struct_t_s.java | 76 -- test/gen/java/nested/struct_t.java | 26 - test/gen/java/nested/struct_t_s.java | 69 - test/gen/java/simple/a_fixed_int_array.java | 76 -- .../simple/a_fixed_int_array_array_array.java | 104 -- .../java/simple/a_fixed_int_multi_array.java | 92 -- .../gen/java/simple/a_variable_int_array.java | 77 -- .../a_variable_int_array_array_array.java | 107 -- .../simple/a_variable_int_multi_array.java | 95 -- test/gen/java/simple/a_void.java | 61 - test/gen/java/simple/an_int.java | 62 - test/gen/java/simple/an_int_struct.java | 82 -- test/gen/nested.typeinfo | 51 - test/gen/nested.vec | Bin 114897 -> 0 bytes test/gen/python/nested.py | 110 -- test/gen/python/simple.py | 54 - test/gen/simple.typeinfo | 27 - test/gen/simple.vec | Bin 3494 -> 0 bytes test/run | 3 +- test/run.py | 3 +- 41 files changed, 35 insertions(+), 6805 deletions(-) create mode 100644 examples/simple_java/example_encoder.c delete mode 100644 test/gen/c/nested.c delete mode 100644 test/gen/c/nested.h delete mode 100644 test/gen/c/simple.c delete mode 100644 test/gen/c/simple.h delete mode 100644 test/gen/csharp/nested.cs delete mode 100644 test/gen/csharp/simple.cs delete mode 100644 test/gen/csharp/test_nested.cs delete mode 100644 test/gen/csharp/test_simple.cs delete mode 100644 test/gen/java/nested/int_array_s.java delete mode 100644 test/gen/java/nested/int_array_t_s.java delete mode 100644 test/gen/java/nested/int_s.java delete mode 100644 test/gen/java/nested/int_t_s.java delete mode 100644 test/gen/java/nested/struct_array_s.java delete mode 100644 test/gen/java/nested/struct_array_ss.java delete mode 100644 test/gen/java/nested/struct_array_t.java delete mode 100644 test/gen/java/nested/struct_array_t_s.java delete mode 100644 test/gen/java/nested/struct_s.java delete mode 100644 test/gen/java/nested/struct_struct_s.java delete mode 100644 test/gen/java/nested/struct_struct_t.java delete mode 100644 test/gen/java/nested/struct_struct_t_s.java delete mode 100644 test/gen/java/nested/struct_t.java delete mode 100644 test/gen/java/nested/struct_t_s.java delete mode 100644 test/gen/java/simple/a_fixed_int_array.java delete mode 100644 test/gen/java/simple/a_fixed_int_array_array_array.java delete mode 100644 test/gen/java/simple/a_fixed_int_multi_array.java delete mode 100644 test/gen/java/simple/a_variable_int_array.java delete mode 100644 test/gen/java/simple/a_variable_int_array_array_array.java delete mode 100644 test/gen/java/simple/a_variable_int_multi_array.java delete mode 100644 test/gen/java/simple/a_void.java delete mode 100644 test/gen/java/simple/an_int.java delete mode 100644 test/gen/java/simple/an_int_struct.java delete mode 100644 test/gen/nested.typeinfo delete mode 100644 test/gen/nested.vec delete mode 100644 test/gen/python/nested.py delete mode 100644 test/gen/python/simple.py delete mode 100644 test/gen/simple.typeinfo delete mode 100644 test/gen/simple.vec diff --git a/examples/simple_java/compile.sh b/examples/simple_java/compile.sh index 7d455a2..84a0e83 100644 --- a/examples/simple_java/compile.sh +++ b/examples/simple_java/compile.sh @@ -1,3 +1,6 @@ -java -jar ../../labComm.jar --java=gen simple.lc +java -jar ../../labComm.jar --java=gen --c=gen/simple.c --h=gen/simple.h simple.lc javac -cp ../../lib/java:. gen/*.java Encoder.java Decoder.java + +gcc -o encoder -I . -I ../../lib/c example_encoder.c gen/simple.c ../../lib/c/labcomm.c ../../lib/c/labcomm_fd_reader_writer.c + diff --git a/examples/simple_java/example_encoder.c b/examples/simple_java/example_encoder.c new file mode 100644 index 0000000..079ca17 --- /dev/null +++ b/examples/simple_java/example_encoder.c @@ -0,0 +1,27 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <labcomm_fd_reader_writer.h> +#include "gen/simple.h" + +int main(int argc, char *argv[]) { + int fd; + struct labcomm_encoder *encoder; + int i, j; + + char *filename = argv[1]; + printf("C encoder writing to %s\n", filename); + fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); + encoder = labcomm_encoder_new(labcomm_fd_writer, &fd); + labcomm_encoder_register_simple_TwoInts(encoder); + labcomm_encoder_register_simple_IntString(encoder); + simple_IntString is; + is.x = 24; + is.s = "Hello, LabComm!"; + labcomm_encode_simple_IntString(encoder, &is); + + simple_TwoInts ti; + ti.a = 13; + ti.b = 37; + labcomm_encode_simple_TwoInts(encoder, &ti); +} diff --git a/test/gen/c/nested.c b/test/gen/c/nested.c deleted file mode 100644 index 097d54c..0000000 --- a/test/gen/c/nested.c +++ /dev/null @@ -1,1213 +0,0 @@ -#include "labcomm.h" -#include "labcomm_private.h" -#include "gen/c/nested.h" - -static unsigned char signature_bytes_struct_array_ss[] = { -// array [1] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // struct { 3 fields - 0, 0, 0, 17, - 0, 0, 0, 3, - // int 'aa' - 0, 0, 0, 2, - 97, 97, - 0, 0, 0, 35, - // boolean 'bb' - 0, 0, 0, 2, - 98, 98, - 0, 0, 0, 32, - // int_array_ss 'ias' - 0, 0, 0, 3, - 105, 97, 115, - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_, 3, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 3, - 0, 0, 0, 0, - // array [5] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 5, - 0, 0, 0, 35, - // } - // } - // } - // } - // } - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_array_ss = { - LABCOMM_SAMPLE, "struct_array_ss", - (int (*)(void *))labcomm_sizeof_nested_struct_array_ss, - sizeof(signature_bytes_struct_array_ss), - signature_bytes_struct_array_ss - }; -static unsigned char signature_bytes_int_s[] = { -0, 0, 0, 35, -}; -labcomm_signature_t labcomm_signature_nested_int_s = { - LABCOMM_SAMPLE, "int_s", - (int (*)(void *))labcomm_sizeof_nested_int_s, - sizeof(signature_bytes_int_s), - signature_bytes_int_s - }; -static unsigned char signature_bytes_int_array_s[] = { -// array [1] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_, 3, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 3, - 0, 0, 0, 0, - // array [5] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 5, - 0, 0, 0, 35, - // } - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_int_array_s = { - LABCOMM_SAMPLE, "int_array_s", - (int (*)(void *))labcomm_sizeof_nested_int_array_s, - sizeof(signature_bytes_int_array_s), - signature_bytes_int_array_s - }; -static unsigned char signature_bytes_struct_s[] = { -// struct { 2 fields -0, 0, 0, 17, - 0, 0, 0, 2, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // double 'bcd' - 0, 0, 0, 3, - 98, 99, 100, - 0, 0, 0, 38, -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_s = { - LABCOMM_SAMPLE, "struct_s", - (int (*)(void *))labcomm_sizeof_nested_struct_s, - sizeof(signature_bytes_struct_s), - signature_bytes_struct_s - }; -static unsigned char signature_bytes_struct_array_s[] = { -// array [2] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_array_s = { - LABCOMM_SAMPLE, "struct_array_s", - (int (*)(void *))labcomm_sizeof_nested_struct_array_s, - sizeof(signature_bytes_struct_array_s), - signature_bytes_struct_array_s - }; -static unsigned char signature_bytes_struct_struct_s[] = { -// struct { 1 fields -0, 0, 0, 17, - 0, 0, 0, 1, - // struct 'a' - 0, 0, 0, 1, - 97, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_struct_s = { - LABCOMM_SAMPLE, "struct_struct_s", - (int (*)(void *))labcomm_sizeof_nested_struct_struct_s, - sizeof(signature_bytes_struct_struct_s), - signature_bytes_struct_struct_s - }; -static unsigned char signature_bytes_int_t_s[] = { -0, 0, 0, 35, -}; -labcomm_signature_t labcomm_signature_nested_int_t_s = { - LABCOMM_SAMPLE, "int_t_s", - (int (*)(void *))labcomm_sizeof_nested_int_t_s, - sizeof(signature_bytes_int_t_s), - signature_bytes_int_t_s - }; -static unsigned char signature_bytes_int_array_t_s[] = { -// array [1] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [3, 4] - 0, 0, 0, 16, - 0, 0, 0, 2, - 0, 0, 0, 3, - 0, 0, 0, 4, - 0, 0, 0, 35, - // } - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_int_array_t_s = { - LABCOMM_SAMPLE, "int_array_t_s", - (int (*)(void *))labcomm_sizeof_nested_int_array_t_s, - sizeof(signature_bytes_int_array_t_s), - signature_bytes_int_array_t_s - }; -static unsigned char signature_bytes_struct_t_s[] = { -// struct { 1 fields -0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_t_s = { - LABCOMM_SAMPLE, "struct_t_s", - (int (*)(void *))labcomm_sizeof_nested_struct_t_s, - sizeof(signature_bytes_struct_t_s), - signature_bytes_struct_t_s - }; -static unsigned char signature_bytes_struct_array_t_s[] = { -// array [2] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_array_t_s = { - LABCOMM_SAMPLE, "struct_array_t_s", - (int (*)(void *))labcomm_sizeof_nested_struct_array_t_s, - sizeof(signature_bytes_struct_array_t_s), - signature_bytes_struct_array_t_s - }; -static unsigned char signature_bytes_struct_struct_t_s[] = { -// struct { 1 fields -0, 0, 0, 17, - 0, 0, 0, 1, - // struct 'a' - 0, 0, 0, 1, - 97, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } -// } -}; -labcomm_signature_t labcomm_signature_nested_struct_struct_t_s = { - LABCOMM_SAMPLE, "struct_struct_t_s", - (int (*)(void *))labcomm_sizeof_nested_struct_struct_t_s, - sizeof(signature_bytes_struct_struct_t_s), - signature_bytes_struct_struct_t_s - }; -static void decode_struct_array_ss( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_array_ss *v, - void *context - ), - void *context -) -{ - nested_struct_array_ss v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - v.a[i_0_0].n_0 = labcomm_decode_int(d); - v.a[i_0_0].a = malloc(sizeof(v.a[i_0_0].a[0]) * v.a[i_0_0].n_0); - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < v.a[i_0_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - v.a[i_0_0].a[i_1].n_0 = labcomm_decode_int(d); - v.a[i_0_0].a[i_1].a = malloc(sizeof(v.a[i_0_0].a[i_1].a[0]) * v.a[i_0_0].a[i_1].n_0); - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < v.a[i_0_0].a[i_1].n_0 ; i_2_0++) { - int i_2 = i_2_0; - v.a[i_0_0].a[i_1].a[i_2].aa = labcomm_decode_int(d); - v.a[i_0_0].a[i_1].a[i_2].bb = labcomm_decode_boolean(d); - { - int i_3_0; - for (i_3_0 = 0 ; i_3_0 < 1 ; i_3_0++) { - v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_0 = labcomm_decode_int(d); - v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2 = labcomm_decode_int(d); - v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].a = malloc(sizeof(v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].a[0]) * v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_0 * 3 * v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2); - { - int i_4_0; - int i_4_1; - int i_4_2; - for (i_4_0 = 0 ; i_4_0 < v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_0 ; i_4_0++) { - for (i_4_1 = 0 ; i_4_1 < 3 ; i_4_1++) { - for (i_4_2 = 0 ; i_4_2 < v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2 ; i_4_2++) { - int i_4 = ((i_4_0) * 3 + i_4_1) * v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2 + i_4_2; - { - int i_5_0; - for (i_5_0 = 0 ; i_5_0 < 5 ; i_5_0++) { - v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].a[i_4].a[i_5_0] = labcomm_decode_int(d); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - handle(&v, context); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < v.a[i_0_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < v.a[i_0_0].a[i_1].n_0 ; i_2_0++) { - int i_2 = i_2_0; - { - int i_3_0; - for (i_3_0 = 0 ; i_3_0 < 1 ; i_3_0++) { - free(v.a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].a); - } - } - } - } - free(v.a[i_0_0].a[i_1].a); - } - } - free(v.a[i_0_0].a); - } - } - } -} -void labcomm_decoder_register_nested_struct_array_ss( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_array_ss *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_array_ss, - (labcomm_decoder_typecast_t)decode_struct_array_ss, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_array_ss( - labcomm_encoder_t *e, - nested_struct_array_ss *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_array_ss); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].n_0); - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < (*v).a[i_0_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1].n_0); - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < (*v).a[i_0_0].a[i_1].n_0 ; i_2_0++) { - int i_2 = i_2_0; - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1].a[i_2].aa); - labcomm_encode_boolean(e, (*v).a[i_0_0].a[i_1].a[i_2].bb); - { - int i_3_0; - for (i_3_0 = 0 ; i_3_0 < 1 ; i_3_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_0); - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2); - { - int i_4_0; - int i_4_1; - int i_4_2; - for (i_4_0 = 0 ; i_4_0 < (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_0 ; i_4_0++) { - for (i_4_1 = 0 ; i_4_1 < 3 ; i_4_1++) { - for (i_4_2 = 0 ; i_4_2 < (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2 ; i_4_2++) { - int i_4 = ((i_4_0) * 3 + i_4_1) * (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2 + i_4_2; - { - int i_5_0; - for (i_5_0 = 0 ; i_5_0 < 5 ; i_5_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].a[i_4].a[i_5_0]); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_array_ss( -labcomm_encoder_t *e, -nested_struct_array_ss *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_array_ss, v); -} -void labcomm_encoder_register_nested_struct_array_ss( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_array_ss, - (labcomm_encode_typecast_t)encode_struct_array_ss - ); -} -int labcomm_sizeof_nested_struct_array_ss(nested_struct_array_ss *v) -{ - int result = 4; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < (*v).a[i_0_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < (*v).a[i_0_0].a[i_1].n_0 ; i_2_0++) { - int i_2 = i_2_0; - { - int i_3_0; - for (i_3_0 = 0 ; i_3_0 < 1 ; i_3_0++) { - result += 20 * (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_0 * 3 * (*v).a[i_0_0].a[i_1].a[i_2].ias.a[i_3_0].n_2; - } - } - result += 5; - } - } - } - } - } - } - return result; -} -static void decode_int_s( - labcomm_decoder_t *d, - void (*handle)( - nested_int_s *v, - void *context - ), - void *context -) -{ - nested_int_s v; - v = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_nested_int_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_int_s, - (labcomm_decoder_typecast_t)decode_int_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_int_s( - labcomm_encoder_t *e, - nested_int_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_int_s); - { - labcomm_encode_int(e, (*v)); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_int_s( -labcomm_encoder_t *e, -nested_int_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_int_s, v); -} -void labcomm_encoder_register_nested_int_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_int_s, - (labcomm_encode_typecast_t)encode_int_s - ); -} -int labcomm_sizeof_nested_int_s(nested_int_s *v) -{ - return 8; -} -static void decode_int_array_s( - labcomm_decoder_t *d, - void (*handle)( - nested_int_array_s *v, - void *context - ), - void *context -) -{ - nested_int_array_s v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - v.a[i_0_0].n_0 = labcomm_decode_int(d); - v.a[i_0_0].n_2 = labcomm_decode_int(d); - v.a[i_0_0].a = malloc(sizeof(v.a[i_0_0].a[0]) * v.a[i_0_0].n_0 * 3 * v.a[i_0_0].n_2); - { - int i_1_0; - int i_1_1; - int i_1_2; - for (i_1_0 = 0 ; i_1_0 < v.a[i_0_0].n_0 ; i_1_0++) { - for (i_1_1 = 0 ; i_1_1 < 3 ; i_1_1++) { - for (i_1_2 = 0 ; i_1_2 < v.a[i_0_0].n_2 ; i_1_2++) { - int i_1 = ((i_1_0) * 3 + i_1_1) * v.a[i_0_0].n_2 + i_1_2; - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < 5 ; i_2_0++) { - v.a[i_0_0].a[i_1].a[i_2_0] = labcomm_decode_int(d); - } - } - } - } - } - } - } - } - handle(&v, context); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - free(v.a[i_0_0].a); - } - } - } -} -void labcomm_decoder_register_nested_int_array_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_array_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_int_array_s, - (labcomm_decoder_typecast_t)decode_int_array_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_int_array_s( - labcomm_encoder_t *e, - nested_int_array_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_int_array_s); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].n_0); - labcomm_encode_int(e, (*v).a[i_0_0].n_2); - { - int i_1_0; - int i_1_1; - int i_1_2; - for (i_1_0 = 0 ; i_1_0 < (*v).a[i_0_0].n_0 ; i_1_0++) { - for (i_1_1 = 0 ; i_1_1 < 3 ; i_1_1++) { - for (i_1_2 = 0 ; i_1_2 < (*v).a[i_0_0].n_2 ; i_1_2++) { - int i_1 = ((i_1_0) * 3 + i_1_1) * (*v).a[i_0_0].n_2 + i_1_2; - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < 5 ; i_2_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1].a[i_2_0]); - } - } - } - } - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_int_array_s( -labcomm_encoder_t *e, -nested_int_array_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_int_array_s, v); -} -void labcomm_encoder_register_nested_int_array_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_int_array_s, - (labcomm_encode_typecast_t)encode_int_array_s - ); -} -int labcomm_sizeof_nested_int_array_s(nested_int_array_s *v) -{ - int result = 4; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - result += 20 * (*v).a[i_0_0].n_0 * 3 * (*v).a[i_0_0].n_2; - } - } - return result; -} -static void decode_struct_s( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_s *v, - void *context - ), - void *context -) -{ - nested_struct_s v; - v.a = labcomm_decode_int(d); - v.bcd = labcomm_decode_double(d); - handle(&v, context); -} -void labcomm_decoder_register_nested_struct_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_s, - (labcomm_decoder_typecast_t)decode_struct_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_s( - labcomm_encoder_t *e, - nested_struct_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_s); - { - labcomm_encode_int(e, (*v).a); - labcomm_encode_double(e, (*v).bcd); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_s( -labcomm_encoder_t *e, -nested_struct_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_s, v); -} -void labcomm_encoder_register_nested_struct_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_s, - (labcomm_encode_typecast_t)encode_struct_s - ); -} -int labcomm_sizeof_nested_struct_s(nested_struct_s *v) -{ - return 16; -} -static void decode_struct_array_s( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_array_s *v, - void *context - ), - void *context -) -{ - nested_struct_array_s v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - v.a[i_0_0].a = labcomm_decode_int(d); - } - } - handle(&v, context); -} -void labcomm_decoder_register_nested_struct_array_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_array_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_array_s, - (labcomm_decoder_typecast_t)decode_struct_array_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_array_s( - labcomm_encoder_t *e, - nested_struct_array_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_array_s); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].a); - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_array_s( -labcomm_encoder_t *e, -nested_struct_array_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_array_s, v); -} -void labcomm_encoder_register_nested_struct_array_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_array_s, - (labcomm_encode_typecast_t)encode_struct_array_s - ); -} -int labcomm_sizeof_nested_struct_array_s(nested_struct_array_s *v) -{ - return 12; -} -static void decode_struct_struct_s( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_struct_s *v, - void *context - ), - void *context -) -{ - nested_struct_struct_s v; - v.a.a = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_nested_struct_struct_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_struct_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_struct_s, - (labcomm_decoder_typecast_t)decode_struct_struct_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_struct_s( - labcomm_encoder_t *e, - nested_struct_struct_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_struct_s); - { - labcomm_encode_int(e, (*v).a.a); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_struct_s( -labcomm_encoder_t *e, -nested_struct_struct_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_struct_s, v); -} -void labcomm_encoder_register_nested_struct_struct_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_struct_s, - (labcomm_encode_typecast_t)encode_struct_struct_s - ); -} -int labcomm_sizeof_nested_struct_struct_s(nested_struct_struct_s *v) -{ - return 8; -} -static void decode_int_t_s( - labcomm_decoder_t *d, - void (*handle)( - nested_int_t_s *v, - void *context - ), - void *context -) -{ - nested_int_t_s v; - v = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_nested_int_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_t_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_int_t_s, - (labcomm_decoder_typecast_t)decode_int_t_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_int_t_s( - labcomm_encoder_t *e, - nested_int_t_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_int_t_s); - { - labcomm_encode_int(e, (*v)); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_int_t_s( -labcomm_encoder_t *e, -nested_int_t_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_int_t_s, v); -} -void labcomm_encoder_register_nested_int_t_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_int_t_s, - (labcomm_encode_typecast_t)encode_int_t_s - ); -} -int labcomm_sizeof_nested_int_t_s(nested_int_t_s *v) -{ - return 8; -} -static void decode_int_array_t_s( - labcomm_decoder_t *d, - void (*handle)( - nested_int_array_t_s *v, - void *context - ), - void *context -) -{ - nested_int_array_t_s v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < 2 ; i_1_0++) { - { - int i_2_0; - int i_2_1; - for (i_2_0 = 0 ; i_2_0 < 3 ; i_2_0++) { - for (i_2_1 = 0 ; i_2_1 < 4 ; i_2_1++) { - v.a[i_0_0].a[i_1_0].a[i_2_0][i_2_1] = labcomm_decode_int(d); - } - } - } - } - } - } - } - handle(&v, context); -} -void labcomm_decoder_register_nested_int_array_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_array_t_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_int_array_t_s, - (labcomm_decoder_typecast_t)decode_int_array_t_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_int_array_t_s( - labcomm_encoder_t *e, - nested_int_array_t_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_int_array_t_s); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 1 ; i_0_0++) { - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < 2 ; i_1_0++) { - { - int i_2_0; - int i_2_1; - for (i_2_0 = 0 ; i_2_0 < 3 ; i_2_0++) { - for (i_2_1 = 0 ; i_2_1 < 4 ; i_2_1++) { - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1_0].a[i_2_0][i_2_1]); - } - } - } - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_int_array_t_s( -labcomm_encoder_t *e, -nested_int_array_t_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_int_array_t_s, v); -} -void labcomm_encoder_register_nested_int_array_t_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_int_array_t_s, - (labcomm_encode_typecast_t)encode_int_array_t_s - ); -} -int labcomm_sizeof_nested_int_array_t_s(nested_int_array_t_s *v) -{ - return 100; -} -static void decode_struct_t_s( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_t_s *v, - void *context - ), - void *context -) -{ - nested_struct_t_s v; - v.a = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_nested_struct_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_t_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_t_s, - (labcomm_decoder_typecast_t)decode_struct_t_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_t_s( - labcomm_encoder_t *e, - nested_struct_t_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_t_s); - { - labcomm_encode_int(e, (*v).a); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_t_s( -labcomm_encoder_t *e, -nested_struct_t_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_t_s, v); -} -void labcomm_encoder_register_nested_struct_t_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_t_s, - (labcomm_encode_typecast_t)encode_struct_t_s - ); -} -int labcomm_sizeof_nested_struct_t_s(nested_struct_t_s *v) -{ - return 8; -} -static void decode_struct_array_t_s( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_array_t_s *v, - void *context - ), - void *context -) -{ - nested_struct_array_t_s v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - v.a[i_0_0].a = labcomm_decode_int(d); - } - } - handle(&v, context); -} -void labcomm_decoder_register_nested_struct_array_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_array_t_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_array_t_s, - (labcomm_decoder_typecast_t)decode_struct_array_t_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_array_t_s( - labcomm_encoder_t *e, - nested_struct_array_t_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_array_t_s); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].a); - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_array_t_s( -labcomm_encoder_t *e, -nested_struct_array_t_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_array_t_s, v); -} -void labcomm_encoder_register_nested_struct_array_t_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_array_t_s, - (labcomm_encode_typecast_t)encode_struct_array_t_s - ); -} -int labcomm_sizeof_nested_struct_array_t_s(nested_struct_array_t_s *v) -{ - return 12; -} -static void decode_struct_struct_t_s( - labcomm_decoder_t *d, - void (*handle)( - nested_struct_struct_t_s *v, - void *context - ), - void *context -) -{ - nested_struct_struct_t_s v; - v.a.a = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_nested_struct_struct_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_struct_t_s *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_nested_struct_struct_t_s, - (labcomm_decoder_typecast_t)decode_struct_struct_t_s, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_struct_struct_t_s( - labcomm_encoder_t *e, - nested_struct_struct_t_s *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_nested_struct_struct_t_s); - { - labcomm_encode_int(e, (*v).a.a); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_nested_struct_struct_t_s( -labcomm_encoder_t *e, -nested_struct_struct_t_s *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_nested_struct_struct_t_s, v); -} -void labcomm_encoder_register_nested_struct_struct_t_s( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_nested_struct_struct_t_s, - (labcomm_encode_typecast_t)encode_struct_struct_t_s - ); -} -int labcomm_sizeof_nested_struct_struct_t_s(nested_struct_struct_t_s *v) -{ - return 8; -} diff --git a/test/gen/c/nested.h b/test/gen/c/nested.h deleted file mode 100644 index 3e38445..0000000 --- a/test/gen/c/nested.h +++ /dev/null @@ -1,350 +0,0 @@ -/* LabComm declarations: -typedef int int_array_ss[1][_, 3, _][5]; -sample struct { - int aa; - boolean bb; - int_array_ss ias; -} struct_array_ss[1][_][_]; -typedef int int_t; -typedef int int_array_t[1][2][3, 4]; -typedef struct { - int a; -} struct_t; -typedef struct { - int a; -} struct_array_t[2]; -typedef struct { - struct { - int a; - } a; -} struct_struct_t; -sample int int_s; -sample int int_array_s[1][_, 3, _][5]; -sample struct { - int a; - double bcd; -} struct_s; -sample struct { - int a; -} struct_array_s[2]; -sample struct { - struct { - int a; - } a; -} struct_struct_s; -sample int_t int_t_s; -sample int_array_t int_array_t_s; -sample struct_t struct_t_s; -sample struct_array_t struct_array_t_s; -sample struct_struct_t struct_struct_t_s; -*/ - - -#ifndef __LABCOMM_nested_H__ -#define __LABCOMM_nested_H__ - -#include "labcomm.h" - -#ifndef PREDEFINED_nested_int_array_ss -typedef struct { - struct { - int n_0; - // n_1=3 - int n_2; - struct { - int a[5]; - } *a; - } a[1]; -} nested_int_array_ss; -#endif - -#ifndef PREDEFINED_nested_struct_array_ss -typedef struct { - struct { - int n_0; - struct { - int n_0; - struct { - int aa; - unsigned char bb; - nested_int_array_ss ias; - } *a; - } *a; - } a[1]; -} nested_struct_array_ss; -#endif -void labcomm_decoder_register_nested_struct_array_ss( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_array_ss *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_array_ss( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_array_ss( - struct labcomm_encoder *e, - nested_struct_array_ss *v -); -extern int labcomm_sizeof_nested_struct_array_ss(nested_struct_array_ss *v); - -#ifndef PREDEFINED_nested_int_t -typedef int nested_int_t; -#endif - -#ifndef PREDEFINED_nested_int_array_t -typedef struct { - struct { - struct { - int a[3][4]; - } a[2]; - } a[1]; -} nested_int_array_t; -#endif - -#ifndef PREDEFINED_nested_struct_t -typedef struct { - int a; -} nested_struct_t; -#endif - -#ifndef PREDEFINED_nested_struct_array_t -typedef struct { - struct { - int a; - } a[2]; -} nested_struct_array_t; -#endif - -#ifndef PREDEFINED_nested_struct_struct_t -typedef struct { - struct { - int a; - } a; -} nested_struct_struct_t; -#endif - -#ifndef PREDEFINED_nested_int_s -typedef int nested_int_s; -#endif -void labcomm_decoder_register_nested_int_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_int_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_int_s( - struct labcomm_encoder *e, - nested_int_s *v -); -extern int labcomm_sizeof_nested_int_s(nested_int_s *v); - -#ifndef PREDEFINED_nested_int_array_s -typedef struct { - struct { - int n_0; - // n_1=3 - int n_2; - struct { - int a[5]; - } *a; - } a[1]; -} nested_int_array_s; -#endif -void labcomm_decoder_register_nested_int_array_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_array_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_int_array_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_int_array_s( - struct labcomm_encoder *e, - nested_int_array_s *v -); -extern int labcomm_sizeof_nested_int_array_s(nested_int_array_s *v); - -#ifndef PREDEFINED_nested_struct_s -typedef struct { - int a; - double bcd; -} nested_struct_s; -#endif -void labcomm_decoder_register_nested_struct_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_s( - struct labcomm_encoder *e, - nested_struct_s *v -); -extern int labcomm_sizeof_nested_struct_s(nested_struct_s *v); - -#ifndef PREDEFINED_nested_struct_array_s -typedef struct { - struct { - int a; - } a[2]; -} nested_struct_array_s; -#endif -void labcomm_decoder_register_nested_struct_array_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_array_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_array_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_array_s( - struct labcomm_encoder *e, - nested_struct_array_s *v -); -extern int labcomm_sizeof_nested_struct_array_s(nested_struct_array_s *v); - -#ifndef PREDEFINED_nested_struct_struct_s -typedef struct { - struct { - int a; - } a; -} nested_struct_struct_s; -#endif -void labcomm_decoder_register_nested_struct_struct_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_struct_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_struct_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_struct_s( - struct labcomm_encoder *e, - nested_struct_struct_s *v -); -extern int labcomm_sizeof_nested_struct_struct_s(nested_struct_struct_s *v); - -#ifndef PREDEFINED_nested_int_t_s -typedef nested_int_t nested_int_t_s; -#endif -void labcomm_decoder_register_nested_int_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_t_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_int_t_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_int_t_s( - struct labcomm_encoder *e, - nested_int_t_s *v -); -extern int labcomm_sizeof_nested_int_t_s(nested_int_t_s *v); - -#ifndef PREDEFINED_nested_int_array_t_s -typedef nested_int_array_t nested_int_array_t_s; -#endif -void labcomm_decoder_register_nested_int_array_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_int_array_t_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_int_array_t_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_int_array_t_s( - struct labcomm_encoder *e, - nested_int_array_t_s *v -); -extern int labcomm_sizeof_nested_int_array_t_s(nested_int_array_t_s *v); - -#ifndef PREDEFINED_nested_struct_t_s -typedef nested_struct_t nested_struct_t_s; -#endif -void labcomm_decoder_register_nested_struct_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_t_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_t_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_t_s( - struct labcomm_encoder *e, - nested_struct_t_s *v -); -extern int labcomm_sizeof_nested_struct_t_s(nested_struct_t_s *v); - -#ifndef PREDEFINED_nested_struct_array_t_s -typedef nested_struct_array_t nested_struct_array_t_s; -#endif -void labcomm_decoder_register_nested_struct_array_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_array_t_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_array_t_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_array_t_s( - struct labcomm_encoder *e, - nested_struct_array_t_s *v -); -extern int labcomm_sizeof_nested_struct_array_t_s(nested_struct_array_t_s *v); - -#ifndef PREDEFINED_nested_struct_struct_t_s -typedef nested_struct_struct_t nested_struct_struct_t_s; -#endif -void labcomm_decoder_register_nested_struct_struct_t_s( - struct labcomm_decoder *d, - void (*handler)( - nested_struct_struct_t_s *v, - void *context - ), - void *context -); -void labcomm_encoder_register_nested_struct_struct_t_s( - struct labcomm_encoder *e); -void labcomm_encode_nested_struct_struct_t_s( - struct labcomm_encoder *e, - nested_struct_struct_t_s *v -); -extern int labcomm_sizeof_nested_struct_struct_t_s(nested_struct_struct_t_s *v); - -#define LABCOMM_FORALL_SAMPLES_nested(func, sep) \ - func(struct_array_ss, nested_struct_array_ss) sep \ - func(int_s, nested_int_s) sep \ - func(int_array_s, nested_int_array_s) sep \ - func(struct_s, nested_struct_s) sep \ - func(struct_array_s, nested_struct_array_s) sep \ - func(struct_struct_s, nested_struct_struct_s) sep \ - func(int_t_s, nested_int_t_s) sep \ - func(int_array_t_s, nested_int_array_t_s) sep \ - func(struct_t_s, nested_struct_t_s) sep \ - func(struct_array_t_s, nested_struct_array_t_s) sep \ - func(struct_struct_t_s, nested_struct_struct_t_s) -#endif diff --git a/test/gen/c/simple.c b/test/gen/c/simple.c deleted file mode 100644 index 89f4e1d..0000000 --- a/test/gen/c/simple.c +++ /dev/null @@ -1,913 +0,0 @@ -#include "labcomm.h" -#include "labcomm_private.h" -#include "gen/c/simple.h" - -static unsigned char signature_bytes_an_int[] = { -0, 0, 0, 35, -}; -labcomm_signature_t labcomm_signature_simple_an_int = { - LABCOMM_SAMPLE, "an_int", - (int (*)(void *))labcomm_sizeof_simple_an_int, - sizeof(signature_bytes_an_int), - signature_bytes_an_int - }; -static unsigned char signature_bytes_a_fixed_int_array[] = { -// array [2] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - 0, 0, 0, 35, -// } -}; -labcomm_signature_t labcomm_signature_simple_a_fixed_int_array = { - LABCOMM_SAMPLE, "a_fixed_int_array", - (int (*)(void *))labcomm_sizeof_simple_a_fixed_int_array, - sizeof(signature_bytes_a_fixed_int_array), - signature_bytes_a_fixed_int_array - }; -static unsigned char signature_bytes_a_fixed_int_multi_array[] = { -// array [2, 2, 2] -0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 2, - 0, 0, 0, 2, - 0, 0, 0, 2, - 0, 0, 0, 35, -// } -}; -labcomm_signature_t labcomm_signature_simple_a_fixed_int_multi_array = { - LABCOMM_SAMPLE, "a_fixed_int_multi_array", - (int (*)(void *))labcomm_sizeof_simple_a_fixed_int_multi_array, - sizeof(signature_bytes_a_fixed_int_multi_array), - signature_bytes_a_fixed_int_multi_array - }; -static unsigned char signature_bytes_a_fixed_int_array_array_array[] = { -// array [2] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - // } -// } -}; -labcomm_signature_t labcomm_signature_simple_a_fixed_int_array_array_array = { - LABCOMM_SAMPLE, "a_fixed_int_array_array_array", - (int (*)(void *))labcomm_sizeof_simple_a_fixed_int_array_array_array, - sizeof(signature_bytes_a_fixed_int_array_array_array), - signature_bytes_a_fixed_int_array_array_array - }; -static unsigned char signature_bytes_a_variable_int_array[] = { -// array [_] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - 0, 0, 0, 35, -// } -}; -labcomm_signature_t labcomm_signature_simple_a_variable_int_array = { - LABCOMM_SAMPLE, "a_variable_int_array", - (int (*)(void *))labcomm_sizeof_simple_a_variable_int_array, - sizeof(signature_bytes_a_variable_int_array), - signature_bytes_a_variable_int_array - }; -static unsigned char signature_bytes_a_variable_int_multi_array[] = { -// array [_, _, _] -0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 35, -// } -}; -labcomm_signature_t labcomm_signature_simple_a_variable_int_multi_array = { - LABCOMM_SAMPLE, "a_variable_int_multi_array", - (int (*)(void *))labcomm_sizeof_simple_a_variable_int_multi_array, - sizeof(signature_bytes_a_variable_int_multi_array), - signature_bytes_a_variable_int_multi_array - }; -static unsigned char signature_bytes_a_variable_int_array_array_array[] = { -// array [_] -0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - // } -// } -}; -labcomm_signature_t labcomm_signature_simple_a_variable_int_array_array_array = { - LABCOMM_SAMPLE, "a_variable_int_array_array_array", - (int (*)(void *))labcomm_sizeof_simple_a_variable_int_array_array_array, - sizeof(signature_bytes_a_variable_int_array_array_array), - signature_bytes_a_variable_int_array_array_array - }; -static unsigned char signature_bytes_an_int_struct[] = { -// struct { 2 fields -0, 0, 0, 17, - 0, 0, 0, 2, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // int 'b' - 0, 0, 0, 1, - 98, - 0, 0, 0, 35, -// } -}; -labcomm_signature_t labcomm_signature_simple_an_int_struct = { - LABCOMM_SAMPLE, "an_int_struct", - (int (*)(void *))labcomm_sizeof_simple_an_int_struct, - sizeof(signature_bytes_an_int_struct), - signature_bytes_an_int_struct - }; -static unsigned char signature_bytes_a_void[] = { -// void -0, 0, 0, 17, -0, 0, 0, 0, -}; -labcomm_signature_t labcomm_signature_simple_a_void = { - LABCOMM_SAMPLE, "a_void", - (int (*)(void *))labcomm_sizeof_simple_a_void, - sizeof(signature_bytes_a_void), - signature_bytes_a_void - }; -static void decode_an_int( - labcomm_decoder_t *d, - void (*handle)( - simple_an_int *v, - void *context - ), - void *context -) -{ - simple_an_int v; - v = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_simple_an_int( - struct labcomm_decoder *d, - void (*handler)( - simple_an_int *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_an_int, - (labcomm_decoder_typecast_t)decode_an_int, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_an_int( - labcomm_encoder_t *e, - simple_an_int *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_an_int); - { - labcomm_encode_int(e, (*v)); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_an_int( -labcomm_encoder_t *e, -simple_an_int *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_an_int, v); -} -void labcomm_encoder_register_simple_an_int( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_an_int, - (labcomm_encode_typecast_t)encode_an_int - ); -} -int labcomm_sizeof_simple_an_int(simple_an_int *v) -{ - return 8; -} -static void decode_a_fixed_int_array( - labcomm_decoder_t *d, - void (*handle)( - simple_a_fixed_int_array *v, - void *context - ), - void *context -) -{ - simple_a_fixed_int_array v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - v.a[i_0_0] = labcomm_decode_int(d); - } - } - handle(&v, context); -} -void labcomm_decoder_register_simple_a_fixed_int_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_fixed_int_array *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_fixed_int_array, - (labcomm_decoder_typecast_t)decode_a_fixed_int_array, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_fixed_int_array( - labcomm_encoder_t *e, - simple_a_fixed_int_array *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_fixed_int_array); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - labcomm_encode_int(e, (*v).a[i_0_0]); - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_fixed_int_array( -labcomm_encoder_t *e, -simple_a_fixed_int_array *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_fixed_int_array, v); -} -void labcomm_encoder_register_simple_a_fixed_int_array( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_fixed_int_array, - (labcomm_encode_typecast_t)encode_a_fixed_int_array - ); -} -int labcomm_sizeof_simple_a_fixed_int_array(simple_a_fixed_int_array *v) -{ - return 12; -} -static void decode_a_fixed_int_multi_array( - labcomm_decoder_t *d, - void (*handle)( - simple_a_fixed_int_multi_array *v, - void *context - ), - void *context -) -{ - simple_a_fixed_int_multi_array v; - { - int i_0_0; - int i_0_1; - int i_0_2; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - for (i_0_1 = 0 ; i_0_1 < 2 ; i_0_1++) { - for (i_0_2 = 0 ; i_0_2 < 2 ; i_0_2++) { - v.a[i_0_0][i_0_1][i_0_2] = labcomm_decode_int(d); - } - } - } - } - handle(&v, context); -} -void labcomm_decoder_register_simple_a_fixed_int_multi_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_fixed_int_multi_array *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_fixed_int_multi_array, - (labcomm_decoder_typecast_t)decode_a_fixed_int_multi_array, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_fixed_int_multi_array( - labcomm_encoder_t *e, - simple_a_fixed_int_multi_array *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_fixed_int_multi_array); - { - { - int i_0_0; - int i_0_1; - int i_0_2; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - for (i_0_1 = 0 ; i_0_1 < 2 ; i_0_1++) { - for (i_0_2 = 0 ; i_0_2 < 2 ; i_0_2++) { - labcomm_encode_int(e, (*v).a[i_0_0][i_0_1][i_0_2]); - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_fixed_int_multi_array( -labcomm_encoder_t *e, -simple_a_fixed_int_multi_array *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_fixed_int_multi_array, v); -} -void labcomm_encoder_register_simple_a_fixed_int_multi_array( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_fixed_int_multi_array, - (labcomm_encode_typecast_t)encode_a_fixed_int_multi_array - ); -} -int labcomm_sizeof_simple_a_fixed_int_multi_array(simple_a_fixed_int_multi_array *v) -{ - return 36; -} -static void decode_a_fixed_int_array_array_array( - labcomm_decoder_t *d, - void (*handle)( - simple_a_fixed_int_array_array_array *v, - void *context - ), - void *context -) -{ - simple_a_fixed_int_array_array_array v; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < 2 ; i_1_0++) { - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < 2 ; i_2_0++) { - v.a[i_0_0].a[i_1_0].a[i_2_0] = labcomm_decode_int(d); - } - } - } - } - } - } - handle(&v, context); -} -void labcomm_decoder_register_simple_a_fixed_int_array_array_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_fixed_int_array_array_array *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_fixed_int_array_array_array, - (labcomm_decoder_typecast_t)decode_a_fixed_int_array_array_array, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_fixed_int_array_array_array( - labcomm_encoder_t *e, - simple_a_fixed_int_array_array_array *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_fixed_int_array_array_array); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < 2 ; i_0_0++) { - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < 2 ; i_1_0++) { - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < 2 ; i_2_0++) { - labcomm_encode_int(e, (*v).a[i_0_0].a[i_1_0].a[i_2_0]); - } - } - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_fixed_int_array_array_array( -labcomm_encoder_t *e, -simple_a_fixed_int_array_array_array *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_fixed_int_array_array_array, v); -} -void labcomm_encoder_register_simple_a_fixed_int_array_array_array( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_fixed_int_array_array_array, - (labcomm_encode_typecast_t)encode_a_fixed_int_array_array_array - ); -} -int labcomm_sizeof_simple_a_fixed_int_array_array_array(simple_a_fixed_int_array_array_array *v) -{ - return 36; -} -static void decode_a_variable_int_array( - labcomm_decoder_t *d, - void (*handle)( - simple_a_variable_int_array *v, - void *context - ), - void *context -) -{ - simple_a_variable_int_array v; - v.n_0 = labcomm_decode_int(d); - v.a = malloc(sizeof(v.a[0]) * v.n_0); - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < v.n_0 ; i_0_0++) { - int i_0 = i_0_0; - v.a[i_0] = labcomm_decode_int(d); - } - } - handle(&v, context); - { - free(v.a); - } -} -void labcomm_decoder_register_simple_a_variable_int_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_variable_int_array *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_variable_int_array, - (labcomm_decoder_typecast_t)decode_a_variable_int_array, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_variable_int_array( - labcomm_encoder_t *e, - simple_a_variable_int_array *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_variable_int_array); - { - labcomm_encode_int(e, (*v).n_0); - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < (*v).n_0 ; i_0_0++) { - int i_0 = i_0_0; - labcomm_encode_int(e, (*v).a[i_0]); - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_variable_int_array( -labcomm_encoder_t *e, -simple_a_variable_int_array *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_variable_int_array, v); -} -void labcomm_encoder_register_simple_a_variable_int_array( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_variable_int_array, - (labcomm_encode_typecast_t)encode_a_variable_int_array - ); -} -int labcomm_sizeof_simple_a_variable_int_array(simple_a_variable_int_array *v) -{ - int result = 4; - result += 4 * (*v).n_0; - return result; -} -static void decode_a_variable_int_multi_array( - labcomm_decoder_t *d, - void (*handle)( - simple_a_variable_int_multi_array *v, - void *context - ), - void *context -) -{ - simple_a_variable_int_multi_array v; - v.n_0 = labcomm_decode_int(d); - v.n_1 = labcomm_decode_int(d); - v.n_2 = labcomm_decode_int(d); - v.a = malloc(sizeof(v.a[0]) * v.n_0 * v.n_1 * v.n_2); - { - int i_0_0; - int i_0_1; - int i_0_2; - for (i_0_0 = 0 ; i_0_0 < v.n_0 ; i_0_0++) { - for (i_0_1 = 0 ; i_0_1 < v.n_1 ; i_0_1++) { - for (i_0_2 = 0 ; i_0_2 < v.n_2 ; i_0_2++) { - int i_0 = ((i_0_0) * v.n_1 + i_0_1) * v.n_2 + i_0_2; - v.a[i_0] = labcomm_decode_int(d); - } - } - } - } - handle(&v, context); - { - free(v.a); - } -} -void labcomm_decoder_register_simple_a_variable_int_multi_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_variable_int_multi_array *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_variable_int_multi_array, - (labcomm_decoder_typecast_t)decode_a_variable_int_multi_array, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_variable_int_multi_array( - labcomm_encoder_t *e, - simple_a_variable_int_multi_array *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_variable_int_multi_array); - { - labcomm_encode_int(e, (*v).n_0); - labcomm_encode_int(e, (*v).n_1); - labcomm_encode_int(e, (*v).n_2); - { - int i_0_0; - int i_0_1; - int i_0_2; - for (i_0_0 = 0 ; i_0_0 < (*v).n_0 ; i_0_0++) { - for (i_0_1 = 0 ; i_0_1 < (*v).n_1 ; i_0_1++) { - for (i_0_2 = 0 ; i_0_2 < (*v).n_2 ; i_0_2++) { - int i_0 = ((i_0_0) * (*v).n_1 + i_0_1) * (*v).n_2 + i_0_2; - labcomm_encode_int(e, (*v).a[i_0]); - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_variable_int_multi_array( -labcomm_encoder_t *e, -simple_a_variable_int_multi_array *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_variable_int_multi_array, v); -} -void labcomm_encoder_register_simple_a_variable_int_multi_array( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_variable_int_multi_array, - (labcomm_encode_typecast_t)encode_a_variable_int_multi_array - ); -} -int labcomm_sizeof_simple_a_variable_int_multi_array(simple_a_variable_int_multi_array *v) -{ - int result = 4; - result += 4 * (*v).n_0 * (*v).n_1 * (*v).n_2; - return result; -} -static void decode_a_variable_int_array_array_array( - labcomm_decoder_t *d, - void (*handle)( - simple_a_variable_int_array_array_array *v, - void *context - ), - void *context -) -{ - simple_a_variable_int_array_array_array v; - v.n_0 = labcomm_decode_int(d); - v.a = malloc(sizeof(v.a[0]) * v.n_0); - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < v.n_0 ; i_0_0++) { - int i_0 = i_0_0; - v.a[i_0].n_0 = labcomm_decode_int(d); - v.a[i_0].a = malloc(sizeof(v.a[i_0].a[0]) * v.a[i_0].n_0); - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < v.a[i_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - v.a[i_0].a[i_1].n_0 = labcomm_decode_int(d); - v.a[i_0].a[i_1].a = malloc(sizeof(v.a[i_0].a[i_1].a[0]) * v.a[i_0].a[i_1].n_0); - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < v.a[i_0].a[i_1].n_0 ; i_2_0++) { - int i_2 = i_2_0; - v.a[i_0].a[i_1].a[i_2] = labcomm_decode_int(d); - } - } - } - } - } - } - handle(&v, context); - { - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < v.n_0 ; i_0_0++) { - int i_0 = i_0_0; - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < v.a[i_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - free(v.a[i_0].a[i_1].a); - } - } - free(v.a[i_0].a); - } - } - free(v.a); - } -} -void labcomm_decoder_register_simple_a_variable_int_array_array_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_variable_int_array_array_array *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_variable_int_array_array_array, - (labcomm_decoder_typecast_t)decode_a_variable_int_array_array_array, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_variable_int_array_array_array( - labcomm_encoder_t *e, - simple_a_variable_int_array_array_array *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_variable_int_array_array_array); - { - labcomm_encode_int(e, (*v).n_0); - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < (*v).n_0 ; i_0_0++) { - int i_0 = i_0_0; - labcomm_encode_int(e, (*v).a[i_0].n_0); - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < (*v).a[i_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - labcomm_encode_int(e, (*v).a[i_0].a[i_1].n_0); - { - int i_2_0; - for (i_2_0 = 0 ; i_2_0 < (*v).a[i_0].a[i_1].n_0 ; i_2_0++) { - int i_2 = i_2_0; - labcomm_encode_int(e, (*v).a[i_0].a[i_1].a[i_2]); - } - } - } - } - } - } - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_variable_int_array_array_array( -labcomm_encoder_t *e, -simple_a_variable_int_array_array_array *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_variable_int_array_array_array, v); -} -void labcomm_encoder_register_simple_a_variable_int_array_array_array( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_variable_int_array_array_array, - (labcomm_encode_typecast_t)encode_a_variable_int_array_array_array - ); -} -int labcomm_sizeof_simple_a_variable_int_array_array_array(simple_a_variable_int_array_array_array *v) -{ - int result = 4; - { - int i_0_0; - for (i_0_0 = 0 ; i_0_0 < (*v).n_0 ; i_0_0++) { - int i_0 = i_0_0; - { - int i_1_0; - for (i_1_0 = 0 ; i_1_0 < (*v).a[i_0].n_0 ; i_1_0++) { - int i_1 = i_1_0; - result += 4 * (*v).a[i_0].a[i_1].n_0; - } - } - } - } - return result; -} -static void decode_an_int_struct( - labcomm_decoder_t *d, - void (*handle)( - simple_an_int_struct *v, - void *context - ), - void *context -) -{ - simple_an_int_struct v; - v.a = labcomm_decode_int(d); - v.b = labcomm_decode_int(d); - handle(&v, context); -} -void labcomm_decoder_register_simple_an_int_struct( - struct labcomm_decoder *d, - void (*handler)( - simple_an_int_struct *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_an_int_struct, - (labcomm_decoder_typecast_t)decode_an_int_struct, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_an_int_struct( - labcomm_encoder_t *e, - simple_an_int_struct *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_an_int_struct); - { - labcomm_encode_int(e, (*v).a); - labcomm_encode_int(e, (*v).b); - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_an_int_struct( -labcomm_encoder_t *e, -simple_an_int_struct *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_an_int_struct, v); -} -void labcomm_encoder_register_simple_an_int_struct( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_an_int_struct, - (labcomm_encode_typecast_t)encode_an_int_struct - ); -} -int labcomm_sizeof_simple_an_int_struct(simple_an_int_struct *v) -{ - return 12; -} -static void decode_a_void( - labcomm_decoder_t *d, - void (*handle)( - simple_a_void *v, - void *context - ), - void *context -) -{ - simple_a_void v; - handle(&v, context); -} -void labcomm_decoder_register_simple_a_void( - struct labcomm_decoder *d, - void (*handler)( - simple_a_void *v, - void *context - ), - void *context -) -{ - labcomm_internal_decoder_register( - d, - &labcomm_signature_simple_a_void, - (labcomm_decoder_typecast_t)decode_a_void, - (labcomm_handler_typecast_t)handler, - context - ); -} -static void encode_a_void( - labcomm_encoder_t *e, - simple_a_void *v -) -{ - e->writer.write(&e->writer, labcomm_writer_start); - labcomm_encode_type_index(e, &labcomm_signature_simple_a_void); - { - } - e->writer.write(&e->writer, labcomm_writer_end); -} -void labcomm_encode_simple_a_void( -labcomm_encoder_t *e, -simple_a_void *v -) -{ -labcomm_internal_encode(e, &labcomm_signature_simple_a_void, v); -} -void labcomm_encoder_register_simple_a_void( - struct labcomm_encoder *e -) -{ - labcomm_internal_encoder_register( - e, - &labcomm_signature_simple_a_void, - (labcomm_encode_typecast_t)encode_a_void - ); -} -int labcomm_sizeof_simple_a_void(simple_a_void *v) -{ - return 4; -} diff --git a/test/gen/c/simple.h b/test/gen/c/simple.h deleted file mode 100644 index 24b4480..0000000 --- a/test/gen/c/simple.h +++ /dev/null @@ -1,233 +0,0 @@ -/* LabComm declarations: -sample int an_int; -sample int a_fixed_int_array[2]; -sample int a_fixed_int_multi_array[2, 2, 2]; -sample int a_fixed_int_array_array_array[2][2][2]; -sample int a_variable_int_array[_]; -sample int a_variable_int_multi_array[_, _, _]; -sample int a_variable_int_array_array_array[_][_][_]; -sample struct { - int a; - int b; -} an_int_struct; -sample void a_void; -*/ - - -#ifndef __LABCOMM_simple_H__ -#define __LABCOMM_simple_H__ - -#include "labcomm.h" - -#ifndef PREDEFINED_simple_an_int -typedef int simple_an_int; -#endif -void labcomm_decoder_register_simple_an_int( - struct labcomm_decoder *d, - void (*handler)( - simple_an_int *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_an_int( - struct labcomm_encoder *e); -void labcomm_encode_simple_an_int( - struct labcomm_encoder *e, - simple_an_int *v -); -extern int labcomm_sizeof_simple_an_int(simple_an_int *v); - -#ifndef PREDEFINED_simple_a_fixed_int_array -typedef struct { - int a[2]; -} simple_a_fixed_int_array; -#endif -void labcomm_decoder_register_simple_a_fixed_int_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_fixed_int_array *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_fixed_int_array( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_fixed_int_array( - struct labcomm_encoder *e, - simple_a_fixed_int_array *v -); -extern int labcomm_sizeof_simple_a_fixed_int_array(simple_a_fixed_int_array *v); - -#ifndef PREDEFINED_simple_a_fixed_int_multi_array -typedef struct { - int a[2][2][2]; -} simple_a_fixed_int_multi_array; -#endif -void labcomm_decoder_register_simple_a_fixed_int_multi_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_fixed_int_multi_array *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_fixed_int_multi_array( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_fixed_int_multi_array( - struct labcomm_encoder *e, - simple_a_fixed_int_multi_array *v -); -extern int labcomm_sizeof_simple_a_fixed_int_multi_array(simple_a_fixed_int_multi_array *v); - -#ifndef PREDEFINED_simple_a_fixed_int_array_array_array -typedef struct { - struct { - struct { - int a[2]; - } a[2]; - } a[2]; -} simple_a_fixed_int_array_array_array; -#endif -void labcomm_decoder_register_simple_a_fixed_int_array_array_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_fixed_int_array_array_array *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_fixed_int_array_array_array( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_fixed_int_array_array_array( - struct labcomm_encoder *e, - simple_a_fixed_int_array_array_array *v -); -extern int labcomm_sizeof_simple_a_fixed_int_array_array_array(simple_a_fixed_int_array_array_array *v); - -#ifndef PREDEFINED_simple_a_variable_int_array -typedef struct { - int n_0; - int *a; -} simple_a_variable_int_array; -#endif -void labcomm_decoder_register_simple_a_variable_int_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_variable_int_array *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_variable_int_array( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_variable_int_array( - struct labcomm_encoder *e, - simple_a_variable_int_array *v -); -extern int labcomm_sizeof_simple_a_variable_int_array(simple_a_variable_int_array *v); - -#ifndef PREDEFINED_simple_a_variable_int_multi_array -typedef struct { - int n_0; - int n_1; - int n_2; - int *a; -} simple_a_variable_int_multi_array; -#endif -void labcomm_decoder_register_simple_a_variable_int_multi_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_variable_int_multi_array *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_variable_int_multi_array( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_variable_int_multi_array( - struct labcomm_encoder *e, - simple_a_variable_int_multi_array *v -); -extern int labcomm_sizeof_simple_a_variable_int_multi_array(simple_a_variable_int_multi_array *v); - -#ifndef PREDEFINED_simple_a_variable_int_array_array_array -typedef struct { - int n_0; - struct { - int n_0; - struct { - int n_0; - int *a; - } *a; - } *a; -} simple_a_variable_int_array_array_array; -#endif -void labcomm_decoder_register_simple_a_variable_int_array_array_array( - struct labcomm_decoder *d, - void (*handler)( - simple_a_variable_int_array_array_array *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_variable_int_array_array_array( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_variable_int_array_array_array( - struct labcomm_encoder *e, - simple_a_variable_int_array_array_array *v -); -extern int labcomm_sizeof_simple_a_variable_int_array_array_array(simple_a_variable_int_array_array_array *v); - -#ifndef PREDEFINED_simple_an_int_struct -typedef struct { - int a; - int b; -} simple_an_int_struct; -#endif -void labcomm_decoder_register_simple_an_int_struct( - struct labcomm_decoder *d, - void (*handler)( - simple_an_int_struct *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_an_int_struct( - struct labcomm_encoder *e); -void labcomm_encode_simple_an_int_struct( - struct labcomm_encoder *e, - simple_an_int_struct *v -); -extern int labcomm_sizeof_simple_an_int_struct(simple_an_int_struct *v); - -#ifndef PREDEFINED_simple_a_void -typedef char simple_a_void; -#endif -void labcomm_decoder_register_simple_a_void( - struct labcomm_decoder *d, - void (*handler)( - simple_a_void *v, - void *context - ), - void *context -); -void labcomm_encoder_register_simple_a_void( - struct labcomm_encoder *e); -void labcomm_encode_simple_a_void( - struct labcomm_encoder *e, - simple_a_void *v -); -extern int labcomm_sizeof_simple_a_void(simple_a_void *v); - -#define LABCOMM_FORALL_SAMPLES_simple(func, sep) \ - func(an_int, simple_an_int) sep \ - func(a_fixed_int_array, simple_a_fixed_int_array) sep \ - func(a_fixed_int_multi_array, simple_a_fixed_int_multi_array) sep \ - func(a_fixed_int_array_array_array, simple_a_fixed_int_array_array_array) sep \ - func(a_variable_int_array, simple_a_variable_int_array) sep \ - func(a_variable_int_multi_array, simple_a_variable_int_multi_array) sep \ - func(a_variable_int_array_array_array, simple_a_variable_int_array_array_array) sep \ - func(an_int_struct, simple_an_int_struct) sep \ - func(a_void, simple_a_void) -#endif diff --git a/test/gen/csharp/nested.cs b/test/gen/csharp/nested.cs deleted file mode 100644 index a8dcd18..0000000 --- a/test/gen/csharp/nested.cs +++ /dev/null @@ -1,1045 +0,0 @@ -using System; -using se.lth.control.labcomm; -/* -sample struct { - int aa; - boolean bb; - int_array_ss ias; -} struct_array_ss[1][_][_]; -*/ - -public class struct_array_ss : LabCommSample { - - public int aa; - public boolean bb; - public int[][,,][] ias; - - public interface Handler : LabCommHandler { - void handle(struct_array_ss[][][] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_array_ss); - } - - public String getName() { - return "struct_array_ss"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_array_ss.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_array_ss[][][] value) { - e.begin(typeof(struct_array_ss)); - int i_0_max = 1; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].GetLength(0)); - int i_1_max = value[i_0].GetLength(0); - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - e.encodeInt(value[i_0][i_1].GetLength(0)); - int i_2_max = value[i_0][i_1].GetLength(0); - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2].aa); - e.encodeBoolean(value[i_0][i_1][i_2].bb); - int i_3_max = 1; - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - e.encodeInt(value[i_0][i_1][i_2].ias[i_3].GetLength(0)); - int i_4_max = value[i_0][i_1][i_2].ias[i_3].GetLength(0); - int i_5_max = 3; - e.encodeInt(value[i_0][i_1][i_2].ias[i_3].GetLength(2)); - int i_6_max = value[i_0][i_1][i_2].ias[i_3].GetLength(2); - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - for (int i_5 = 0 ; i_5 < i_5_max ; i_5++) { - for (int i_6 = 0 ; i_6 < i_6_max ; i_6++) { - int i_7_max = 5; - for (int i_7 = 0 ; i_7 < i_7_max ; i_7++) { - e.encodeInt(value[i_0][i_1][i_2].ias[i_3][i_4, i_5, i_6][i_7]); - } - } - } - } - } - } - } - } - e.end(typeof(struct_array_ss)); - } - - public static struct_array_ss[][][] decode(LabCommDecoder d) { - struct_array_ss[][][] result; - { - int i_0_max = 1; - result = new struct_array_ss[i_0_max] - [][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = d.decodeInt(); - result[i_0] = new struct_array_ss[i_1_max] - []; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = d.decodeInt(); - result[i_0][i_1] = new struct_array_ss[i_2_max] - ; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = new struct_array_ss(); - result[i_0][i_1][i_2].aa = d.decodeInt(); - result[i_0][i_1][i_2].bb = d.decodeBoolean(); - { - int i_3_max = 1; - result[i_0][i_1][i_2].ias = new int[i_3_max] - [][,,]; - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - { - int i_4_max = d.decodeInt(); - int i_5_max = 3; - int i_6_max = d.decodeInt(); - result[i_0][i_1][i_2].ias[i_3] = new int[i_4_max, i_5_max, i_6_max] - []; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - for (int i_5 = 0 ; i_5 < i_5_max ; i_5++) { - for (int i_6 = 0 ; i_6 < i_6_max ; i_6++) { - { - int i_7_max = 5; - result[i_0][i_1][i_2].ias[i_3][i_4, i_5, i_6] = new int[i_7_max] - ; - for (int i_7 = 0 ; i_7 < i_7_max ; i_7++) { - result[i_0][i_1][i_2].ias[i_3][i_4, i_5, i_6][i_7] = d.decodeInt(); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // struct { 3 fields - 0, 0, 0, 17, - 0, 0, 0, 3, - // int 'aa' - 0, 0, 0, 2, - 97, 97, - 0, 0, 0, 35, - // boolean 'bb' - 0, 0, 0, 2, - 98, 98, - 0, 0, 0, 32, - // int_array_ss 'ias' - 0, 0, 0, 3, - 105, 97, 115, - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_, 3, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 3, - 0, 0, 0, 0, - // array [5] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 5, - 0, 0, 0, 35, - // } - // } - // } - // } - // } - // } - // } - }; - -} -/* -typedef struct { - int a; -} struct_t; -*/ - -public class struct_t : LabCommType { - - public int a; - - public static void encode(LabCommEncoder e, struct_t value) { - e.encodeInt(value.a); - } - - public static struct_t decode(LabCommDecoder d) { - struct_t result; - result = new struct_t(); - result.a = d.decodeInt(); - return result; - } - -} -/* -typedef struct { - int a; -} struct_array_t[2]; -*/ - -public class struct_array_t : LabCommType { - - public int a; - - public static void encode(LabCommEncoder e, struct_array_t[] value) { - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].a); - } - } - - public static struct_array_t[] decode(LabCommDecoder d) { - struct_array_t[] result; - { - int i_0_max = 2; - result = new struct_array_t[i_0_max] - ; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = new struct_array_t(); - result[i_0].a = d.decodeInt(); - } - } - return result; - } - -} -/* -typedef struct { - struct { - int a; - } a; -} struct_struct_t; -*/ - -public class struct_struct_t : LabCommType { - - public static class struct_a { - public int a; - } - - public struct_a a; - - public static void encode(LabCommEncoder e, struct_struct_t value) { - e.encodeInt(value.a.a); - } - - public static struct_struct_t decode(LabCommDecoder d) { - struct_struct_t result; - result = new struct_struct_t(); - result.a = new struct_a(); - result.a.a = d.decodeInt(); - return result; - } - -} -/* -sample int int_s; -*/ - -public class int_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(int_s); - } - - public String getName() { - return "int_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(int_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int value) { - e.begin(typeof(int_s)); - e.encodeInt(value); - e.end(typeof(int_s)); - } - - public static int decode(LabCommDecoder d) { - int result; - result = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - 0, 0, 0, 35, - }; - -} -/* -sample int int_array_s[1][_, 3, _][5]; -*/ - -public class int_array_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[][,,][] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(int_array_s); - } - - public String getName() { - return "int_array_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(int_array_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][,,][] value) { - e.begin(typeof(int_array_s)); - int i_0_max = 1; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].GetLength(0)); - int i_1_max = value[i_0].GetLength(0); - int i_2_max = 3; - e.encodeInt(value[i_0].GetLength(2)); - int i_3_max = value[i_0].GetLength(2); - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - int i_4_max = 5; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - e.encodeInt(value[i_0][i_1, i_2, i_3][i_4]); - } - } - } - } - } - e.end(typeof(int_array_s)); - } - - public static int[][,,][] decode(LabCommDecoder d) { - int[][,,][] result; - { - int i_0_max = 1; - result = new int[i_0_max] - [][,,]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = d.decodeInt(); - int i_2_max = 3; - int i_3_max = d.decodeInt(); - result[i_0] = new int[i_1_max, i_2_max, i_3_max] - []; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - { - int i_4_max = 5; - result[i_0][i_1, i_2, i_3] = new int[i_4_max] - ; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - result[i_0][i_1, i_2, i_3][i_4] = d.decodeInt(); - } - } - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_, 3, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 3, - 0, 0, 0, 0, - // array [5] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 5, - 0, 0, 0, 35, - // } - // } - // } - }; - -} -/* -sample struct { - int a; - double bcd; -} struct_s; -*/ - -public class struct_s : LabCommSample { - - public int a; - public double bcd; - - public interface Handler : LabCommHandler { - void handle(struct_s value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_s); - } - - public String getName() { - return "struct_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_s value) { - e.begin(typeof(struct_s)); - e.encodeInt(value.a); - e.encodeDouble(value.bcd); - e.end(typeof(struct_s)); - } - - public static struct_s decode(LabCommDecoder d) { - struct_s result; - result = new struct_s(); - result.a = d.decodeInt(); - result.bcd = d.decodeDouble(); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 2 fields - 0, 0, 0, 17, - 0, 0, 0, 2, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // double 'bcd' - 0, 0, 0, 3, - 98, 99, 100, - 0, 0, 0, 38, - // } - }; - -} -/* -sample struct { - int a; -} struct_array_s[2]; -*/ - -public class struct_array_s : LabCommSample { - - public int a; - - public interface Handler : LabCommHandler { - void handle(struct_array_s[] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_array_s); - } - - public String getName() { - return "struct_array_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_array_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_array_s[] value) { - e.begin(typeof(struct_array_s)); - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].a); - } - e.end(typeof(struct_array_s)); - } - - public static struct_array_s[] decode(LabCommDecoder d) { - struct_array_s[] result; - { - int i_0_max = 2; - result = new struct_array_s[i_0_max] - ; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = new struct_array_s(); - result[i_0].a = d.decodeInt(); - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} -/* -sample struct { - struct { - int a; - } a; -} struct_struct_s; -*/ - -public class struct_struct_s : LabCommSample { - - public static class struct_a { - public int a; - } - - public struct_a a; - - public interface Handler : LabCommHandler { - void handle(struct_struct_s value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_struct_s); - } - - public String getName() { - return "struct_struct_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_struct_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_struct_s value) { - e.begin(typeof(struct_struct_s)); - e.encodeInt(value.a.a); - e.end(typeof(struct_struct_s)); - } - - public static struct_struct_s decode(LabCommDecoder d) { - struct_struct_s result; - result = new struct_struct_s(); - result.a = new struct_a(); - result.a.a = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // struct 'a' - 0, 0, 0, 1, - 97, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} -/* -sample int_t int_t_s; -*/ - -public class int_t_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(int_t_s); - } - - public String getName() { - return "int_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(int_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int value) { - e.begin(typeof(int_t_s)); - e.encodeInt(value); - e.end(typeof(int_t_s)); - } - - public static int decode(LabCommDecoder d) { - int result; - result = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - 0, 0, 0, 35, - }; - -} -/* -sample int_array_t int_array_t_s; -*/ - -public class int_array_t_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[,][][] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(int_array_t_s); - } - - public String getName() { - return "int_array_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(int_array_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[,][][] value) { - e.begin(typeof(int_array_t_s)); - int i_0_max = 1; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - int i_1_max = 2; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - int i_2_max = 3; - int i_3_max = 4; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - e.encodeInt(value[i_0][i_1][i_2, i_3]); - } - } - } - } - e.end(typeof(int_array_t_s)); - } - - public static int[,][][] decode(LabCommDecoder d) { - int[,][][] result; - { - int i_0_max = 1; - result = new int[i_0_max] - [,][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = 2; - result[i_0] = new int[i_1_max] - [,]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = 3; - int i_3_max = 4; - result[i_0][i_1] = new int[i_2_max, i_3_max] - ; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - result[i_0][i_1][i_2, i_3] = d.decodeInt(); - } - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [3, 4] - 0, 0, 0, 16, - 0, 0, 0, 2, - 0, 0, 0, 3, - 0, 0, 0, 4, - 0, 0, 0, 35, - // } - // } - // } - }; - -} -/* -sample struct_t struct_t_s; -*/ - -public class struct_t_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(struct_t value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_t_s); - } - - public String getName() { - return "struct_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_t value) { - e.begin(typeof(struct_t_s)); - struct_t.encode(e, value); - e.end(typeof(struct_t_s)); - } - - public static struct_t decode(LabCommDecoder d) { - struct_t result; - result = struct_t.decode(d); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - }; - -} -/* -sample struct_array_t struct_array_t_s; -*/ - -public class struct_array_t_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(struct_array_t[] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_array_t_s); - } - - public String getName() { - return "struct_array_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_array_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_array_t[] value) { - e.begin(typeof(struct_array_t_s)); - struct_array_t.encode(e, value); - e.end(typeof(struct_array_t_s)); - } - - public static struct_array_t[] decode(LabCommDecoder d) { - struct_array_t[] result; - result = struct_array_t.decode(d); - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} -/* -sample struct_struct_t struct_struct_t_s; -*/ - -public class struct_struct_t_s : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(struct_struct_t value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(struct_struct_t_s); - } - - public String getName() { - return "struct_struct_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(struct_struct_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_struct_t value) { - e.begin(typeof(struct_struct_t_s)); - struct_struct_t.encode(e, value); - e.end(typeof(struct_struct_t_s)); - } - - public static struct_struct_t decode(LabCommDecoder d) { - struct_struct_t result; - result = struct_struct_t.decode(d); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // struct 'a' - 0, 0, 0, 1, - 97, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} diff --git a/test/gen/csharp/simple.cs b/test/gen/csharp/simple.cs deleted file mode 100644 index 853d615..0000000 --- a/test/gen/csharp/simple.cs +++ /dev/null @@ -1,701 +0,0 @@ -using System; -using se.lth.control.labcomm; -/* -sample int an_int; -*/ - -public class an_int : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(an_int); - } - - public String getName() { - return "an_int"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(an_int.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int value) { - e.begin(typeof(an_int)); - e.encodeInt(value); - e.end(typeof(an_int)); - } - - public static int decode(LabCommDecoder d) { - int result; - result = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - 0, 0, 0, 35, - }; - -} -/* -sample int a_fixed_int_array[2]; -*/ - -public class a_fixed_int_array : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_fixed_int_array); - } - - public String getName() { - return "a_fixed_int_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(a_fixed_int_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[] value) { - e.begin(typeof(a_fixed_int_array)); - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0]); - } - e.end(typeof(a_fixed_int_array)); - } - - public static int[] decode(LabCommDecoder d) { - int[] result; - { - int i_0_max = 2; - result = new int[i_0_max] - ; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = d.decodeInt(); - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - }; - -} -/* -sample int a_fixed_int_multi_array[2, 2, 2]; -*/ - -public class a_fixed_int_multi_array : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[,,] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_fixed_int_multi_array); - } - - public String getName() { - return "a_fixed_int_multi_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(a_fixed_int_multi_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[,,] value) { - e.begin(typeof(a_fixed_int_multi_array)); - int i_0_max = 2; - int i_1_max = 2; - int i_2_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0, i_1, i_2]); - } - } - } - e.end(typeof(a_fixed_int_multi_array)); - } - - public static int[,,] decode(LabCommDecoder d) { - int[,,] result; - { - int i_0_max = 2; - int i_1_max = 2; - int i_2_max = 2; - result = new int[i_0_max, i_1_max, i_2_max] - ; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0, i_1, i_2] = d.decodeInt(); - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2, 2, 2] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 2, - 0, 0, 0, 2, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - }; - -} -/* -sample int a_fixed_int_array_array_array[2][2][2]; -*/ - -public class a_fixed_int_array_array_array : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[][][] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_fixed_int_array_array_array); - } - - public String getName() { - return "a_fixed_int_array_array_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(a_fixed_int_array_array_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][] value) { - e.begin(typeof(a_fixed_int_array_array_array)); - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - int i_1_max = 2; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - int i_2_max = 2; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2]); - } - } - } - e.end(typeof(a_fixed_int_array_array_array)); - } - - public static int[][][] decode(LabCommDecoder d) { - int[][][] result; - { - int i_0_max = 2; - result = new int[i_0_max] - [][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = 2; - result[i_0] = new int[i_1_max] - []; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = 2; - result[i_0][i_1] = new int[i_2_max] - ; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = d.decodeInt(); - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - // } - // } - }; - -} -/* -sample int a_variable_int_array[_]; -*/ - -public class a_variable_int_array : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_variable_int_array); - } - - public String getName() { - return "a_variable_int_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(a_variable_int_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[] value) { - e.begin(typeof(a_variable_int_array)); - e.encodeInt(value.GetLength(0)); - int i_0_max = value.GetLength(0); - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0]); - } - e.end(typeof(a_variable_int_array)); - } - - public static int[] decode(LabCommDecoder d) { - int[] result; - { - int i_0_max = d.decodeInt(); - result = new int[i_0_max] - ; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = d.decodeInt(); - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - }; - -} -/* -sample int a_variable_int_multi_array[_, _, _]; -*/ - -public class a_variable_int_multi_array : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[,,] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_variable_int_multi_array); - } - - public String getName() { - return "a_variable_int_multi_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(a_variable_int_multi_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[,,] value) { - e.begin(typeof(a_variable_int_multi_array)); - e.encodeInt(value.GetLength(0)); - int i_0_max = value.GetLength(0); - e.encodeInt(value.GetLength(1)); - int i_1_max = value.GetLength(1); - e.encodeInt(value.GetLength(2)); - int i_2_max = value.GetLength(2); - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0, i_1, i_2]); - } - } - } - e.end(typeof(a_variable_int_multi_array)); - } - - public static int[,,] decode(LabCommDecoder d) { - int[,,] result; - { - int i_0_max = d.decodeInt(); - int i_1_max = d.decodeInt(); - int i_2_max = d.decodeInt(); - result = new int[i_0_max, i_1_max, i_2_max] - ; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0, i_1, i_2] = d.decodeInt(); - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [_, _, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - }; - -} -/* -sample int a_variable_int_array_array_array[_][_][_]; -*/ - -public class a_variable_int_array_array_array : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(int[][][] value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_variable_int_array_array_array); - } - - public String getName() { - return "a_variable_int_array_array_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(a_variable_int_array_array_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][] value) { - e.begin(typeof(a_variable_int_array_array_array)); - e.encodeInt(value.GetLength(0)); - int i_0_max = value.GetLength(0); - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].GetLength(0)); - int i_1_max = value[i_0].GetLength(0); - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - e.encodeInt(value[i_0][i_1].GetLength(0)); - int i_2_max = value[i_0][i_1].GetLength(0); - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2]); - } - } - } - e.end(typeof(a_variable_int_array_array_array)); - } - - public static int[][][] decode(LabCommDecoder d) { - int[][][] result; - { - int i_0_max = d.decodeInt(); - result = new int[i_0_max] - [][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = d.decodeInt(); - result[i_0] = new int[i_1_max] - []; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = d.decodeInt(); - result[i_0][i_1] = new int[i_2_max] - ; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = d.decodeInt(); - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - // } - // } - }; - -} -/* -sample struct { - int a; - int b; -} an_int_struct; -*/ - -public class an_int_struct : LabCommSample { - - public int a; - public int b; - - public interface Handler : LabCommHandler { - void handle(an_int_struct value); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(an_int_struct); - } - - public String getName() { - return "an_int_struct"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - ((Handler)h).handle(an_int_struct.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, an_int_struct value) { - e.begin(typeof(an_int_struct)); - e.encodeInt(value.a); - e.encodeInt(value.b); - e.end(typeof(an_int_struct)); - } - - public static an_int_struct decode(LabCommDecoder d) { - an_int_struct result; - result = new an_int_struct(); - result.a = d.decodeInt(); - result.b = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 2 fields - 0, 0, 0, 17, - 0, 0, 0, 2, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // int 'b' - 0, 0, 0, 1, - 98, - 0, 0, 0, 35, - // } - }; - -} -/* -sample void a_void; -*/ - -public class a_void : LabCommSample { - - public interface Handler : LabCommHandler { - void handle(); - } - - public static void register(LabCommDecoder d, Handler h) { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) { - e.register(new Dispatcher()); - } - - private class Dispatcher : LabCommDispatcher { - - public Type getSampleClass() { - return typeof(a_void); - } - - public String getName() { - return "a_void"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, LabCommHandler h) { - a_void.decode(d); - ((Handler)h).handle(); - } - - } - - public static void encode(LabCommEncoder e) { - e.begin(typeof(a_void)); - e.end(typeof(a_void)); - } - - public static void decode(LabCommDecoder d) { - } - - private static byte[] signature = new byte[] { - // void - 0, 0, 0, 17, - 0, 0, 0, 0, - }; - -} diff --git a/test/gen/csharp/test_nested.cs b/test/gen/csharp/test_nested.cs deleted file mode 100644 index 38858cb..0000000 --- a/test/gen/csharp/test_nested.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.IO; -using se.lth.control.labcomm; - -class x : -struct_array_ss.Handler, -int_s.Handler, -int_array_s.Handler, -struct_s.Handler, -struct_array_s.Handler, -struct_struct_s.Handler, -int_t_s.Handler, -int_array_t_s.Handler, -struct_t_s.Handler, -struct_array_t_s.Handler, -struct_struct_t_s.Handler -{ - - LabCommEncoderChannel encoder; - - void struct_array_ss.Handler.handle(struct_array_ss[][][] data) { - Console.Error.WriteLine("struct_array_ss"); - struct_array_ss.encode(encoder, data); - } - - void int_s.Handler.handle(int data) { - Console.Error.WriteLine("int_s"); - int_s.encode(encoder, data); - } - - void int_array_s.Handler.handle(int[][,,][] data) { - Console.Error.WriteLine("int_array_s"); - int_array_s.encode(encoder, data); - } - - void struct_s.Handler.handle(struct_s data) { - Console.Error.WriteLine("struct_s"); - struct_s.encode(encoder, data); - } - - void struct_array_s.Handler.handle(struct_array_s[] data) { - Console.Error.WriteLine("struct_array_s"); - struct_array_s.encode(encoder, data); - } - - void struct_struct_s.Handler.handle(struct_struct_s data) { - Console.Error.WriteLine("struct_struct_s"); - struct_struct_s.encode(encoder, data); - } - - void int_t_s.Handler.handle(int data) { - Console.Error.WriteLine("int_t_s"); - int_t_s.encode(encoder, data); - } - - void int_array_t_s.Handler.handle(int[,][][] data) { - Console.Error.WriteLine("int_array_t_s"); - int_array_t_s.encode(encoder, data); - } - - void struct_t_s.Handler.handle(struct_t data) { - Console.Error.WriteLine("struct_t_s"); - struct_t_s.encode(encoder, data); - } - - void struct_array_t_s.Handler.handle(struct_array_t[] data) { - Console.Error.WriteLine("struct_array_t_s"); - struct_array_t_s.encode(encoder, data); - } - - void struct_struct_t_s.Handler.handle(struct_struct_t data) { - Console.Error.WriteLine("struct_struct_t_s"); - struct_struct_t_s.encode(encoder, data); - } - - public x(String InName, String OutName) { - FileStream InFile = new FileStream(InName, - FileMode.Open, - FileAccess.Read); - LabCommDecoderChannel d = new LabCommDecoderChannel(InFile); - FileStream OutFile = new FileStream(OutName, - FileMode.OpenOrCreate, - FileAccess.Write); - encoder = new LabCommEncoderChannel(OutFile); - - struct_array_ss.register(d, this); - int_s.register(d, this); - int_array_s.register(d, this); - struct_s.register(d, this); - struct_array_s.register(d, this); - struct_struct_s.register(d, this); - int_t_s.register(d, this); - int_array_t_s.register(d, this); - struct_t_s.register(d, this); - struct_array_t_s.register(d, this); - struct_struct_t_s.register(d, this); - - struct_array_ss.register(encoder); - int_s.register(encoder); - int_array_s.register(encoder); - struct_s.register(encoder); - struct_array_s.register(encoder); - struct_struct_s.register(encoder); - int_t_s.register(encoder); - int_array_t_s.register(encoder); - struct_t_s.register(encoder); - struct_array_t_s.register(encoder); - struct_struct_t_s.register(encoder); - - try { - d.run(); - } catch (EndOfStreamException) { - } - - } - - static void Main(String[] arg) { - new x(arg[0], arg[1]); - } - -} diff --git a/test/gen/csharp/test_simple.cs b/test/gen/csharp/test_simple.cs deleted file mode 100644 index d127c42..0000000 --- a/test/gen/csharp/test_simple.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.IO; -using se.lth.control.labcomm; - -class x : -an_int.Handler, -a_fixed_int_array.Handler, -a_fixed_int_multi_array.Handler, -a_fixed_int_array_array_array.Handler, -a_variable_int_array.Handler, -a_variable_int_multi_array.Handler, -a_variable_int_array_array_array.Handler, -an_int_struct.Handler, -a_void.Handler -{ - - LabCommEncoderChannel encoder; - - void an_int.Handler.handle(int data) { - Console.Error.WriteLine("an_int"); - an_int.encode(encoder, data); - } - - void a_fixed_int_array.Handler.handle(int[] data) { - Console.Error.WriteLine("a_fixed_int_array"); - a_fixed_int_array.encode(encoder, data); - } - - void a_fixed_int_multi_array.Handler.handle(int[,,] data) { - Console.Error.WriteLine("a_fixed_int_multi_array"); - a_fixed_int_multi_array.encode(encoder, data); - } - - void a_fixed_int_array_array_array.Handler.handle(int[][][] data) { - Console.Error.WriteLine("a_fixed_int_array_array_array"); - a_fixed_int_array_array_array.encode(encoder, data); - } - - void a_variable_int_array.Handler.handle(int[] data) { - Console.Error.WriteLine("a_variable_int_array"); - a_variable_int_array.encode(encoder, data); - } - - void a_variable_int_multi_array.Handler.handle(int[,,] data) { - Console.Error.WriteLine("a_variable_int_multi_array"); - a_variable_int_multi_array.encode(encoder, data); - } - - void a_variable_int_array_array_array.Handler.handle(int[][][] data) { - Console.Error.WriteLine("a_variable_int_array_array_array"); - a_variable_int_array_array_array.encode(encoder, data); - } - - void an_int_struct.Handler.handle(an_int_struct data) { - Console.Error.WriteLine("an_int_struct"); - an_int_struct.encode(encoder, data); - } - - void a_void.Handler.handle() { - Console.Error.WriteLine("a_void"); - a_void.encode(encoder); - } - - public x(String InName, String OutName) { - FileStream InFile = new FileStream(InName, - FileMode.Open, - FileAccess.Read); - LabCommDecoderChannel d = new LabCommDecoderChannel(InFile); - FileStream OutFile = new FileStream(OutName, - FileMode.OpenOrCreate, - FileAccess.Write); - encoder = new LabCommEncoderChannel(OutFile); - - an_int.register(d, this); - a_fixed_int_array.register(d, this); - a_fixed_int_multi_array.register(d, this); - a_fixed_int_array_array_array.register(d, this); - a_variable_int_array.register(d, this); - a_variable_int_multi_array.register(d, this); - a_variable_int_array_array_array.register(d, this); - an_int_struct.register(d, this); - a_void.register(d, this); - - an_int.register(encoder); - a_fixed_int_array.register(encoder); - a_fixed_int_multi_array.register(encoder); - a_fixed_int_array_array_array.register(encoder); - a_variable_int_array.register(encoder); - a_variable_int_multi_array.register(encoder); - a_variable_int_array_array_array.register(encoder); - an_int_struct.register(encoder); - a_void.register(encoder); - - try { - d.run(); - } catch (EndOfStreamException) { - } - - } - - static void Main(String[] arg) { - new x(arg[0], arg[1]); - } - -} diff --git a/test/gen/java/nested/int_array_s.java b/test/gen/java/nested/int_array_s.java deleted file mode 100644 index 851b1b5..0000000 --- a/test/gen/java/nested/int_array_s.java +++ /dev/null @@ -1,122 +0,0 @@ -/* -sample int int_array_s[1][_, 3, _][5]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class int_array_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_int_array_s(int[][][][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return int_array_s.class; - } - - public String getName() { - return "int_array_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_int_array_s(int_array_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][][][] value) throws IOException { - e.begin(int_array_s.class); - int i_0_max = 1; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].length); - int i_1_max = value[i_0].length; - int i_2_max = 3; - e.encodeInt(value[i_0][0][0].length); - int i_3_max = value[i_0][0][0].length; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - int i_4_max = 5; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - e.encodeInt(value[i_0][i_1][i_2][i_3][i_4]); - } - } - } - } - } - e.end(int_array_s.class); - } - - public static int[][][][][] decode(LabCommDecoder d) throws IOException { - int[][][][][] result; - { - int i_0_max = 1; - result = new int[i_0_max][][][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = d.decodeInt(); - int i_2_max = 3; - int i_3_max = d.decodeInt(); - result[i_0] = new int[i_1_max][][][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - result[i_0][i_1] = new int[i_2_max][][]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = new int[i_3_max][]; - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - { - int i_4_max = 5; - result[i_0][i_1][i_2][i_3] = new int[i_4_max]; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - result[i_0][i_1][i_2][i_3][i_4] = d.decodeInt(); - } - } - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_, 3, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 3, - 0, 0, 0, 0, - // array [5] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 5, - 0, 0, 0, 35, - // } - // } - // } - }; - -} diff --git a/test/gen/java/nested/int_array_t_s.java b/test/gen/java/nested/int_array_t_s.java deleted file mode 100644 index 707cc77..0000000 --- a/test/gen/java/nested/int_array_t_s.java +++ /dev/null @@ -1,112 +0,0 @@ -/* -sample int_array_t int_array_t_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class int_array_t_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_int_array_t_s(int[][][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return int_array_t_s.class; - } - - public String getName() { - return "int_array_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_int_array_t_s(int_array_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][][] value) throws IOException { - e.begin(int_array_t_s.class); - int i_0_max = 1; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - int i_1_max = 2; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - int i_2_max = 3; - int i_3_max = 4; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - e.encodeInt(value[i_0][i_1][i_2][i_3]); - } - } - } - } - e.end(int_array_t_s.class); - } - - public static int[][][][] decode(LabCommDecoder d) throws IOException { - int[][][][] result; - { - int i_0_max = 1; - result = new int[i_0_max][][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = 2; - result[i_0] = new int[i_1_max][][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = 3; - int i_3_max = 4; - result[i_0][i_1] = new int[i_2_max][]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = new int[i_3_max]; - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - result[i_0][i_1][i_2][i_3] = d.decodeInt(); - } - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [3, 4] - 0, 0, 0, 16, - 0, 0, 0, 2, - 0, 0, 0, 3, - 0, 0, 0, 4, - 0, 0, 0, 35, - // } - // } - // } - }; - -} diff --git a/test/gen/java/nested/int_s.java b/test/gen/java/nested/int_s.java deleted file mode 100644 index f6d7379..0000000 --- a/test/gen/java/nested/int_s.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -sample int int_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class int_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_int_s(int value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return int_s.class; - } - - public String getName() { - return "int_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_int_s(int_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int value) throws IOException { - e.begin(int_s.class); - e.encodeInt(value); - e.end(int_s.class); - } - - public static int decode(LabCommDecoder d) throws IOException { - int result; - result = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - 0, 0, 0, 35, - }; - -} diff --git a/test/gen/java/nested/int_t_s.java b/test/gen/java/nested/int_t_s.java deleted file mode 100644 index 206cb7a..0000000 --- a/test/gen/java/nested/int_t_s.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -sample int_t int_t_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class int_t_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_int_t_s(int value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return int_t_s.class; - } - - public String getName() { - return "int_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_int_t_s(int_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int value) throws IOException { - e.begin(int_t_s.class); - e.encodeInt(value); - e.end(int_t_s.class); - } - - public static int decode(LabCommDecoder d) throws IOException { - int result; - result = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - 0, 0, 0, 35, - }; - -} diff --git a/test/gen/java/nested/struct_array_s.java b/test/gen/java/nested/struct_array_s.java deleted file mode 100644 index 41379c9..0000000 --- a/test/gen/java/nested/struct_array_s.java +++ /dev/null @@ -1,88 +0,0 @@ -/* -sample struct { - int a; -} struct_array_s[2]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_array_s implements LabCommSample { - - public int a; - - public interface Handler extends LabCommHandler { - public void handle_struct_array_s(struct_array_s[] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_array_s.class; - } - - public String getName() { - return "struct_array_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_array_s(struct_array_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_array_s[] value) throws IOException { - e.begin(struct_array_s.class); - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].a); - } - e.end(struct_array_s.class); - } - - public static struct_array_s[] decode(LabCommDecoder d) throws IOException { - struct_array_s[] result; - { - int i_0_max = 2; - result = new struct_array_s[i_0_max]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = new struct_array_s(); - result[i_0].a = d.decodeInt(); - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} diff --git a/test/gen/java/nested/struct_array_ss.java b/test/gen/java/nested/struct_array_ss.java deleted file mode 100644 index 37c4304..0000000 --- a/test/gen/java/nested/struct_array_ss.java +++ /dev/null @@ -1,194 +0,0 @@ -/* -sample struct { - int aa; - boolean bb; - int_array_ss ias; -} struct_array_ss[1][_][_]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_array_ss implements LabCommSample { - - public int aa; - public boolean bb; - public int[][][][][] ias; - - public interface Handler extends LabCommHandler { - public void handle_struct_array_ss(struct_array_ss[][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_array_ss.class; - } - - public String getName() { - return "struct_array_ss"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_array_ss(struct_array_ss.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_array_ss[][][] value) throws IOException { - e.begin(struct_array_ss.class); - int i_0_max = 1; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].length); - int i_1_max = value[i_0].length; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - e.encodeInt(value[i_0][i_1].length); - int i_2_max = value[i_0][i_1].length; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2].aa); - e.encodeBoolean(value[i_0][i_1][i_2].bb); - int i_3_max = 1; - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - e.encodeInt(value[i_0][i_1][i_2].ias[i_3].length); - int i_4_max = value[i_0][i_1][i_2].ias[i_3].length; - int i_5_max = 3; - e.encodeInt(value[i_0][i_1][i_2].ias[i_3][0][0].length); - int i_6_max = value[i_0][i_1][i_2].ias[i_3][0][0].length; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - for (int i_5 = 0 ; i_5 < i_5_max ; i_5++) { - for (int i_6 = 0 ; i_6 < i_6_max ; i_6++) { - int i_7_max = 5; - for (int i_7 = 0 ; i_7 < i_7_max ; i_7++) { - e.encodeInt(value[i_0][i_1][i_2].ias[i_3][i_4][i_5][i_6][i_7]); - } - } - } - } - } - } - } - } - e.end(struct_array_ss.class); - } - - public static struct_array_ss[][][] decode(LabCommDecoder d) throws IOException { - struct_array_ss[][][] result; - { - int i_0_max = 1; - result = new struct_array_ss[i_0_max][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = d.decodeInt(); - result[i_0] = new struct_array_ss[i_1_max][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = d.decodeInt(); - result[i_0][i_1] = new struct_array_ss[i_2_max]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = new struct_array_ss(); - result[i_0][i_1][i_2].aa = d.decodeInt(); - result[i_0][i_1][i_2].bb = d.decodeBoolean(); - { - int i_3_max = 1; - result[i_0][i_1][i_2].ias = new int[i_3_max][][][][]; - for (int i_3 = 0 ; i_3 < i_3_max ; i_3++) { - { - int i_4_max = d.decodeInt(); - int i_5_max = 3; - int i_6_max = d.decodeInt(); - result[i_0][i_1][i_2].ias[i_3] = new int[i_4_max][][][]; - for (int i_4 = 0 ; i_4 < i_4_max ; i_4++) { - result[i_0][i_1][i_2].ias[i_3][i_4] = new int[i_5_max][][]; - for (int i_5 = 0 ; i_5 < i_5_max ; i_5++) { - result[i_0][i_1][i_2].ias[i_3][i_4][i_5] = new int[i_6_max][]; - for (int i_6 = 0 ; i_6 < i_6_max ; i_6++) { - { - int i_7_max = 5; - result[i_0][i_1][i_2].ias[i_3][i_4][i_5][i_6] = new int[i_7_max]; - for (int i_7 = 0 ; i_7 < i_7_max ; i_7++) { - result[i_0][i_1][i_2].ias[i_3][i_4][i_5][i_6][i_7] = d.decodeInt(); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // struct { 3 fields - 0, 0, 0, 17, - 0, 0, 0, 3, - // int 'aa' - 0, 0, 0, 2, - 97, 97, - 0, 0, 0, 35, - // boolean 'bb' - 0, 0, 0, 2, - 98, 98, - 0, 0, 0, 32, - // int_array_ss 'ias' - 0, 0, 0, 3, - 105, 97, 115, - // array [1] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 1, - // array [_, 3, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 3, - 0, 0, 0, 0, - // array [5] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 5, - 0, 0, 0, 35, - // } - // } - // } - // } - // } - // } - // } - }; - -} diff --git a/test/gen/java/nested/struct_array_t.java b/test/gen/java/nested/struct_array_t.java deleted file mode 100644 index ba0364a..0000000 --- a/test/gen/java/nested/struct_array_t.java +++ /dev/null @@ -1,35 +0,0 @@ -/* -typedef struct { - int a; -} struct_array_t[2]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommType; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommDecoder; - -public class struct_array_t implements LabCommType { - - public int a; - - public static void encode(LabCommEncoder e, struct_array_t[] value) throws IOException { - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].a); - } - } - - public static struct_array_t[] decode(LabCommDecoder d) throws IOException { - struct_array_t[] result; - { - int i_0_max = 2; - result = new struct_array_t[i_0_max]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = new struct_array_t(); - result[i_0].a = d.decodeInt(); - } - } - return result; - } - -} diff --git a/test/gen/java/nested/struct_array_t_s.java b/test/gen/java/nested/struct_array_t_s.java deleted file mode 100644 index cab63bb..0000000 --- a/test/gen/java/nested/struct_array_t_s.java +++ /dev/null @@ -1,74 +0,0 @@ -/* -sample struct_array_t struct_array_t_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_array_t_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_struct_array_t_s(struct_array_t[] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_array_t_s.class; - } - - public String getName() { - return "struct_array_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_array_t_s(struct_array_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_array_t[] value) throws IOException { - e.begin(struct_array_t_s.class); - struct_array_t.encode(e, value); - e.end(struct_array_t_s.class); - } - - public static struct_array_t[] decode(LabCommDecoder d) throws IOException { - struct_array_t[] result; - result = struct_array_t.decode(d); - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} diff --git a/test/gen/java/nested/struct_s.java b/test/gen/java/nested/struct_s.java deleted file mode 100644 index c7879c0..0000000 --- a/test/gen/java/nested/struct_s.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -sample struct { - int a; - double bcd; -} struct_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_s implements LabCommSample { - - public int a; - public double bcd; - - public interface Handler extends LabCommHandler { - public void handle_struct_s(struct_s value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_s.class; - } - - public String getName() { - return "struct_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_s(struct_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_s value) throws IOException { - e.begin(struct_s.class); - e.encodeInt(value.a); - e.encodeDouble(value.bcd); - e.end(struct_s.class); - } - - public static struct_s decode(LabCommDecoder d) throws IOException { - struct_s result; - result = new struct_s(); - result.a = d.decodeInt(); - result.bcd = d.decodeDouble(); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 2 fields - 0, 0, 0, 17, - 0, 0, 0, 2, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // double 'bcd' - 0, 0, 0, 3, - 98, 99, 100, - 0, 0, 0, 38, - // } - }; - -} diff --git a/test/gen/java/nested/struct_struct_s.java b/test/gen/java/nested/struct_struct_s.java deleted file mode 100644 index 8f6e30d..0000000 --- a/test/gen/java/nested/struct_struct_s.java +++ /dev/null @@ -1,88 +0,0 @@ -/* -sample struct { - struct { - int a; - } a; -} struct_struct_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_struct_s implements LabCommSample { - - public static class struct_a { - public int a; - } - - public struct_a a; - - public interface Handler extends LabCommHandler { - public void handle_struct_struct_s(struct_struct_s value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_struct_s.class; - } - - public String getName() { - return "struct_struct_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_struct_s(struct_struct_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_struct_s value) throws IOException { - e.begin(struct_struct_s.class); - e.encodeInt(value.a.a); - e.end(struct_struct_s.class); - } - - public static struct_struct_s decode(LabCommDecoder d) throws IOException { - struct_struct_s result; - result = new struct_struct_s(); - result.a = new struct_a(); - result.a.a = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // struct 'a' - 0, 0, 0, 1, - 97, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} diff --git a/test/gen/java/nested/struct_struct_t.java b/test/gen/java/nested/struct_struct_t.java deleted file mode 100644 index 7864d86..0000000 --- a/test/gen/java/nested/struct_struct_t.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -typedef struct { - struct { - int a; - } a; -} struct_struct_t; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommType; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommDecoder; - -public class struct_struct_t implements LabCommType { - - public static class struct_a { - public int a; - } - - public struct_a a; - - public static void encode(LabCommEncoder e, struct_struct_t value) throws IOException { - e.encodeInt(value.a.a); - } - - public static struct_struct_t decode(LabCommDecoder d) throws IOException { - struct_struct_t result; - result = new struct_struct_t(); - result.a = new struct_a(); - result.a.a = d.decodeInt(); - return result; - } - -} diff --git a/test/gen/java/nested/struct_struct_t_s.java b/test/gen/java/nested/struct_struct_t_s.java deleted file mode 100644 index 9a241c8..0000000 --- a/test/gen/java/nested/struct_struct_t_s.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -sample struct_struct_t struct_struct_t_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_struct_t_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_struct_struct_t_s(struct_struct_t value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_struct_t_s.class; - } - - public String getName() { - return "struct_struct_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_struct_t_s(struct_struct_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_struct_t value) throws IOException { - e.begin(struct_struct_t_s.class); - struct_struct_t.encode(e, value); - e.end(struct_struct_t_s.class); - } - - public static struct_struct_t decode(LabCommDecoder d) throws IOException { - struct_struct_t result; - result = struct_struct_t.decode(d); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // struct 'a' - 0, 0, 0, 1, - 97, - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - // } - }; - -} diff --git a/test/gen/java/nested/struct_t.java b/test/gen/java/nested/struct_t.java deleted file mode 100644 index a248887..0000000 --- a/test/gen/java/nested/struct_t.java +++ /dev/null @@ -1,26 +0,0 @@ -/* -typedef struct { - int a; -} struct_t; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommType; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommDecoder; - -public class struct_t implements LabCommType { - - public int a; - - public static void encode(LabCommEncoder e, struct_t value) throws IOException { - e.encodeInt(value.a); - } - - public static struct_t decode(LabCommDecoder d) throws IOException { - struct_t result; - result = new struct_t(); - result.a = d.decodeInt(); - return result; - } - -} diff --git a/test/gen/java/nested/struct_t_s.java b/test/gen/java/nested/struct_t_s.java deleted file mode 100644 index f2a6932..0000000 --- a/test/gen/java/nested/struct_t_s.java +++ /dev/null @@ -1,69 +0,0 @@ -/* -sample struct_t struct_t_s; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class struct_t_s implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_struct_t_s(struct_t value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return struct_t_s.class; - } - - public String getName() { - return "struct_t_s"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_struct_t_s(struct_t_s.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, struct_t value) throws IOException { - e.begin(struct_t_s.class); - struct_t.encode(e, value); - e.end(struct_t_s.class); - } - - public static struct_t decode(LabCommDecoder d) throws IOException { - struct_t result; - result = struct_t.decode(d); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 1 fields - 0, 0, 0, 17, - 0, 0, 0, 1, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // } - }; - -} diff --git a/test/gen/java/simple/a_fixed_int_array.java b/test/gen/java/simple/a_fixed_int_array.java deleted file mode 100644 index 510e3d7..0000000 --- a/test/gen/java/simple/a_fixed_int_array.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -sample int a_fixed_int_array[2]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_fixed_int_array implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_fixed_int_array(int[] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_fixed_int_array.class; - } - - public String getName() { - return "a_fixed_int_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_a_fixed_int_array(a_fixed_int_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[] value) throws IOException { - e.begin(a_fixed_int_array.class); - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0]); - } - e.end(a_fixed_int_array.class); - } - - public static int[] decode(LabCommDecoder d) throws IOException { - int[] result; - { - int i_0_max = 2; - result = new int[i_0_max]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = d.decodeInt(); - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - }; - -} diff --git a/test/gen/java/simple/a_fixed_int_array_array_array.java b/test/gen/java/simple/a_fixed_int_array_array_array.java deleted file mode 100644 index 979184f..0000000 --- a/test/gen/java/simple/a_fixed_int_array_array_array.java +++ /dev/null @@ -1,104 +0,0 @@ -/* -sample int a_fixed_int_array_array_array[2][2][2]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_fixed_int_array_array_array implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_fixed_int_array_array_array(int[][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_fixed_int_array_array_array.class; - } - - public String getName() { - return "a_fixed_int_array_array_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_a_fixed_int_array_array_array(a_fixed_int_array_array_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][] value) throws IOException { - e.begin(a_fixed_int_array_array_array.class); - int i_0_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - int i_1_max = 2; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - int i_2_max = 2; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2]); - } - } - } - e.end(a_fixed_int_array_array_array.class); - } - - public static int[][][] decode(LabCommDecoder d) throws IOException { - int[][][] result; - { - int i_0_max = 2; - result = new int[i_0_max][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = 2; - result[i_0] = new int[i_1_max][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = 2; - result[i_0][i_1] = new int[i_2_max]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = d.decodeInt(); - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - // array [2] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - // } - // } - }; - -} diff --git a/test/gen/java/simple/a_fixed_int_multi_array.java b/test/gen/java/simple/a_fixed_int_multi_array.java deleted file mode 100644 index d0f53eb..0000000 --- a/test/gen/java/simple/a_fixed_int_multi_array.java +++ /dev/null @@ -1,92 +0,0 @@ -/* -sample int a_fixed_int_multi_array[2, 2, 2]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_fixed_int_multi_array implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_fixed_int_multi_array(int[][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_fixed_int_multi_array.class; - } - - public String getName() { - return "a_fixed_int_multi_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_a_fixed_int_multi_array(a_fixed_int_multi_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][] value) throws IOException { - e.begin(a_fixed_int_multi_array.class); - int i_0_max = 2; - int i_1_max = 2; - int i_2_max = 2; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2]); - } - } - } - e.end(a_fixed_int_multi_array.class); - } - - public static int[][][] decode(LabCommDecoder d) throws IOException { - int[][][] result; - { - int i_0_max = 2; - int i_1_max = 2; - int i_2_max = 2; - result = new int[i_0_max][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = new int[i_1_max][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - result[i_0][i_1] = new int[i_2_max]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = d.decodeInt(); - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [2, 2, 2] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 2, - 0, 0, 0, 2, - 0, 0, 0, 2, - 0, 0, 0, 35, - // } - }; - -} diff --git a/test/gen/java/simple/a_variable_int_array.java b/test/gen/java/simple/a_variable_int_array.java deleted file mode 100644 index df4df75..0000000 --- a/test/gen/java/simple/a_variable_int_array.java +++ /dev/null @@ -1,77 +0,0 @@ -/* -sample int a_variable_int_array[_]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_variable_int_array implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_variable_int_array(int[] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_variable_int_array.class; - } - - public String getName() { - return "a_variable_int_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_a_variable_int_array(a_variable_int_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[] value) throws IOException { - e.begin(a_variable_int_array.class); - e.encodeInt(value.length); - int i_0_max = value.length; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0]); - } - e.end(a_variable_int_array.class); - } - - public static int[] decode(LabCommDecoder d) throws IOException { - int[] result; - { - int i_0_max = d.decodeInt(); - result = new int[i_0_max]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = d.decodeInt(); - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - }; - -} diff --git a/test/gen/java/simple/a_variable_int_array_array_array.java b/test/gen/java/simple/a_variable_int_array_array_array.java deleted file mode 100644 index c3ae12d..0000000 --- a/test/gen/java/simple/a_variable_int_array_array_array.java +++ /dev/null @@ -1,107 +0,0 @@ -/* -sample int a_variable_int_array_array_array[_][_][_]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_variable_int_array_array_array implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_variable_int_array_array_array(int[][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_variable_int_array_array_array.class; - } - - public String getName() { - return "a_variable_int_array_array_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_a_variable_int_array_array_array(a_variable_int_array_array_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][] value) throws IOException { - e.begin(a_variable_int_array_array_array.class); - e.encodeInt(value.length); - int i_0_max = value.length; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - e.encodeInt(value[i_0].length); - int i_1_max = value[i_0].length; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - e.encodeInt(value[i_0][i_1].length); - int i_2_max = value[i_0][i_1].length; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2]); - } - } - } - e.end(a_variable_int_array_array_array.class); - } - - public static int[][][] decode(LabCommDecoder d) throws IOException { - int[][][] result; - { - int i_0_max = d.decodeInt(); - result = new int[i_0_max][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - { - int i_1_max = d.decodeInt(); - result[i_0] = new int[i_1_max][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - { - int i_2_max = d.decodeInt(); - result[i_0][i_1] = new int[i_2_max]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = d.decodeInt(); - } - } - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - // array [_] - 0, 0, 0, 16, - 0, 0, 0, 1, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - // } - // } - }; - -} diff --git a/test/gen/java/simple/a_variable_int_multi_array.java b/test/gen/java/simple/a_variable_int_multi_array.java deleted file mode 100644 index e599fa0..0000000 --- a/test/gen/java/simple/a_variable_int_multi_array.java +++ /dev/null @@ -1,95 +0,0 @@ -/* -sample int a_variable_int_multi_array[_, _, _]; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_variable_int_multi_array implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_variable_int_multi_array(int[][][] value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_variable_int_multi_array.class; - } - - public String getName() { - return "a_variable_int_multi_array"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_a_variable_int_multi_array(a_variable_int_multi_array.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int[][][] value) throws IOException { - e.begin(a_variable_int_multi_array.class); - e.encodeInt(value.length); - int i_0_max = value.length; - e.encodeInt(value[0].length); - int i_1_max = value[0].length; - e.encodeInt(value[0][0].length); - int i_2_max = value[0][0].length; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - e.encodeInt(value[i_0][i_1][i_2]); - } - } - } - e.end(a_variable_int_multi_array.class); - } - - public static int[][][] decode(LabCommDecoder d) throws IOException { - int[][][] result; - { - int i_0_max = d.decodeInt(); - int i_1_max = d.decodeInt(); - int i_2_max = d.decodeInt(); - result = new int[i_0_max][][]; - for (int i_0 = 0 ; i_0 < i_0_max ; i_0++) { - result[i_0] = new int[i_1_max][]; - for (int i_1 = 0 ; i_1 < i_1_max ; i_1++) { - result[i_0][i_1] = new int[i_2_max]; - for (int i_2 = 0 ; i_2 < i_2_max ; i_2++) { - result[i_0][i_1][i_2] = d.decodeInt(); - } - } - } - } - return result; - } - - private static byte[] signature = new byte[] { - // array [_, _, _] - 0, 0, 0, 16, - 0, 0, 0, 3, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 35, - // } - }; - -} diff --git a/test/gen/java/simple/a_void.java b/test/gen/java/simple/a_void.java deleted file mode 100644 index 5c21ae4..0000000 --- a/test/gen/java/simple/a_void.java +++ /dev/null @@ -1,61 +0,0 @@ -/* -sample void a_void; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class a_void implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_a_void() throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return a_void.class; - } - - public String getName() { - return "a_void"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - a_void.decode(d); - ((Handler)h).handle_a_void(); - } - - } - - public static void encode(LabCommEncoder e) throws IOException { - e.begin(a_void.class); - e.end(a_void.class); - } - - public static void decode(LabCommDecoder d) throws IOException { - } - - private static byte[] signature = new byte[] { - // void - 0, 0, 0, 17, - 0, 0, 0, 0, - }; - -} diff --git a/test/gen/java/simple/an_int.java b/test/gen/java/simple/an_int.java deleted file mode 100644 index 417cb0c..0000000 --- a/test/gen/java/simple/an_int.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -sample int an_int; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class an_int implements LabCommSample { - - public interface Handler extends LabCommHandler { - public void handle_an_int(int value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return an_int.class; - } - - public String getName() { - return "an_int"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_an_int(an_int.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, int value) throws IOException { - e.begin(an_int.class); - e.encodeInt(value); - e.end(an_int.class); - } - - public static int decode(LabCommDecoder d) throws IOException { - int result; - result = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - 0, 0, 0, 35, - }; - -} diff --git a/test/gen/java/simple/an_int_struct.java b/test/gen/java/simple/an_int_struct.java deleted file mode 100644 index 9da7ebe..0000000 --- a/test/gen/java/simple/an_int_struct.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -sample struct { - int a; - int b; -} an_int_struct; -*/ -import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; - -public class an_int_struct implements LabCommSample { - - public int a; - public int b; - - public interface Handler extends LabCommHandler { - public void handle_an_int_struct(an_int_struct value) throws Exception; - } - - public static void register(LabCommDecoder d, Handler h) throws IOException { - d.register(new Dispatcher(), h); - } - - public static void register(LabCommEncoder e) throws IOException { - e.register(new Dispatcher()); - } - - private static class Dispatcher implements LabCommDispatcher { - - public Class getSampleClass() { - return an_int_struct.class; - } - - public String getName() { - return "an_int_struct"; - } - - public byte[] getSignature() { - return signature; - } - - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { - ((Handler)h).handle_an_int_struct(an_int_struct.decode(d)); - } - - } - - public static void encode(LabCommEncoder e, an_int_struct value) throws IOException { - e.begin(an_int_struct.class); - e.encodeInt(value.a); - e.encodeInt(value.b); - e.end(an_int_struct.class); - } - - public static an_int_struct decode(LabCommDecoder d) throws IOException { - an_int_struct result; - result = new an_int_struct(); - result.a = d.decodeInt(); - result.b = d.decodeInt(); - return result; - } - - private static byte[] signature = new byte[] { - // struct { 2 fields - 0, 0, 0, 17, - 0, 0, 0, 2, - // int 'a' - 0, 0, 0, 1, - 97, - 0, 0, 0, 35, - // int 'b' - 0, 0, 0, 1, - 98, - 0, 0, 0, 35, - // } - }; - -} diff --git a/test/gen/nested.typeinfo b/test/gen/nested.typeinfo deleted file mode 100644 index 7b21149..0000000 --- a/test/gen/nested.typeinfo +++ /dev/null @@ -1,51 +0,0 @@ -C,typedef,int_array_ss,int_array_ss -C,sample,struct_array_ss,struct_array_ss -C,typedef,int_t,int_t -C,typedef,int_array_t,int_array_t -C,typedef,struct_t,struct_t -C,typedef,struct_array_t,struct_array_t -C,typedef,struct_struct_t,struct_struct_t -C,sample,int_s,int_s -C,sample,int_array_s,int_array_s -C,sample,struct_s,struct_s -C,sample,struct_array_s,struct_array_s -C,sample,struct_struct_s,struct_struct_s -C,sample,int_t_s,int_t_s -C,sample,int_array_t_s,int_array_t_s -C,sample,struct_t_s,struct_t_s -C,sample,struct_array_t_s,struct_array_t_s -C,sample,struct_struct_t_s,struct_struct_t_s -Java,typedef,int_array_ss,int[][][][][] -Java,sample,struct_array_ss,struct_array_ss[][][] -Java,typedef,int_t,int -Java,typedef,int_array_t,int[][][][] -Java,typedef,struct_t,struct_t -Java,typedef,struct_array_t,struct_array_t[] -Java,typedef,struct_struct_t,struct_struct_t -Java,sample,int_s,int -Java,sample,int_array_s,int[][][][][] -Java,sample,struct_s,struct_s -Java,sample,struct_array_s,struct_array_s[] -Java,sample,struct_struct_s,struct_struct_s -Java,sample,int_t_s,int -Java,sample,int_array_t_s,int[][][][] -Java,sample,struct_t_s,struct_t -Java,sample,struct_array_t_s,struct_array_t[] -Java,sample,struct_struct_t_s,struct_struct_t -C#,typedef,int_array_ss,int[][,,][] -C#,sample,struct_array_ss,struct_array_ss[][][] -C#,typedef,int_t,int -C#,typedef,int_array_t,int[,][][] -C#,typedef,struct_t,struct_t -C#,typedef,struct_array_t,struct_array_t[] -C#,typedef,struct_struct_t,struct_struct_t -C#,sample,int_s,int -C#,sample,int_array_s,int[][,,][] -C#,sample,struct_s,struct_s -C#,sample,struct_array_s,struct_array_s[] -C#,sample,struct_struct_s,struct_struct_s -C#,sample,int_t_s,int -C#,sample,int_array_t_s,int[,][][] -C#,sample,struct_t_s,struct_t -C#,sample,struct_array_t_s,struct_array_t[] -C#,sample,struct_struct_t_s,struct_struct_t diff --git a/test/gen/nested.vec b/test/gen/nested.vec deleted file mode 100644 index 3791316580bed3fed9da211c67eae50c9dfcad5c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114897 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 diff --git a/test/gen/python/nested.py b/test/gen/python/nested.py deleted file mode 100644 index a1c1343..0000000 --- a/test/gen/python/nested.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/python -# Auto generated nested - -import labcomm - -class int_array_ss(object): - no_signature = labcomm.typedef('int_array_ss', - labcomm.array([1], - labcomm.array([0, 3, 0], - labcomm.array([5], - labcomm.INTEGER())))) - -class struct_array_ss(object): - signature = labcomm.sample('struct_array_ss', - labcomm.array([1], - labcomm.array([0], - labcomm.array([0], - labcomm.struct([ - ('aa', labcomm.INTEGER()), - ('bb', labcomm.BOOLEAN()), - ('ias', labcomm.array([1], - labcomm.array([0, 3, 0], - labcomm.array([5], - labcomm.INTEGER()))))]))))) - -class int_t(object): - no_signature = labcomm.typedef('int_t', - labcomm.INTEGER()) - -class int_array_t(object): - no_signature = labcomm.typedef('int_array_t', - labcomm.array([1], - labcomm.array([2], - labcomm.array([3, 4], - labcomm.INTEGER())))) - -class struct_t(object): - no_signature = labcomm.typedef('struct_t', - labcomm.struct([ - ('a', labcomm.INTEGER())])) - -class struct_array_t(object): - no_signature = labcomm.typedef('struct_array_t', - labcomm.array([2], - labcomm.struct([ - ('a', labcomm.INTEGER())]))) - -class struct_struct_t(object): - no_signature = labcomm.typedef('struct_struct_t', - labcomm.struct([ - ('a', labcomm.struct([ - ('a', labcomm.INTEGER())]))])) - -class int_s(object): - signature = labcomm.sample('int_s', - labcomm.INTEGER()) - -class int_array_s(object): - signature = labcomm.sample('int_array_s', - labcomm.array([1], - labcomm.array([0, 3, 0], - labcomm.array([5], - labcomm.INTEGER())))) - -class struct_s(object): - signature = labcomm.sample('struct_s', - labcomm.struct([ - ('a', labcomm.INTEGER()), - ('bcd', labcomm.DOUBLE())])) - -class struct_array_s(object): - signature = labcomm.sample('struct_array_s', - labcomm.array([2], - labcomm.struct([ - ('a', labcomm.INTEGER())]))) - -class struct_struct_s(object): - signature = labcomm.sample('struct_struct_s', - labcomm.struct([ - ('a', labcomm.struct([ - ('a', labcomm.INTEGER())]))])) - -class int_t_s(object): - signature = labcomm.sample('int_t_s', - labcomm.INTEGER()) - -class int_array_t_s(object): - signature = labcomm.sample('int_array_t_s', - labcomm.array([1], - labcomm.array([2], - labcomm.array([3, 4], - labcomm.INTEGER())))) - -class struct_t_s(object): - signature = labcomm.sample('struct_t_s', - labcomm.struct([ - ('a', labcomm.INTEGER())])) - -class struct_array_t_s(object): - signature = labcomm.sample('struct_array_t_s', - labcomm.array([2], - labcomm.struct([ - ('a', labcomm.INTEGER())]))) - -class struct_struct_t_s(object): - signature = labcomm.sample('struct_struct_t_s', - labcomm.struct([ - ('a', labcomm.struct([ - ('a', labcomm.INTEGER())]))])) - diff --git a/test/gen/python/simple.py b/test/gen/python/simple.py deleted file mode 100644 index 4c5e0e6..0000000 --- a/test/gen/python/simple.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/python -# Auto generated simple - -import labcomm - -class an_int(object): - signature = labcomm.sample('an_int', - labcomm.INTEGER()) - -class a_fixed_int_array(object): - signature = labcomm.sample('a_fixed_int_array', - labcomm.array([2], - labcomm.INTEGER())) - -class a_fixed_int_multi_array(object): - signature = labcomm.sample('a_fixed_int_multi_array', - labcomm.array([2, 2, 2], - labcomm.INTEGER())) - -class a_fixed_int_array_array_array(object): - signature = labcomm.sample('a_fixed_int_array_array_array', - labcomm.array([2], - labcomm.array([2], - labcomm.array([2], - labcomm.INTEGER())))) - -class a_variable_int_array(object): - signature = labcomm.sample('a_variable_int_array', - labcomm.array([0], - labcomm.INTEGER())) - -class a_variable_int_multi_array(object): - signature = labcomm.sample('a_variable_int_multi_array', - labcomm.array([0, 0, 0], - labcomm.INTEGER())) - -class a_variable_int_array_array_array(object): - signature = labcomm.sample('a_variable_int_array_array_array', - labcomm.array([0], - labcomm.array([0], - labcomm.array([0], - labcomm.INTEGER())))) - -class an_int_struct(object): - signature = labcomm.sample('an_int_struct', - labcomm.struct([ - ('a', labcomm.INTEGER()), - ('b', labcomm.INTEGER())])) - -class a_void(object): - signature = labcomm.sample('a_void', - labcomm.struct([]) -) - diff --git a/test/gen/simple.typeinfo b/test/gen/simple.typeinfo deleted file mode 100644 index a990483..0000000 --- a/test/gen/simple.typeinfo +++ /dev/null @@ -1,27 +0,0 @@ -C,sample,an_int,an_int -C,sample,a_fixed_int_array,a_fixed_int_array -C,sample,a_fixed_int_multi_array,a_fixed_int_multi_array -C,sample,a_fixed_int_array_array_array,a_fixed_int_array_array_array -C,sample,a_variable_int_array,a_variable_int_array -C,sample,a_variable_int_multi_array,a_variable_int_multi_array -C,sample,a_variable_int_array_array_array,a_variable_int_array_array_array -C,sample,an_int_struct,an_int_struct -C,sample,a_void,a_void -Java,sample,an_int,int -Java,sample,a_fixed_int_array,int[] -Java,sample,a_fixed_int_multi_array,int[][][] -Java,sample,a_fixed_int_array_array_array,int[][][] -Java,sample,a_variable_int_array,int[] -Java,sample,a_variable_int_multi_array,int[][][] -Java,sample,a_variable_int_array_array_array,int[][][] -Java,sample,an_int_struct,an_int_struct -Java,sample,a_void,void -C#,sample,an_int,int -C#,sample,a_fixed_int_array,int[] -C#,sample,a_fixed_int_multi_array,int[,,] -C#,sample,a_fixed_int_array_array_array,int[][][] -C#,sample,a_variable_int_array,int[] -C#,sample,a_variable_int_multi_array,int[,,] -C#,sample,a_variable_int_array_array_array,int[][][] -C#,sample,an_int_struct,an_int_struct -C#,sample,a_void,void diff --git a/test/gen/simple.vec b/test/gen/simple.vec deleted file mode 100644 index 36516c7d0b6bd674da98d73d2bd8598766edd35d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3494 zcma)8U27Xb3_QEgw?YGjLZMLT4>Ol01w)#G>y-AXYv;rM*Y1pN=Q38-=Lq&BjYcEw zg)`~8Zr*iW!MW%c-<N-`uNKSO^`c*``o93*<IHeK`da-4{__j+(9&#l5sxLfh2TdQ z{Bd`)ULHxksk6C<?{bg)L%;alua^Dg&2@8kP{!RK5Pxa$Ppr>gt(;@6|A@k;q}jd! z6=dpu0`L~yKbKdCE^3)~+(qS<cS0oo9`U<A(8aIy>h2qhY-7u;$Aiq-WerL}zymAs z93JK0;c(zVx?y4Jkb`s1Hqt!hA+RlYOdWD?&e`_V4B-&CuOjrbG9--WjCo*3oB;}q zZ&P-}p*{+sW3wJAnVugEjj`)wPUb0>&-|>#+%b=H?`!wbd(!UQMVQA~pR-3^;k4)b zw`wgcYq~}VR!!lt4-)@-`reL{>v^8VeZ20mG^aRIwLDAvvqzRW+?S@=%H=aZYsEf; zL_Bj{+O9XnAun?s^SHH}dgXO5&J-r!!m_6JKeuzPOWSeI^*qmF&FdcfJsi(*&bdD= z&l2YR%+Y(&Y~}KqpS74f=5g+Q?LM>myXZR!<6erhK4+^YFO62Mg=Njx?mSPw-=U3W z$GN-bc@}%T?y=v)@uPU6{}Hu#ckndk+EIDz#{{N2IW+H|m4HT0=n^wrTER6u?g;9L zvu1Ve=)akqtzAdF(HGjn<<YDDW?ek_%GVx9$9`fo>gj&UbuZ=W_a5Crm~&MlM)RGW zKUAN0V2!;p^<~`as(GK+iR%bI<@GMKqt9oL>YAmx=j@GBzk6{;%y44tjqlrV?K|T3 zJ!*&OO?YTgQ@A`Z^@X-@`C8Z97yaVNga3rHD|o>84>@heI{d!i!2^qU2!~i4Vr3}s TUw2u=;?S3&vacAkh?)Nfi+SVw diff --git a/test/run b/test/run index 3045653..07c4a0c 100755 --- a/test/run +++ b/test/run @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- coding: iso8859-15 -*- -import labcomm import math import os import sys @@ -157,6 +156,8 @@ if __name__ == "__main__": "gen/%s.typeinfo" % f) + sys.path.insert(0, "../lib/python") + import labcomm; sys.path.insert(0, "gen/python") for f in files: print f diff --git a/test/run.py b/test/run.py index 32e6ff5..927e1a8 100755 --- a/test/run.py +++ b/test/run.py @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- coding: iso8859-15 -*- -import labcomm import math import os import sys @@ -122,6 +121,8 @@ def generate(decl): raise Exception("unhandled decl %s" % decl.__class__) if __name__ == "__main__": + sys.path.insert(0, "../lib/python/") + import labcomm print os.getcwd(), sys.argv if not os.path.exists("gen"): os.makedirs("gen") -- GitLab