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