void dump_objects(tmx_object *o, int depth) { char padding[11]; mk_padding(padding, depth); printf("\n%s" "object={", padding); if (!o) { printf(" (NULL) }"); } else { printf("\n%s\t" "name='%s'", padding, o->name); printf("\n%s\t" "shape=", padding); print_shape(o->shape); printf("\n%s\t" "x=%f", padding, o->x); printf("\n%s\t" "y=%f", padding, o->y); printf("\n%s\t" "number of points='%d'", padding, o->points_len); printf("\n%s\t" "rotation=%f", padding, o->rotation); printf("\n%s\t" "visible=%s", padding, str_bool(o->visible)); if (o->points_len) { printf("\n%s\t" "points=", padding); dump_points(o->points, o->points_len); } dump_prop(o->properties, depth+1); printf("\n%s}", padding); } if (o && o->next) { dump_objects(o->next, depth); } }
/* debug print */ void print_unplaced(unplaced_t *unit) { fprintf(stdout, "printing unit info for %s\n", unit->name); fprintf(stdout, "area=%.5f\tmin=%.5f\tmax=%.5f\trotable=%d\n", unit->area, unit->min_aspect, unit->max_aspect, unit->rotable); print_shape(unit->shape); fprintf(stdout, "\n"); }
int main(int argc, char *argv[]) { Shape* shape1 = new_shape_1d(100); Shape* shape2 = new_shape_2d(200, 200); Shape* shape3 = new_shape_3d(300, 200, 3); Shape* shape4 = new_shape_4d(200, 200, 3, 5000); dn_int data[5] = {1,2,3,4,5}; Shape* shape5 = new_shape(5, data); dn_int data_new[4] = {2,3,4,5}; Shape* shape6 = new_shape(5, data); reshape_to(shape6, 4, data_new); dn_int data_new_1[6] = {1,1,2,3,4,5}; reshape_to(shape6,6,data_new_1); PRINT_LINE; print_shape(shape1); PRINT_LINE; print_shape(shape2); PRINT_LINE; print_shape(shape3); PRINT_LINE; print_shape(shape4); PRINT_LINE; print_shape(shape5); PRINT_LINE; print_shape(shape6); PRINT_LINE; del_shape(shape1); del_shape(shape2); del_shape(shape3); del_shape(shape4); del_shape(shape5); del_shape(shape6); return 0; }
/* debug print */ void print_tree(tree_node_t *root, flp_desc_t *flp_desc) { if(root->left != NULL) print_tree(root->left, flp_desc); if (root->right != NULL) print_tree(root->right, flp_desc); if (root->label.unit >= 0) fprintf(stdout, "printing shape curve for %s\n", flp_desc->units[root->label.unit].name); else if (root->label.cut_type == CUT_VERTICAL) fprintf(stdout, "printing shape curve for VERTICAL CUT\n"); else if (root->label.cut_type == CUT_HORIZONTAL) fprintf(stdout, "printing shape curve for HORIZONTAL CUT\n"); else fprintf(stdout, "unknown cut type\n"); print_shape(root->curve); }