7 double variable_lookup(struct variable *in)
12 double expression_eval(struct expression *in)
16 return expression_eval(in->a) * expression_eval(in->b);
19 return expression_eval(in->a) / expression_eval(in->b);
22 return expression_eval(in->a) + expression_eval(in->b);
25 return expression_eval(in->a) - expression_eval(in->b);
28 if (in->v.base == NULL) {
30 } else return variable_lookup(&in->v);
33 assert(!!!"OH NOES!!!");
38 static void decor_print(gpointer data, gpointer user_data)
41 struct decor *decor = data;
42 printf(" decor id %s\n", decor->name);
43 printf(" anchor.x = %f\n", expression_eval(&decor->space.anchor.x));
44 if (decor->texture.present) {
45 if (decor->texture.internal)
46 printf(" texture internal: %s\n", decor->texture.name);
48 printf(" texture file: %s\n", decor->texture.name);
50 // printf(" anchor (%d %d %d)\n", decor->space.anchor.x, decor->space.anchor.y, decor->space.anchor.z);
51 // printf(" up (%d %d %d)\n", decor->space.up.x, decor->space.up.y, decor->space.up.z);
53 g_slist_foreach(decor->children, decor_print, NULL);
56 static void style_print(gpointer key, gpointer value, gpointer user_data)
58 char *stylename = key;
59 struct style *style = value;
61 printf(" style %s\n", stylename);
62 g_slist_foreach(style->tree, decor_print, NULL);
65 static void theme_print(gpointer key, gpointer value, gpointer user_data)
68 struct theme *thm = value;
69 printf("name = %s\n", name);
70 g_hash_table_foreach(thm->styles, style_print, NULL);
73 static void material_print(gpointer key, gpointer value, gpointer user_data)
76 struct material *mat = value;
77 printf("name = %s\n", name);
78 printf(" opacity = %f\n", mat->opacity);
81 int main(int argc, char **argv)
84 struct obthemedata themedata;
86 themedata.themes = g_hash_table_new(g_str_hash, g_str_equal);
87 themedata.materials = g_hash_table_new(g_str_hash, g_str_equal);
88 err = obtheme_parse(&themedata, argv[1]);
89 printf("err = %d\n", err);
91 g_hash_table_foreach(themedata.materials, material_print, NULL);
93 g_hash_table_foreach(themedata.themes, theme_print, NULL);