Index: trunk/src/create.c =================================================================== --- trunk/src/create.c (revision 2420) +++ trunk/src/create.c (revision 2421) @@ -274,7 +274,7 @@ jmp_buf env; }; -static int line_callback(const BoxType * b, void *cl) +static r_dir_t line_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct line_info *i = (struct line_info *) cl; @@ -337,7 +337,7 @@ } } } - return 0; + return R_DIR_NOT_FOUND; } Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 2420) +++ trunk/src/crosshair.c (revision 2421) @@ -719,7 +719,7 @@ Coord Y; }; -static int onpoint_line_callback(const BoxType * box, void *cl) +static r_dir_t onpoint_line_callback(const BoxType * box, void *cl) { struct onpoint_search_info *info = (struct onpoint_search_info *) cl; CrosshairType *crosshair = info->crosshair; @@ -736,16 +736,16 @@ vtop_append(&crosshair->onpoint_objs, op); SET_FLAG(ONPOINTFLAG, (AnyObjectType *) line); DrawLine(NULL, line); - return 1; + return R_DIR_FOUND_CONTINUE; } else { - return 0; + return R_DIR_NOT_FOUND; } } #define close_enough(v1, v2) (coord_abs((v1)-(v2)) < 10) -static int onpoint_arc_callback(const BoxType * box, void *cl) +static r_dir_t onpoint_arc_callback(const BoxType * box, void *cl) { struct onpoint_search_info *info = (struct onpoint_search_info *) cl; CrosshairType *crosshair = info->crosshair; @@ -766,10 +766,10 @@ vtop_append(&crosshair->onpoint_objs, op); SET_FLAG(ONPOINTFLAG, (AnyObjectType *) arc); DrawArc(NULL, arc); - return 1; + return R_DIR_FOUND_CONTINUE; } else { - return 0; + return R_DIR_NOT_FOUND; } } Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 2420) +++ trunk/src/draw.c (revision 2421) @@ -243,10 +243,10 @@ _draw_pv(pin, draw_hole); } -static int pin_callback(const BoxType * b, void *cl) +static r_dir_t pin_callback(const BoxType * b, void *cl) { draw_pin((PinType *) b, false); - return 1; + return R_DIR_FOUND_CONTINUE; } static void draw_via(PinTypePtr via, bool draw_hole) @@ -255,10 +255,10 @@ _draw_pv(via, draw_hole); } -static int via_callback(const BoxType * b, void *cl) +static r_dir_t via_callback(const BoxType * b, void *cl) { draw_via((PinType *) b, false); - return 1; + return R_DIR_FOUND_CONTINUE; } static void draw_pad_name(PadType * pad) @@ -355,7 +355,7 @@ draw_pad_name(pad); } -static int pad_callback(const BoxType * b, void *cl) +static r_dir_t pad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; int *side = cl; @@ -362,7 +362,7 @@ if (ON_SIDE(pad, *side)) draw_pad(pad); - return 1; + return R_DIR_FOUND_CONTINUE; } static void draw_element_name(ElementType * element) @@ -387,7 +387,7 @@ } -static int name_callback(const BoxType * b, void *cl) +static r_dir_t name_callback(const BoxType * b, void *cl) { TextTypePtr text = (TextTypePtr) b; ElementTypePtr element = (ElementTypePtr) text->Element; @@ -394,11 +394,11 @@ int *side = cl; if (TEST_FLAG(HIDENAMEFLAG, element)) - return 0; + return R_DIR_NOT_FOUND; if (ON_SIDE(element, *side)) draw_element_name(element); - return 0; + return R_DIR_NOT_FOUND; } static void draw_element_pins_and_pads(ElementType * element) @@ -416,15 +416,15 @@ END_LOOP; } -static int EMark_callback(const BoxType * b, void *cl) +static r_dir_t EMark_callback(const BoxType * b, void *cl) { ElementTypePtr element = (ElementTypePtr) b; DrawEMark(element, element->MarkX, element->MarkY, !FRONT(element)); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int hole_callback(const BoxType * b, void *cl) +static r_dir_t hole_callback(const BoxType * b, void *cl) { PinTypePtr pv = (PinTypePtr) b; int plated = cl ? *(int *) cl : -1; @@ -432,7 +432,7 @@ char buf[sizeof("#XXXXXX")]; if ((plated == 0 && !TEST_FLAG(HOLEFLAG, pv)) || (plated == 1 && TEST_FLAG(HOLEFLAG, pv))) - return 1; + return R_DIR_FOUND_CONTINUE; if (conf_core.editor.thin_draw) { if (!TEST_FLAG(HOLEFLAG, pv)) { @@ -463,7 +463,7 @@ gui->set_line_width(Output.fgGC, 0); gui->draw_arc(Output.fgGC, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); } - return 1; + return R_DIR_FOUND_CONTINUE; } static void DrawHoles(bool draw_plated, bool draw_unplated, const BoxType * drawn_area) @@ -516,13 +516,13 @@ _draw_line(line); } -static int line_callback(const BoxType * b, void *cl) +static r_dir_t line_callback(const BoxType * b, void *cl) { draw_line((LayerType *) cl, (LineType *) b); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int rat_callback(const BoxType * b, void *cl) +static r_dir_t rat_callback(const BoxType * b, void *cl) { RatType *rat = (RatType *) b; @@ -549,7 +549,7 @@ } else _draw_line((LineType *) rat); - return 1; + return R_DIR_FOUND_CONTINUE; } static void _draw_arc(ArcType * arc) @@ -591,10 +591,10 @@ _draw_arc(arc); } -static int arc_callback(const BoxType * b, void *cl) +static r_dir_t arc_callback(const BoxType * b, void *cl) { draw_arc((LayerTypePtr) cl, (ArcTypePtr) b); - return 1; + return R_DIR_FOUND_CONTINUE; } static void draw_element_package(ElementType * element) @@ -622,7 +622,7 @@ END_LOOP; } -static int element_callback(const BoxType * b, void *cl) +static r_dir_t element_callback(const BoxType * b, void *cl) { ElementTypePtr element = (ElementTypePtr) b; int *side = cl; @@ -629,7 +629,7 @@ if (ON_SIDE(element, *side)) draw_element_package(element); - return 1; + return R_DIR_FOUND_CONTINUE; } /* --------------------------------------------------------------------------- @@ -858,7 +858,7 @@ r_search(PCB->Data->pin_tree, drawn_area, NULL, hole_callback, NULL); } -static int clearPin_callback(const BoxType * b, void *cl) +static r_dir_t clearPin_callback(const BoxType * b, void *cl) { PinType *pin = (PinTypePtr) b; if (conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly) @@ -865,7 +865,7 @@ gui->thindraw_pcb_pv(Output.pmGC, Output.pmGC, pin, false, true); else gui->fill_pcb_pv(Output.pmGC, Output.pmGC, pin, false, true); - return 1; + return R_DIR_FOUND_CONTINUE; } struct poly_info { @@ -873,7 +873,7 @@ LayerType *layer; }; -static int poly_callback(const BoxType * b, void *cl) +static r_dir_t poly_callback(const BoxType * b, void *cl) { struct poly_info *i = cl; PolygonType *polygon = (PolygonType *) b; @@ -881,7 +881,7 @@ char buf[sizeof("#XXXXXX")]; if (!polygon->Clipped) - return 0; + return R_DIR_NOT_FOUND; if (TEST_FLAG(WARNFLAG, polygon)) color = PCB->WarnColor; @@ -911,16 +911,16 @@ gui->thindraw_pcb_polygon(Output.fgGC, &poly, i->drawn_area); } - return 1; + return R_DIR_FOUND_CONTINUE; } -static int clearPad_callback(const BoxType * b, void *cl) +static r_dir_t clearPad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; int *side = cl; if (ON_SIDE(pad, *side) && pad->Mask) _draw_pad(Output.pmGC, pad, true, true); - return 1; + return R_DIR_FOUND_CONTINUE; } /* --------------------------------------------------------------------------- @@ -1037,7 +1037,7 @@ gui->use_mask(HID_MASK_OFF); } -static int text_callback(const BoxType * b, void *cl) +static r_dir_t text_callback(const BoxType * b, void *cl) { LayerType *layer = cl; TextType *text = (TextType *) b; @@ -1052,7 +1052,7 @@ else min_silk_line = PCB->minWid; DrawTextLowLevel(text, min_silk_line); - return 1; + return R_DIR_FOUND_CONTINUE; } void DrawLayer(LayerTypePtr Layer, const BoxType * screen) Index: trunk/src/find_drc.c =================================================================== --- trunk/src/find_drc.c (revision 2420) +++ trunk/src/find_drc.c (revision 2421) @@ -214,8 +214,7 @@ } /* DRC clearance callback */ - -static int drc_callback(DataTypePtr data, LayerTypePtr layer, PolygonTypePtr polygon, int type, void *ptr1, void *ptr2) +static r_dir_t drc_callback(DataTypePtr data, LayerTypePtr layer, PolygonTypePtr polygon, int type, void *ptr1, void *ptr2) { char *message; Coord x, y; @@ -278,7 +277,7 @@ default: Message("hace: Bad Plow object in callback\n"); } - return 0; + return R_DIR_NOT_FOUND; doIsBad: AddObjectToFlagUndoList(POLYGON_TYPE, layer, polygon, polygon); @@ -298,11 +297,11 @@ free(object_type_list); if (!throw_drc_dialog()) { IsBad = true; - return 1; + return R_DIR_FOUND_CONTINUE; } IncrementUndoSerialNumber(); Undo(true); - return 0; + return R_DIR_NOT_FOUND; } Index: trunk/src/find_lookup.c =================================================================== --- trunk/src/find_lookup.c (revision 2420) +++ trunk/src/find_lookup.c (revision 2421) @@ -274,7 +274,7 @@ jmp_buf env; }; -static int LOCtoPVline_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPVline_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct pv_info *i = (struct pv_info *) cl; @@ -283,10 +283,10 @@ if (ADD_LINE_TO_LIST(i->layer, line, PIN_TYPE, &i->pv, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPVarc_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPVarc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct pv_info *i = (struct pv_info *) cl; @@ -295,10 +295,10 @@ if (ADD_ARC_TO_LIST(i->layer, arc, PIN_TYPE, &i->pv, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPVpad_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPVpad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct pv_info *i = (struct pv_info *) cl; @@ -307,10 +307,10 @@ !TEST_FLAG(HOLEFLAG, &i->pv) && ADD_PAD_TO_LIST(TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER, pad, PIN_TYPE, &i->pv, FCT_COPPER)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPVrat_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPVrat_callback(const BoxType * b, void *cl) { RatTypePtr rat = (RatTypePtr) b; struct pv_info *i = (struct pv_info *) cl; @@ -317,10 +317,10 @@ if (!TEST_FLAG(TheFlag, rat) && IS_PV_ON_RAT(&i->pv, rat) && ADD_RAT_TO_LIST(rat, PIN_TYPE, &i->pv, FCT_RAT)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPVpoly_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPVpoly_callback(const BoxType * b, void *cl) { PolygonTypePtr polygon = (PolygonTypePtr) b; struct pv_info *i = (struct pv_info *) cl; @@ -354,7 +354,7 @@ && ADD_POLYGON_TO_LIST(i->layer, polygon, PIN_TYPE, &i->pv, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -511,7 +511,7 @@ return (false); } -static int pv_pv_callback(const BoxType * b, void *cl) +static r_dir_t pv_pv_callback(const BoxType * b, void *cl) { PinTypePtr pin = (PinTypePtr) b; struct pv_info *i = (struct pv_info *) cl; @@ -528,7 +528,7 @@ else if (ADD_PV_TO_LIST(pin, PIN_TYPE, &i->pv, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -590,7 +590,7 @@ jmp_buf env; }; -static int pv_line_callback(const BoxType * b, void *cl) +static r_dir_t pv_line_callback(const BoxType * b, void *cl) { PinTypePtr pv = (PinTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -604,10 +604,10 @@ else if (ADD_PV_TO_LIST(pv, LINE_TYPE, &i->line, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int pv_pad_callback(const BoxType * b, void *cl) +static r_dir_t pv_pad_callback(const BoxType * b, void *cl) { PinTypePtr pv = (PinTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -621,10 +621,10 @@ else if (ADD_PV_TO_LIST(pv, PAD_TYPE, &i->pad, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int pv_arc_callback(const BoxType * b, void *cl) +static r_dir_t pv_arc_callback(const BoxType * b, void *cl) { PinTypePtr pv = (PinTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -638,10 +638,10 @@ else if (ADD_PV_TO_LIST(pv, ARC_TYPE, &i->arc, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int pv_poly_callback(const BoxType * b, void *cl) +static r_dir_t pv_poly_callback(const BoxType * b, void *cl) { PinTypePtr pv = (PinTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -670,10 +670,10 @@ longjmp(i->env, 1); } } - return 0; + return R_DIR_NOT_FOUND; } -static int pv_rat_callback(const BoxType * b, void *cl) +static r_dir_t pv_rat_callback(const BoxType * b, void *cl) { PinTypePtr pv = (PinTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -681,7 +681,7 @@ /* rats can't cause DRC so there is no early exit */ if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_RAT(pv, &i->rat)) ADD_PV_TO_LIST(pv, RATLINE_TYPE, &i->rat, FCT_RAT); - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -797,7 +797,7 @@ return (false); } -int pv_touch_callback(const BoxType * b, void *cl) +r_dir_t pv_touch_callback(const BoxType * b, void *cl) { PinTypePtr pin = (PinTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -804,10 +804,10 @@ if (!TEST_FLAG(TheFlag, pin) && PinLineIntersect(pin, &i->line)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoArcLine_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoArcLine_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -816,10 +816,10 @@ if (ADD_LINE_TO_LIST(i->layer, line, ARC_TYPE, &i->arc, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoArcArc_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoArcArc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -830,10 +830,10 @@ if (ADD_ARC_TO_LIST(i->layer, arc, ARC_TYPE, &i->arc, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoArcPad_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoArcPad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -841,7 +841,7 @@ if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) && ArcPadIntersect(&i->arc, pad) && ADD_PAD_TO_LIST(i->layer, pad, ARC_TYPE, &i->arc, FCT_COPPER)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -899,7 +899,7 @@ return (false); } -static int LOCtoLineLine_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoLineLine_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -908,10 +908,10 @@ if (ADD_LINE_TO_LIST(i->layer, line, LINE_TYPE, &i->line, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoLineArc_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoLineArc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -922,10 +922,10 @@ if (ADD_ARC_TO_LIST(i->layer, arc, LINE_TYPE, &i->line, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoLineRat_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoLineRat_callback(const BoxType * b, void *cl) { RatTypePtr rat = (RatTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -942,10 +942,10 @@ longjmp(i->env, 1); } } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoLinePad_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoLinePad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -953,7 +953,7 @@ if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) && LinePadIntersect(&i->line, pad) && ADD_PAD_TO_LIST(i->layer, pad, LINE_TYPE, &i->line, FCT_COPPER)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -1027,7 +1027,7 @@ jmp_buf env; }; -static int LOCtoRat_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoRat_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct rat_info *i = (struct rat_info *) cl; @@ -1038,10 +1038,10 @@ if (ADD_LINE_TO_LIST(i->layer, line, RATLINE_TYPE, &i->Point, FCT_RAT)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int PolygonToRat_callback(const BoxType * b, void *cl) +static r_dir_t PolygonToRat_callback(const BoxType * b, void *cl) { PolygonTypePtr polygon = (PolygonTypePtr) b; struct rat_info *i = (struct rat_info *) cl; @@ -1052,10 +1052,10 @@ if (ADD_POLYGON_TO_LIST(i->layer, polygon, RATLINE_TYPE, &i->Point, FCT_RAT)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPad_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct rat_info *i = (struct rat_info *) cl; @@ -1068,7 +1068,7 @@ (pad->Point1.Y + pad->Point2.Y) / 2 == i->Point->Y)) && ADD_PAD_TO_LIST(i->layer, pad, RATLINE_TYPE, &i->Point, FCT_RAT)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -1115,7 +1115,7 @@ return (false); } -static int LOCtoPadLine_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPadLine_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1124,10 +1124,10 @@ if (ADD_LINE_TO_LIST(i->layer, line, PAD_TYPE, &i->pad, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPadArc_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPadArc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1138,10 +1138,10 @@ if (ADD_ARC_TO_LIST(i->layer, arc, PAD_TYPE, &i->pad, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPadPoly_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPadPoly_callback(const BoxType * b, void *cl) { PolygonTypePtr polygon = (PolygonTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1151,10 +1151,10 @@ if (IsPadInPolygon(&i->pad, polygon) && ADD_POLYGON_TO_LIST(i->layer, polygon, PAD_TYPE, &i->pad, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPadRat_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPadRat_callback(const BoxType * b, void *cl) { RatTypePtr rat = (RatTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1177,10 +1177,10 @@ longjmp(i->env, 1); } } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPadPad_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPadPad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1188,7 +1188,7 @@ if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(ONSOLDERFLAG, pad) ? SOLDER_LAYER : COMPONENT_LAYER) && PadPadIntersect(pad, &i->pad) && ADD_PAD_TO_LIST(i->layer, pad, PAD_TYPE, &i->pad, FCT_COPPER)) longjmp(i->env, 1); - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -1291,7 +1291,7 @@ return retv; } -static int LOCtoPolyLine_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPolyLine_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1300,10 +1300,10 @@ if (ADD_LINE_TO_LIST(i->layer, line, POLYGON_TYPE, &i->polygon, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPolyArc_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPolyArc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1317,7 +1317,7 @@ return 0; } -static int LOCtoPolyPad_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPolyPad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1327,10 +1327,10 @@ if (ADD_PAD_TO_LIST(i->layer, pad, POLYGON_TYPE, &i->polygon, FCT_COPPER)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } -static int LOCtoPolyRat_callback(const BoxType * b, void *cl) +static r_dir_t LOCtoPolyRat_callback(const BoxType * b, void *cl) { RatTypePtr rat = (RatTypePtr) b; struct lo_info *i = (struct lo_info *) cl; @@ -1344,7 +1344,7 @@ if (ADD_RAT_TO_LIST(rat, POLYGON_TYPE, &i->polygon, FCT_RAT)) longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } Index: trunk/src/line.c =================================================================== --- trunk/src/line.c (revision 2420) +++ trunk/src/line.c (revision 2421) @@ -206,7 +206,7 @@ jmp_buf env; }; -static int drcVia_callback(const BoxType * b, void *cl) +static r_dir_t drcVia_callback(const BoxType * b, void *cl) { PinTypePtr via = (PinTypePtr) b; struct drc_info *i = (struct drc_info *) cl; @@ -213,10 +213,10 @@ if (!TEST_FLAG(FOUNDFLAG, via) && PinLineIntersect(via, i->line)) longjmp(i->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int drcPad_callback(const BoxType * b, void *cl) +static r_dir_t drcPad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct drc_info *i = (struct drc_info *) cl; @@ -223,10 +223,10 @@ if (TEST_FLAG(ONSOLDERFLAG, pad) == i->solder && !TEST_FLAG(FOUNDFLAG, pad) && LinePadIntersect(i->line, pad)) longjmp(i->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int drcLine_callback(const BoxType * b, void *cl) +static r_dir_t drcLine_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct drc_info *i = (struct drc_info *) cl; @@ -233,10 +233,10 @@ if (!TEST_FLAG(FOUNDFLAG, line) && LineLineIntersect(line, i->line)) longjmp(i->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int drcArc_callback(const BoxType * b, void *cl) +static r_dir_t drcArc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct drc_info *i = (struct drc_info *) cl; @@ -243,7 +243,7 @@ if (!TEST_FLAG(FOUNDFLAG, arc) && LineArcIntersect(i->line, arc)) longjmp(i->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } /* drc_lines() checks for intersectors against two lines and Index: trunk/src/misc.c =================================================================== --- trunk/src/misc.c (revision 2420) +++ trunk/src/misc.c (revision 2421) @@ -531,7 +531,7 @@ int nunplated; } HoleCountStruct; -static int hole_counting_callback(const BoxType * b, void *cl) +static r_dir_t hole_counting_callback(const BoxType * b, void *cl) { PinTypePtr pin = (PinTypePtr) b; HoleCountStruct *hcs = (HoleCountStruct *) cl; @@ -539,7 +539,7 @@ hcs->nunplated++; else hcs->nplated++; - return 1; + return R_DIR_FOUND_CONTINUE; } /* --------------------------------------------------------------------------- Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 2420) +++ trunk/src/move.c (revision 2421) @@ -489,7 +489,7 @@ jmp_buf env; }; -static int moveline_callback(const BoxType * b, void *cl) +static r_dir_t moveline_callback(const BoxType * b, void *cl) { struct via_info *i = (struct via_info *) cl; PinTypePtr via; @@ -634,12 +634,12 @@ PolygonTypePtr polygon; } mptlc; -int mptl_pin_callback(const BoxType * b, void *cl) +r_dir_t mptl_pin_callback(const BoxType * b, void *cl) { struct mptlc *d = (struct mptlc *) cl; PinTypePtr pin = (PinTypePtr) b; if (!TEST_THERM(d->snum, pin) || !IsPointInPolygon(pin->X, pin->Y, pin->Thickness + pin->Clearance + 2, d->polygon)) - return 0; + return R_DIR_NOT_FOUND; if (d->type == PIN_TYPE) AddObjectToFlagUndoList(PIN_TYPE, pin->Element, pin, pin); else @@ -646,7 +646,7 @@ AddObjectToFlagUndoList(VIA_TYPE, pin, pin, pin); ASSIGN_THERM(d->dnum, GET_THERM(d->snum, pin), pin); CLEAR_THERM(d->snum, pin); - return 1; + return R_DIR_FOUND_CONTINUE; } /* --------------------------------------------------------------------------- Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 2420) +++ trunk/src/polygon.c (revision 2421) @@ -867,7 +867,7 @@ info->batch_size = 0; } -static int pin_sub_callback(const BoxType * b, void *cl) +static r_dir_t pin_sub_callback(const BoxType * b, void *cl) { PinTypePtr pin = (PinTypePtr) b; struct cpInfo *info = (struct cpInfo *) cl; @@ -878,16 +878,16 @@ /* don't subtract the object that was put back! */ if (b == info->other) - return 0; + return R_DIR_NOT_FOUND; polygon = info->polygon; if (pin->Clearance == 0) - return 0; + return R_DIR_NOT_FOUND; i = GetLayerNumber(info->data, info->layer); if (TEST_THERM(i, pin)) { np = ThermPoly((PCBTypePtr) (info->data->pcb), pin, i); if (!np) - return 1; + return R_DIR_FOUND_CONTINUE; } else { np = PinPoly(pin, PIN_SIZE(pin), pin->Clearance); @@ -903,10 +903,10 @@ if (info->batch_size == SUBTRACT_PIN_VIA_BATCH_SIZE) subtract_accumulated(info, polygon); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int arc_sub_callback(const BoxType * b, void *cl) +static r_dir_t arc_sub_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; struct cpInfo *info = (struct cpInfo *) cl; @@ -914,16 +914,16 @@ /* don't subtract the object that was put back! */ if (b == info->other) - return 0; + return R_DIR_NOT_FOUND; if (!TEST_FLAG(CLEARLINEFLAG, arc)) - return 0; + return R_DIR_NOT_FOUND; polygon = info->polygon; if (SubtractArc(arc, polygon) < 0) longjmp(info->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int pad_sub_callback(const BoxType * b, void *cl) +static r_dir_t pad_sub_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct cpInfo *info = (struct cpInfo *) cl; @@ -931,19 +931,19 @@ /* don't subtract the object that was put back! */ if (b == info->other) - return 0; + return R_DIR_NOT_FOUND; if (pad->Clearance == 0) - return 0; + return R_DIR_NOT_FOUND; polygon = info->polygon; if (XOR(TEST_FLAG(ONSOLDERFLAG, pad), !info->solder)) { if (SubtractPad(pad, polygon) < 0) longjmp(info->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } - return 0; + return R_DIR_NOT_FOUND; } -static int line_sub_callback(const BoxType * b, void *cl) +static r_dir_t line_sub_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct cpInfo *info = (struct cpInfo *) cl; @@ -953,9 +953,9 @@ /* don't subtract the object that was put back! */ if (b == info->other) - return 0; + return R_DIR_NOT_FOUND; if (!TEST_FLAG(CLEARLINEFLAG, line)) - return 0; + return R_DIR_NOT_FOUND; polygon = info->polygon; if (!(np = LinePoly(line, line->Thickness + line->Clearance))) @@ -968,10 +968,10 @@ if (info->batch_size == SUBTRACT_LINE_BATCH_SIZE) subtract_accumulated(info, polygon); - return 1; + return R_DIR_FOUND_CONTINUE; } -static int text_sub_callback(const BoxType * b, void *cl) +static r_dir_t text_sub_callback(const BoxType * b, void *cl) { TextTypePtr text = (TextTypePtr) b; struct cpInfo *info = (struct cpInfo *) cl; @@ -979,13 +979,13 @@ /* don't subtract the object that was put back! */ if (b == info->other) - return 0; + return R_DIR_NOT_FOUND; if (!TEST_FLAG(CLEARLINEFLAG, text)) - return 0; + return R_DIR_NOT_FOUND; polygon = info->polygon; if (SubtractText(text, polygon) < 0) longjmp(info->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } static int Group(DataTypePtr Data, Cardinal layer) @@ -1383,10 +1383,10 @@ void *ptr1, *ptr2; LayerTypePtr layer; DataTypePtr data; - int (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *); + r_dir_t (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *); }; -static int subtract_plow(DataTypePtr Data, LayerTypePtr Layer, PolygonTypePtr Polygon, int type, void *ptr1, void *ptr2) +static r_dir_t subtract_plow(DataTypePtr Data, LayerTypePtr Layer, PolygonTypePtr Polygon, int type, void *ptr1, void *ptr2) { if (!Polygon->Clipped) return 0; @@ -1395,51 +1395,51 @@ case VIA_TYPE: SubtractPin(Data, (PinTypePtr) ptr2, Layer, Polygon); Polygon->NoHolesValid = 0; - return 1; + return R_DIR_FOUND_CONTINUE; case LINE_TYPE: SubtractLine((LineTypePtr) ptr2, Polygon); Polygon->NoHolesValid = 0; - return 1; + return R_DIR_FOUND_CONTINUE; case ARC_TYPE: SubtractArc((ArcTypePtr) ptr2, Polygon); Polygon->NoHolesValid = 0; - return 1; + return R_DIR_FOUND_CONTINUE; case PAD_TYPE: SubtractPad((PadTypePtr) ptr2, Polygon); Polygon->NoHolesValid = 0; - return 1; + return R_DIR_FOUND_CONTINUE; case TEXT_TYPE: SubtractText((TextTypePtr) ptr2, Polygon); Polygon->NoHolesValid = 0; - return 1; + return R_DIR_FOUND_CONTINUE; } - return 0; + return R_DIR_NOT_FOUND; } -static int add_plow(DataTypePtr Data, LayerTypePtr Layer, PolygonTypePtr Polygon, int type, void *ptr1, void *ptr2) +static r_dir_t add_plow(DataTypePtr Data, LayerTypePtr Layer, PolygonTypePtr Polygon, int type, void *ptr1, void *ptr2) { switch (type) { case PIN_TYPE: case VIA_TYPE: UnsubtractPin((PinTypePtr) ptr2, Layer, Polygon); - return 1; + return R_DIR_FOUND_CONTINUE; case LINE_TYPE: UnsubtractLine((LineTypePtr) ptr2, Layer, Polygon); - return 1; + return R_DIR_FOUND_CONTINUE; case ARC_TYPE: UnsubtractArc((ArcTypePtr) ptr2, Layer, Polygon); - return 1; + return R_DIR_FOUND_CONTINUE; case PAD_TYPE: UnsubtractPad((PadTypePtr) ptr2, Layer, Polygon); - return 1; + return R_DIR_FOUND_CONTINUE; case TEXT_TYPE: UnsubtractText((TextTypePtr) ptr2, Layer, Polygon); - return 1; + return R_DIR_FOUND_CONTINUE; } - return 0; + return R_DIR_NOT_FOUND; } -static int plow_callback(const BoxType * b, void *cl) +static r_dir_t plow_callback(const BoxType * b, void *cl) { struct plow_info *plow = (struct plow_info *) cl; PolygonTypePtr polygon = (PolygonTypePtr) b; @@ -1446,12 +1446,12 @@ if (TEST_FLAG(CLEARPOLYFLAG, polygon)) return plow->callback(plow->data, plow->layer, polygon, plow->type, plow->ptr1, plow->ptr2); - return 0; + return R_DIR_NOT_FOUND; } int PlowsPolygon(DataType * Data, int type, void *ptr1, void *ptr2, - int (*call_back) (DataTypePtr data, LayerTypePtr lay, PolygonTypePtr poly, int type, void *ptr1, void *ptr2)) + r_dir_t (*call_back) (DataTypePtr data, LayerTypePtr lay, PolygonTypePtr poly, int type, void *ptr1, void *ptr2)) { BoxType sb = ((PinTypePtr) ptr2)->BoundingBox; int r = 0; Index: trunk/src/polygon.h =================================================================== --- trunk/src/polygon.h (revision 2420) +++ trunk/src/polygon.h (revision 2421) @@ -32,6 +32,7 @@ #define PCB_POLYGON_H #include "global.h" +#include "rtree.h" /* Implementation constants */ @@ -61,7 +62,7 @@ void CopyAttachedPolygonToLayer(void); int PolygonHoles(PolygonType * ptr, const BoxType * range, int (*callback) (PLINE *, void *user_data), void *user_data); int PlowsPolygon(DataType *, int, void *, void *, - int (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *)); + r_dir_t (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *)); void ComputeNoHoles(PolygonType * poly); POLYAREA *ContourToPoly(PLINE *); POLYAREA *PolygonToPoly(PolygonType *); Index: trunk/src/polygon1.c =================================================================== --- trunk/src/polygon1.c (revision 2420) +++ trunk/src/polygon1.c (revision 2421) @@ -522,20 +522,20 @@ * (C) 2006, harry eaton * This prunes the search for boxes that don't intersect the segment. */ -static int seg_in_region(const BoxType * b, void *cl) +static r_dir_t seg_in_region(const BoxType * b, void *cl) { struct info *i = (struct info *) cl; double y1, y2; /* for zero slope the search is aligned on the axis so it is already pruned */ if (i->m == 0.) - return 1; + return R_DIR_FOUND_CONTINUE; y1 = i->m * b->X1 + i->b; y2 = i->m * b->X2 + i->b; if (min(y1, y2) >= b->Y2) - return 0; + return R_DIR_NOT_FOUND; if (max(y1, y2) < b->Y1) - return 0; - return 1; /* might intersect */ + return R_DIR_NOT_FOUND; + return R_DIR_FOUND_CONTINUE; /* might intersect */ } /* Prepend a deferred node-insersion task to a list */ @@ -559,7 +559,7 @@ * problem. There are efficient algorithms for finding intersections with snap * rounding, but I don't have time to implement them right now. */ -static int seg_in_seg(const BoxType * b, void *cl) +static r_dir_t seg_in_seg(const BoxType * b, void *cl) { struct info *i = (struct info *) cl; struct seg *s = (struct seg *) b; @@ -572,11 +572,11 @@ * already been intersected this pass, skip it until the next pass. */ if (s->intersected || i->s->intersected) - return 0; + return R_DIR_NOT_FOUND; cnt = vect_inters2(s->v->point, s->v->next->point, i->v->point, i->v->next->point, s1, s2); if (!cnt) - return 0; + return R_DIR_NOT_FOUND; if (i->touch) /* if checking touches one find and we're done */ longjmp(*i->touch, TOUCHES); i->s->p->Flags.status = ISECTED; @@ -599,7 +599,7 @@ #endif i->node_insert_list = prepend_insert_node_task(i->node_insert_list, s, new_node); s->intersected = 1; - return 0; /* Keep looking for intersections with segment "i" */ + return R_DIR_NOT_FOUND; /* Keep looking for intersections with segment "i" */ } /* Skip any remaining r_search hits against segment i, as any futher * intersections will be rejected until the next pass anyway. @@ -607,7 +607,7 @@ if (done_insert_on_i) longjmp(*i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } static void *make_edge_tree(PLINE * pb) @@ -643,7 +643,7 @@ return (void *) ans; } -static int get_seg(const BoxType * b, void *cl) +static r_dir_t get_seg(const BoxType * b, void *cl) { struct info *i = (struct info *) cl; struct seg *s = (struct seg *) b; @@ -651,7 +651,7 @@ i->s = s; longjmp(i->sego, 1); } - return 0; + return R_DIR_NOT_FOUND; } /* @@ -672,7 +672,7 @@ * */ -static int contour_bounds_touch(const BoxType * b, void *cl) +static r_dir_t contour_bounds_touch(const BoxType * b, void *cl) { contour_info *c_info = (contour_info *) cl; PLINE *pa = c_info->pa; @@ -743,7 +743,7 @@ c_info->node_insert_list = info.node_insert_list; if (info.need_restart) c_info->need_restart = 1; - return 0; + return R_DIR_NOT_FOUND; } static int intersect_impl(jmp_buf * jb, POLYAREA * b, POLYAREA * a, int add) @@ -872,14 +872,14 @@ /*****************************************************************/ /* Routines for making labels */ -static int count_contours_i_am_inside(const BoxType * b, void *cl) +static r_dir_t count_contours_i_am_inside(const BoxType * b, void *cl) { PLINE *me = (PLINE *) cl; PLINE *check = (PLINE *) b; if (poly_ContourInContour(check, me)) - return 1; - return 0; + return R_DIR_FOUND_CONTINUE; + return R_DIR_NOT_FOUND; } /* cntr_in_M_POLYAREA @@ -1126,15 +1126,15 @@ POLYAREA *pa; }; -static int heap_it(const BoxType * b, void *cl) +static r_dir_t heap_it(const BoxType * b, void *cl) { heap_t *heap = (heap_t *) cl; struct polyarea_info *pa_info = (struct polyarea_info *) b; PLINE *p = pa_info->pa->contours; if (p->Count == 0) - return 0; /* how did this happen? */ + return R_DIR_NOT_FOUND; /* how did this happen? */ heap_insert(heap, p->area, pa_info); - return 1; + return R_DIR_FOUND_CONTINUE; } struct find_inside_info { @@ -1143,7 +1143,7 @@ PLINE *result; }; -static int find_inside(const BoxType * b, void *cl) +static r_dir_t find_inside(const BoxType * b, void *cl) { struct find_inside_info *info = (struct find_inside_info *) cl; PLINE *check = (PLINE *) b; @@ -1150,13 +1150,13 @@ /* Do test on check to see if it inside info->want_inside */ /* If it is: */ if (check->Flags.orient == PLF_DIR) { - return 0; + return R_DIR_NOT_FOUND; } if (poly_ContourInContour(info->want_inside, check)) { info->result = check; longjmp(info->jb, 1); } - return 0; + return R_DIR_NOT_FOUND; } static void InsertHoles(jmp_buf * e, POLYAREA * dest, PLINE ** src) @@ -1738,21 +1738,21 @@ PLINE *result; }; -static int find_inside_m_pa(const BoxType * b, void *cl) +static r_dir_t find_inside_m_pa(const BoxType * b, void *cl) { struct find_inside_m_pa_info *info = (struct find_inside_m_pa_info *) cl; PLINE *check = (PLINE *) b; /* Don't report for the main contour */ if (check->Flags.orient == PLF_DIR) - return 0; + return R_DIR_NOT_FOUND; /* Don't look at contours marked as being intersected */ if (check->Flags.status == ISECTED) - return 0; + return R_DIR_NOT_FOUND; if (cntr_in_M_POLYAREA(check, info->want_inside, FALSE)) { info->result = check; longjmp(info->jb, 1); } - return 0; + return R_DIR_NOT_FOUND; } @@ -2343,11 +2343,11 @@ C->tree = (rtree_t *) make_edge_tree(C); } /* poly_PreContour */ -static int flip_cb(const BoxType * b, void *cl) +static r_dir_t flip_cb(const BoxType * b, void *cl) { struct seg *s = (struct seg *) b; s->v = s->v->prev; - return 1; + return R_DIR_FOUND_CONTINUE; } void poly_InvContour(PLINE * c) @@ -2528,7 +2528,7 @@ } pip; -static int crossing(const BoxType * b, void *cl) +static r_dir_t crossing(const BoxType * b, void *cl) { struct seg *s = (struct seg *) b; struct pip *p = (struct pip *) cl; @@ -2563,7 +2563,7 @@ p->f -= 1; } } - return 1; + return R_DIR_FOUND_CONTINUE; } int poly_InsideContour(PLINE * c, Vector p) Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 2420) +++ trunk/src/remove.c (revision 2421) @@ -294,12 +294,12 @@ LineTypePtr line; PointTypePtr point; }; -static int remove_point(const BoxType * b, void *cl) +static r_dir_t remove_point(const BoxType * b, void *cl) { LineType *line = (LineType *) b; struct rlp_info *info = (struct rlp_info *) cl; if (line == info->line) - return 0; + return R_DIR_NOT_FOUND; if ((line->Point1.X == info->point->X) && (line->Point1.Y == info->point->Y)) { info->line = line; @@ -312,7 +312,7 @@ info->point = &line->Point2; longjmp(info->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- Index: trunk/src/rtree.c =================================================================== --- trunk/src/rtree.c (revision 2420) +++ trunk/src/rtree.c (revision 2421) @@ -396,8 +396,8 @@ } typedef struct { - int (*check_it) (const BoxType * region, void *cl); - int (*found_it) (const BoxType * box, void *cl); + r_dir_t (*check_it) (const BoxType * region, void *cl); + r_dir_t (*found_it) (const BoxType * box, void *cl); void *closure; } r_arg; @@ -477,8 +477,8 @@ */ int r_search(rtree_t * rtree, const BoxType * query, - int (*check_region) (const BoxType * region, void *cl), - int (*found_rectangle) (const BoxType * box, void *cl), void *cl) + r_dir_t (*check_region) (const BoxType * region, void *cl), + r_dir_t (*found_rectangle) (const BoxType * box, void *cl), void *cl) { r_arg arg; @@ -510,7 +510,7 @@ } /*------ r_region_is_empty ------*/ -static int __r_region_is_empty_rect_in_reg(const BoxType * box, void *cl) +static r_dir_t __r_region_is_empty_rect_in_reg(const BoxType * box, void *cl) { jmp_buf *envp = (jmp_buf *) cl; longjmp(*envp, 1); /* found one! */ Index: trunk/src/rtree.h =================================================================== --- trunk/src/rtree.h (revision 2420) +++ trunk/src/rtree.h (revision 2421) @@ -39,6 +39,12 @@ #include "global.h" +/* callback direction to the search engine */ +typedef enum r_dir_e { + R_DIR_NOT_FOUND = 0, /* object not found or not accepted */ + R_DIR_FOUND_CONTINUE = 1, /* object found or accepted, go on searching */ + R_DIR_FOUND_CANCEL /* object found or accepted, cancel the search and return */ +} r_dir_t; /* create an rtree from the list of boxes. if 'manage' is true, then * the tree will take ownership of 'boxlist' and free it when the tree @@ -65,12 +71,12 @@ */ int r_search(rtree_t * rtree, const BoxType * starting_region, - int (*region_in_search) (const BoxType * region, void *cl), - int (*rectangle_in_region) (const BoxType * box, void *cl), void *closure); + r_dir_t (*region_in_search) (const BoxType * region, void *cl), + r_dir_t (*rectangle_in_region) (const BoxType * box, void *cl), void *closure); static inline int r_search_pt(rtree_t * rtree, const PointType * pt, int radius, - int (*region_in_search) (const BoxType * region, void *cl), - int (*rectangle_in_region) (const BoxType * box, void *cl), void *closure) + r_dir_t (*region_in_search) (const BoxType * region, void *cl), + r_dir_t (*rectangle_in_region) (const BoxType * box, void *cl), void *closure) { BoxType box; Index: trunk/src/rubberband.c =================================================================== --- trunk/src/rubberband.c (revision 2420) +++ trunk/src/rubberband.c (revision 2421) @@ -61,7 +61,7 @@ static void CheckLinePointForRubberbandConnection(LayerTypePtr, LineTypePtr, PointTypePtr, bool); static void CheckPolygonForRubberbandConnection(LayerTypePtr, PolygonTypePtr); static void CheckLinePointForRat(LayerTypePtr, PointTypePtr); -static int rubber_callback(const BoxType * b, void *cl); +static r_dir_t rubber_callback(const BoxType * b, void *cl); struct rubber_info { Coord radius; @@ -71,7 +71,7 @@ LayerTypePtr layer; }; -static int rubber_callback(const BoxType * b, void *cl) +static r_dir_t rubber_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct rubber_info *i = (struct rubber_info *) cl; @@ -82,9 +82,9 @@ t = line->Thickness / 2; if (TEST_FLAG(LOCKFLAG, line)) - return 0; + return R_DIR_NOT_FOUND; if (line == i->line) - return 0; + return R_DIR_NOT_FOUND; /* * Check to see if the line touches a rectangular region. * To do this we need to look for the intersection of a circular @@ -147,7 +147,7 @@ found++; } } - return found; + return found ? R_DIR_FOUND_CONTINUE : R_DIR_NOT_FOUND; } /* circular search region */ if (i->radius < 0) @@ -168,7 +168,7 @@ dist2 = x + y - rad; if (dist1 > 0 && dist2 > 0) - return 0; + return R_DIR_NOT_FOUND; #ifdef CLOSEST_ONLY /* keep this to remind me */ if (dist1 < dist2) @@ -181,7 +181,7 @@ if (dist2 <= 0) CreateNewRubberbandEntry(i->layer, line, &line->Point2); #endif - return 1; + return R_DIR_FOUND_CONTINUE; } /* --------------------------------------------------------------------------- @@ -224,7 +224,7 @@ PointTypePtr point; }; -static int rat_callback(const BoxType * box, void *cl) +static r_dir_t rat_callback(const BoxType * box, void *cl) { RatTypePtr rat = (RatTypePtr) box; struct rinfo *i = (struct rinfo *) cl; @@ -263,7 +263,7 @@ default: Message("hace: bad rubber-rat lookup callback\n"); } - return 0; + return R_DIR_NOT_FOUND; } static void CheckPadForRat(PadTypePtr Pad) Index: trunk/src/search.c =================================================================== --- trunk/src/search.c (revision 2420) +++ trunk/src/search.c (revision 2421) @@ -86,7 +86,7 @@ int locked; /* This will be zero or LOCKFLAG */ }; -static int pinorvia_callback(const BoxType * box, void *cl) +static r_dir_t pinorvia_callback(const BoxType * box, void *cl) { struct ans_info *i = (struct ans_info *) cl; PinTypePtr pin = (PinTypePtr) box; @@ -93,14 +93,14 @@ AnyObjectType *ptr1 = pin->Element ? pin->Element : pin; if (TEST_FLAG(i->locked, ptr1)) - return 0; + return R_DIR_NOT_FOUND; if (!IsPointOnPin(PosX, PosY, SearchRadius, pin)) - return 0; + return R_DIR_NOT_FOUND; *i->ptr1 = ptr1; *i->ptr2 = *i->ptr3 = pin; longjmp(i->env, 1); - return 1; /* never reached */ + return R_DIR_FOUND_CONTINUE; /* never reached */ } static bool SearchViaByLocation(int locked, PinTypePtr * Via, PinTypePtr * Dummy1, PinTypePtr * Dummy2) @@ -146,7 +146,7 @@ return false; } -static int pad_callback(const BoxType * b, void *cl) +static r_dir_t pad_callback(const BoxType * b, void *cl) { PadTypePtr pad = (PadTypePtr) b; struct ans_info *i = (struct ans_info *) cl; @@ -153,7 +153,7 @@ AnyObjectType *ptr1 = pad->Element; if (TEST_FLAG(i->locked, ptr1)) - return 0; + return R_DIR_NOT_FOUND; if (FRONT(pad) || i->BackToo) { if (IsPointInPad(PosX, PosY, SearchRadius, pad)) { @@ -162,7 +162,7 @@ longjmp(i->env, 1); } } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -200,20 +200,20 @@ int locked; }; -static int line_callback(const BoxType * box, void *cl) +static r_dir_t line_callback(const BoxType * box, void *cl) { struct line_info *i = (struct line_info *) cl; LineTypePtr l = (LineTypePtr) box; if (TEST_FLAG(i->locked, l)) - return 0; + return R_DIR_NOT_FOUND; if (!IsPointInPad(PosX, PosY, SearchRadius, (PadTypePtr) l)) - return 0; + return R_DIR_NOT_FOUND; *i->Line = l; *i->Point = (PointTypePtr) l; longjmp(i->env, 1); - return 1; /* never reached */ + return R_DIR_FOUND_CONTINUE; /* never reached */ } @@ -233,13 +233,13 @@ return (true); } -static int rat_callback(const BoxType * box, void *cl) +static r_dir_t rat_callback(const BoxType * box, void *cl) { LineTypePtr line = (LineTypePtr) box; struct ans_info *i = (struct ans_info *) cl; if (TEST_FLAG(i->locked, line)) - return 0; + return R_DIR_NOT_FOUND; if (TEST_FLAG(VIAFLAG, line) ? (Distance(line->Point1.X, line->Point1.Y, PosX, PosY) <= @@ -247,7 +247,7 @@ *i->ptr1 = *i->ptr2 = *i->ptr3 = line; longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -278,13 +278,13 @@ int locked; }; -static int arc_callback(const BoxType * box, void *cl) +static r_dir_t arc_callback(const BoxType * box, void *cl) { struct arc_info *i = (struct arc_info *) cl; ArcTypePtr a = (ArcTypePtr) box; if (TEST_FLAG(i->locked, a)) - return 0; + return R_DIR_NOT_FOUND; if (!IsPointOnArc(PosX, PosY, SearchRadius, a)) return 0; @@ -291,7 +291,7 @@ *i->Arc = a; *i->Dummy = a; longjmp(i->env, 1); - return 1; /* never reached */ + return R_DIR_FOUND_CONTINUE; /* never reached */ } @@ -311,19 +311,19 @@ return (true); } -static int text_callback(const BoxType * box, void *cl) +static r_dir_t text_callback(const BoxType * box, void *cl) { TextTypePtr text = (TextTypePtr) box; struct ans_info *i = (struct ans_info *) cl; if (TEST_FLAG(i->locked, text)) - return 0; + return R_DIR_NOT_FOUND; if (POINT_IN_BOX(PosX, PosY, &text->BoundingBox)) { *i->ptr2 = *i->ptr3 = text; longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -345,19 +345,19 @@ return (true); } -static int polygon_callback(const BoxType * box, void *cl) +static r_dir_t polygon_callback(const BoxType * box, void *cl) { PolygonTypePtr polygon = (PolygonTypePtr) box; struct ans_info *i = (struct ans_info *) cl; if (TEST_FLAG(i->locked, polygon)) - return 0; + return R_DIR_NOT_FOUND; if (IsPointInPolygon(PosX, PosY, SearchRadius, polygon)) { *i->ptr2 = *i->ptr3 = polygon; longjmp(i->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } @@ -380,15 +380,15 @@ return (true); } -static int linepoint_callback(const BoxType * b, void *cl) +static r_dir_t linepoint_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; struct line_info *i = (struct line_info *) cl; - int ret_val = 0; + r_dir_t ret_val = R_DIR_NOT_FOUND; double d; if (TEST_FLAG(i->locked, line)) - return 0; + return R_DIR_NOT_FOUND; /* some stupid code to check both points */ d = Distance(PosX, PosY, line->Point1.X, line->Point1.Y); @@ -396,7 +396,7 @@ i->least = d; *i->Line = line; *i->Point = &line->Point1; - ret_val = 1; + ret_val = R_DIR_FOUND_CONTINUE; } d = Distance(PosX, PosY, line->Point2.X, line->Point2.Y); @@ -404,7 +404,7 @@ i->least = d; *i->Line = line; *i->Point = &line->Point2; - ret_val = 1; + ret_val = R_DIR_FOUND_CONTINUE; } return ret_val; } @@ -457,7 +457,7 @@ return (false); } -static int name_callback(const BoxType * box, void *cl) +static r_dir_t name_callback(const BoxType * box, void *cl) { TextTypePtr text = (TextTypePtr) box; struct ans_info *i = (struct ans_info *) cl; @@ -465,7 +465,7 @@ double newarea; if (TEST_FLAG(i->locked, text)) - return 0; + return R_DIR_NOT_FOUND; if ((FRONT(element) || i->BackToo) && !TEST_FLAG(HIDENAMEFLAG, element) && POINT_IN_BOX(PosX, PosY, &text->BoundingBox)) { /* use the text with the smallest bounding box */ @@ -475,9 +475,9 @@ *i->ptr1 = element; *i->ptr2 = *i->ptr3 = text; } - return 1; + return R_DIR_FOUND_CONTINUE; } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- @@ -503,7 +503,7 @@ return (false); } -static int element_callback(const BoxType * box, void *cl) +static r_dir_t element_callback(const BoxType * box, void *cl) { ElementTypePtr element = (ElementTypePtr) box; struct ans_info *i = (struct ans_info *) cl; @@ -510,7 +510,7 @@ double newarea; if (TEST_FLAG(i->locked, element)) - return 0; + return R_DIR_NOT_FOUND; if ((FRONT(element) || i->BackToo) && POINT_IN_BOX(PosX, PosY, &element->VBox)) { /* use the element with the smallest bounding box */ @@ -518,10 +518,10 @@ if (newarea < i->area) { i->area = newarea; *i->ptr1 = *i->ptr2 = *i->ptr3 = element; - return 1; + return R_DIR_FOUND_CONTINUE; } } - return 0; + return R_DIR_NOT_FOUND; } /* --------------------------------------------------------------------------- Index: trunk/src_plugins/autoplace/autoplace.c =================================================================== --- trunk/src_plugins/autoplace/autoplace.c (revision 2420) +++ trunk/src_plugins/autoplace/autoplace.c (revision 2421) @@ -222,7 +222,7 @@ t = (box).X1; (box).X1 = (box).X2; (box).X2 = t;\ } /* helper methods for __r_find_neighbor */ -static int __r_find_neighbor_reg_in_sea(const BoxType * region, void *cl) +static r_dir_t __r_find_neighbor_reg_in_sea(const BoxType * region, void *cl) { struct r_neighbor_info *ni = (struct r_neighbor_info *) cl; BoxType query = *region; @@ -233,11 +233,12 @@ * | | * trap.x1 trap.x2 sides at 45-degree angle */ - return (query.Y2 > ni->trap.Y1) && (query.Y1 < ni->trap.Y2) && - (query.X2 + ni->trap.Y2 > ni->trap.X1 + query.Y1) && (query.X1 + query.Y1 < ni->trap.X2 + ni->trap.Y2); + if ((query.Y2 > ni->trap.Y1) && (query.Y1 < ni->trap.Y2) && (query.X2 + ni->trap.Y2 > ni->trap.X1 + query.Y1) && (query.X1 + query.Y1 < ni->trap.X2 + ni->trap.Y2)) + return R_DIR_FOUND_CONTINUE; + return R_DIR_NOT_FOUND; } -static int __r_find_neighbor_rect_in_reg(const BoxType * box, void *cl) +static r_dir_t __r_find_neighbor_rect_in_reg(const BoxType * box, void *cl) { struct r_neighbor_info *ni = (struct r_neighbor_info *) cl; BoxType query = *box; @@ -256,7 +257,7 @@ ni->trap.Y1 = query.Y2; ni->neighbor = box; } - return r; + return r ? R_DIR_FOUND_CONTINUE : R_DIR_NOT_FOUND; } /* main r_find_neighbor routine. Returns NULL if no neighbor in the Index: trunk/src_plugins/autoroute/autoroute.c =================================================================== --- trunk/src_plugins/autoroute/autoroute.c (revision 2420) +++ trunk/src_plugins/autoroute/autoroute.c (revision 2421) @@ -779,7 +779,7 @@ jmp_buf env; }; -static int __found_one_on_lg(const BoxType * box, void *cl) +static r_dir_t __found_one_on_lg(const BoxType * box, void *cl) { struct rb_info *inf = (struct rb_info *) cl; routebox_t *rb = (routebox_t *) box; @@ -786,15 +786,15 @@ BoxType sb; if (rb->flags.nonstraight) - return 0; + return R_DIR_NOT_FOUND; sb = shrink_box(&rb->box, rb->style->Clearance); if (inf->query.X1 >= sb.X2 || inf->query.X2 <= sb.X1 || inf->query.Y1 >= sb.Y2 || inf->query.Y2 <= sb.Y1) - return 0; + return R_DIR_NOT_FOUND; inf->winner = rb; if (rb->type == PLANE) - return 1; /* keep looking for something smaller if a plane was found */ + return R_DIR_FOUND_CONTINUE; /* keep looking for something smaller if a plane was found */ longjmp(inf->env, 1); - return 0; + return R_DIR_NOT_FOUND; } static routebox_t *FindRouteBoxOnLayerGroup(routedata_t * rd, Coord X, Coord Y, Cardinal layergroup) @@ -1473,21 +1473,21 @@ routebox_t *nearest; cost_t nearest_cost; }; -static int __region_within_guess(const BoxType * region, void *cl) +static r_dir_t __region_within_guess(const BoxType * region, void *cl) { struct mincost_target_closure *mtc = (struct mincost_target_closure *) cl; cost_t cost_to_region; if (mtc->nearest == NULL) - return 1; + return R_DIR_FOUND_CONTINUE; cost_to_region = cost_to_layerless_box(mtc->CostPoint, mtc->CostPointLayer, region); assert(cost_to_region >= 0); /* if no guess yet, all regions are "close enough" */ /* note that cost is *strictly more* than minimum distance, so we'll * always search a region large enough. */ - return (cost_to_region < mtc->nearest_cost); + return (cost_to_region < mtc->nearest_cost) ? R_DIR_FOUND_CONTINUE : R_DIR_NOT_FOUND; } -static int __found_new_guess(const BoxType * box, void *cl) +static r_dir_t __found_new_guess(const BoxType * box, void *cl) { struct mincost_target_closure *mtc = (struct mincost_target_closure *) cl; routebox_t *guess = (routebox_t *) box; @@ -1497,10 +1497,10 @@ if (cost_to_guess < mtc->nearest_cost) { mtc->nearest = guess; mtc->nearest_cost = cost_to_guess; /* this is our new guess! */ - return 1; + return R_DIR_FOUND_CONTINUE; } else - return 0; /* not less expensive than our last guess */ + return R_DIR_NOT_FOUND; /* not less expensive than our last guess */ } /* target_guess is our guess at what the nearest target is, or NULL if we @@ -1850,7 +1850,7 @@ * like it wouldn't be seen. We do this while keep the inflated * box as large as possible. */ -static int __Expand_this_rect(const BoxType * box, void *cl) +static r_dir_t __Expand_this_rect(const BoxType * box, void *cl) { struct E_result *res = (struct E_result *) cl; routebox_t *rb = (routebox_t *) box; @@ -1859,7 +1859,7 @@ /* we don't see conflicts already encountered */ if (rb->flags.touched) - return 0; + return R_DIR_NOT_FOUND; /* The inflated box outer edges include its own * track width plus its own clearance. @@ -1877,7 +1877,7 @@ bloat = res->bloat; if (rbox.X2 <= res->inflated.X1 + bloat || rbox.X1 >= res->inflated.X2 - bloat || rbox.Y1 >= res->inflated.Y2 - bloat || rbox.Y2 <= res->inflated.Y1 + bloat) - return 0; /* doesn't touch */ + return R_DIR_NOT_FOUND; /* doesn't touch */ } else { if (rb->style->Clearance > res->keep) @@ -1887,13 +1887,13 @@ if (rbox.X2 <= res->inflated.X1 || rbox.X1 >= res->inflated.X2 || rbox.Y1 >= res->inflated.Y2 || rbox.Y2 <= res->inflated.Y1) - return 0; /* doesn't touch */ + return R_DIR_NOT_FOUND; /* doesn't touch */ bloat = 0; } /* this is an intersecting box; it has to jump through a few more hoops */ if (rb == res->parent || rb->parent.expansion_area == res->parent) - return 0; /* don't see what we came from */ + return R_DIR_NOT_FOUND; /* don't see what we came from */ /* if we are expanding a source edge, don't let other sources * or their expansions stop us. @@ -1901,7 +1901,7 @@ #if 1 if (res->parent->flags.source) if (rb->flags.source || (rb->type == EXPANSION_AREA && rb->parent.expansion_area->flags.source)) - return 0; + return R_DIR_NOT_FOUND; #endif /* we ignore via expansion boxes because maybe its @@ -1909,12 +1909,12 @@ * the path we're exploring now. */ if (rb->flags.is_via && rb->type == EXPANSION_AREA) - return 0; + return R_DIR_NOT_FOUND; if (rb->type == PLANE) { /* expanding inside a plane is not good */ if (rbox.X1 < res->orig.X1 && rbox.X2 > res->orig.X2 && rbox.Y1 < res->orig.Y1 && rbox.Y2 > res->orig.Y2) { res->inflated = bloat_box(&res->orig, res->bloat); - return 1; + return R_DIR_FOUND_CONTINUE; } } /* calculate the distances from original box to this blocker */ @@ -1928,7 +1928,7 @@ if (!(res->done & _WEST) && rbox.X1 <= res->orig.X1 && rbox.X2 > res->inflated.X1) dw = res->orig.X1 - rbox.X2; if (dn <= 0 && de <= 0 && ds <= 0 && dw <= 0) - return 1; + return R_DIR_FOUND_CONTINUE; /* now shrink the inflated box to the largest blocking direction */ if (dn >= de && dn >= ds && dn >= dw) { res->inflated.Y1 = rbox.Y2 - bloat; @@ -1946,7 +1946,7 @@ res->inflated.X1 = rbox.X2 - bloat; res->w = rb; } - return 1; + return R_DIR_FOUND_CONTINUE; } static bool boink_box(routebox_t * rb, struct E_result *res, direction_t dir) @@ -2385,7 +2385,7 @@ bool ignore_source; }; -static int __GatherBlockers(const BoxType * box, void *cl) +static r_dir_t __GatherBlockers(const BoxType * box, void *cl) { routebox_t *rb = (routebox_t *) box; struct break_info *bi = (struct break_info *) cl; @@ -2392,15 +2392,17 @@ BoxType b; if (bi->parent == rb || rb->flags.touched || bi->parent->parent.expansion_area == rb) - return 0; + return R_DIR_NOT_FOUND; if (rb->flags.source && bi->ignore_source) - return 0; + return R_DIR_NOT_FOUND; b = rb->sbox; if (rb->style->Clearance > AutoRouteParameters.style->Clearance) b = bloat_box(&b, rb->style->Clearance - AutoRouteParameters.style->Clearance); if (b.X2 <= bi->box.X1 || b.X1 >= bi->box.X2 || b.Y1 >= bi->box.Y2 || b.Y2 <= bi->box.Y1) - return 0; - return blocker_to_heap(bi->heap, rb, &bi->box, bi->dir); + return R_DIR_NOT_FOUND; + if (blocker_to_heap(bi->heap, rb, &bi->box, bi->dir)) + return R_DIR_FOUND_CONTINUE; + return R_DIR_NOT_FOUND; } /* shrink the box to the last limit for the previous direction, @@ -2716,22 +2718,22 @@ jmp_buf env; }; -static int foib_rect_in_reg(const BoxType * box, void *cl) +static r_dir_t foib_rect_in_reg(const BoxType * box, void *cl) { struct foib_info *foib = (struct foib_info *) cl; BoxType rbox; routebox_t *rb = (routebox_t *) box; if (rb->flags.touched) - return 0; + return R_DIR_NOT_FOUND; /* if (rb->type == EXPANSION_AREA && !rb->flags.is_via)*/ - /* return 0; */ + /* return R_DIR_NOT_FOUND; */ rbox = bloat_routebox(rb); if (!box_intersect(&rbox, foib->box)) - return 0; + return R_DIR_NOT_FOUND; /* this is an intersector! */ foib->intersect = (routebox_t *) box; longjmp(foib->env, 1); /* skip to the end! */ - return 1; + return R_DIR_FOUND_CONTINUE; } static routebox_t *FindOneInBox(rtree_t * rtree, routebox_t * rb) @@ -2753,7 +2755,7 @@ BoxType query; jmp_buf env; }; -static int ftherm_rect_in_reg(const BoxType * box, void *cl) +static r_dir_t ftherm_rect_in_reg(const BoxType * box, void *cl) { routebox_t *rbox = (routebox_t *) box; struct therm_info *ti = (struct therm_info *) cl; @@ -2760,9 +2762,9 @@ BoxType sq, sb; if (rbox->type != PIN && rbox->type != VIA && rbox->type != VIA_SHADOW) - return 0; + return R_DIR_NOT_FOUND; if (rbox->group != ti->plane->group) - return 0; + return R_DIR_NOT_FOUND; sb = shrink_routebox(rbox); switch (rbox->type) { @@ -2769,7 +2771,7 @@ case PIN: sq = shrink_box(&ti->query, rbox->parent.pin->Thickness); if (!box_intersect(&sb, &sq)) - return 0; + return R_DIR_NOT_FOUND; sb.X1 = rbox->parent.pin->X; sb.Y1 = rbox->parent.pin->Y; break; @@ -2785,12 +2787,12 @@ sb.Y1 = CENTER_Y(sb); } if (!box_intersect(&sb, &sq)) - return 0; + return R_DIR_NOT_FOUND; break; case VIA_SHADOW: sq = shrink_box(&ti->query, rbox->style->Diameter); if (!box_intersect(&sb, &sq)) - return 0; + return R_DIR_NOT_FOUND; sb.X1 = CENTER_X(sb); sb.Y1 = CENTER_Y(sb); break; @@ -2799,7 +2801,7 @@ } ti->plane = rbox; longjmp(ti->env, 1); - return 1; + return R_DIR_FOUND_CONTINUE; } /* check for a pin or via target that a polygon can just use a thermal to connect to */ @@ -3507,17 +3509,17 @@ #endif -static int __conflict_source(const BoxType * box, void *cl) +static r_dir_t __conflict_source(const BoxType * box, void *cl) { routebox_t *rb = (routebox_t *) box; if (rb->flags.touched || rb->flags.fixed) - return 0; + return R_DIR_NOT_FOUND; else { routebox_t *dis = (routebox_t *) cl; path_conflicts(dis, rb, false); touch_conflicts(dis->conflicts_with, 1); } - return 1; + return R_DIR_FOUND_CONTINUE; } static void source_conflicts(rtree_t * tree, routebox_t * rb) @@ -4045,12 +4047,12 @@ } #ifndef NDEBUG -int bad_boy(const BoxType * b, void *cl) +r_dir_t bad_boy(const BoxType * b, void *cl) { routebox_t *box = (routebox_t *) b; if (box->type == EXPANSION_AREA) - return 1; - return 0; + return R_DIR_FOUND_COTINUE; + return R_DIR_NOT_FOUND; } bool no_expansion_boxes(routedata_t * rd) @@ -4084,11 +4086,11 @@ } } -static int ripout_livedraw_obj_cb(const BoxType * b, void *cl) +static r_dir_t ripout_livedraw_obj_cb(const BoxType * b, void *cl) { routebox_t *box = (routebox_t *) b; ripout_livedraw_obj(box); - return 0; + return R_DIR_NOT_FOUND; } struct routeall_status { @@ -4384,7 +4386,7 @@ jmp_buf env; }; -static int fpin_rect(const BoxType * b, void *cl) +static r_dir_t fpin_rect(const BoxType * b, void *cl) { PinTypePtr pin = (PinTypePtr) b; struct fpin_info *info = (struct fpin_info *) cl; @@ -4392,7 +4394,7 @@ info->pin = (PinTypePtr) b; longjmp(info->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } static int FindPin(const BoxType * box, PinTypePtr * pin) Index: trunk/src_plugins/autoroute/mtspace.c =================================================================== --- trunk/src_plugins/autoroute/mtspace.c (revision 2420) +++ trunk/src_plugins/autoroute/mtspace.c (revision 2421) @@ -132,7 +132,7 @@ jmp_buf env; }; -static int mts_remove_one(const BoxType * b, void *cl) +static r_dir_t mts_remove_one(const BoxType * b, void *cl) { struct mts_info *info = (struct mts_info *) cl; mtspacebox_t *box = (mtspacebox_t *) b; @@ -144,7 +144,7 @@ r_delete_entry(info->tree, b); longjmp(info->env, 1); } - return 0; + return R_DIR_NOT_FOUND; } rtree_t *which_tree(mtspace_t * mtspace, mtspace_type_t which) @@ -212,7 +212,7 @@ * First check if it does intersect, then break it into * overlaping regions that don't intersect this box. */ -static int query_one(const BoxType * box, void *cl) +static r_dir_t query_one(const BoxType * box, void *cl) { struct query_closure *qc = (struct query_closure *) cl; mtspacebox_t *mtsb = (mtspacebox_t *) box; @@ -227,7 +227,7 @@ * then we didn't actually touch this box */ if (qc->cbox->X1 + shrink >= mtsb->box.X2 || qc->cbox->X2 - shrink <= mtsb->box.X1 || qc->cbox->Y1 + shrink >= mtsb->box.Y2 || qc->cbox->Y2 - shrink <= mtsb->box.Y1) - return 0; + return R_DIR_NOT_FOUND; /* ok, we do touch this box, now create up to 4 boxes that don't */ if (mtsb->box.Y1 > qc->cbox->Y1 + shrink) { /* top region exists */ Coord Y1 = qc->cbox->Y1; @@ -291,7 +291,7 @@ else free(qc->cbox); /* done with this one */ longjmp(qc->env, 1); - return 1; /* never reached */ + return R_DIR_FOUND_CONTINUE; /* never reached */ } /* qloop takes a vector (or heap) of regions to check (checking) if they don't intersect Index: trunk/src_plugins/gl/hidgl.c =================================================================== --- trunk/src_plugins/gl/hidgl.c (revision 2420) +++ trunk/src_plugins/gl/hidgl.c (revision 2421) @@ -551,7 +551,7 @@ double scale; }; -static int do_hole(const BoxType * b, void *cl) +static r_dir_t do_hole(const BoxType * b, void *cl) { struct do_hole_info *info = cl; PLINE *curc = (PLINE *) b; @@ -558,11 +558,11 @@ /* Ignore the outer contour - we draw it first explicitly */ if (curc->Flags.orient == PLF_DIR) { - return 0; + return R_DIR_NOT_FOUND; } tesselate_contour(info->tobj, curc, info->vertices, info->scale); - return 1; + return R_DIR_FOUND_CONTINUE; } static GLint stencil_bits; Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c (revision 2420) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c (revision 2421) @@ -29,10 +29,10 @@ } } -static int search_callback (const BoxType * b, void *cl) +static r_dir_t search_callback (const BoxType * b, void *cl) { search_append(cl, (void *)b); - return 1; + return R_DIR_FOUND_CONTINUE; } hash_t *layout_searches = NULL; Index: trunk/src_plugins/puller/puller.c =================================================================== --- trunk/src_plugins/puller/puller.c (revision 2420) +++ trunk/src_plugins/puller/puller.c (revision 2421) @@ -279,7 +279,7 @@ /* */ /*****************************************************************************/ -static int line_callback(const BoxType * b, void *cl) +static r_dir_t line_callback(const BoxType * b, void *cl) { /* LayerTypePtr layer = (LayerTypePtr)cl; */ LineTypePtr l = (LineTypePtr) b; @@ -302,10 +302,10 @@ printf("picked, exact %d\n", line_exact); #endif } - return 1; + return R_DIR_FOUND_CONTINUE; } -static int arc_callback(const BoxType * b, void *cl) +static r_dir_t arc_callback(const BoxType * b, void *cl) { /* LayerTypePtr layer = (LayerTypePtr) cl; */ ArcTypePtr a = (ArcTypePtr) b; @@ -336,7 +336,7 @@ printf("picked, exact %d\n", arc_exact); #endif } - return 1; + return R_DIR_FOUND_CONTINUE; } static int find_pair(int Px, int Py) @@ -652,7 +652,7 @@ #define NEAR(a,b) ((a) <= (b) + 2 && (a) >= (b) - 2) -static int find_pair_line_callback(const BoxType * b, void *cl) +static r_dir_t find_pair_line_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; #if TRACE1 @@ -661,7 +661,7 @@ FindPairCallbackStruct *fpcs = (FindPairCallbackStruct *) cl; if (line == fpcs->me) - return 0; + return R_DIR_NOT_FOUND; #ifdef CHECK_LINE_PT_NEG if (line->Point1.X < 0) abort1(); @@ -684,10 +684,10 @@ #endif } } - return 0; + return R_DIR_NOT_FOUND; } -static int find_pair_arc_callback(const BoxType * b, void *cl) +static r_dir_t find_pair_arc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; Extra *e = ARC2EXTRA(arc); @@ -694,7 +694,7 @@ FindPairCallbackStruct *fpcs = (FindPairCallbackStruct *) cl; if (arc == fpcs->me) - return 0; + return R_DIR_NOT_FOUND; #if TRACE1 pcb_printf(" - %p arc %#mD or %#mD\n", e, e->start.x, e->start.y, e->end.x, e->end.y); #endif @@ -709,7 +709,7 @@ else *fpcs->extra_ptr = e; } - return 0; + return R_DIR_NOT_FOUND; } static void find_pairs_1(void *me, Extra ** e, int x, int y) @@ -754,7 +754,7 @@ return 0; } -static int find_pair_pinline_callback(const BoxType * b, void *cl) +static r_dir_t find_pair_pinline_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; PinTypePtr pin = (PinTypePtr) cl; @@ -770,7 +770,7 @@ hits += check_point_in_pin(pin, line->Point2.X, line->Point2.Y, &(e->end)); if (hits) - return 0; + return R_DIR_NOT_FOUND; /* See if the line passes through this pin. */ /* FIXME: this assumes round pads, but it's good enough for square @@ -783,10 +783,10 @@ unlink_end(e, &e->start.next); unlink_end(e, &e->end.next); } - return 0; + return R_DIR_NOT_FOUND; } -static int find_pair_pinarc_callback(const BoxType * b, void *cl) +static r_dir_t find_pair_pinarc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; PinTypePtr pin = (PinTypePtr) cl; @@ -795,10 +795,10 @@ hits = check_point_in_pin(pin, e->start.x, e->start.y, &(e->start)); hits += check_point_in_pin(pin, e->end.x, e->end.y, &(e->end)); - return 0; + return R_DIR_NOT_FOUND; } -static int check_point_in_pad(PadTypePtr pad, int x, int y, End * e) +static r_dir_t check_point_in_pad(PadTypePtr pad, int x, int y, End * e) { int inside_p; int t; @@ -837,12 +837,12 @@ e->at_pin = 1; e->pin = pad; e->is_pad = 1; - return 1; + return R_DIR_FOUND_CONTINUE; } - return 0; + return R_DIR_NOT_FOUND; } -static int find_pair_padline_callback(const BoxType * b, void *cl) +static r_dir_t find_pair_padline_callback(const BoxType * b, void *cl) { LineTypePtr line = (LineTypePtr) b; PadTypePtr pad = (PadTypePtr) cl; @@ -854,11 +854,11 @@ if (TEST_FLAG(ONSOLDERFLAG, pad)) { if (!current_is_solder) - return 0; + return R_DIR_NOT_FOUND; } else { if (!current_is_component) - return 0; + return R_DIR_NOT_FOUND; } #ifdef CHECK_LINE_PT_NEG @@ -870,7 +870,7 @@ hits += check_point_in_pad(pad, line->Point2.X, line->Point2.Y, &(e->end)); if (hits) - return 0; + return R_DIR_NOT_FOUND; /* Ok, something strange. The line intersects our space, but doesn't end in our space. See if it just passes through us, and @@ -897,10 +897,10 @@ unlink_end(e, &e->end.next); } - return 0; + return R_DIR_NOT_FOUND; } -static int find_pair_padarc_callback(const BoxType * b, void *cl) +static r_dir_t find_pair_padarc_callback(const BoxType * b, void *cl) { ArcTypePtr arc = (ArcTypePtr) b; PadTypePtr pad = (PadTypePtr) cl; @@ -909,16 +909,16 @@ if (TEST_FLAG(ONSOLDERFLAG, pad)) { if (!current_is_solder) - return 0; + return R_DIR_NOT_FOUND; } else { if (!current_is_component) - return 0; + return R_DIR_NOT_FOUND; } hits = check_point_in_pad(pad, e->start.x, e->start.y, &(e->start)); hits += check_point_in_pad(pad, e->end.x, e->end.y, &(e->end)); - return 0; + return R_DIR_NOT_FOUND; } static void null_multi_next_ends(AnyObjectType * ptr, Extra * extra, void *userdata) @@ -1494,14 +1494,14 @@ return gp_point_force(x, y, t, e, esa, eda, 0, func); } -static int gp_line_cb(const BoxType * b, void *cb) +static r_dir_t gp_line_cb(const BoxType * b, void *cb) { const LineTypePtr l = (LineTypePtr) b; Extra *e = LINE2EXTRA(l); if (l == start_line || l == end_line) - return 0; + return R_DIR_NOT_FOUND; if (e->deleted) - return 0; + return R_DIR_NOT_FOUND; #ifdef CHECK_LINE_PT_NEG if (l->Point1.X < 0) abort1(); @@ -1510,32 +1510,32 @@ gp_point(l->Point1.X, l->Point1.Y, l->Thickness / 2, &e->start); if (!e->end.next || !EXTRA_IS_ARC(e->end.next)) gp_point(l->Point2.X, l->Point2.Y, l->Thickness / 2, &e->end); - return 0; + return R_DIR_NOT_FOUND; } -static int gp_arc_cb(const BoxType * b, void *cb) +static r_dir_t gp_arc_cb(const BoxType * b, void *cb) { const ArcTypePtr a = (ArcTypePtr) b; Extra *e = ARC2EXTRA(a); if (a == start_arc || a == end_arc) - return 0; + return R_DIR_NOT_FOUND; if (e->deleted) - return 0; + return R_DIR_NOT_FOUND; gp_point_2(a->X, a->Y, a->Width + a->Thickness / 2, 0, a->StartAngle, a->Delta, __FUNCTION__); if (start_arc && a->X == start_arc->X && a->Y == start_arc->Y) - return 0; + return R_DIR_NOT_FOUND; if (end_arc && a->X != end_arc->X && a->Y != end_arc->Y) - return 0; + return R_DIR_NOT_FOUND; if (e->start.next || e->end.next) - return 0; + return R_DIR_NOT_FOUND; gp_point(e->start.x, e->start.y, a->Thickness / 2, 0); gp_point(e->end.x, e->end.y, a->Thickness / 2, 0); - return 0; + return R_DIR_NOT_FOUND; } -static int gp_text_cb(const BoxType * b, void *cb) +static r_dir_t gp_text_cb(const BoxType * b, void *cb) { const TextTypePtr t = (TextTypePtr) b; /* FIXME: drop in the actual text-line endpoints later. */ @@ -1543,25 +1543,25 @@ gp_point(t->BoundingBox.X1, t->BoundingBox.Y2, 0, 0); gp_point(t->BoundingBox.X2, t->BoundingBox.Y2, 0, 0); gp_point(t->BoundingBox.X2, t->BoundingBox.Y1, 0, 0); - return 0; + return R_DIR_NOT_FOUND; } -static int gp_poly_cb(const BoxType * b, void *cb) +static r_dir_t gp_poly_cb(const BoxType * b, void *cb) { int i; const PolygonTypePtr p = (PolygonTypePtr) b; for (i = 0; i < p->PointN; i++) gp_point(p->Points[i].X, p->Points[i].Y, 0, 0); - return 0; + return R_DIR_NOT_FOUND; } -static int gp_pin_cb(const BoxType * b, void *cb) +static r_dir_t gp_pin_cb(const BoxType * b, void *cb) { const PinTypePtr p = (PinTypePtr) b; int t2 = (p->Thickness + 1) / 2; if (p == start_pinpad || p == end_pinpad) - return 0; + return R_DIR_NOT_FOUND; /* FIXME: we lump octagonal pins in with square; safe, but not optimal. */ @@ -1574,24 +1574,24 @@ else { gp_point(p->X, p->Y, t2, 0); } - return 0; + return R_DIR_NOT_FOUND; } -static int gp_pad_cb(const BoxType * b, void *cb) +static r_dir_t gp_pad_cb(const BoxType * b, void *cb) { const PadTypePtr p = (PadTypePtr) b; int t2 = (p->Thickness + 1) / 2; if (p == start_pinpad || p == end_pinpad) - return 0; + return R_DIR_NOT_FOUND; if (TEST_FLAG(ONSOLDERFLAG, p)) { if (!current_is_solder) - return 0; + return R_DIR_NOT_FOUND; } else { if (!current_is_component) - return 0; + return R_DIR_NOT_FOUND; } /* FIXME: we lump octagonal pads in with square; safe, but not @@ -1620,7 +1620,7 @@ gp_point(p->Point1.X, p->Point1.Y, t2, 0); gp_point(p->Point2.X, p->Point2.Y, t2, 0); } - return 0; + return R_DIR_NOT_FOUND; } static LineTypePtr create_line(LineTypePtr sample, int x1, int y1, int x2, int y2)