1 #include <stdio.h>
2 #include "tpl.h"
3
main()4 int main() {
5 tpl_node *tn;
6 int j;
7
8 tn = tpl_map("A(A(i))",&j);
9
10 j=1;
11 tpl_pack(tn,2);
12 tpl_pack(tn,1);
13 /* j=2; */
14 /* tpl_pack(tn,2); */
15 tpl_pack(tn,1); /* pack zero-length nested array */
16
17 tpl_dump(tn, TPL_FILE, "/tmp/test53.tpl");
18 tpl_free(tn);
19
20 tn = tpl_map("A(A(i))",&j);
21 tpl_load(tn, TPL_FILE, "/tmp/test53.tpl");
22 while(tpl_unpack(tn,1) > 0) {
23 printf("----------\n");
24 while(tpl_unpack(tn,2) > 0) {
25 printf("--> j is %d\n", j);
26 }
27 }
28 tpl_free(tn);
29 return(0);
30 }
31