repair brokeness provided by a foolish Makefile
[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 #include "geom.h"
8
9 #undef YY_DECL
10 #define YY_DECL int obthemelex(YYSTYPE *yylval, struct parser_control *pc)
11
12 #define YYDEBUG 1
13 #define YYLEX_PARAM pc
14
15 #define MAX_INCLUDE_DEPTH 32
16 #define LINE pc->currline[pc->include_stack_ptr]
17
18 extern int themedebug;
19
20 typedef enum {
21         OB_THEME_INV,
22         OB_THEME_ADD,
23         OB_THEME_SUB,
24         OB_THEME_MUL,
25         OB_THEME_DIV,
26         OB_THEME_EQL
27 } ObThemeOp;
28
29 struct variable {
30         char *base;
31         char *member;
32         double number;
33 };
34
35 struct expression {
36         ObThemeOp op;
37         struct expression *a;
38         struct expression *b;
39         struct variable v;
40 };
41
42 struct material {
43         float opacity;
44 };
45
46 struct style {
47         char *name;
48         GSList *tree;
49 };
50
51 struct obthemedata {
52         GHashTable *themes;
53         GHashTable *materials;
54 };
55
56 struct theme {
57         char *name;
58         GHashTable *styles;
59 };
60
61 struct vector {
62         struct expression x;
63         struct expression y;
64         struct expression z;
65 };
66
67 struct space {
68         struct vector anchor;
69         struct vector up;
70 };
71
72 struct texture {
73         gboolean present;
74         gboolean internal;
75         char *name;
76 };
77
78 struct box {
79         struct vector start;
80         struct vector end;
81 };
82
83 struct geometry {
84         struct box box;
85 };
86
87 struct decor {
88         char *name;
89         GSList *children;
90         struct space space;
91         ObDirection cursor;
92         ObFrameContext context;
93         struct texture texture;
94         struct material *material;
95         struct geometry geometry;
96 };
97
98 struct parser_control {
99         struct yy_buffer_state *include_stack[MAX_INCLUDE_DEPTH];
100         int currline[MAX_INCLUDE_DEPTH];
101         char currfile[MAX_INCLUDE_DEPTH][501];
102         int include_stack_ptr;
103         char error_buf[4096];
104         struct obthemedata *target;
105 };
106
107 void obthemeerror(struct parser_control *pc, char *s);
108 int obtheme_parse(struct obthemedata *td, const char *filename);
109 struct parser_control *parser_init(struct obthemedata *td);
110 int obthemeparse(struct parser_control *);
111 void parser_finish(struct parser_control *);
112 void obtheme_calc_bound(struct theme *thm, char *name, Rect *r, Strut *s);
113 void obtheme_decorate_window(struct theme *thm, char *name);
114
115 #endif /* __THEME_PARSE_H__ */