Index: trunk/doc-rnd/hacking/renames =================================================================== --- trunk/doc-rnd/hacking/renames (revision 5068) +++ trunk/doc-rnd/hacking/renames (revision 5069) @@ -1120,3 +1120,10 @@ PLF_MARK -> PCB_PLF_MARK VertexEqu -> pcb_vertex_equ VertexCpy -> pcb_vertex_cpy +err_no_memory -> pcb_err_no_memory +err_bad_parm -> pcb_err_bad_parm +err_ok -> pcb_err_ok +PBO_UNITE -> PCB_PBO_UNITE +PBO_ISECT -> PCB_PBO_ISECT +PBO_SUB -> PCB_PBO_SUB +PBO_XOR -> PCB_PBO_XOR Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 5068) +++ trunk/src/action_helper.c (revision 5069) @@ -1013,7 +1013,7 @@ new_hole = pcb_poly_from_poly(&pcb_crosshair.AttachedPolygon); /* Subtract the hole from the original polygon shape */ - pcb_polyarea_boolean_free(original, new_hole, &result, PBO_SUB); + pcb_polyarea_boolean_free(original, new_hole, &result, PCB_PBO_SUB); /* Convert the resulting polygon(s) into a new set of nodes * and place them on the page. Delete the original polygon. Index: trunk/src/hid_draw_helpers.c =================================================================== --- trunk/src/hid_draw_helpers.c (revision 5068) +++ trunk/src/hid_draw_helpers.c (revision 5069) @@ -85,8 +85,8 @@ pcb_poly_contour_copy(&pl_copy, pl); piece_poly = pcb_polyarea_create(); pcb_polyarea_contour_include(piece_poly, pl_copy); - x = pcb_polyarea_boolean_free(piece_poly, clip_poly, &clipped_pieces, PBO_ISECT); - if (x != err_ok || clipped_pieces == NULL) + x = pcb_polyarea_boolean_free(piece_poly, clip_poly, &clipped_pieces, PCB_PBO_ISECT); + if (x != pcb_err_ok || clipped_pieces == NULL) return; draw_piece = clipped_pieces; Index: trunk/src/obj_pinvia_therm.c =================================================================== --- trunk/src/obj_pinvia_therm.c (revision 5068) +++ trunk/src/obj_pinvia_therm.c (revision 5069) @@ -318,20 +318,20 @@ p = pcb_poly_from_octagon(pin->X, pin->Y, w, PCB_FLAG_SQUARE_GET(pin)); p2 = pcb_poly_from_octagon(pin->X, pin->Y, pin->Thickness, PCB_FLAG_SQUARE_GET(pin)); /* make full clearance ring */ - pcb_polyarea_boolean_free(p, p2, &m, PBO_SUB); + pcb_polyarea_boolean_free(p, p2, &m, PCB_PBO_SUB); switch (style) { default: case 1: p = diag_line(pin->X, pin->Y, w, t, pcb_true); - pcb_polyarea_boolean_free(m, p, &p2, PBO_SUB); + pcb_polyarea_boolean_free(m, p, &p2, PCB_PBO_SUB); p = diag_line(pin->X, pin->Y, w, t, pcb_false); - pcb_polyarea_boolean_free(p2, p, &m, PBO_SUB); + pcb_polyarea_boolean_free(p2, p, &m, PCB_PBO_SUB); return m; case 2: p = pcb_poly_from_rect(pin->X - t, pin->X + t, pin->Y - w, pin->Y + w); - pcb_polyarea_boolean_free(m, p, &p2, PBO_SUB); + pcb_polyarea_boolean_free(m, p, &p2, PCB_PBO_SUB); p = pcb_poly_from_rect(pin->X - w, pin->X + w, pin->Y - t, pin->Y + t); - pcb_polyarea_boolean_free(p2, p, &m, PBO_SUB); + pcb_polyarea_boolean_free(p2, p, &m, PCB_PBO_SUB); return m; /* fix me add thermal style 4 */ case 5: @@ -341,8 +341,8 @@ /* cheat by using the square therm's rounded parts */ p = square_therm(pin, style); q = pcb_poly_from_rect(pin->X - t, pin->X + t, pin->Y - t, pin->Y + t); - pcb_polyarea_boolean_free(p, q, &p2, PBO_UNITE); - pcb_polyarea_boolean_free(m, p2, &p, PBO_ISECT); + pcb_polyarea_boolean_free(p, q, &p2, PCB_PBO_UNITE); + pcb_polyarea_boolean_free(m, p2, &p, PCB_PBO_ISECT); return p; } } @@ -377,7 +377,7 @@ pa = pcb_poly_from_circle(pin->X, pin->Y, t); arc = pcb_poly_from_circle(pin->X, pin->Y, pin->Thickness / 2); /* create a thin ring */ - pcb_polyarea_boolean_free(pa, arc, &m, PBO_SUB); + pcb_polyarea_boolean_free(pa, arc, &m, PCB_PBO_SUB); /* fix me needs error checking */ if (style == 2) { /* t is the theoretically required length, but we use twice that @@ -384,7 +384,7 @@ * to avoid descritisation errors in our circle approximation. */ pa = pcb_poly_from_rect(pin->X - t * 2, pin->X + t * 2, pin->Y - w, pin->Y + w); - pcb_polyarea_boolean_free(m, pa, &arc, PBO_SUB); + pcb_polyarea_boolean_free(m, pa, &arc, PCB_PBO_SUB); pa = pcb_poly_from_rect(pin->X - w, pin->X + w, pin->Y - t * 2, pin->Y + t * 2); } else { @@ -392,10 +392,10 @@ * to avoid descritisation errors in our circle approximation. */ pa = diag_line(pin->X, pin->Y, t * 2, w, pcb_true); - pcb_polyarea_boolean_free(m, pa, &arc, PBO_SUB); + pcb_polyarea_boolean_free(m, pa, &arc, PCB_PBO_SUB); pa = diag_line(pin->X, pin->Y, t * 2, w, pcb_false); } - pcb_polyarea_boolean_free(arc, pa, &m, PBO_SUB); + pcb_polyarea_boolean_free(arc, pa, &m, PCB_PBO_SUB); return m; } Index: trunk/src/polyarea.h =================================================================== --- trunk/src/polyarea.h (revision 5068) +++ trunk/src/polyarea.h (revision 5069) @@ -49,9 +49,9 @@ extern pcb_vector_t vect_zero; enum { - err_no_memory = 2, - err_bad_parm = 3, - err_ok = 0 + pcb_err_no_memory = 2, + pcb_err_bad_parm = 3, + pcb_err_ok = 0 }; @@ -148,10 +148,10 @@ pcb_bool pcb_poly_valid(pcb_polyarea_t * p); enum pcb_poly_bool_op_e { - PBO_UNITE, - PBO_ISECT, - PBO_SUB, - PBO_XOR + PCB_PBO_UNITE, + PCB_PBO_ISECT, + PCB_PBO_SUB, + PCB_PBO_XOR }; double pcb_vect_dist2(pcb_vector_t v1, pcb_vector_t v2); Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 5068) +++ trunk/src/polygon.c (revision 5069) @@ -559,7 +559,7 @@ tmp1 = ArcPolyNoIntersect(&seg1, thick); tmp2 = ArcPolyNoIntersect(&seg2, thick); - pcb_polyarea_boolean_free(tmp1, tmp2, &res, PBO_UNITE); + pcb_polyarea_boolean_free(tmp1, tmp2, &res, PCB_PBO_UNITE); return res; } @@ -708,14 +708,14 @@ assert(pcb_poly_valid(p->Clipped)); assert(pcb_poly_valid(np)); if (fnp) - x = pcb_polyarea_boolean_free(p->Clipped, np, &merged, PBO_SUB); + x = pcb_polyarea_boolean_free(p->Clipped, np, &merged, PCB_PBO_SUB); else { - x = pcb_polyarea_boolean(p->Clipped, np, &merged, PBO_SUB); + x = pcb_polyarea_boolean(p->Clipped, np, &merged, PCB_PBO_SUB); pcb_polyarea_free(&p->Clipped); } assert(!merged || pcb_poly_valid(merged)); - if (x != err_ok) { - fprintf(stderr, "Error while clipping PBO_SUB: %d\n", x); + if (x != pcb_err_ok) { + fprintf(stderr, "Error while clipping PCB_PBO_SUB: %d\n", x); pcb_polyarea_free(&merged); p->Clipped = NULL; if (p->NoHoles) @@ -894,7 +894,7 @@ longjmp(info->env, 1); } - pcb_polyarea_boolean_free(info->accumulate, np, &merged, PBO_UNITE); + pcb_polyarea_boolean_free(info->accumulate, np, &merged, PCB_PBO_UNITE); info->accumulate = merged; info->batch_size++; @@ -960,7 +960,7 @@ if (!(np = pcb_poly_from_line(line, line->Thickness + line->Clearance))) longjmp(info->env, 1); - pcb_polyarea_boolean_free(info->accumulate, np, &merged, PBO_UNITE); + pcb_polyarea_boolean_free(info->accumulate, np, &merged, PCB_PBO_UNITE); info->accumulate = merged; info->batch_size++; @@ -1058,16 +1058,16 @@ orig_poly = original_poly(p); - x = pcb_polyarea_boolean_free(np, orig_poly, &clipped_np, PBO_ISECT); - if (x != err_ok) { - fprintf(stderr, "Error while clipping PBO_ISECT: %d\n", x); + x = pcb_polyarea_boolean_free(np, orig_poly, &clipped_np, PCB_PBO_ISECT); + if (x != pcb_err_ok) { + fprintf(stderr, "Error while clipping PCB_PBO_ISECT: %d\n", x); pcb_polyarea_free(&clipped_np); goto fail; } - x = pcb_polyarea_boolean_free(p->Clipped, clipped_np, &merged, PBO_UNITE); - if (x != err_ok) { - fprintf(stderr, "Error while clipping PBO_UNITE: %d\n", x); + x = pcb_polyarea_boolean_free(p->Clipped, clipped_np, &merged, PCB_PBO_UNITE); + if (x != pcb_err_ok) { + fprintf(stderr, "Error while clipping PCB_PBO_UNITE: %d\n", x); pcb_polyarea_free(&merged); goto fail; } @@ -1666,7 +1666,7 @@ /* clip to the bounding box */ if (clip) { pcb_polyarea_t *cbox = pcb_poly_from_rect(clip->X1, clip->X2, clip->Y1, clip->Y2); - pcb_polyarea_boolean_free(main_contour, cbox, &main_contour, PBO_ISECT); + pcb_polyarea_boolean_free(main_contour, cbox, &main_contour, PCB_PBO_ISECT); } if (main_contour == NULL) return; Index: trunk/src/polygon1.c =================================================================== --- trunk/src/polygon1.c (revision 5068) +++ trunk/src/polygon1.c (revision 5069) @@ -98,7 +98,7 @@ #define MemGet(ptr, type) \ if (PCB_UNLIKELY(((ptr) = (type *)malloc(sizeof(type))) == NULL)) \ - error(err_no_memory); + error(pcb_err_no_memory); #undef DEBUG_LABEL #undef DEBUG_ALL_LABELS @@ -848,7 +848,7 @@ pcb_cvc_list_t *the_list = NULL; if (a == NULL || b == NULL) - error(err_bad_parm); + error(pcb_err_bad_parm); do { do { if (a->contours->xmax >= b->contours->xmin && @@ -855,7 +855,7 @@ a->contours->ymax >= b->contours->ymin && a->contours->xmin <= b->contours->xmax && a->contours->ymin <= b->contours->ymax) { if (PCB_UNLIKELY(intersect(e, a, b, add))) - error(err_no_memory); + error(pcb_err_no_memory); } } while (add && (a = a->f) != afst); @@ -863,7 +863,7 @@ if (curcB->Flags.status == ISECTED) { the_list = add_descriptors(curcB, 'B', the_list); if (PCB_UNLIKELY(the_list == NULL)) - error(err_no_memory); + error(pcb_err_no_memory); } } while (add && (b = b->f) != bfst); @@ -872,7 +872,7 @@ if (curcA->Flags.status == ISECTED) { the_list = add_descriptors(curcA, 'A', the_list); if (PCB_UNLIKELY(the_list == NULL)) - error(err_no_memory); + error(pcb_err_no_memory); } } while (add && (a = a->f) != afst); @@ -1190,7 +1190,7 @@ if (*src == NULL) return; /* empty hole list */ if (dest == NULL) - error(err_bad_parm); /* empty contour list */ + error(pcb_err_bad_parm); /* empty contour list */ /* Count dest polyareas */ curc = dest; @@ -1231,7 +1231,7 @@ #endif #endif pcb_poly_contour_del(&curh); - error(err_bad_parm); + error(pcb_err_bad_parm); } /* Now search the heap for the container. If there was only one item * in the heap, assume it is the container without the expense of @@ -1264,7 +1264,7 @@ #endif curh->next = NULL; pcb_poly_contour_del(&curh); - error(err_bad_parm); + error(pcb_err_bad_parm); } else { /* Need to check if this new hole means we need to kick out any old ones for reprocessing */ @@ -1468,11 +1468,11 @@ if (!*result) { *result = pcb_poly_contour_new(cur->point); if (*result == NULL) - return err_no_memory; + return pcb_err_no_memory; } else { if ((newn = pcb_poly_node_create(cur->point)) == NULL) - return err_no_memory; + return pcb_err_no_memory; pcb_poly_vertex_include((*result)->head.prev, newn); } #ifdef DEBUG_GATHER @@ -1489,14 +1489,14 @@ cur = (dir == FORW ? cur->next : cur->prev); } while (1); - return err_ok; + return pcb_err_ok; } /* Gather */ static void Collect1(jmp_buf * e, pcb_vnode_t * cur, DIRECTION dir, pcb_polyarea_t ** contours, pcb_pline_t ** holes, J_Rule j_rule) { pcb_pline_t *p = NULL; /* start making contour */ - int errc = err_ok; - if ((errc = Gather(dir == FORW ? cur : cur->next, &p, j_rule, dir)) != err_ok) { + int errc = pcb_err_ok; + if ((errc = Gather(dir == FORW ? cur : cur->next, &p, j_rule, dir)) != pcb_err_ok) { if (p != NULL) pcb_poly_contour_del(&p); error(errc); @@ -1544,16 +1544,16 @@ if ((*A)->Flags.status == ISECTED) { switch (action) { - case PBO_UNITE: + case PCB_PBO_UNITE: Collect(e, *A, contours, holes, UniteS_Rule, UniteJ_Rule); break; - case PBO_ISECT: + case PCB_PBO_ISECT: Collect(e, *A, contours, holes, IsectS_Rule, IsectJ_Rule); break; - case PBO_XOR: + case PCB_PBO_XOR: Collect(e, *A, contours, holes, XorS_Rule, XorJ_Rule); break; - case PBO_SUB: + case PCB_PBO_SUB: Collect(e, *A, contours, holes, SubS_Rule, SubJ_Rule); break; }; @@ -1560,7 +1560,7 @@ } else { switch (action) { - case PBO_ISECT: + case PCB_PBO_ISECT: if ((*A)->Flags.status == INSIDE) { tmprev = *A; /* disappear this contour (rtree entry removed in PutContour) */ @@ -1570,7 +1570,7 @@ return pcb_true; } break; - case PBO_XOR: + case PCB_PBO_XOR: if ((*A)->Flags.status == INSIDE) { tmprev = *A; /* disappear this contour (rtree entry removed in PutContour) */ @@ -1581,8 +1581,8 @@ return pcb_true; } /* break; *//* Fall through (I think this is correct! pcjc2) */ - case PBO_UNITE: - case PBO_SUB: + case PCB_PBO_UNITE: + case PCB_PBO_SUB: if ((*A)->Flags.status == OUTSIDE) { tmprev = *A; /* disappear this contour (rtree entry removed in PutContour) */ @@ -1611,10 +1611,10 @@ if ((*cur)->Flags.status == INSIDE) switch (action) { - case PBO_XOR: - case PBO_SUB: + case PCB_PBO_XOR: + case PCB_PBO_SUB: pcb_poly_contour_inv(*cur); - case PBO_ISECT: + case PCB_PBO_ISECT: tmp = *cur; *cur = tmp->next; next = cur; @@ -1622,13 +1622,13 @@ tmp->Flags.status = UNKNWN; PutContour(e, tmp, contours, holes, b, NULL, NULL); break; - case PBO_UNITE: + case PCB_PBO_UNITE: break; /* nothing to do - already included */ } else if ((*cur)->Flags.status == OUTSIDE) switch (action) { - case PBO_XOR: - case PBO_UNITE: + case PCB_PBO_XOR: + case PCB_PBO_UNITE: /* include */ tmp = *cur; *cur = tmp->next; @@ -1637,8 +1637,8 @@ tmp->Flags.status = UNKNWN; PutContour(e, tmp, contours, holes, b, NULL, NULL); break; - case PBO_ISECT: - case PBO_SUB: + case PCB_PBO_ISECT: + case PCB_PBO_SUB: break; /* do nothing, not included */ } } @@ -1790,14 +1790,14 @@ return; switch (action) { - case PBO_ISECT: + case PCB_PBO_ISECT: del_outside = 1; break; - case PBO_UNITE: - case PBO_SUB: + case PCB_PBO_UNITE: + case PCB_PBO_SUB: del_inside = 1; break; - case PBO_XOR: /* NOT IMPLEMENTED OR USED */ + case PCB_PBO_XOR: /* NOT IMPLEMENTED OR USED */ /* inv_inside = 1; */ assert(0); break; @@ -2054,7 +2054,7 @@ pcb_polyarea_t *a = NULL, *b = NULL; if (!pcb_polyarea_m_copy0(&a, a_org) || !pcb_polyarea_m_copy0(&b, b_org)) - return err_no_memory; + return pcb_err_no_memory; return pcb_polyarea_boolean_free(a, b, res, action); } /* poly_Boolean */ @@ -2072,28 +2072,28 @@ if (!a) { switch (action) { - case PBO_XOR: - case PBO_UNITE: + case PCB_PBO_XOR: + case PCB_PBO_UNITE: *res = bi; - return err_ok; - case PBO_SUB: - case PBO_ISECT: + return pcb_err_ok; + case PCB_PBO_SUB: + case PCB_PBO_ISECT: if (b != NULL) pcb_polyarea_free(&b); - return err_ok; + return pcb_err_ok; } } if (!b) { switch (action) { - case PBO_SUB: - case PBO_XOR: - case PBO_UNITE: + case PCB_PBO_SUB: + case PCB_PBO_XOR: + case PCB_PBO_UNITE: *res = ai; - return err_ok; - case PBO_ISECT: + return pcb_err_ok; + case PCB_PBO_ISECT: if (a != NULL) pcb_polyarea_free(&a); - return err_ok; + return pcb_err_ok; } } @@ -2184,7 +2184,7 @@ M_pcb_polyarea_t_label(a, b, pcb_false); M_pcb_polyarea_t_label(b, a, pcb_false); - M_pcb_polyarea_t_Collect(&e, a, aandb, &holes, PBO_ISECT, pcb_false); + M_pcb_polyarea_t_Collect(&e, a, aandb, &holes, PCB_PBO_ISECT, pcb_false); InsertHoles(&e, *aandb, &holes); assert(pcb_poly_valid(*aandb)); /* delete holes if any left */ @@ -2195,7 +2195,7 @@ holes = NULL; clear_marks(a); clear_marks(b); - M_pcb_polyarea_t_Collect(&e, a, aminusb, &holes, PBO_SUB, pcb_false); + M_pcb_polyarea_t_Collect(&e, a, aminusb, &holes, PCB_PBO_SUB, pcb_false); InsertHoles(&e, *aminusb, &holes); pcb_polyarea_free(&a); pcb_polyarea_free(&b); Index: trunk/src_plugins/jostle/jostle.c =================================================================== --- trunk/src_plugins/jostle/jostle.c (revision 5068) +++ trunk/src_plugins/jostle/jostle.c (revision 5069) @@ -286,7 +286,7 @@ line = Createpcb_vector_tLineOnLayer(layer, a, b, orig->Thickness, orig->Clearance, orig->Flags); if (line && expandp) { pcb_polyarea_t *p = pcb_poly_from_line(line, line->Thickness + line->Clearance); - pcb_polyarea_boolean_free(*expandp, p, expandp, PBO_UNITE); + pcb_polyarea_boolean_free(*expandp, p, expandp, PCB_PBO_UNITE); } return line; } @@ -411,9 +411,9 @@ lp = pcb_poly_from_line(line, 1); if (!pcb_polyarea_m_copy0(©, info->brush)) return 0; - r = pcb_polyarea_boolean_free(copy, lp, &tmp, PBO_SUB); - if (r != err_ok) { - pcb_fprintf(stderr, "Error while jostling PBO_SUB: %d\n", r); + r = pcb_polyarea_boolean_free(copy, lp, &tmp, PCB_PBO_SUB); + if (r != pcb_err_ok) { + pcb_fprintf(stderr, "Error while jostling PCB_PBO_SUB: %d\n", r); return 0; } if (tmp == tmp->f) { @@ -422,9 +422,9 @@ */ pcb_fprintf(stderr, "try isect??\n"); lp = pcb_poly_from_line(line, line->Thickness); - r = pcb_polyarea_boolean_free(tmp, lp, &tmp, PBO_ISECT); - if (r != err_ok) { - fprintf(stderr, "Error while jostling PBO_ISECT: %d\n", r); + r = pcb_polyarea_boolean_free(tmp, lp, &tmp, PCB_PBO_ISECT); + if (r != pcb_err_ok) { + fprintf(stderr, "Error while jostling PCB_PBO_ISECT: %d\n", r); return 0; } nocentroid = 1; @@ -532,7 +532,7 @@ expand = NULL; MakeBypassingLines(info.smallest, info.layer, info.line, info.side, &expand); pcb_polyarea_free(&info.smallest); - pcb_polyarea_boolean_free(info.brush, expand, &info.brush, PBO_UNITE); + pcb_polyarea_boolean_free(info.brush, expand, &info.brush, PCB_PBO_UNITE); } } while (found); pcb_board_set_changed_flag(pcb_true); Index: trunk/src_plugins/polycombine/polycombine.c =================================================================== --- trunk/src_plugins/polycombine/polycombine.c (revision 5068) +++ trunk/src_plugins/polycombine/polycombine.c (revision 5069) @@ -256,7 +256,7 @@ for (cur_node = root; cur_node != NULL; cur_node = cur_node->next) { /* Process this element */ /* printf ("Processing node %ld %s\n", cur_node->polygon->ID, cur_node->forward ? "FWD" : "BWD");*/ - pcb_polyarea_boolean_free(accumulate, cur_node->polyarea, &res, cur_node->forward ? PBO_UNITE : PBO_SUB); + pcb_polyarea_boolean_free(accumulate, cur_node->polyarea, &res, cur_node->forward ? PCB_PBO_UNITE : PCB_PBO_SUB); accumulate = res; /* And its children if it has them */