]> git.ozlabs.org Git - ccan-lca-2011.git/blob - ccan/cdump/test/example_generated-defs.h
cdump: first cut of translation of Tridge's genstruct junkcode.
[ccan-lca-2011.git] / ccan / cdump / test / example_generated-defs.h
1 const struct cdump_enum cdump_enum_fruit[] = {
2         { "APPLE", APPLE },
3         { "ORANGE", ORANGE },
4         { "PEAR", PEAR },
5         { "RASBERRY", RASBERRY },
6         { "PEACH", PEACH },
7         { NULL, 0 } };
8 bool cdump_bundle_enum_fruit(struct cdump_string *p, const void *ptr, unsigned indent)
9 {
10         return cdump_bundle_enum(cdump_enum_fruit, p, ptr, indent);
11 }
12 bool cdump_unbundle_enum_fruit(const void *ctx, void *ptr, const char *str)
13 {
14         return cdump_unbundle_enum(cdump_enum_fruit, ptr, str);
15 }
16
17 const struct cdump_desc cdump_struct_test2[] = {
18         { "x1", 0, sizeof(int), offsetof(struct test2, x1), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
19         { "foo", 1, sizeof(char), offsetof(struct test2, foo), 0, NULL, 0, cdump_bundle_char, cdump_unbundle_char },
20         { "fstring", 0, sizeof(char), offsetof(struct test2, fstring), (20), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
21         { "dlen", 0, sizeof(int), offsetof(struct test2, dlen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
22         { "dfoo", 1, sizeof(char), offsetof(struct test2, dfoo), 0, "dlen", 0, cdump_bundle_char, cdump_unbundle_char },
23         { "fvalue", 0, sizeof(enum fruit), offsetof(struct test2, fvalue), 0, NULL, CDUMP_FLAG_ALWAYS, cdump_bundle_enum_fruit, cdump_unbundle_enum_fruit },
24         { "next", 1, sizeof(struct test2), offsetof(struct test2, next), 0, NULL, 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
25         { NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL } };
26 bool cdump_bundle_struct_test2(struct cdump_string *p, const void *ptr, unsigned indent)
27 {
28         return cdump_bundle_struct(cdump_struct_test2, p, ptr, indent);
29 }
30 bool cdump_unbundle_struct_test2(const void *ctx, void *ptr, const char *str)
31 {
32         return cdump_unbundle_struct(ctx, cdump_struct_test2, ptr, str);
33 }
34
35 const struct cdump_desc cdump_struct_test1[] = {
36         { "foo", 0, sizeof(char), offsetof(struct test1, foo), (100), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
37         { "foo2", 1, sizeof(char), offsetof(struct test1, foo2), (20), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
38         { "xlen", 0, sizeof(int), offsetof(struct test1, xlen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
39         { "iarray", 1, sizeof(int), offsetof(struct test1, iarray), 0, "xlen", 0, cdump_bundle_int, cdump_unbundle_int },
40         { "slen", 0, sizeof(unsigned), offsetof(struct test1, slen), 0, NULL, 0, cdump_bundle_unsigned, cdump_unbundle_unsigned },
41         { "strings", 2, sizeof(char), offsetof(struct test1, strings), 0, "slen", 0, cdump_bundle_char, cdump_unbundle_char },
42         { "s2", 1, sizeof(char), offsetof(struct test1, s2), (5), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
43         { "d1", 0, sizeof(double), offsetof(struct test1, d1), 0, NULL, 0, cdump_bundle_double, cdump_unbundle_double },
44         { "d2", 0, sizeof(double), offsetof(struct test1, d2), 0, NULL, 0, cdump_bundle_double, cdump_unbundle_double },
45         { "d3", 0, sizeof(double), offsetof(struct test1, d3), 0, NULL, 0, cdump_bundle_double, cdump_unbundle_double },
46         { "test2", 1, sizeof(struct test2), offsetof(struct test1, test2), 0, NULL, 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
47         { "alen", 0, sizeof(int), offsetof(struct test1, alen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
48         { "test2_array", 1, sizeof(struct test2), offsetof(struct test1, test2_array), 0, "alen", 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
49         { "test2_fixed", 1, sizeof(struct test2), offsetof(struct test1, test2_fixed), (2), NULL, 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
50         { "plen", 0, sizeof(int), offsetof(struct test1, plen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
51         { "test2_parray", 2, sizeof(struct test2), offsetof(struct test1, test2_parray), 0, "plen", 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
52         { NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL } };
53 bool cdump_bundle_struct_test1(struct cdump_string *p, const void *ptr, unsigned indent)
54 {
55         return cdump_bundle_struct(cdump_struct_test1, p, ptr, indent);
56 }
57 bool cdump_unbundle_struct_test1(const void *ctx, void *ptr, const char *str)
58 {
59         return cdump_unbundle_struct(ctx, cdump_struct_test1, ptr, str);
60 }
61