merging
[henge/apc.git] / src / ir.c
index 8652ddc..d9b1dc5 100644 (file)
--- a/src/ir.c
+++ b/src/ir.c
@@ -65,6 +65,8 @@ push_cdat(struct name*);
 void\r
 pop_cdat(void);\r
 void\r
+insert_refid(int);\r
+void\r
 insert_link_name(struct name*);\r
 void\r
 insert_link_namelist(struct name*);\r
@@ -152,14 +154,14 @@ insert_framesheet(struct name*, int,  int,  int, int, uint8_t*);
 \r
 \r
 \r
-/* Dynamically allocate memory for a class data structure,\r
-   or cdat, after a class has been identified in a grammar.\r
-   We also create a stack of class pointers so that\r
-   we can access the cdat during processing of that\r
-   cdats sets and elements, a requirement because the\r
-   nature of recursive classes prevents us from accessing\r
-   the cdat based on the previous index into cdat_buf,\r
-   which is a list of all allocated cdats\r
+/*  Dynamically allocate memory for a class data structure, */\r
+/*    or cdat, after a class has been identified in a grammar. */\r
+/*    We also create a stack of class pointers so that */\r
+/*    we can access the cdat during processing of that */\r
+/*    cdats sets and elements, a requirement because the */\r
+/*    nature of recursive classes prevents us from accessing */\r
+/*    the cdat based on the previous index into cdat_buf, */\r
+/*    which is a list of all allocated cdats */\r
 /*  Cdats: A cdat is a class data structure. Cdats serve as the central       */\r
 /*  data types of the IR. Cdats contain pointers to their subclasses so that the relationship between     */\r
 /*  classes can be determined, but the subclasses are not represented inside  */\r
@@ -385,7 +387,6 @@ ir_init()
   u8_stpncpy(name.name, root, 4);\r
 \r
   pagesize = sysconf(_SC_PAGESIZE);\r
-  printf("pagesize is %l\n", pagesize);\r
 \r
   INIT_CDAT();\r
   *cdat_stackp = CURRENT_CDAT();\r
@@ -736,8 +737,6 @@ insert_set_namelist
        }\r
      \r
     }\r
- done:\r
-  ;\r
 }\r
 \r
 /*. We create new odats for each map variant that are children of the current odat/set\r
@@ -783,6 +782,8 @@ insert_map
   /* set cdat idx values for both set and odat */\r
   curr_mem_setp->cdat_idx = num_cdats;\r
 \r
+  /* TODO: INSERT MAP HEIGHT/WIDTH/NAME/FILEPATH INTO ODAT */\r
+\r
 \r
   /* Generate refid if needed, put into ref_buf */\r
   if(!refid)\r
@@ -791,7 +792,7 @@ insert_map
   insert_ref(curr_mem_odatp, refid);\r
 \r
   /* If current odatp on stack has a link, then we need to make our own link. just set the vdat_idx */\r
-  if(CURR_SS_ODATP()->vdat_idx = 0)\r
+  if(CURR_SS_ODATP()->vdat_idx == 0)\r
     { //alloc a link\r
       linkp = alloc_link();\r
       linkp->type = CURR_SS_ODATP()->linkp->type;\r
@@ -857,6 +858,8 @@ insert_framesheet
   name_u8_cpy(&curr_modelp->name, model_name);\r
   curr_modelp->spritesheet[direction].height = height;\r
   curr_modelp->spritesheet[direction].width = width;\r
+  /* TODO: INSERT FILEPATH INTO VDAT */\r
+  u8_stpncpy(curr_modelp->spritesheet[direction].filepath, filepath, FPATH_MAX);\r
 \r
   name_u8_cpy(last_model_name, model_name);\r
 \r
@@ -968,17 +971,18 @@ insert_ref
 void\r
 insert_vdat\r
 ()\r
-{ struct odat* curr_ss_odatp;\r
-  struct vdat* curr_vdatp;\r
+{ struct vdat* curr_vdatp;\r
+\r
+  curr_vdatp = curr_vdat();\r
   \r
-  curr_vdatp->creator = curr_ss_odatp;\r
-  curr_ss_odatp->vdat_idx = num_vdats;\r
-  curr_ss_odatp->vdatp = curr_vdatp;\r
+  curr_vdatp->creator = CURR_SS_ODATP();\r
+  CURR_SS_ODATP()->vdat_idx = num_vdats;\r
+  CURR_SS_ODATP()->vdatp = curr_vdatp;\r
   alloc_vdat();\r
 }\r
 \r
 void\r
-insert_refid_statement\r
+insert_refid\r
 ( refid )\r
      int refid;\r
 { CURR_SS_ODATP()->refid = refid;\r