1 #include <stdio.h>
2 #include "tpl.h"
3 
4 #define ILEN 10
5 #define KLEN 8
6 #define FLEN 5
7 
8 struct st {
9     char c;
10     double f[FLEN];
11 };
12 
main()13 int main() {
14     tpl_node *tn;
15     /* some meaningless test data */
16     struct st s;
17     int j;
18     int i[ILEN];
19     int k[KLEN];
20     char a;
21     char b;
22 
23     tn = tpl_map("cA(i#)S(cf#)A(ci#)", &a, i, ILEN, &s, FLEN, &b, k, KLEN);
24     tpl_load(tn,TPL_FILE,"/tmp/test82.tpl");
25 
26     tpl_unpack(tn,0);
27     printf("%c %c %.2f %.2f %.2f %.2f %.2f \n", a, s.c, s.f[0], s.f[1], s.f[2], s.f[3], s.f[4]);
28 
29     while( tpl_unpack(tn,1) > 0) {
30         for(j=0;j<ILEN;j++) printf("%d ", i[j]);
31         printf("\n");
32     }
33 
34     while( tpl_unpack(tn,2) > 0) {
35         printf("%c ", b);
36         for(j=0;j<KLEN;j++) printf("%d ", k[j]);
37         printf("\n");
38     }
39 
40     tpl_free(tn);
41     return(0);
42 }
43