]> git.ozlabs.org Git - ccan-lca-2011.git/blobdiff - 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
diff --git a/ccan/cdump/test/example_generated-defs.h b/ccan/cdump/test/example_generated-defs.h
new file mode 100644 (file)
index 0000000..4f266ea
--- /dev/null
@@ -0,0 +1,61 @@
+const struct cdump_enum cdump_enum_fruit[] = {
+       { "APPLE", APPLE },
+       { "ORANGE", ORANGE },
+       { "PEAR", PEAR },
+       { "RASBERRY", RASBERRY },
+       { "PEACH", PEACH },
+       { NULL, 0 } };
+bool cdump_bundle_enum_fruit(struct cdump_string *p, const void *ptr, unsigned indent)
+{
+       return cdump_bundle_enum(cdump_enum_fruit, p, ptr, indent);
+}
+bool cdump_unbundle_enum_fruit(const void *ctx, void *ptr, const char *str)
+{
+       return cdump_unbundle_enum(cdump_enum_fruit, ptr, str);
+}
+
+const struct cdump_desc cdump_struct_test2[] = {
+       { "x1", 0, sizeof(int), offsetof(struct test2, x1), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
+       { "foo", 1, sizeof(char), offsetof(struct test2, foo), 0, NULL, 0, cdump_bundle_char, cdump_unbundle_char },
+       { "fstring", 0, sizeof(char), offsetof(struct test2, fstring), (20), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
+       { "dlen", 0, sizeof(int), offsetof(struct test2, dlen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
+       { "dfoo", 1, sizeof(char), offsetof(struct test2, dfoo), 0, "dlen", 0, cdump_bundle_char, cdump_unbundle_char },
+       { "fvalue", 0, sizeof(enum fruit), offsetof(struct test2, fvalue), 0, NULL, CDUMP_FLAG_ALWAYS, cdump_bundle_enum_fruit, cdump_unbundle_enum_fruit },
+       { "next", 1, sizeof(struct test2), offsetof(struct test2, next), 0, NULL, 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
+       { NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL } };
+bool cdump_bundle_struct_test2(struct cdump_string *p, const void *ptr, unsigned indent)
+{
+       return cdump_bundle_struct(cdump_struct_test2, p, ptr, indent);
+}
+bool cdump_unbundle_struct_test2(const void *ctx, void *ptr, const char *str)
+{
+       return cdump_unbundle_struct(ctx, cdump_struct_test2, ptr, str);
+}
+
+const struct cdump_desc cdump_struct_test1[] = {
+       { "foo", 0, sizeof(char), offsetof(struct test1, foo), (100), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
+       { "foo2", 1, sizeof(char), offsetof(struct test1, foo2), (20), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
+       { "xlen", 0, sizeof(int), offsetof(struct test1, xlen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
+       { "iarray", 1, sizeof(int), offsetof(struct test1, iarray), 0, "xlen", 0, cdump_bundle_int, cdump_unbundle_int },
+       { "slen", 0, sizeof(unsigned), offsetof(struct test1, slen), 0, NULL, 0, cdump_bundle_unsigned, cdump_unbundle_unsigned },
+       { "strings", 2, sizeof(char), offsetof(struct test1, strings), 0, "slen", 0, cdump_bundle_char, cdump_unbundle_char },
+       { "s2", 1, sizeof(char), offsetof(struct test1, s2), (5), NULL, 0, cdump_bundle_char, cdump_unbundle_char },
+       { "d1", 0, sizeof(double), offsetof(struct test1, d1), 0, NULL, 0, cdump_bundle_double, cdump_unbundle_double },
+       { "d2", 0, sizeof(double), offsetof(struct test1, d2), 0, NULL, 0, cdump_bundle_double, cdump_unbundle_double },
+       { "d3", 0, sizeof(double), offsetof(struct test1, d3), 0, NULL, 0, cdump_bundle_double, cdump_unbundle_double },
+       { "test2", 1, sizeof(struct test2), offsetof(struct test1, test2), 0, NULL, 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
+       { "alen", 0, sizeof(int), offsetof(struct test1, alen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
+       { "test2_array", 1, sizeof(struct test2), offsetof(struct test1, test2_array), 0, "alen", 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
+       { "test2_fixed", 1, sizeof(struct test2), offsetof(struct test1, test2_fixed), (2), NULL, 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
+       { "plen", 0, sizeof(int), offsetof(struct test1, plen), 0, NULL, 0, cdump_bundle_int, cdump_unbundle_int },
+       { "test2_parray", 2, sizeof(struct test2), offsetof(struct test1, test2_parray), 0, "plen", 0, cdump_bundle_struct_test2, cdump_unbundle_struct_test2 },
+       { NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL } };
+bool cdump_bundle_struct_test1(struct cdump_string *p, const void *ptr, unsigned indent)
+{
+       return cdump_bundle_struct(cdump_struct_test1, p, ptr, indent);
+}
+bool cdump_unbundle_struct_test1(const void *ctx, void *ptr, const char *str)
+{
+       return cdump_unbundle_struct(ctx, cdump_struct_test1, ptr, str);
+}
+