void DWGimpl::output_BLOCK_HEADER(dwg_object_ref* ref) { dwg_object* obj, *variable_obj; dwg_obj_block_header* hdr; int error; unsigned long abs_ref; obj = dwg_obj_reference_get_object(ref, &error); abs_ref = dwg_obj_ref_get_abs_ref(ref, &error); if (!ref) { fprintf(stderr, "Found null object reference. Could not output an SVG symbol for this BLOCK_HEADER\n"); return; } if (!obj) { fprintf(stderr, "Found null ref->obj\n"); return; } /* TODO: Review. (This check avoids a segfault, but it is still unclear whether or not the condition is valid.) */ if (!dwg_object_to_object(obj, &error)) { fprintf(stderr, "Found null ref->obj->tio.object\n"); return; } // hdr = dwg_object_to_BLOCK_HEADER(obj); hdr = obj->tio.object->tio.BLOCK_HEADER; variable_obj = get_first_owned_object(obj, hdr); while (variable_obj) { OutputObject(variable_obj); variable_obj = get_next_owned_object(obj, variable_obj, hdr); } }
void output_BLOCK_HEADER(Dwg_Object_Ref* ref) { Dwg_Object* obj; Dwg_Object_BLOCK_HEADER* hdr; if (!ref) { fprintf(stderr, "Found null object reference. Could not output an SVG symbol for this BLOCK_HEADER\n"); return; } if (!ref->obj) { fprintf(stderr, "Found null ref->obj\n"); return; } /* TODO: Review. (This check avoids a segfault, but it is still unclear whether or not the condition is valid.) */ if (!ref->obj->tio.object) { fprintf(stderr, "Found null ref->obj->tio.object\n"); return; } hdr = ref->obj->tio.object->tio.BLOCK_HEADER; printf( "\t<g id=\"symbol-%lu\" >\n\t\t<!-- %s -->\n", ref->absolute_ref, hdr->entry_name); obj = get_first_owned_object(ref->obj, hdr); while(obj) { output_object(obj); obj = get_next_owned_object(ref->obj, obj, hdr); } printf("\t</g>\n"); }