pushing to debug make
[henge/webcc.git] / src / apc / ir.h
index d4ab90b..9b8f4ab 100644 (file)
@@ -1,48 +1,29 @@
 /* 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 cdat {
-  char label[32];
-  int num_subclasses;
-  int num_sets;
-  int subclass_index;
-  int set_index;
-  struct cdat subclass_list[MAX_SUBCLASSES];
-  struct set set_list[MAX_SETS];
-};
-
-//Element or a set
-struct odat {
-  char label[32];
-  int vdat_id;
-  int class_id;
-  int num_ref;
-  int ref_index;
-  struct ref ref_list[MAX_REFS];
-};
-
 struct ref {
   int x, y, z, objref;
 };
 
+struct ele {
+  int odat_id;
+  int parent_id;//offset into class set_stack
+};
+
+//TODO: Add jump table
 struct set {
   int odat_id;
   int parent_id;//offset into CB
@@ -51,9 +32,12 @@ struct set {
   struct ele ele_list[MAX_ELES];
 };
 
-struct ele {
-  int odat_id;
-  int parent_id;//offset into class set_stack
+
+//8 ids for each direction
+//fdat_id ordered by alphabetical direction
+struct model {
+  char label[32];
+  int fdat_id[8];
 };
 
 //TODO: Do vdats need labels?
@@ -61,12 +45,43 @@ struct vdat {
   int num_models;
   int msi; //model_stack_index
   struct model model_list[MAX_MODELS];
-};
+} vdat_buf[BUF_SIZE];
 
-//8 ids for each direction
-//fdat_id ordered by alphabetical direction
-struct model {
+struct cdat {
   char label[32];
-  int fdat_id[8];
-};
+  int num_subclasses;
+  int num_sets;
+  int subclass_index;
+  int set_index;
+  struct cdat* subclass_list[MAX_SUBCLASSES];
+  struct set set_list[MAX_SETS];
+} cdat_buf[BUF_SIZE];
+
+//Element or a set
+struct odat {
+  char label[32];
+  int vdat_id;
+  int class_id;
+  int num_ref;
+  int ref_index;
+  struct ref ref_list[MAX_REFS];
+} odat_buf[BUF_SIZE];
+
+
+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);