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