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