parser wip pt2
[henge/webcc.git] / src / apc / ir.h
1 /* Structures allocated for and updated during parse time that
2 are the IR before writing to the output file */
3
4 #define BUFF_SIZE 256
5 #define MAX_SUBCLASSES 16
6 #define MAX_SETS 256
7 #define MAX_ELES 256
8 #define MAX_REFS 256
9 #define MAX_MODELS 256
10
11 //These IR buffers will be condensed into their respective output files.
12 //parse_init() all to zero.
13 struct cdat CB[BUFF_SIZE];
14 struct vdat VB[BUFF_SIZE];
15 struct odat OB[BUFF_SIZE];
16
17 //indexes for buffers
18 int cbi = 0;
19 int vbi = 0;
20 int obi = 0;
21
22 struct cdat {
23 char label[32];
24 int num_subclasses;
25 int num_sets;
26 int subclass_index;
27 int set_index;
28 struct cdat subclass_list[MAX_SUBCLASSES];
29 struct set set_list[MAX_SETS];
30 };
31
32 //Element or a set
33 struct odat {
34 char label[32];
35 int vdat_id;
36 int class_id;
37 int num_ref;
38 int ref_index;
39 struct ref ref_list[MAX_REFS];
40 };
41
42 struct ref {
43 int x, y, z, objref;
44 };
45
46 struct set {
47 int odat_id;
48 int parent_id;//offset into CB
49 int num_ele;
50 int ele_index; //same as num_ele?
51 struct ele ele_list[MAX_ELES];
52 };
53
54 struct ele {
55 int odat_id;
56 int parent_id;//offset into class set_stack
57 };
58
59 //TODO: Do vdats need labels?
60 struct vdat {
61 int num_models;
62 int msi; //model_stack_index
63 struct model model_list[MAX_MODELS];
64 };
65
66 //8 ids for each direction
67 //fdat_id ordered by alphabetical direction
68 struct model {
69 char label[32];
70 int fdat_id[8];
71 };
72