Index: polyhelp.c =================================================================== --- polyhelp.c (revision 30902) +++ polyhelp.c (revision 30903) @@ -65,15 +65,15 @@ #if 0 /* debug helper */ -static void cross(FILE *f, pcb_coord_t x, pcb_coord_t y) +static void cross(FILE *f, rnd_coord_t x, rnd_coord_t y) { - static pcb_coord_t cs = PCB_MM_TO_COORD(0.2); + static rnd_coord_t cs = PCB_MM_TO_COORD(0.2); pcb_fprintf(f, "line %#mm %#mm %#mm %#mm\n", x - cs, y, x + cs, y); pcb_fprintf(f, "line %#mm %#mm %#mm %#mm\n", x, y - cs, x, y + cs); } #endif -pcb_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const pcb_pline_t *src, pcb_coord_t thickness, pcb_coord_t clearance, pcb_flag_t flags) +pcb_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const pcb_pline_t *src, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags) { pcb_cardinal_t cnt = 0; vtp0_t tracks; @@ -100,7 +100,7 @@ return cnt; } -pcb_bool pcb_pline_is_aligned(const pcb_pline_t *src) +rnd_bool pcb_pline_is_aligned(const pcb_pline_t *src) { const pcb_vnode_t *v, *n; @@ -115,7 +115,7 @@ } -pcb_bool pcb_cpoly_is_simple_rect(const pcb_poly_t *p) +rnd_bool pcb_cpoly_is_simple_rect(const pcb_poly_t *p) { if (p->Clipped->f != p->Clipped) return pcb_false; /* more than one islands */ @@ -145,7 +145,7 @@ return res; } -static void add_track_seg(pcb_cpoly_edgetree_t *dst, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) +static void add_track_seg(pcb_cpoly_edgetree_t *dst, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2) { pcb_cpoly_edge_t *e = &dst->edges[dst->used++]; pcb_box_t *b = &e->bbox; @@ -179,7 +179,7 @@ static void add_track(pcb_cpoly_edgetree_t *dst, pcb_pline_t *track) { int go, first = 1; - pcb_coord_t x, y, px, py; + rnd_coord_t x, y, px, py; pcb_poly_it_t it; it.cntr = track; @@ -197,7 +197,7 @@ /* collect all edge lines (contour and holes) in an rtree, calculate the bbox */ -pcb_cpoly_edgetree_t *pcb_cpoly_edgetree_create(const pcb_poly_t *src, pcb_coord_t offs) +pcb_cpoly_edgetree_t *pcb_cpoly_edgetree_create(const pcb_poly_t *src, rnd_coord_t offs) { pcb_poly_it_t it; pcb_polyarea_t *pa; @@ -240,8 +240,8 @@ typedef struct { int used; - pcb_coord_t at; - pcb_coord_t coord[1]; + rnd_coord_t at; + rnd_coord_t coord[1]; } intersect_t; static pcb_r_dir_t pcb_cploy_hatch_edge_hor(const pcb_box_t *region, void *cl) @@ -284,7 +284,7 @@ static int coord_cmp(const void *p1, const void *p2) { - const pcb_coord_t *c1 = p1, *c2 = p2; + const rnd_coord_t *c1 = p1, *c2 = p2; if (*c1 < *c2) return -1; return 1; @@ -291,7 +291,7 @@ } -void pcb_cpoly_hatch(const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, pcb_coord_t offs, pcb_coord_t period, void *ctx, void (*cb)(void *ctx, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2)) +void pcb_cpoly_hatch(const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, rnd_coord_t offs, rnd_coord_t period, void *ctx, void (*cb)(void *ctx, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2)) { pcb_cpoly_edgetree_t *etr; pcb_box_t scan; @@ -303,10 +303,10 @@ etr = pcb_cpoly_edgetree_create(src, offs); - is = malloc(sizeof(intersect_t) + sizeof(pcb_coord_t) * etr->alloced); + is = malloc(sizeof(intersect_t) + sizeof(rnd_coord_t) * etr->alloced); if (dir & PCB_CPOLY_HATCH_HORIZONTAL) { - pcb_coord_t y; + rnd_coord_t y; for(y = etr->bbox.Y1; y <= etr->bbox.Y2; y += period) { scan.X1 = -PCB_MAX_COORD; @@ -317,7 +317,7 @@ is->used = 0; is->at = y; pcb_r_search(etr->edge_tree, &scan, NULL, pcb_cploy_hatch_edge_hor, is, NULL); - qsort(is->coord, is->used, sizeof(pcb_coord_t), coord_cmp); + qsort(is->coord, is->used, sizeof(rnd_coord_t), coord_cmp); for(n = 1; n < is->used; n+=2) /* call the callback for the odd scan lines */ cb(ctx, is->coord[n-1], y, is->coord[n], y); } @@ -324,7 +324,7 @@ } if (dir & PCB_CPOLY_HATCH_VERTICAL) { - pcb_coord_t x; + rnd_coord_t x; for(x = etr->bbox.X1; x <= etr->bbox.X2; x += period) { scan.Y1 = -PCB_MAX_COORD; @@ -335,7 +335,7 @@ is->used = 0; is->at = x; pcb_r_search(etr->edge_tree, &scan, NULL, pcb_cploy_hatch_edge_ver, is, NULL); - qsort(is->coord, is->used, sizeof(pcb_coord_t), coord_cmp); + qsort(is->coord, is->used, sizeof(rnd_coord_t), coord_cmp); for(n = 1; n < is->used; n+=2) /* call the callback for the odd scan lines */ cb(ctx, x, is->coord[n-1], x, is->coord[n]); } @@ -348,17 +348,17 @@ typedef struct { pcb_layer_t *dst; - pcb_coord_t thickness, clearance; + rnd_coord_t thickness, clearance; pcb_flag_t flags; } hatch_ctx_t; -static void hatch_cb(void *ctx_, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) +static void hatch_cb(void *ctx_, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2) { hatch_ctx_t *ctx = (hatch_ctx_t *)ctx_; pcb_line_new(ctx->dst, x1, y1, x2, y2, ctx->thickness, ctx->clearance, ctx->flags); } -void pcb_cpoly_hatch_lines(pcb_layer_t *dst, const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, pcb_coord_t period, pcb_coord_t thickness, pcb_coord_t clearance, pcb_flag_t flags) +void pcb_cpoly_hatch_lines(pcb_layer_t *dst, const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, rnd_coord_t period, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags) { hatch_ctx_t ctx; @@ -371,7 +371,7 @@ pcb_cpoly_hatch(src, dir, (thickness/2)+1, period, &ctx, hatch_cb); } -static int polyhatch_gui(pcb_coord_t *period, pcb_cpoly_hatchdir_t *dir, pcb_flag_t *flg, int *want_contour) +static int polyhatch_gui(rnd_coord_t *period, pcb_cpoly_hatchdir_t *dir, pcb_flag_t *flg, int *want_contour) { int wspc, wcont, whor, wver, wclr; pcb_hid_dad_buttons_t clbtn[] = {{"Cancel", -1}, {"ok", 0}, {NULL, 0}}; @@ -436,7 +436,7 @@ static fgw_error_t pcb_act_PolyHatch(fgw_arg_t *res, int argc, fgw_arg_t *argv) { const char *op, *arg = NULL; - pcb_coord_t period = 0; + rnd_coord_t period = 0; pcb_cpoly_hatchdir_t dir = 0; pcb_flag_t flg; int want_contour = 0, want_poly = 0, cont_specd = 0; @@ -452,10 +452,10 @@ } else { if (op != NULL) { - pcb_bool succ; + rnd_bool succ; period = pcb_get_value(op, NULL, NULL, &succ); if (!succ) { - pcb_message(PCB_MSG_ERROR, "Invalid spacing value - must be a coordinate\n"); + rnd_message(PCB_MSG_ERROR, "Invalid spacing value - must be a coordinate\n"); return -1; } } @@ -508,7 +508,7 @@ static const char pcb_acth_PolyOffs[] = "replicate the outer contour of the selected polygon(s) with growing or shrinking them by offset; the new polygon is drawn on the current layer"; static fgw_error_t pcb_act_PolyOffs(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - pcb_coord_t offs; + rnd_coord_t offs; RND_PCB_ACT_CONVARG(1, FGW_COORD, PolyOffs, offs = fgw_coord(&argv[1])); Index: polyhelp.h =================================================================== --- polyhelp.h (revision 30902) +++ polyhelp.h (revision 30903) @@ -32,20 +32,20 @@ /* Add lines on dst tracing pline from the inner side (no line will extend outside of the original pline, except when the original polygon has a hair narrower than thickness). Returns number of lines created */ -pcb_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const pcb_pline_t *src, pcb_coord_t thickness, pcb_coord_t clearance, pcb_flag_t flags); +pcb_cardinal_t pcb_pline_to_lines(pcb_layer_t *dst, const pcb_pline_t *src, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags); /* Returns whether the clipped polygon is a simple rectangle (single island, no-hole rectangle). */ -pcb_bool pcb_cpoly_is_simple_rect(const pcb_poly_t *p); +rnd_bool pcb_cpoly_is_simple_rect(const pcb_poly_t *p); /* Returns whether all edges of a pline are axis aligned */ -pcb_bool pcb_pline_is_aligned(const pcb_pline_t *src); +rnd_bool pcb_pline_is_aligned(const pcb_pline_t *src); /*** Generate an rtree of all edges if a polygon */ typedef struct { pcb_box_t bbox; - pcb_coord_t x1, y1, x2, y2; + rnd_coord_t x1, y1, x2, y2; } pcb_cpoly_edge_t; typedef struct { @@ -55,7 +55,7 @@ pcb_cpoly_edge_t edges[1]; } pcb_cpoly_edgetree_t; -pcb_cpoly_edgetree_t *pcb_cpoly_edgetree_create(const pcb_poly_t *src, pcb_coord_t offs); +pcb_cpoly_edgetree_t *pcb_cpoly_edgetree_create(const pcb_poly_t *src, rnd_coord_t offs); void pcb_cpoly_edgetree_destroy(pcb_cpoly_edgetree_t *etr); @@ -69,8 +69,8 @@ /* hatch a polygon with horizontal and/or vertical lines drawn on dst, one line per period */ -void pcb_cpoly_hatch_lines(pcb_layer_t *dst, const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, pcb_coord_t period, pcb_coord_t thickness, pcb_coord_t clearance, pcb_flag_t flags); +void pcb_cpoly_hatch_lines(pcb_layer_t *dst, const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, rnd_coord_t period, rnd_coord_t thickness, rnd_coord_t clearance, pcb_flag_t flags); /* Generic hor-ver hatch with a callback */ -void pcb_cpoly_hatch(const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, pcb_coord_t offs, pcb_coord_t period, void *ctx, void (*cb)(void *ctx, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2)); +void pcb_cpoly_hatch(const pcb_poly_t *src, pcb_cpoly_hatchdir_t dir, rnd_coord_t offs, rnd_coord_t period, void *ctx, void (*cb)(void *ctx, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2)); Index: topoly.c =================================================================== --- topoly.c (revision 30902) +++ topoly.c (revision 30903) @@ -54,13 +54,13 @@ vtp0_t *list; vti0_t *endlist; pcb_any_obj_t *curr, *result; - pcb_coord_t tx, ty; + rnd_coord_t tx, ty; pcb_dynf_t mark; } next_conn_t; static pcb_r_dir_t next_conn_found_arc(const pcb_box_t *box, void *cl) { - pcb_coord_t ex, ey; + rnd_coord_t ex, ey; next_conn_t *ctx = cl; pcb_any_obj_t *obj = (pcb_any_obj_t *)box; int n; @@ -115,7 +115,7 @@ pcb_line_t *l; int n; next_conn_t ctx; - pcb_coord_t cx[2], cy[2]; + rnd_coord_t cx[2], cy[2]; /* determine the endpoints of the current object */ switch(curr->type) { @@ -151,7 +151,7 @@ pcb_r_search(curr->parent.layer->arc_tree, ®ion, NULL, next_conn_found_arc, &ctx, &len); if (len > 1) { - pcb_message(PCB_MSG_ERROR, "map_contour(): contour is not a clean loop: it contains at least one stub or subloop\n"); + rnd_message(PCB_MSG_ERROR, "map_contour(): contour is not a clean loop: it contains at least one stub or subloop\n"); return NULL; } if (ctx.result != NULL) @@ -159,7 +159,7 @@ pcb_r_search(curr->parent.layer->line_tree, ®ion, NULL, next_conn_found_line, &ctx, &len); if (len > 1) { - pcb_message(PCB_MSG_ERROR, "map_contour(): contour is not a clean loop: it contains at least one stub or subloop\n"); + rnd_message(PCB_MSG_ERROR, "map_contour(): contour is not a clean loop: it contains at least one stub or subloop\n"); return NULL; } if (ctx.result != NULL) @@ -194,7 +194,7 @@ return 0; } -static int contour2poly_cb(void *uctx, pcb_coord_t x, pcb_coord_t y) +static int contour2poly_cb(void *uctx, rnd_coord_t x, rnd_coord_t y) { pcb_poly_t *poly = uctx; pcb_poly_point_new(poly, x, y); @@ -253,7 +253,7 @@ pcb_poly_t *poly; if (!VALID_TYPE(start)) { - pcb_message(PCB_MSG_ERROR, "pcb_topoly_conn(): starting object is not a line or arc\n"); + rnd_message(PCB_MSG_ERROR, "pcb_topoly_conn(): starting object is not a line or arc\n"); return NULL; } @@ -261,7 +261,7 @@ vti0_init(&ends); res = map_contour(pcb->Data, &objs, &ends, start); if (res != 0) { - pcb_message(PCB_MSG_ERROR, "pcb_topoly_conn(): failed to find a closed loop of lines and arcs\n"); + rnd_message(PCB_MSG_ERROR, "pcb_topoly_conn(): failed to find a closed loop of lines and arcs\n"); vtp0_uninit(&objs); vti0_uninit(&ends); return NULL; @@ -288,7 +288,7 @@ pcb_layer_id_t lid; pcb_layer_t *layer; pcb_any_obj_t *best = NULL; - pcb_coord_t x, y; + rnd_coord_t x, y; double bestd = (double)pcb->hidlib.size_y*(double)pcb->hidlib.size_y + (double)pcb->hidlib.size_x*(double)pcb->hidlib.size_x; for(lid = 0; lid < pcb->Data->LayerN; lid++) { @@ -345,10 +345,10 @@ rnd_PCB_ACT_MAY_CONVARG(1, FGW_STR, topoly, op = argv[1].val.str); if (op == NULL) { - pcb_coord_t x, y; + rnd_coord_t x, y; rnd_hid_get_coords("Click on a line or arc of the contour loop", &x, &y, 0); if (pcb_search_screen(x, y, CONT_TYPE, &r1, &r2, &r3) == 0) { - pcb_message(PCB_MSG_ERROR, "ToPoly(): failed to find a line or arc there\n"); + rnd_message(PCB_MSG_ERROR, "ToPoly(): failed to find a line or arc there\n"); RND_ACT_IRES(1); return 0; } @@ -360,7 +360,7 @@ return 0; } else { - pcb_message(PCB_MSG_ERROR, "Invalid first argument\n"); + rnd_message(PCB_MSG_ERROR, "Invalid first argument\n"); RND_ACT_IRES(1); return 0; }