1 #include <stdio.h>
2 #include "tpl.h"
3 #include <inttypes.h>
4
5 const char *filename = "/tmp/test109.tpl";
6
7 typedef struct {
8 char c;
9 uint32_t i;
10 uint16_t j;
11 char d;
12 } spad;
13
main()14 int main() {
15 tpl_node *tn;
16 spad s = {'a', 1, 2, 'b'}, t = {'?', 0, 0, '!'};;
17
18 printf("sizeof(s): %d\n", (int)sizeof(s));;
19 tn = tpl_map("S(cijc)", &s);
20 tpl_pack(tn,0);
21 tpl_dump(tn,TPL_FILE,filename);
22 tpl_free(tn);
23
24 tn = tpl_map("S(cijc)", &t);
25 tpl_load(tn,TPL_FILE,filename);
26 tpl_unpack(tn,0);
27 tpl_free(tn);
28
29 if (s.c==t.c && s.i==t.i && s.j==t.j && s.d==t.d)
30 printf("structures match\n");
31 else
32 printf("structures mismatch\n");
33
34 return 0;
35 }
36