#include #include //#define CURR_ODAT (OB[obi]) //#define CURR_VDAT (VB[vbi]) //#define CURR_CDAT (CB[cbi]) //TODO: label and vdat_id void insert_set() { cdat_buf[cbi].set_list[set_index].odat_id = obi; cdat_buf[cbi].set_list[set_index].parent_id =//from lexer //TODO: add ele_stack is created in element_list //TODO: add set to odat_buf } #define CURR_QUAD (odat_buf[obi].ref_list[ref_index]) void insert_ref(int x, int y, int z, int ref) { CURR_QUAD.x = x; CURR_QUAD.y = y; CURR_QUAD.z = z; CURR_QUAD.ref = ref; } //Insert element into odat_buf and cdat_buf void insert_ele(char* label, int vdat_id) { odat_buf[obi].label = label; odat_buf[obi].vdat_id = vdat_id; //TODO: check set_obi to see if set_map_data exists //comes from e odat_buf[obi].num_ref = odat_buf[set_obi].num_ref; odat_buf[obi].ref_list = odat_buf[set_obi].ref_list; odat_buf[obi].class_id = cbi; if(IS_SUBCLASS()) { cdat_buf[cbi].subclass_list[subclass_index].set_list[set_index].ele_list[ele_index].odat_id = obi; cdat_buf[cbi].subclass_list[subclass_index].set_list[set_index].ele_list[ele_index].parent_id = cdat_buf[cbi].subclass_list[subclass_index].set_index; } else { cdat_buf[cbi].set_list[set_index].ele_list[ele_index].odat_id = obi; cdat_buf[cbi].set_list[set_index].ele_list[ele_index].parent_id = cdat_buf[cbi].set_index; } obi++; } /* fd could be a directory entry */ int insert_fdat(char* label, char direction, int fd) { vdat_buf[vbi].model_list[vdat_buf[vbi].len].label = label; vdat_buf[vbi].model_list[vdat_buf[vbi].len].fdat_id[(int)direction] = fd; } void condense() { FILE* vp, op, cp; int v, m; int num_models; vp = fopen("vdat_output", w+); if(!vp) perror("vdat_output failed to open\n"); op = fopen("odat_output", w+); if(!op) perror("odat_output failed to open\n"); cp = fopen("cdat_output", w+); if(!cp) perror("cdat_output failed to open\n"); /* fwrite vdat */ for(v = 0; v <= vbi; v++) { num_models = vdat_buf[v].num_models; //data duplication for caching for(m = 0; m <= num_models; m++) { } } /* fwrite odat */ /* Convert ref_list to actual offset */ /* fwrite cdat */ } void inc_cbi() { cbi++; } void set_class_label(char* label) { cdat_buf[cbi].label = $1; } void inc_subclass_idx() { cdat_buf[cbi].subclass_index++; } void inc_set_index() { odat_buf[cbi].set_index++; } void inc_ref() { odat_buf[obi].ref_index++; odat_buf[obi].num_ref++; } //TODO: This needs to be changed to account for // when the set is of a subclass. void inc_ele() { cdat_buf[cbi].set_stack[stack_index].num_ele++; } void inc_models() { vdat_buf[vbi].num_models++; }