node processing code/macros, and other fixes
[mikachu/openbox.git] / obcl / main.c
1 #include "obcl.h"
2
3 void process_foo(CLNode *node)
4 {
5     if (CL_IS_NODE(node)) {
6         printf("foo name: %s\n"
7                "foo age: %.2f\n",
8                CL_STRVAL(CL_LIST_NTH(node,0)),
9                CL_NUMVAL(CL_LIST_NTH(node,1)));
10     }
11 }
12
13 void process_bah(CLNode *node)
14 {
15     printf("handling bah\n");
16 }
17
18 int main()
19 {
20     GList *lst = cl_parse("foo.conf");
21 /*     cl_tree_print(lst,0); */
22 /*     cl_tree_free(lst); */
23
24     
25     CLProc *p = cl_proc_new();
26     cl_proc_add_handler_func(p, "foo", process_foo);
27     cl_proc_add_handler_func(p, "bah", process_bah);
28
29     cl_process(lst, p);
30
31     return 0;
32 }