diff --git a/examples/simple_java/compile.sh b/examples/simple_java/compile.sh index 7d455a2b9ecc250542b57e7daff8ad0e8395ec14..84a0e83e8f8c31364890f54c497b3ced3d7a77a5 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 0000000000000000000000000000000000000000..079ca17b99b37b3c3e6a64ae7429c29263473518 --- /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 097d54c597985106a384803a481ff527180fa324..0000000000000000000000000000000000000000 --- 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 3e384451f8255de1be136122d8032ca4570396ca..0000000000000000000000000000000000000000 --- 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 89f4e1d2bf9c4d13eaf9060cf57776d486dcb59d..0000000000000000000000000000000000000000 --- 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 24b44808c5d620cbbfef4c412a2ca982a2f20eb0..0000000000000000000000000000000000000000 --- 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 a8dcd180445f39eae16bb5d63456dc5880e3637f..0000000000000000000000000000000000000000 --- 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 853d615a945d969979bfbc43e9a5379b68de43a2..0000000000000000000000000000000000000000 --- 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 38858cb77edc8dfdbe246ee22d984a6d237faf93..0000000000000000000000000000000000000000 --- 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 d127c4263b4f9701380d74f6c3b21749746f0647..0000000000000000000000000000000000000000 --- 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 851b1b57dca42a0e02ef575a2eef105707ef6b8a..0000000000000000000000000000000000000000 --- 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 707cc77ec77d92859bea24359489db881f78eb0e..0000000000000000000000000000000000000000 --- 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 f6d7379a86f8bc36f6a6e9284ded4f0a8e8e8dfb..0000000000000000000000000000000000000000 --- 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 206cb7abbf0ff14d6fbd4a04b9f308cacac23e12..0000000000000000000000000000000000000000 --- 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 41379c9c9becf0bad0f5af2004c7a2ccda4f44a1..0000000000000000000000000000000000000000 --- 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 37c4304b778023873e5085857b3cb0240abdc769..0000000000000000000000000000000000000000 --- 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 ba0364a5629c7757e554ed354171b8918fd5a6dd..0000000000000000000000000000000000000000 --- 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 cab63bb5364f471b96c40cb4468a1af0acdbb802..0000000000000000000000000000000000000000 --- 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 c7879c0a72425fdc3584c6f615e079c7bb9bea75..0000000000000000000000000000000000000000 --- 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 8f6e30dd19e8097784cd909d5cddff0c588fd88c..0000000000000000000000000000000000000000 --- 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 7864d869d3672fb7c36cdf1f6ae9217d7a43e3bc..0000000000000000000000000000000000000000 --- 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 9a241c83dbde363af8bb45b05587b2dc79b30435..0000000000000000000000000000000000000000 --- 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 a248887acc41bb362905f99306f9e2505721cb4c..0000000000000000000000000000000000000000 --- 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 f2a693273e6711189b7d4b3f49c967278bb8eda6..0000000000000000000000000000000000000000 --- 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 510e3d7b73e372f96f131b93e43d8dcb21f205b0..0000000000000000000000000000000000000000 --- 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 979184fe598c10dfc34d12555cc0dffbe2ba3107..0000000000000000000000000000000000000000 --- 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 d0f53eb5126d299397ce719c54f5691723a0dba0..0000000000000000000000000000000000000000 --- 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 df4df75d48fcd3e959bcf37e9d298f221bd7fb8d..0000000000000000000000000000000000000000 --- 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 c3ae12d4b3087d0640406daa082a73feb643604b..0000000000000000000000000000000000000000 --- 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 e599fa0f5f7fbd76c8928818bb8872d5334d78f2..0000000000000000000000000000000000000000 --- 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 5c21ae4fdac501b56a68519a306f93a263cda673..0000000000000000000000000000000000000000 --- 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 417cb0c9b9fb5844e448bd8b4ceed9c8130341a9..0000000000000000000000000000000000000000 --- 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 9da7ebef0e8f29322ce2a3952229ff04f74bf281..0000000000000000000000000000000000000000 --- 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 7b21149bf81d02172f548e971973d279d24f3a0b..0000000000000000000000000000000000000000 --- 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 Binary files a/test/gen/nested.vec and /dev/null differ diff --git a/test/gen/python/nested.py b/test/gen/python/nested.py deleted file mode 100644 index a1c1343f40799d06e4ce6ef287cfbda92ff1bb93..0000000000000000000000000000000000000000 --- 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 4c5e0e6e3cbc44bbac045fe1e635281bc4d86f6c..0000000000000000000000000000000000000000 --- 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 a990483ef30575d161af520a5be29be958cd2615..0000000000000000000000000000000000000000 --- 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 Binary files a/test/gen/simple.vec and /dev/null differ diff --git a/test/run b/test/run index 3045653d5646b1b1bc1dc46614eb53ece972a1dc..07c4a0cdfcea7948ba2c0dde931e169dd3a7a213 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 32e6ff5d367cd508fc0d4cc3d2252abc86cfdd35..927e1a8870a4723da5620465eb913ce2ffef3f7a 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")