initial import
[manmower/obtheme.git] / obtheme.h
1 #ifndef __THEME_PARSE_H__
2 #define __THEME_PARSE_H__
3
4 #include <glib.h>
5
6 #undef YY_DECL
7 #define YY_DECL int obthemelex(YYSTYPE *yylval, struct parser_control *pc)
8
9 #define YYDEBUG 1
10 #define YYLEX_PARAM pc
11
12 #define MAX_INCLUDE_DEPTH 32
13 #define LINE pc->currline[pc->include_stack_ptr]
14
15 extern int themedebug;
16
17 struct material {
18         float opacity;
19 };
20
21 struct class {
22         char *name;
23         GSList *tree;
24 };
25
26 struct obthemedata {
27         GHashTable *themes;
28         GHashTable *materials;
29 };
30
31 struct theme {
32         char *name;
33         GHashTable *classes;
34 };
35
36 struct vector {
37         int x;
38         int y;
39         int z;
40 };
41
42 struct space {
43         struct vector anchor;
44         struct vector up;
45 };
46
47 struct decor {
48         char *name;
49         GSList *children;
50         struct space space;
51 };
52
53 struct parser_control {
54         struct yy_buffer_state *include_stack[MAX_INCLUDE_DEPTH];
55         int currline[MAX_INCLUDE_DEPTH];
56         char currfile[MAX_INCLUDE_DEPTH][501];
57         int include_stack_ptr;
58         char error_buf[4096];
59         struct obthemedata *target;
60 };
61
62 void obthemeerror(struct parser_control *pc, char *s);
63 int obtheme_parse(struct obthemedata *td, const char *filename);
64 struct parser_control *parser_init(struct obthemedata *td);
65 int obthemeparse(struct parser_control *);
66 void parser_finish(struct parser_control *);
67
68 #endif /* __THEME_PARSE_H__ */