X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=blobdiff_plain;f=src%2Fapc%2Fir.c;fp=src%2Fapc%2Fir.c;h=5673d0c107d24f39fa329e4e83991f49ded1e002;hp=4e23d161ed9edb26a11c287975cf06b7763bba02;hb=301cac5f6e2edcecf2e1bd89aee5182130a213fc;hpb=0f505368fa8abbc2e9ab0296b9a5e6bd4869345f diff --git a/src/apc/ir.c b/src/apc/ir.c index 4e23d16..5673d0c 100755 --- a/src/apc/ir.c +++ b/src/apc/ir.c @@ -53,12 +53,12 @@ struct odat* curr_odat(void); extern -struct variant* -curr_variant(void); +struct map* +curr_map(void); extern -struct variant* -alloc_variant(void); +struct map* +alloc_map(void); extern struct vdat* @@ -125,6 +125,45 @@ pop_cdat cdat_stackp--; } + +/* Every odat has a single map variant. We track the odats that have related map variants + by adding the name of the map to the end of the odat name. E.g. for an odat with name + A and map variants a,b,c we get A_a, A_b, A_c. We create new odats for each map variant*/ +void +insert_map +( uint8_t* name, + int height, + int width, + uint8_t* filepath +) +{ + struct odat* curr_odatp; + int curr_odat_vdatid; + + curr_odatp = curr_odat(); + + curr_odat_vdatid = curr_odatp->vdat_id; + + + + if(curr_odatp->map.name[0] != 0) //odat already has a map so make a new odat + { curr_odatp = alloc_odat(); + curr_odatp->vdat_id = curr_odat_vdatid; + } + /* Add a delimiter '_' in between odat name and map variant name */ + u8_strcat(curr_odatp->map.name, (uint8_t*) '_'); + u8_strcat(curr_odatp->map.name, name); + + u8_strcpy(curr_odatp->map.filepath, filepath); + curr_odatp->map.height = height; + curr_odatp->map.width = width; + +} + + + + + /* Called in the reduction of a set. While both odats (eles and sets) have identical label terminals, we are unable to give a single grammatical rule for both due to how we allocate odats in the odat buf. Due to the @@ -151,6 +190,7 @@ insert_set_label u8_cpy(curr_set_odatp->name, name, 32); u8_cpy(curr_setp->name, name, 32); curr_set_odatp->parent_odatp = NULL; + curr_set_odatp->map.name[0] = 0; if(ref_id != -1) { curr_set_odatp->ref_id = ref_id; @@ -244,7 +284,7 @@ insert_set struct ref* curr_refp; struct vdat* curr_vdatp; - curr_odatp = curr_set_odatp; //allocated at insert_set_label, preserved in global space + curr_odatp = curr_set_odatp; //allocated at insert_set_label curr_cdatp = curr_cdat(); curr_setp = curr_set(); prev_refp = curr_ref(); @@ -299,6 +339,7 @@ insert_ele_label curr_odatp = alloc_odat(); u8_cpy(curr_odatp->name, name, 32); + curr_odatp->map.name[0] = 0; if(ref_id != -1) curr_odatp->ref_id = ref_id; @@ -427,26 +468,6 @@ insert_vdat } -void -insert_variant -(uint8_t* filename, int height, int width, uint8_t* filepath) -{ struct variant* curr_variantp; - int x, y, pixel, num_frames, n; - int* pixel_buf; - - /* Allocate the mdat */ - curr_variantp = alloc_variant(); - - u8_strcpy(curr_variantp->filename, filename); - u8_strcpy(curr_variantp->filepath, filepath); - curr_variantp->height = height; - curr_variantp->width = width; - - //curr_mdatp->quad_list[num_quads].x/.y/.z/ref_id */ - - - curr_set_odatp->variant_list[curr_set_odatp->vli++] = curr_variantp; -} /* void */