pcb 4.1.1
An interactive printed circuit board layout editor.

find.c File Reference

Routines to find connections between pins, vias, lines ... More...

#include <setjmp.h>
#include <assert.h>
#include "global.h"
#include "data.h"
#include "draw.h"
#include "error.h"
#include "find.h"
#include "misc.h"
#include "rtree.h"
#include "polygon.h"
#include "pcb-printf.h"
#include "search.h"
#include "set.h"
#include "undo.h"
#include "rats.h"
Include dependency graph for find.c:

Go to the source code of this file.

Data Structures

struct  ListType
 Some local types. More...
struct  pv_info
struct  lo_info
struct  rat_info
struct  drc_info

Defines

#define SEPARATE(FP)
#define LIST_ENTRY(list, I)   (((AnyObjectType **)list->Data)[(I)])
#define PADLIST_ENTRY(L, I)   (((PadType **)PadList[(L)].Data)[(I)])
#define LINELIST_ENTRY(L, I)   (((LineType **)LineList[(L)].Data)[(I)])
#define ARCLIST_ENTRY(L, I)   (((ArcType **)ArcList[(L)].Data)[(I)])
#define RATLIST_ENTRY(I)   (((RatType **)RatList.Data)[(I)])
#define POLYGONLIST_ENTRY(L, I)   (((PolygonType **)PolygonList[(L)].Data)[(I)])
#define PVLIST_ENTRY(I)   (((PinType **)PVList.Data)[(I)])
#define IS_PV_ON_RAT(PV, Rat)   (IsPointOnLineEnd((PV)->X,(PV)->Y, (Rat)))
#define IS_PV_ON_ARC(PV, Arc)
#define IS_PV_ON_PAD(PV, Pad)   ( IsPointInPad((PV)->X, (PV)->Y, MAX((PV)->Thickness/2 +Bloat,0), (Pad)))
#define DRC_CONTINUE   _("Press Next to continue DRC checking")
#define DRC_NEXT   _("Next")
#define DRC_CANCEL   _("Cancel")

Functions

static DrcViolationTypepcb_drc_violation_new (const char *title, const char *explanation, Coord x, Coord y, Angle angle, bool have_measured, Coord measured_value, Coord required_value, int object_count, long int *object_id_list, int *object_type_list)
static void pcb_drc_violation_free (DrcViolationType *violation)
static void reset_drc_dialog_message (void)
static void append_drc_dialog_message (const char *fmt,...)
static void GotoError (void)
 Center the display to show the offending item (thing).
static void append_drc_violation (DrcViolationType *violation)
static int throw_drc_dialog (void)
 Message when asked about continuing DRC checks after next violation is found.
static bool LookupLOConnectionsToLine (LineType *Line, Cardinal LayerGroup, int flag, bool PolysTo, bool AndRats)
 Searches all LOs that are connected to the given line on the given layergroup.
static bool LookupLOConnectionsToPad (PadType *Pad, Cardinal LayerGroup, int flag, bool AndRats)
 Searches all LOs that are connected to the given pad on the given layergroup.
static bool LookupLOConnectionsToPolygon (PolygonType *Polygon, Cardinal LayerGroup, int flag, bool AndRats)
 Looks up LOs that are connected to the given polygon on the given layergroup.
static bool LookupLOConnectionsToArc (ArcType *Arc, Cardinal LayerGroup, int flag, bool AndRats)
 Searches all LOs that are connected to the given arc on the given layergroup.
static bool LookupLOConnectionsToRatEnd (PointType *Point, Cardinal LayerGroup, int flag)
 Searches all LOs that are connected to the given rat-line on the given layergroup.
static bool IsRatPointOnLineEnd (PointType *Point, LineType *Line)
 Tests if point is same as line end point.
static bool ArcArcIntersect (ArcType *Arc1, ArcType *Arc2)
 Check if two arcs intersect.
static bool PrepareNextLoop (FILE *FP)
 Resets some flags for looking up the next pin/pad.
static void DrawNewConnections (void)
 Draws all new connections which have been found since the routine was called the last time.
static void DumpList (void)
 Dumps the list contents.
static void LocateError (Coord *x, Coord *y)
 Locate the coordinatates of offending item (thing).
static void BuildObjectList (int *object_count, long int **object_id_list, int **object_type_list)
 Build a list of the of offending items by ID.
static bool SetThing (int, void *, void *, void *)
static bool IsArcInPolygon (ArcType *Arc, PolygonType *Polygon)
 Checks if an arc has a connection to a polygon.
static bool IsLineInPolygon (LineType *Line, PolygonType *Polygon)
 Checks if a line has a connection to a polygon.
static bool IsPadInPolygon (PadType *pad, PolygonType *polygon)
 Checks if a pad connects to a non-clearing polygon.
static bool IsPolygonInPolygon (PolygonType *P1, PolygonType *P2)
 Checks if a polygon has a connection to a second one.
bool LinePadIntersect (LineType *Line, PadType *Pad)
 
bool ArcPadIntersect (ArcType *Arc, PadType *Pad)
static bool add_object_to_list (ListType *list, int type, void *ptr1, void *ptr2, void *ptr3, int flag)
static bool ADD_PV_TO_LIST (PinType *Pin, int flag)
static bool ADD_PAD_TO_LIST (Cardinal L, PadType *Pad, int flag)
static bool ADD_LINE_TO_LIST (Cardinal L, LineType *Ptr, int flag)
static bool ADD_ARC_TO_LIST (Cardinal L, ArcType *Ptr, int flag)
static bool ADD_RAT_TO_LIST (RatType *Ptr, int flag)
static bool ADD_POLYGON_TO_LIST (Cardinal L, PolygonType *Ptr, int flag)
static BoxType expand_bounds (BoxType *box_in)
bool PinLineIntersect (PinType *PV, LineType *Line)
bool BoxBoxIntersection (BoxType *b1, BoxType *b2)
static bool PadPadIntersect (PadType *p1, PadType *p2)
static bool PV_TOUCH_PV (PinType *PV1, PinType *PV2)
static void FreeLayoutLookupMemory (void)
 Releases all allocated memory.
static void FreeComponentLookupMemory (void)
static void InitComponentLookup (void)
 Allocates memory for component related stacks ...
static void InitLayoutLookup (void)
 Allocates memory for layout related stacks ...
static int LOCtoPVline_callback (const BoxType *b, void *cl)
static int LOCtoPVarc_callback (const BoxType *b, void *cl)
static int LOCtoPVpad_callback (const BoxType *b, void *cl)
static int LOCtoPVrat_callback (const BoxType *b, void *cl)
static int LOCtoPVpoly_callback (const BoxType *b, void *cl)
static bool LookupLOConnectionsToPVList (int flag, bool AndRats)
 Checks if a PV is connected to LOs, if it is, the LO is added to the appropriate list and the 'used' flag is set.
static bool LookupLOConnectionsToLOList (int flag, bool AndRats)
 Find all connections between LO at the current list position and new LOs.
static int pv_pv_callback (const BoxType *b, void *cl)
static bool LookupPVConnectionsToPVList (int flag)
 Searches for new PVs that are connected to PVs on the list.
static int pv_line_callback (const BoxType *b, void *cl)
static int pv_pad_callback (const BoxType *b, void *cl)
static int pv_arc_callback (const BoxType *b, void *cl)
static int pv_poly_callback (const BoxType *b, void *cl)
static int pv_rat_callback (const BoxType *b, void *cl)
static bool LookupPVConnectionsToLOList (int flag, bool AndRats)
 Searches for new PVs that are connected to NEW LOs on the list.
static void normalize_angles (Angle *sa, Angle *d)
 Reduce arc start angle and delta to 0..360.
static int radius_crosses_arc (double x, double y, ArcType *arc)
static void get_arc_ends (Coord *box, ArcType *arc)
static void form_slanted_rectangle (PointType p[4], LineType *l)
 Writes vertices of a squared line.
bool LineLineIntersect (LineType *Line1, LineType *Line2)
 Checks if two lines intersect.
bool LineArcIntersect (LineType *Line, ArcType *Arc)
 Check for line intersection with an arc.
static int LOCtoArcLine_callback (const BoxType *b, void *cl)
static int LOCtoArcArc_callback (const BoxType *b, void *cl)
static int LOCtoArcPad_callback (const BoxType *b, void *cl)
static int LOCtoLineLine_callback (const BoxType *b, void *cl)
static int LOCtoLineArc_callback (const BoxType *b, void *cl)
static int LOCtoLineRat_callback (const BoxType *b, void *cl)
static int LOCtoLinePad_callback (const BoxType *b, void *cl)
static int LOCtoRat_callback (const BoxType *b, void *cl)
static int PolygonToRat_callback (const BoxType *b, void *cl)
static int LOCtoPad_callback (const BoxType *b, void *cl)
static int LOCtoPadLine_callback (const BoxType *b, void *cl)
static int LOCtoPadArc_callback (const BoxType *b, void *cl)
static int LOCtoPadPoly_callback (const BoxType *b, void *cl)
static int LOCtoPadRat_callback (const BoxType *b, void *cl)
static int LOCtoPadPad_callback (const BoxType *b, void *cl)
static int LOCtoPolyLine_callback (const BoxType *b, void *cl)
static int LOCtoPolyArc_callback (const BoxType *b, void *cl)
static int LOCtoPolyPad_callback (const BoxType *b, void *cl)
static int LOCtoPolyRat_callback (const BoxType *b, void *cl)
static void PrintElementNameList (ElementType *Element, FILE *FP)
 Writes the several names of an element to a file.
static void PrintConnectionElementName (ElementType *Element, FILE *FP)
 Writes the several names of an element to a file.
static void PrintConnectionListEntry (char *ObjName, ElementType *Element, bool FirstOne, FILE *FP)
 Prints one {pin,pad,via}/element entry of connection lists.
static void PrintPadConnections (Cardinal Layer, FILE *FP, bool IsFirst)
 Prints all found connections of a pads to file FP the connections are stacked in 'PadList'.
static void PrintPinConnections (FILE *FP, bool IsFirst)
 Prints all found connections of a pin to file FP the connections are stacked in 'PVList'.
static bool ListsEmpty (bool AndRats)
 Checks if all lists of new objects are handled.
static void reassign_no_drc_flags (void)
static bool DoIt (int flag, bool AndRats, bool AndDraw)
 Loops till no more connections are found.
static bool PrintAndSelectUnusedPinsAndPadsOfElement (ElementType *Element, FILE *FP, int flag)
 Prints all unused pins of an element to file FP.
static bool PrintElementConnections (ElementType *Element, FILE *FP, int flag, bool AndDraw)
 Finds all connections to the pins of the passed element.
void LookupElementConnections (ElementType *Element, FILE *FP)
 Find all connections to pins within one element.
void LookupConnectionsToAllElements (FILE *FP)
 Find all connections to pins of all element.
static bool ListStart (int type, void *ptr1, void *ptr2, void *ptr3, int flag)
 Add the starting object to the list of found objects.
void LookupConnection (Coord X, Coord Y, bool AndDraw, Coord Range, int flag, bool AndRats)
 Looks up all connections from the object at the given coordinates the TheFlag (normally 'FOUNDFLAG') is set for all objects found.
void LookupConnectionByPin (int type, void *ptr1)
void RatFindHook (int type, void *ptr1, void *ptr2, void *ptr3, bool undo, int flag, bool AndRats)
 Find connections for rats nesting.
void LookupUnusedPins (FILE *FP)
 Find all unused pins of all elements.
bool ClearFlagOnPinsViasAndPads (bool AndDraw, int flag)
 Resets all used flags of pins and vias.
bool ClearFlagOnLinesAndPolygons (bool AndDraw, int flag)
 Resets all used flags of LOs.
bool ClearFlagOnAllObjects (bool AndDraw, int flag)
 Resets all found connections.
static bool DRCFind (int What, void *ptr1, void *ptr2, void *ptr3)
 Check for DRC violations on a single net starting from the pad or pin.
static int drc_callback (DataType *data, LayerType *layer, PolygonType *polygon, int type, void *ptr1, void *ptr2, void *userdata)
 DRC clearance callback.
int DRCAll (void)
 Check for DRC violations.
void InitConnectionLookup (void)
void FreeConnectionLookupMemory (void)

Variables

static GString * drc_dialog_message
static Coord Bloat = 0
static void * thing_ptr1
static void * thing_ptr2
static void * thing_ptr3
static int thing_type
static bool User = false
static bool drc = false
static Cardinal drcerr_count
static Cardinal TotalP
static Cardinal TotalV
static ListType LineList [MAX_LAYER]
static ListType PolygonList [MAX_LAYER]
static ListType ArcList [MAX_LAYER]
static ListType PadList [2]
static ListType RatList
static ListType PVList

Detailed Description

Routines to find connections between pins, vias, lines ...

Short description:

  • Lists for pins and vias, lines, arcs, pads and for polygons are created.
    Every object that has to be checked is added to its list.
    Coarse searching is accomplished with the data rtrees.
  • There's no 'speed-up' mechanism for polygons because they are not used as often as other objects.
  • The maximum distance between line and pin ... would depend on the angle between them. To speed up computation the limit is set to one half of the thickness of the objects (cause of square pins).

PV: means pin or via (objects that connect layers).
LO: all non PV objects (layer objects like lines, arcs, polygons, pads).

  1. First, the LO or PV at the given coordinates is looked up.
  2. All LO connections to that PV are looked up next.
  3. Lookup of all LOs connected to LOs from (2).
    This step is repeated until no more new connections are found.
  4. Lookup all PVs connected to the LOs from (2) and (3).
  5. Start again with (1) for all new PVs from (4).

Intersection of line <--> circle:

  • Calculate the signed distance from the line to the center, return false if abs(distance) > R.
  • Get the distance from the line <--> distancevector intersection to (X1,Y1) in range [0,1], return true if 0 <= distance <= 1.
  • Depending on (r > 1.0 or r < 0.0) check the distance of X2,Y2 or X1,Y1 to X,Y.

Intersection of line <--> line:

  • See the description of 'LineLineIntersect()'.

Copyright.


PCB, interactive printed circuit board design

Copyright (C) 1994,1995,1996, 2005 Thomas Nau

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Contact addresses for paper mail and Email: Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany Thomas.Nau@rz.uni-ulm.de

Definition in file find.c.


Define Documentation

#define ARCLIST_ENTRY (   L,
 
)    (((ArcType **)ArcList[(L)].Data)[(I)])
#define DRC_CANCEL   _("Cancel")

Definition at line 231 of file find.c.

Referenced by throw_drc_dialog().

#define DRC_CONTINUE   _("Press Next to continue DRC checking")

Definition at line 229 of file find.c.

Referenced by throw_drc_dialog().

#define DRC_NEXT   _("Next")

Definition at line 230 of file find.c.

Referenced by throw_drc_dialog().

#define IS_PV_ON_ARC (   PV,
  Arc 
)
Value:
(TEST_FLAG(SQUAREFLAG, (PV)) ? \
                IsArcInRectangle( \
                        (PV)->X -MAX(((PV)->Thickness+1)/2 +Bloat,0), (PV)->Y -MAX(((PV)->Thickness+1)/2 +Bloat,0), \
                        (PV)->X +MAX(((PV)->Thickness+1)/2 +Bloat,0), (PV)->Y +MAX(((PV)->Thickness+1)/2 +Bloat,0), \
                        (Arc)) : \
                IsPointOnArc((PV)->X,(PV)->Y,MAX((PV)->Thickness/2.0 + Bloat,0.0), (Arc)))

Definition at line 128 of file find.c.

Referenced by LOCtoPVarc_callback(), and pv_arc_callback().

#define IS_PV_ON_PAD (   PV,
  Pad 
)    ( IsPointInPad((PV)->X, (PV)->Y, MAX((PV)->Thickness/2 +Bloat,0), (Pad)))

Definition at line 136 of file find.c.

Referenced by LOCtoPVpad_callback(), and pv_pad_callback().

#define IS_PV_ON_RAT (   PV,
  Rat 
)    (IsPointOnLineEnd((PV)->X,(PV)->Y, (Rat)))

Definition at line 125 of file find.c.

Referenced by LOCtoPVrat_callback(), and pv_rat_callback().

#define LINELIST_ENTRY (   L,
 
)    (((LineType **)LineList[(L)].Data)[(I)])
#define LIST_ENTRY (   list,
 
)    (((AnyObjectType **)list->Data)[(I)])

Definition at line 117 of file find.c.

Referenced by add_object_to_list().

#define PADLIST_ENTRY (   L,
 
)    (((PadType **)PadList[(L)].Data)[(I)])
#define POLYGONLIST_ENTRY (   L,
 
)    (((PolygonType **)PolygonList[(L)].Data)[(I)])
#define PVLIST_ENTRY (   I)    (((PinType **)PVList.Data)[(I)])
#define RATLIST_ENTRY (   I)    (((RatType **)RatList.Data)[(I)])
#define SEPARATE (   FP)
Value:
{                                                                                       \
                int     i;                                                                      \
                fputc('#', (FP));                                               \
                for (i = Settings.CharPerLine; i; i--)  \
                        fputc('=', (FP));                                       \
                fputc('\n', (FP));                                              \
        }

Definition at line 108 of file find.c.

Referenced by LookupConnectionsToAllElements(), and PrintAndSelectUnusedPinsAndPadsOfElement().


Function Documentation

static bool ADD_ARC_TO_LIST ( Cardinal  L,
ArcType Ptr,
int  flag 
) [static]

Definition at line 364 of file find.c.

References add_object_to_list(), and LAYER_PTR.

Referenced by ListStart(), LOCtoArcArc_callback(), LOCtoLineArc_callback(), LOCtoPadArc_callback(), LOCtoPolyArc_callback(), and LOCtoPVarc_callback().

Here is the call graph for this function:

static bool ADD_LINE_TO_LIST ( Cardinal  L,
LineType Ptr,
int  flag 
) [static]

Definition at line 358 of file find.c.

References add_object_to_list(), and LAYER_PTR.

Referenced by ListStart(), LOCtoArcLine_callback(), LOCtoLineLine_callback(), LOCtoPadLine_callback(), LOCtoPolyLine_callback(), LOCtoPVline_callback(), and LOCtoRat_callback().

Here is the call graph for this function:

static bool add_object_to_list ( ListType list,
int  type,
void *  ptr1,
void *  ptr2,
void *  ptr3,
int  flag 
) [static]
static bool ADD_PAD_TO_LIST ( Cardinal  L,
PadType Pad,
int  flag 
) [static]
static bool ADD_POLYGON_TO_LIST ( Cardinal  L,
PolygonType Ptr,
int  flag 
) [static]
static bool ADD_PV_TO_LIST ( PinType Pin,
int  flag 
) [static]
static bool ADD_RAT_TO_LIST ( RatType Ptr,
int  flag 
) [static]

Definition at line 370 of file find.c.

References add_object_to_list().

Referenced by ListStart(), LOCtoLineRat_callback(), LOCtoPadRat_callback(), LOCtoPolyRat_callback(), and LOCtoPVrat_callback().

Here is the call graph for this function:

static void append_drc_dialog_message ( const char *  fmt,
  ... 
) [static]

Definition at line 190 of file find.c.

References drc_dialog_message, and pcb_vprintf().

Referenced by append_drc_violation(), and throw_drc_dialog().

Here is the call graph for this function:

static void append_drc_violation ( DrcViolationType violation) [static]
static bool ArcArcIntersect ( ArcType Arc1,
ArcType Arc2 
) [static]

Check if two arcs intersect.

First we check for circle intersections, then find the actual points of intersection and test them to see if they are on arcs.

Consider a, the distance from the center of arc 1 to the point perpendicular to the intersecting points.

= (r1^2 - r2^2 + l^2)/(2l)

The perpendicular distance to the point of intersection is then:

= sqrt(r1^2 - a^2)

The points of intersection would then be:

= X1 + a/l dx +- d/l dy

= Y1 + a/l dy -+ d/l dx

Where dx = X2 - X1 and dy = Y2 - Y1.

Definition at line 1347 of file find.c.

References Bloat, box, ArcType::Delta, Distance(), get_arc_ends(), IsPointOnArc(), normalize_angles(), radius_crosses_arc(), ArcType::StartAngle, ArcType::Thickness, ArcType::Width, ArcType::X, x, ArcType::Y, and y.

Referenced by LOCtoArcArc_callback().

Here is the call graph for this function:

bool ArcPadIntersect ( ArcType Arc,
PadType Pad 
)

Definition at line 317 of file find.c.

References LineArcIntersect().

Referenced by LOCtoArcPad_callback(), and LOCtoPadArc_callback().

Here is the call graph for this function:

bool BoxBoxIntersection ( BoxType b1,
BoxType b2 
)

Definition at line 428 of file find.c.

References BoxType::X1, BoxType::X2, BoxType::Y1, and BoxType::Y2.

Referenced by PV_TOUCH_PV().

static void BuildObjectList ( int *  object_count,
long int **  object_id_list,
int **  object_type_list 
) [static]

Build a list of the of offending items by ID.

(Currently just "thing").

Definition at line 4257 of file find.c.

References _, malloc(), thing_ptr3, and thing_type.

Referenced by drc_callback(), DRCAll(), and DRCFind().

Here is the call graph for this function:

bool ClearFlagOnLinesAndPolygons ( bool  AndDraw,
int  flag 
)
bool ClearFlagOnPinsViasAndPads ( bool  AndDraw,
int  flag 
)

Resets all used flags of pins and vias.

Definition at line 3265 of file find.c.

References AddObjectToFlagUndoList(), CLEAR_FLAG, PCBType::Data, DrawPad(), DrawPin(), DrawVia(), ELEMENT_LOOP, END_LOOP, lo_info::pad, PAD_LOOP, PCB, pin, PIN_LOOP, SetChangedFlag(), TEST_FLAG, and VIA_LOOP.

Referenced by ActionConnection(), ClearFlagOnAllObjects(), and IPCD356_Netlist().

Here is the call graph for this function:

static bool DoIt ( int  flag,
bool  AndRats,
bool  AndDraw 
) [static]
static void DrawNewConnections ( void  ) [static]

Draws all new connections which have been found since the routine was called the last time.

Definition at line 2954 of file find.c.

References ARCLIST_ENTRY, PCBType::Data, DrawArc(), DrawLine(), ListType::DrawLocation, DrawPad(), DrawPin(), DrawPolygon(), DrawRat(), DrawVia(), DataType::Layer, layer, LAYER_PTR, LayerStack, LINELIST_ENTRY, max_copper_layer, ListType::Number, LayerType::On, PADLIST_ENTRY, PCB, PCBType::PinOn, POLYGONLIST_ENTRY, PVLIST_ENTRY, RATLIST_ENTRY, PCBType::RatOn, TEST_FLAG, and PCBType::ViaOn.

Referenced by DoIt().

Here is the call graph for this function:

static int drc_callback ( DataType data,
LayerType layer,
PolygonType polygon,
int  type,
void *  ptr1,
void *  ptr2,
void *  userdata 
) [static]
static bool DRCFind ( int  What,
void *  ptr1,
void *  ptr2,
void *  ptr3 
) [static]

Check for DRC violations on a single net starting from the pad or pin.

Sees if the connectivity changes when everything is bloated, or shrunk.

Definition at line 3444 of file find.c.

References _, append_drc_violation(), PCBType::Bloat, Bloat, BuildObjectList(), ClearFlagOnAllObjects(), DoIt(), drc, drcerr_count, DumpList(), FALSE, IncrementUndoSerialNumber(), ListStart(), LocateError(), PCB, pcb_drc_violation_free(), pcb_drc_violation_new(), PCBType::Shrink, thing_ptr1, thing_ptr2, thing_ptr3, thing_type, throw_drc_dialog(), Undo(), User, x, and y.

Referenced by DRCAll().

Here is the call graph for this function:

static void DumpList ( void  ) [static]

Dumps the list contents.

Definition at line 3400 of file find.c.

References ListType::DrawLocation, ListType::Location, max_copper_layer, and ListType::Number.

Referenced by DRCFind(), ListStart(), and RatFindHook().

static void form_slanted_rectangle ( PointType  p[4],
LineType l 
) [static]

Writes vertices of a squared line.

Definition at line 1479 of file find.c.

References Distance(), PointType::X, and PointType::Y.

Referenced by LineLineIntersect().

Here is the call graph for this function:

static void FreeComponentLookupMemory ( void  ) [static]

Definition at line 493 of file find.c.

References ListType::Data.

Referenced by FreeConnectionLookupMemory().

static void FreeLayoutLookupMemory ( void  ) [static]

Releases all allocated memory.

Definition at line 473 of file find.c.

References ListType::Data, and max_copper_layer.

Referenced by FreeConnectionLookupMemory().

static void get_arc_ends ( Coord box,
ArcType arc 
) [static]

Definition at line 1313 of file find.c.

References ArcType::Delta, ArcType::Height, M180, ArcType::StartAngle, ArcType::Width, ArcType::X, and ArcType::Y.

Referenced by ArcArcIntersect().

static void GotoError ( void  ) [static]

Center the display to show the offending item (thing).

Definition at line 4292 of file find.c.

References CenterDisplay(), ChangeGroupVisibility(), PCBType::Data, GetLayerNumber(), LocateError(), PCB, thing_ptr1, thing_type, X, and Y.

Referenced by append_drc_violation().

Here is the call graph for this function:

static void InitComponentLookup ( void  ) [static]

Allocates memory for component related stacks ...

Initializes index and sorts it by X1 and X2.

Definition at line 507 of file find.c.

References ALLPAD_LOOP, BOTTOM_SIDE, ListType::Data, PCBType::Data, ListType::DrawLocation, ENDALL_LOOP, ListType::Location, ListType::Number, PCB, ListType::Size, TEST_FLAG, and TOP_SIDE.

Referenced by InitConnectionLookup().

static void InitLayoutLookup ( void  ) [static]

Allocates memory for layout related stacks ...

Initializes index and sorts it by X1 and X2.

Definition at line 543 of file find.c.

References LayerType::ArcN, PCBType::Data, ListType::Data, ListType::DrawLocation, layer, LAYER_PTR, LayerType::LineN, ListType::Location, max_copper_layer, ListType::Number, PCB, DataType::pin_tree, LayerType::PolygonN, DataType::RatN, rtree::size, ListType::Size, TotalP, TotalV, and DataType::via_tree.

Referenced by InitConnectionLookup().

static bool IsArcInPolygon ( ArcType Arc,
PolygonType Polygon 
) [static]

Checks if an arc has a connection to a polygon.

  • first check if the arc can intersect with the polygon by evaluating the bounding boxes.
  • check the two end points of the arc. If none of them matches
  • check all segments of the polygon against the arc.

Definition at line 2433 of file find.c.

References ArcPoly(), Bloat, polygon_st::Clipped, POLYAREA::contours, isects(), TEST_FLAG, ArcType::Thickness, BoxType::X1, BoxType::X2, PLINE::xmax, PLINE::xmin, BoxType::Y1, BoxType::Y2, PLINE::ymax, and PLINE::ymin.

Referenced by LOCtoPolyArc_callback(), and LookupLOConnectionsToArc().

Here is the call graph for this function:

static bool IsLineInPolygon ( LineType Line,
PolygonType Polygon 
) [static]

Checks if a line has a connection to a polygon.

  • first check if the line can intersect with the polygon by evaluating the bounding boxes
  • check the two end points of the line. If none of them matches
  • check all segments of the polygon against the line.

Definition at line 2465 of file find.c.

References Bloat, polygon_st::Clipped, POLYAREA::contours, FALSE, isects(), IsRectangleInPolygon(), LinePoly(), MAX, MIN, TEST_FLAG, BoxType::X1, BoxType::X2, PLINE::xmax, PLINE::xmin, BoxType::Y1, BoxType::Y2, PLINE::ymax, and PLINE::ymin.

Referenced by IsPadInPolygon(), IsPolygonInPolygon(), LOCtoPolyLine_callback(), and LookupLOConnectionsToLine().

Here is the call graph for this function:

static bool IsPadInPolygon ( PadType pad,
PolygonType polygon 
) [static]

Checks if a pad connects to a non-clearing polygon.

The polygon is assumed to already have been proven non-clearing.

Definition at line 2504 of file find.c.

References IsLineInPolygon().

Referenced by drc_callback(), LOCtoPadPoly_callback(), and LOCtoPolyPad_callback().

Here is the call graph for this function:

static bool IsPolygonInPolygon ( PolygonType P1,
PolygonType P2 
) [static]

Checks if a polygon has a connection to a second one.

First check all points out of P1 against P2 and vice versa. If both fail check all lines of P1 against the ones of P2.

Definition at line 2516 of file find.c.

References Bloat, c, polygon_st::Clipped, POLYAREA::contours, PLINE::head, isects(), IsLineInPolygon(), line, VNODE::next, PLINE::next, NoFlags, VNODE::point, SetLineBoundingBox(), TRUE, PLINE::xmax, PLINE::xmin, PLINE::ymax, and PLINE::ymin.

Referenced by LookupLOConnectionsToPolygon().

Here is the call graph for this function:

static bool IsRatPointOnLineEnd ( PointType Point,
LineType Line 
) [static]

Tests if point is same as line end point.

Definition at line 1466 of file find.c.

References PointType::X, and PointType::Y.

Referenced by LOCtoLineRat_callback().

bool LineArcIntersect ( LineType Line,
ArcType Arc 
)

Check for line intersection with an arc.

Mostly this is like the circle/line intersection found in IsPointOnLine (search.c) see the detailed discussion for the basics there.

Since this is only an arc, not a full circle we need to find the actual points of intersection with the circle, and see if they are on the arc.

To do this, we translate along the line from the point Q plus or minus a distance delta = sqrt(Radius^2 - d^2) but it's handy to normalize with respect to l, the line length so a single projection is done (e.g. we don't first find the point Q.

 The projection is now of the form:
      Px = X1 + (r +- r2)(X2 - X1)
      Py = Y1 + (r +- r2)(Y2 - Y1)
 

Where r2 sqrt(Radius^2 l^2 - d^2)/l^2 note that this is the variable d, not the symbol d described in IsPointOnLine (variable d = symbol d * l).

The end points are hell so they are checked individually.

Definition at line 1674 of file find.c.

References Bloat, box, GetArcEnds(), IsPointInPad(), IsPointOnArc(), MAX, ArcType::Thickness, ArcType::Width, ArcType::X, BoxType::X1, BoxType::X2, ArcType::Y, BoxType::Y1, and BoxType::Y2.

Referenced by ArcPadIntersect(), drcArc_callback(), IsArcInRectangle(), LOCtoArcLine_callback(), and LOCtoLineArc_callback().

Here is the call graph for this function:

bool LineLineIntersect ( LineType Line1,
LineType Line2 
)

Checks if two lines intersect.

 From news FAQ:
 Let A,B,C,D be 2-space position vectors.
 Then the directed line segments AB & CD are given by:
      AB=A+r(B-A), r in [0,1]
      CD=C+s(D-C), s in [0,1]
 If AB & CD intersect, then
      A+r(B-A)=C+s(D-C), or
      XA+r(XB-XA)=XC+s*(XD-XC)
      YA+r(YB-YA)=YC+s(YD-YC)  for some r,s in [0,1]
 Solving the above for r and s yields
          (YA-YC)(XD-XC)-(XA-XC)(YD-YC)
      r = -----------------------------  (eqn 1)
          (XB-XA)(YD-YC)-(YB-YA)(XD-XC)
          (YA-YC)(XB-XA)-(XA-XC)(YB-YA)
      s = -----------------------------  (eqn 2)
          (XB-XA)(YD-YC)-(YB-YA)(XD-XC)
 Let I be the position vector of the intersection point, then:
      I=A+r(B-A) or
      XI=XA+r(XB-XA)
      YI=YA+r(YB-YA)
 By examining the values of r & s, you can also determine some
 other limiting conditions:
      If 0<=r<=1 & 0<=s<=1, intersection exists
          r<0 or r>1 or s<0 or s>1 line segments do not intersect
      If the denominator in eqn 1 is zero, AB & CD are parallel
      If the numerator in eqn 1 is also zero, AB & CD are coincident
 If the intersection point of the 2 lines are needed (lines in this
 context mean infinite lines) regardless whether the two line
 segments intersect, then
      If r>1, I is located on extension of AB
      If r<0, I is located on extension of BA
      If s>1, I is located on extension of CD
      If s<0, I is located on extension of DC
 Also note that the denominators of eqn 1 & 2 are identical.
 

Definition at line 1564 of file find.c.

References Bloat, form_slanted_rectangle(), IsLineInQuadrangle(), IsPointInPad(), MAX, s, and TEST_FLAG.

Referenced by drcLine_callback(), IsLineInQuadrangle(), IsLineInRectangle(), LinePadIntersect(), and LOCtoLineLine_callback().

Here is the call graph for this function:

bool LinePadIntersect ( LineType Line,
PadType Pad 
)

Some of the 'pad' routines are the same as for lines because the 'pad' struct starts with a line struct. See global.h for details.

Definition at line 311 of file find.c.

References LineLineIntersect().

Referenced by drcPad_callback(), LOCtoLinePad_callback(), LOCtoPadLine_callback(), and PadPadIntersect().

Here is the call graph for this function:

static bool ListsEmpty ( bool  AndRats) [static]

Checks if all lists of new objects are handled.

Definition at line 2693 of file find.c.

References LAYER_PTR, ListType::Location, max_copper_layer, Number, and ListType::Number.

Referenced by DoIt().

static bool ListStart ( int  type,
void *  ptr1,
void *  ptr2,
void *  ptr3,
int  flag 
) [static]

Add the starting object to the list of found objects.

Definition at line 3075 of file find.c.

References ADD_ARC_TO_LIST(), ADD_LINE_TO_LIST(), ADD_PAD_TO_LIST(), ADD_POLYGON_TO_LIST(), ADD_PV_TO_LIST(), ADD_RAT_TO_LIST(), BOTTOM_SIDE, PCBType::Data, DumpList(), GetLayerNumber(), layer, lo_info::pad, PCB, TEST_FLAG, and TOP_SIDE.

Referenced by DRCFind(), LookupConnection(), LookupConnectionByPin(), and RatFindHook().

Here is the call graph for this function:

static void LocateError ( Coord x,
Coord y 
) [static]

Locate the coordinatates of offending item (thing).

Definition at line 4194 of file find.c.

References polygon_st::Clipped, POLYAREA::contours, line, ElementType::MarkX, ElementType::MarkY, pin, thing_ptr3, thing_type, pin_st::X, ArcType::X, PLINE::xmax, PLINE::xmin, pin_st::Y, ArcType::Y, PLINE::ymax, and PLINE::ymin.

Referenced by drc_callback(), DRCAll(), DRCFind(), and GotoError().

static int LOCtoArcArc_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1745 of file find.c.

References ADD_ARC_TO_LIST(), lo_info::arc, ArcArcIntersect(), lo_info::env, lo_info::flag, lo_info::layer, TEST_FLAG, and ArcType::Thickness.

Referenced by LookupLOConnectionsToArc().

Here is the call graph for this function:

static int LOCtoArcLine_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1731 of file find.c.

References ADD_LINE_TO_LIST(), lo_info::arc, lo_info::env, lo_info::flag, lo_info::layer, line, LineArcIntersect(), and TEST_FLAG.

Referenced by LookupLOConnectionsToArc().

Here is the call graph for this function:

static int LOCtoArcPad_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1761 of file find.c.

References ADD_PAD_TO_LIST(), lo_info::arc, ArcPadIntersect(), BOTTOM_SIDE, lo_info::env, lo_info::flag, lo_info::layer, lo_info::pad, TEST_FLAG, and TOP_SIDE.

Referenced by LookupLOConnectionsToArc().

Here is the call graph for this function:

static int LOCtoLineArc_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1857 of file find.c.

References ADD_ARC_TO_LIST(), lo_info::arc, lo_info::env, lo_info::flag, lo_info::layer, lo_info::line, LineArcIntersect(), TEST_FLAG, and ArcType::Thickness.

Referenced by LookupLOConnectionsToLine().

Here is the call graph for this function:

static int LOCtoLineLine_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1843 of file find.c.

References ADD_LINE_TO_LIST(), lo_info::env, lo_info::flag, lo_info::layer, lo_info::line, line, LineLineIntersect(), and TEST_FLAG.

Referenced by LookupLOConnectionsToLine().

Here is the call graph for this function:

static int LOCtoLinePad_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1897 of file find.c.

References ADD_PAD_TO_LIST(), BOTTOM_SIDE, lo_info::env, lo_info::flag, lo_info::layer, lo_info::line, LinePadIntersect(), lo_info::pad, TEST_FLAG, and TOP_SIDE.

Referenced by LookupLOConnectionsToLine().

Here is the call graph for this function:

static int LOCtoLineRat_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1873 of file find.c.

References ADD_RAT_TO_LIST(), lo_info::env, lo_info::flag, RatType::group1, RatType::group2, IsRatPointOnLineEnd(), lo_info::layer, lo_info::line, lo_info::rat, and TEST_FLAG.

Referenced by LookupLOConnectionsToLine().

Here is the call graph for this function:

static int LOCtoPad_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2034 of file find.c.

References ADD_PAD_TO_LIST(), BOTTOM_SIDE, rat_info::env, rat_info::flag, rat_info::layer, rat_info::Point, TEST_FLAG, TOP_SIDE, PointType::X, and PointType::Y.

Referenced by LookupLOConnectionsToRatEnd().

Here is the call graph for this function:

static int LOCtoPadArc_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2121 of file find.c.

References ADD_ARC_TO_LIST(), lo_info::arc, ArcPadIntersect(), lo_info::env, lo_info::flag, lo_info::layer, lo_info::pad, TEST_FLAG, and ArcType::Thickness.

Referenced by LookupLOConnectionsToPad().

Here is the call graph for this function:

static int LOCtoPadLine_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2107 of file find.c.

References ADD_LINE_TO_LIST(), lo_info::env, lo_info::flag, lo_info::layer, line, LinePadIntersect(), lo_info::pad, and TEST_FLAG.

Referenced by LookupLOConnectionsToPad().

Here is the call graph for this function:

static int LOCtoPadPad_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2184 of file find.c.

References ADD_PAD_TO_LIST(), BOTTOM_SIDE, lo_info::env, lo_info::flag, lo_info::layer, lo_info::pad, PadPadIntersect(), TEST_FLAG, and TOP_SIDE.

Referenced by LookupLOConnectionsToPad().

Here is the call graph for this function:

static int LOCtoPadPoly_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2137 of file find.c.

References ADD_POLYGON_TO_LIST(), lo_info::env, lo_info::flag, IsPadInPolygon(), lo_info::layer, lo_info::pad, lo_info::polygon, and TEST_FLAG.

Referenced by LookupLOConnectionsToPad().

Here is the call graph for this function:

static int LOCtoPadRat_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2154 of file find.c.

References ADD_RAT_TO_LIST(), lo_info::env, lo_info::flag, RatType::group1, RatType::group2, lo_info::layer, lo_info::pad, lo_info::rat, and TEST_FLAG.

Referenced by LookupLOConnectionsToPad().

Here is the call graph for this function:

static int LOCtoPolyArc_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2289 of file find.c.

References ADD_ARC_TO_LIST(), lo_info::arc, lo_info::env, lo_info::flag, IsArcInPolygon(), lo_info::layer, lo_info::polygon, TEST_FLAG, and ArcType::Thickness.

Referenced by LookupLOConnectionsToPolygon().

Here is the call graph for this function:

static int LOCtoPolyLine_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2275 of file find.c.

References ADD_LINE_TO_LIST(), lo_info::env, lo_info::flag, IsLineInPolygon(), lo_info::layer, line, lo_info::polygon, and TEST_FLAG.

Referenced by LookupLOConnectionsToPolygon().

Here is the call graph for this function:

static int LOCtoPolyPad_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2305 of file find.c.

References ADD_PAD_TO_LIST(), BOTTOM_SIDE, lo_info::env, lo_info::flag, IsPadInPolygon(), lo_info::layer, lo_info::pad, lo_info::polygon, TEST_FLAG, and TOP_SIDE.

Referenced by LookupLOConnectionsToPolygon().

Here is the call graph for this function:

static int LOCtoPolyRat_callback ( const BoxType b,
void *  cl 
) [static]
static int LOCtoPVarc_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 633 of file find.c.

References ADD_ARC_TO_LIST(), pv_info::env, pv_info::flag, GetLayerGroupNumberByNumber(), IS_PV_ON_ARC, pv_info::layer, pv_info::pv, TEST_FLAG, and ViaIsOnLayerGroup().

Referenced by LookupLOConnectionsToPVList().

Here is the call graph for this function:

static int LOCtoPVline_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 615 of file find.c.

References ADD_LINE_TO_LIST(), pv_info::env, pv_info::flag, GetLayerGroupNumberByNumber(), pv_info::layer, line, PinLineIntersect(), pv_info::pv, TEST_FLAG, and ViaIsOnLayerGroup().

Referenced by LookupLOConnectionsToPVList().

Here is the call graph for this function:

static int LOCtoPVpad_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 651 of file find.c.

References ADD_PAD_TO_LIST(), BOTTOM_SIDE, pv_info::env, pv_info::flag, GetLayerGroupNumberBySide(), IS_PV_ON_PAD, pv_info::pv, TEST_FLAG, TOP_SIDE, and ViaIsOnLayerGroup().

Referenced by LookupLOConnectionsToPVList().

Here is the call graph for this function:

static int LOCtoPVpoly_callback ( const BoxType b,
void *  cl 
) [static]
static int LOCtoPVrat_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 668 of file find.c.

References ADD_RAT_TO_LIST(), pv_info::env, pv_info::flag, IS_PV_ON_RAT, pv_info::pv, and TEST_FLAG.

Referenced by LookupLOConnectionsToPVList().

Here is the call graph for this function:

static int LOCtoRat_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 2002 of file find.c.

References ADD_LINE_TO_LIST(), rat_info::env, rat_info::flag, rat_info::layer, line, rat_info::Point, TEST_FLAG, PointType::X, and PointType::Y.

Referenced by LookupLOConnectionsToRatEnd().

Here is the call graph for this function:

void LookupConnection ( Coord  X,
Coord  Y,
bool  AndDraw,
Coord  Range,
int  flag,
bool  AndRats 
)

Looks up all connections from the object at the given coordinates the TheFlag (normally 'FOUNDFLAG') is set for all objects found.

The objects are re-drawn if AndDraw is true, also the action is marked as undoable if AndDraw is true.

Definition at line 3148 of file find.c.

References hid_st::beep, ConnectionName(), PCBType::Data, DoIt(), Draw(), FreeConnectionLookupMemory(), GetLayerNumber(), gui, hid_actionl(), IncrementUndoSerialNumber(), InitConnectionLookup(), ListStart(), LOOKUP_FIRST, LOOKUP_MORE, max_copper_layer, PCB, ptr1, ptr2, ptr3, reassign_no_drc_flags(), SettingType::RingBellWhenFinished, SearchObjectByLocation(), Settings, SILK_TYPE, and User.

Referenced by ActionConnection(), ActionDisplay(), netlist_find(), netlist_select(), NotifyLine(), NotifyMode(), and XYtoNetLength().

Here is the call graph for this function:

void LookupConnectionByPin ( int  type,
void *  ptr1 
)

Definition at line 3203 of file find.c.

References DoIt(), FreeConnectionLookupMemory(), InitConnectionLookup(), ListStart(), and User.

Referenced by IPCD356_Netlist().

Here is the call graph for this function:

void LookupConnectionsToAllElements ( FILE *  FP)

Find all connections to pins of all element.

Definition at line 3047 of file find.c.

References hid_st::beep, ClearFlagOnAllObjects(), PCBType::Data, ELEMENT_LOOP, END_LOOP, FreeConnectionLookupMemory(), gui, InitConnectionLookup(), n, PCB, PrintElementConnections(), Redraw(), SettingType::ResetAfterElement, SettingType::RingBellWhenFinished, SEPARATE, Settings, and User.

Referenced by ActionSaveTo().

Here is the call graph for this function:

void LookupElementConnections ( ElementType Element,
FILE *  FP 
)

Find all connections to pins within one element.

Definition at line 3027 of file find.c.

References hid_st::beep, ClearFlagOnAllObjects(), Draw(), FreeConnectionLookupMemory(), gui, IncrementUndoSerialNumber(), InitConnectionLookup(), PrintElementConnections(), SettingType::RingBellWhenFinished, SetChangedFlag(), Settings, and User.

Referenced by ActionSaveTo().

Here is the call graph for this function:

static bool LookupLOConnectionsToArc ( ArcType Arc,
Cardinal  LayerGroup,
int  flag,
bool  AndRats 
) [static]

Searches all LOs that are connected to the given arc on the given layergroup.

All found connections are added to the list.

The notation that is used is:
Xij means Xj at arc i.

Definition at line 1783 of file find.c.

References ADD_POLYGON_TO_LIST(), lo_info::arc, LayerType::arc_tree, PCBType::Data, LayerGroupType::Entries, lo_info::env, expand_bounds(), lo_info::flag, IsArcInPolygon(), lo_info::layer, layer, LAYER_PTR, PCBType::LayerGroups, LayerType::line_tree, LOCtoArcArc_callback(), LOCtoArcLine_callback(), LOCtoArcPad_callback(), max_copper_layer, LayerGroupType::Number, DataType::pad_tree, PCB, lo_info::polygon, LayerType::Polygon, r_search(), and TEST_FLAG.

Referenced by LookupLOConnectionsToLOList().

Here is the call graph for this function:

static bool LookupLOConnectionsToLine ( LineType Line,
Cardinal  LayerGroup,
int  flag,
bool  PolysTo,
bool  AndRats 
) [static]

Searches all LOs that are connected to the given line on the given layergroup.

All found connections are added to the list.

The notation that is used is: Xij means Xj at line i.

Definition at line 1919 of file find.c.

References ADD_POLYGON_TO_LIST(), LayerType::arc_tree, PCBType::Data, LayerGroupType::Entries, lo_info::env, expand_bounds(), lo_info::flag, IsLineInPolygon(), layer, lo_info::layer, LAYER_PTR, PCBType::LayerGroups, lo_info::line, LayerType::line_tree, LOCtoLineArc_callback(), LOCtoLineLine_callback(), LOCtoLinePad_callback(), LOCtoLineRat_callback(), max_copper_layer, LayerGroupType::Number, DataType::pad_tree, PCB, lo_info::polygon, LayerType::Polygon, r_search(), DataType::rat_tree, and TEST_FLAG.

Referenced by LookupLOConnectionsToLOList(), and LookupLOConnectionsToPad().

Here is the call graph for this function:

static bool LookupLOConnectionsToLOList ( int  flag,
bool  AndRats 
) [static]
static bool LookupLOConnectionsToPad ( PadType Pad,
Cardinal  LayerGroup,
int  flag,
bool  AndRats 
) [static]
static bool LookupLOConnectionsToPolygon ( PolygonType Polygon,
Cardinal  LayerGroup,
int  flag,
bool  AndRats 
) [static]
static bool LookupLOConnectionsToPVList ( int  flag,
bool  AndRats 
) [static]
static bool LookupLOConnectionsToRatEnd ( PointType Point,
Cardinal  LayerGroup,
int  flag 
) [static]

Searches all LOs that are connected to the given rat-line on the given layergroup.

All found connections are added to the list.

The notation that is used is: Xij means Xj at line i.

Definition at line 2060 of file find.c.

References PCBType::Data, LayerGroupType::Entries, rat_info::env, rat_info::flag, rat_info::layer, layer, LAYER_PTR, PCBType::LayerGroups, LayerType::line_tree, LOCtoPad_callback(), LOCtoRat_callback(), max_copper_layer, LayerGroupType::Number, DataType::pad_tree, PCB, rat_info::Point, LayerType::polygon_tree, PolygonToRat_callback(), and r_search_pt().

Referenced by LookupLOConnectionsToLOList().

Here is the call graph for this function:

static bool LookupPVConnectionsToLOList ( int  flag,
bool  AndRats 
) [static]
static bool LookupPVConnectionsToPVList ( int  flag) [static]

Searches for new PVs that are connected to PVs on the list.

Definition at line 958 of file find.c.

References PCBType::Data, pv_info::env, expand_bounds(), pv_info::flag, ListType::Location, ListType::Number, PCB, DataType::pin_tree, pv_info::pv, pv_pv_callback(), PVLIST_ENTRY, r_search(), and DataType::via_tree.

Referenced by DoIt().

Here is the call graph for this function:

void LookupUnusedPins ( FILE *  FP)
static void normalize_angles ( Angle sa,
Angle d 
) [static]

Reduce arc start angle and delta to 0..360.

Definition at line 1286 of file find.c.

References NormalizeAngle().

Referenced by ArcArcIntersect(), and radius_crosses_arc().

Here is the call graph for this function:

static bool PadPadIntersect ( PadType p1,
PadType p2 
) [static]

Definition at line 438 of file find.c.

References LinePadIntersect().

Referenced by LOCtoPadPad_callback().

Here is the call graph for this function:

static void pcb_drc_violation_free ( DrcViolationType violation) [static]

Definition at line 170 of file find.c.

References drc_violation_st::explanation, and drc_violation_st::title.

Referenced by drc_callback(), DRCAll(), and DRCFind().

static DrcViolationType* pcb_drc_violation_new ( const char *  title,
const char *  explanation,
Coord  x,
Coord  y,
Angle  angle,
bool  have_measured,
Coord  measured_value,
Coord  required_value,
int  object_count,
long int *  object_id_list,
int *  object_type_list 
) [static]
bool PinLineIntersect ( PinType PV,
LineType Line 
)

Definition at line 398 of file find.c.

References Bloat, IsLineInRectangle(), IsPointInPad(), MAX, PIN_SIZE, TEST_FLAG, pin_st::X, and pin_st::Y.

Referenced by canonicalize_line(), drcVia_callback(), LOCtoPVline_callback(), and pv_line_callback().

Here is the call graph for this function:

static int PolygonToRat_callback ( const BoxType b,
void *  cl 
) [static]
static bool PrepareNextLoop ( FILE *  FP) [static]

Resets some flags for looking up the next pin/pad.

Definition at line 2861 of file find.c.

References layer, ListType::Location, max_copper_layer, Number, and ListType::Number.

Referenced by PrintAndSelectUnusedPinsAndPadsOfElement(), and PrintElementConnections().

static bool PrintAndSelectUnusedPinsAndPadsOfElement ( ElementType Element,
FILE *  FP,
int  flag 
) [static]
static void PrintConnectionElementName ( ElementType Element,
FILE *  FP 
) [static]

Writes the several names of an element to a file.

Definition at line 2593 of file find.c.

References PrintElementNameList().

Referenced by PrintAndSelectUnusedPinsAndPadsOfElement(), and PrintElementConnections().

Here is the call graph for this function:

static void PrintConnectionListEntry ( char *  ObjName,
ElementType Element,
bool  FirstOne,
FILE *  FP 
) [static]

Prints one {pin,pad,via}/element entry of connection lists.

Definition at line 2604 of file find.c.

References CreateQuotedString(), DynamicStringType::Data, and PrintElementNameList().

Referenced by PrintElementConnections(), PrintPadConnections(), and PrintPinConnections().

Here is the call graph for this function:

static bool PrintElementConnections ( ElementType Element,
FILE *  FP,
int  flag,
bool  AndDraw 
) [static]

Finds all connections to the pins of the passed element.

The result is written to file FP.

Returns:
true if operation was aborted.

Definition at line 2892 of file find.c.

References ADD_PAD_TO_LIST(), ADD_PV_TO_LIST(), BOTTOM_SIDE, DoIt(), EMPTY, END_LOOP, layer, pad_st::Name, pin_st::Name, lo_info::pad, PAD_LOOP, pin, PIN_LOOP, PrepareNextLoop(), PrintConnectionElementName(), PrintConnectionListEntry(), PrintPadConnections(), PrintPinConnections(), TEST_FLAG, and TOP_SIDE.

Referenced by LookupConnectionsToAllElements(), and LookupElementConnections().

Here is the call graph for this function:

static void PrintElementNameList ( ElementType Element,
FILE *  FP 
) [static]

Writes the several names of an element to a file.

Definition at line 2579 of file find.c.

References CreateQuotedString(), DynamicStringType::Data, DESCRIPTION_NAME, EMPTY, NAMEONPCB_NAME, and VALUE_NAME.

Referenced by PrintConnectionElementName(), and PrintConnectionListEntry().

Here is the call graph for this function:

static void PrintPadConnections ( Cardinal  Layer,
FILE *  FP,
bool  IsFirst 
) [static]

Prints all found connections of a pads to file FP the connections are stacked in 'PadList'.

Definition at line 2627 of file find.c.

References pad_st::Element, EMPTY, Layer, pad_st::Name, ListType::Number, Number, PADLIST_ENTRY, PrintConnectionListEntry(), ptr, and UNKNOWN.

Referenced by PrintElementConnections().

Here is the call graph for this function:

static void PrintPinConnections ( FILE *  FP,
bool  IsFirst 
) [static]

Prints all found connections of a pin to file FP the connections are stacked in 'PVList'.

Definition at line 2663 of file find.c.

References pin_st::Element, EMPTY, pin_st::Name, ListType::Number, PrintConnectionListEntry(), and PVLIST_ENTRY.

Referenced by PrintElementConnections().

Here is the call graph for this function:

static int pv_arc_callback ( const BoxType b,
void *  cl 
) [static]
static int pv_line_callback ( const BoxType b,
void *  cl 
) [static]
static int pv_pad_callback ( const BoxType b,
void *  cl 
) [static]
static int pv_poly_callback ( const BoxType b,
void *  cl 
) [static]
static int pv_pv_callback ( const BoxType b,
void *  cl 
) [static]
static int pv_rat_callback ( const BoxType b,
void *  cl 
) [static]

Definition at line 1116 of file find.c.

References ADD_PV_TO_LIST(), lo_info::flag, IS_PV_ON_RAT, lo_info::rat, and TEST_FLAG.

Referenced by LookupPVConnectionsToLOList().

Here is the call graph for this function:

static bool PV_TOUCH_PV ( PinType PV1,
PinType PV2 
) [inline, static]

Definition at line 444 of file find.c.

References Bloat, BoxBoxIntersection(), IsPointOnPin(), MAX, TEST_FLAG, pin_st::Thickness, pin_st::X, BoxType::X1, BoxType::X2, pin_st::Y, BoxType::Y1, and BoxType::Y2.

Referenced by pv_pv_callback().

Here is the call graph for this function:

static int radius_crosses_arc ( double  x,
double  y,
ArcType arc 
) [static]

Definition at line 1299 of file find.c.

References ArcType::Delta, normalize_angles(), RAD_TO_DEG, ArcType::StartAngle, ArcType::X, and ArcType::Y.

Referenced by ArcArcIntersect().

Here is the call graph for this function:

void RatFindHook ( int  type,
void *  ptr1,
void *  ptr2,
void *  ptr3,
bool  undo,
int  flag,
bool  AndRats 
)

Find connections for rats nesting.

Assumes InitConnectionLookup() has already been done.

Definition at line 3222 of file find.c.

References DoIt(), DumpList(), ListStart(), and User.

Referenced by GatherSubnets(), gsvit_create_netlist(), nbcb_select_common(), and netlist_select_cb().

Here is the call graph for this function:

static void reassign_no_drc_flags ( void  ) [static]

Definition at line 2710 of file find.c.

References AttributeGet, layer, LAYER_PTR, max_copper_layer, and LayerType::no_drc.

Referenced by DoIt(), and LookupConnection().

static void reset_drc_dialog_message ( void  ) [static]

Definition at line 179 of file find.c.

References drc_dialog_message, hid_st::drc_gui, FALSE, gui, and HID_DRC_GUI::reset_drc_dialog_message.

Referenced by DRCAll(), and throw_drc_dialog().

bool SetThing ( int  type,
void *  ptr1,
void *  ptr2,
void *  ptr3 
) [static]

Definition at line 418 of file find.c.

References ptr1, ptr2, ptr3, thing_ptr1, thing_ptr2, thing_ptr3, and thing_type.

Referenced by add_object_to_list(), drc_callback(), and DRCAll().

static int throw_drc_dialog ( void  ) [static]

Message when asked about continuing DRC checks after next violation is found.

Definition at line 238 of file find.c.

References append_drc_dialog_message(), hid_st::confirm_dialog, DRC_CANCEL, DRC_CONTINUE, drc_dialog_message, hid_st::drc_gui, DRC_NEXT, gui, reset_drc_dialog_message(), and HID_DRC_GUI::throw_drc_dialog.

Referenced by drc_callback(), DRCAll(), and DRCFind().

Here is the call graph for this function:


Variable Documentation

ListType ArcList[MAX_LAYER]

Definition at line 280 of file find.c.

bool drc = false [static]

Whether to stop if finding something not found.

Definition at line 277 of file find.c.

Referenced by add_object_to_list(), and DRCFind().

GString* drc_dialog_message [static]

Definition at line 177 of file find.c.

Referenced by append_drc_dialog_message(), reset_drc_dialog_message(), and throw_drc_dialog().

Count of drc errors

Definition at line 278 of file find.c.

Referenced by drc_callback(), DRCAll(), and DRCFind().

ListType LineList[MAX_LAYER] [static]

List of objects to.

Definition at line 280 of file find.c.

Definition at line 280 of file find.c.

ListType PolygonList[MAX_LAYER]

Definition at line 280 of file find.c.

Definition at line 280 of file find.c.

Definition at line 280 of file find.c.

void* thing_ptr1 [static]

Definition at line 274 of file find.c.

Referenced by DRCFind(), GotoError(), and SetThing().

void * thing_ptr2

Definition at line 274 of file find.c.

Referenced by DRCFind(), and SetThing().

void * thing_ptr3

Definition at line 274 of file find.c.

Referenced by BuildObjectList(), DRCFind(), LocateError(), and SetThing().

int thing_type [static]

Definition at line 275 of file find.c.

Referenced by BuildObjectList(), DRCFind(), GotoError(), LocateError(), and SetThing().

Cardinal TotalP [static]

Definition at line 279 of file find.c.

Referenced by InitLayoutLookup(), and LookupPVConnectionsToLOList().

Definition at line 279 of file find.c.

Referenced by InitLayoutLookup(), and LookupPVConnectionsToLOList().