ir files compile, still a wip
[henge/webcc.git] / src / apc / ir.h
index d4ab90b..ef54476 100644 (file)
@@ -1,23 +1,46 @@
 /* Structures allocated for and updated during parse time that
    are the IR before writing to the output file */
 
-#define BUFF_SIZE 256
+#define BUF_SIZE 256
 #define MAX_SUBCLASSES 16
 #define MAX_SETS 256
 #define MAX_ELES 256
 #define MAX_REFS 256
 #define MAX_MODELS 256
 
-//These IR buffers will be condensed into their respective output files.
-//parse_init() all to zero.
-struct cdat CB[BUFF_SIZE];
-struct vdat VB[BUFF_SIZE];
-struct odat OB[BUFF_SIZE];
 
-//indexes for buffers
-int cbi = 0;
-int vbi = 0;
-int obi = 0;
+
+struct ref {
+  int x, y, z, objref;
+};
+
+struct ele {
+  int odat_id;
+  int parent_id;//offset into class set_stack
+};
+
+struct set {
+  int odat_id;
+  int parent_id;//offset into CB
+  int num_ele;
+  int ele_index; //same as num_ele?
+  struct ele ele_list[MAX_ELES];
+};
+
+
+//8 ids for each direction
+//fdat_id ordered by alphabetical direction
+struct model {
+  char label[32];
+  int fdat_id[8];
+};
+
+struct vdat {
+  char label[32];
+  int num_models;
+  int msi; //model_stack_index
+  struct model model_list[MAX_MODELS];
+};
 
 struct cdat {
   char label[32];
@@ -25,7 +48,7 @@ struct cdat {
   int num_sets;
   int subclass_index;
   int set_index;
-  struct cdat subclass_list[MAX_SUBCLASSES];
+  struct cdat* subclass_list[MAX_SUBCLASSES];
   struct set set_list[MAX_SETS];
 };
 
@@ -39,34 +62,36 @@ struct odat {
   struct ref ref_list[MAX_REFS];
 };
 
-struct ref {
-  int x, y, z, objref;
-};
 
-struct set {
-  int odat_id;
-  int parent_id;//offset into CB
-  int num_ele;
-  int ele_index; //same as num_ele?
-  struct ele ele_list[MAX_ELES];
-};
+struct cdat cdat_buf[BUF_SIZE];
+struct odat odat_buf[BUF_SIZE];
+struct vdat vdat_buf[BUF_SIZE];
 
-struct ele {
-  int odat_id;
-  int parent_id;//offset into class set_stack
-};
+//indexes for buffers
+int cbi = 0;
+int vbi = 0;
+int obi = 0;
 
-//TODO: Do vdats need labels?
-struct vdat {
-  int num_models;
-  int msi; //model_stack_index
-  struct model model_list[MAX_MODELS];
-};
+void
+insert_set(void);
 
-//8 ids for each direction
-//fdat_id ordered by alphabetical direction
-struct model {
-  char label[32];
-  int fdat_id[8];
-};
+void
+insert_ref(int, int, int, int);
+
+void
+inc_cbi(void);
+
+void
+set_class_label(char*);
+
+void
+inc_subclass_index(void);
+
+void
+inc_subclass_index(void);
+
+void
+inc_ref(void);
 
+void
+inc_models(void);