Added Bag Implementation
[panda.git] / scratch / main.c
blob96355b21452d0c979d8fa281853f9052be070a03
3 #include "goo-mini.h"
5 #include <glib.h>
7 /* foo table */
9 typedef struct _GooFoo GooFoo;
11 struct _GooFoo
13 GooMiniBase base_table;
15 void (* foo) (GooFoo *table);
19 #define GOO_MINI_TYPE_FOO (goo_foo_get_type ())
20 #define GOO_MINI_FOO_TABLE(table) ((GooFoo *) table)
22 GooMiniType goo_foo_get_type ();
24 GOO_MINI_DEFINE_TYPE (GooFoo, goo_foo, GOO_MINI_TYPE_BASE);
27 static void
28 foo_handler (GooFoo *table)
30 g_debug (G_STRFUNC);
33 static void
34 goo_foo_table_init (GooFoo *table)
36 table->foo = foo_handler;
40 /* bar table */
42 typedef struct _GooBar GooBar;
44 struct _GooBar
46 GooFoo parent_table;
48 void (* bar) (GooBar *table);
52 #define GOO_MINI_TYPE_BAR (goo_bar_get_type ())
53 #define GOO_MINI_BAR_TABLE(table) ((GooBar *) table)
55 GooMiniType goo_bar_get_type ();
57 GOO_MINI_DEFINE_TYPE (GooBar, goo_bar, GOO_MINI_TYPE_FOO);
59 static void
60 bar_foo_handler (GooFoo *table)
62 g_debug (G_STRFUNC);
63 GOO_MINI_FOO_TABLE (goo_bar_parent_table)->foo (table);
66 static void
67 bar_handler (GooBar *table)
69 g_debug (G_STRFUNC);
72 static void
73 goo_bar_table_init (GooBar *table)
76 GooFoo *foo_table = GOO_MINI_FOO_TABLE (table);
78 foo_table->foo = bar_foo_handler;
80 table->bar = bar_handler;
85 int
86 main (int argc, char *argv[])
88 GooFoo *table = (GooFoo *) goo_mini_type_get_table (GOO_MINI_TYPE_BAR);
90 table->foo (table);
92 return 0;