remove important functions from main.c
[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 boundrect {
20         double x1, y1, x2, y2;
21 };
22
23 typedef enum {
24         OB_THEME_INV,
25         OB_THEME_ADD,
26         OB_THEME_SUB,
27         OB_THEME_MUL,
28         OB_THEME_DIV,
29         OB_THEME_EQL
30 } ObThemeOp;
31
32 struct variable {
33         char *base;
34         char *member;
35         double number;
36 };
37
38 struct expression {
39         ObThemeOp op;
40         struct expression *a;
41         struct expression *b;
42         struct variable v;
43 };
44
45 struct material {
46         float opacity;
47 };
48
49 struct style {
50         char *name;
51         GSList *tree;
52 };
53
54 struct obthemedata {
55         GHashTable *themes;
56         GHashTable *materials;
57 };
58
59 struct theme {
60         char *name;
61         GHashTable *styles;
62 };
63
64 struct vector {
65         struct expression x;
66         struct expression y;
67         struct expression z;
68 };
69
70 struct space {
71         struct vector anchor;
72         struct vector up;
73 };
74
75 struct texture {
76         gboolean present;
77         gboolean internal;
78         char *name;
79 };
80
81 struct box {
82         struct vector start;
83         struct vector end;
84 };
85
86 struct geometry {
87         struct box box;
88 };
89
90 struct decor {
91         char *name;
92         GSList *children;
93         struct space space;
94         ObDirection cursor;
95         ObFrameContext context;
96         struct texture texture;
97         struct material *material;
98         struct geometry geometry;
99 };
100
101 struct parser_control {
102         struct yy_buffer_state *include_stack[MAX_INCLUDE_DEPTH];
103         int currline[MAX_INCLUDE_DEPTH];
104         char currfile[MAX_INCLUDE_DEPTH][501];
105         int include_stack_ptr;
106         char error_buf[4096];
107         struct obthemedata *target;
108 };
109
110 void obthemeerror(struct parser_control *pc, char *s);
111 int obtheme_parse(struct obthemedata *td, const char *filename);
112 struct parser_control *parser_init(struct obthemedata *td);
113 int obthemeparse(struct parser_control *);
114 void parser_finish(struct parser_control *);
115 void obtheme_calc_bound(struct theme *thm, char *name, struct boundrect *br);
116 void obtheme_decorate_window(struct theme *thm, char *name);
117
118 #endif /* __THEME_PARSE_H__ */