#include #include #include #include #define CURR_ODAT (odat_buf[obi]) #define CURR_VDAT (vdat_buf[vbi]) #define CURR_CDAT (cdat_buf[cbi]) //more like the base cdat //TODO: label and vdat_id void insert_set() { CURR_CDAT.set_list[CURR_CDAT.set_index].odat_id = obi; CURR_CDAT.set_list[CURR_CDAT.set_index].parent_id = 0;//from lexer //TODO: add ele_stack is created in element_list //TODO: add set to odat_buf } #define CURR_QUAD (CURR_ODAT.ref_list[CURR_ODAT.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.objref = ref; } //Insert element into odat_buf and cdat_buf void insert_ele(char* label, int vdat_id) { memmove(CURR_ODAT.label,label,32); CURR_ODAT.vdat_id = vdat_id; //TODO: check set_obi to see if set_map_data exists //comes from e //CURR_ODAT.num_ref = //comes from its set //CURR_ODAT.ref_list = //comes from its set //CURR_ODAT.class_id = //comes from lexer? obi++; } /* fd could be a directory entry */ void insert_fdat(char* label, char direction, int fd) { memmove(CURR_VDAT.model_list[CURR_VDAT.num_models].label,label,32); CURR_VDAT.model_list[CURR_VDAT.num_models].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) { memmove(CURR_CDAT.label,label,32); } void inc_subclass_idx() { CURR_CDAT.subclass_index++; } void inc_set_index() { cdat_buf[cbi].set_index++; } void inc_ref() { CURR_ODAT.ref_index++; CURR_ODAT.num_ref++; } //TODO: This needs to be changed to account for // when the set is of a subclass. void inc_ele() { CURR_CDAT.set_list[CURR_CDAT.set_index].num_ele++; vbi++; } void inc_models() { CURR_VDAT.num_models++; }