pushing to debug make
[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 BUF_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
12 //indexes for buffers
13 int cbi = 0;
14 int vbi = 0;
15 int obi = 0;
16
17 struct ref {
18 int x, y, z, objref;
19 };
20
21 struct ele {
22 int odat_id;
23 int parent_id;//offset into class set_stack
24 };
25
26 //TODO: Add jump table
27 struct set {
28 int odat_id;
29 int parent_id;//offset into CB
30 int num_ele;
31 int ele_index; //same as num_ele?
32 struct ele ele_list[MAX_ELES];
33 };
34
35
36 //8 ids for each direction
37 //fdat_id ordered by alphabetical direction
38 struct model {
39 char label[32];
40 int fdat_id[8];
41 };
42
43 //TODO: Do vdats need labels?
44 struct vdat {
45 int num_models;
46 int msi; //model_stack_index
47 struct model model_list[MAX_MODELS];
48 } vdat_buf[BUF_SIZE];
49
50 struct cdat {
51 char label[32];
52 int num_subclasses;
53 int num_sets;
54 int subclass_index;
55 int set_index;
56 struct cdat* subclass_list[MAX_SUBCLASSES];
57 struct set set_list[MAX_SETS];
58 } cdat_buf[BUF_SIZE];
59
60 //Element or a set
61 struct odat {
62 char label[32];
63 int vdat_id;
64 int class_id;
65 int num_ref;
66 int ref_index;
67 struct ref ref_list[MAX_REFS];
68 } odat_buf[BUF_SIZE];
69
70
71 void
72 inc_cbi(void);
73
74 void
75 set_class_label(char*);
76
77 void
78 inc_subclass_index(void);
79
80 void
81 inc_subclass_index(void);
82
83 void
84 inc_ref(void);
85
86 void
87 inc_models(void);