Tag physically/logically connected items differently in the "Find" action
[geda-pcb/pcjc2.git] / src / global.h
blob91cb74a479c0e8869ef2c66055d8db8f6b5ef272
1 /*
2 * COPYRIGHT
4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996, 2004 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
27 /* definition of types
30 /* Change History:
31 * 10/11/96 11:37 AJF Added support for a Text() driver function.
32 * This was done out of a pressing need to force text to be printed on the
33 * silkscreen layer. Perhaps the design is not the best.
36 #ifndef PCB_GLOBAL_H
37 #define PCB_GLOBAL_H
39 #ifdef HAVE_CONFIG_H
40 #include "config.h"
41 #endif
43 #include "const.h"
44 #include "macro.h"
46 #ifdef HAVE_STDINT_H
47 #include <stdint.h>
48 #endif
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <string.h>
52 #include <strings.h>
53 #include <stdarg.h>
54 #include <math.h>
55 #include <ctype.h>
56 #include <sys/types.h>
57 #include <stdbool.h>
58 #include <glib.h>
60 /* Forward declarations for structures the HIDs need. */
61 typedef struct BoxType BoxType;
62 typedef struct polygon_st PolygonType;
63 typedef struct pad_st PadType;
64 typedef struct pin_st PinType;
65 typedef struct drc_violation_st DrcViolationType;
66 typedef struct rtree rtree_t;
67 typedef struct AttributeListType AttributeListType;
69 typedef struct unit Unit;
70 typedef struct increments Increments;
72 typedef COORD_TYPE Coord; /* pcb base unit */
73 typedef double Angle; /* degrees */
75 #include "hid.h"
76 #include "polyarea.h"
78 /* Internationalization support. */
79 #ifdef ENABLE_NLS
80 # include <libintl.h>
81 # define _(S) gettext(S)
82 # if defined(gettext_noop)
83 # define N_(S) gettext_noop(S)
84 # else
85 # define N_(S) (S)
86 # endif
87 #else
88 # define _(S) (S)
89 # define N_(S) (S)
90 # define textdomain(S) (S)
91 # define gettext(S) (S)
92 # define dgettext(D, S) (S)
93 # define dcgettext(D, S, T) (S)
94 # define bindtextdomain(D, Dir) (D)
95 #endif /* ENABLE_NLS */
97 /* This is used by the lexer/parser */
98 typedef struct {
99 int ival;
100 Coord bval;
101 double dval;
102 char has_units;
103 } PLMeasure;
105 #ifndef XtSpecificationRelease
106 typedef unsigned int Cardinal;
107 /*typedef unsigned int Pixel;*/
108 typedef char *String;
109 typedef short Position;
110 typedef short Dimension;
111 #endif
112 typedef unsigned char BYTE;
114 /* Nobody should know about the internals of this except the macros in
115 macros.h that access it. This structure must be simple-assignable
116 for now. */
117 typedef struct
119 unsigned long f; /* generic flags */
120 unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */
121 } FlagType;
123 #ifndef __GNUC__
124 #define __FUNCTION1(a,b) a ":" #b
125 #define __FUNCTION2(a,b) __FUNCTION1(a,b)
126 #define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__)
127 #endif
130 /* ---------------------------------------------------------------------------
131 * Macros to annotate branch-prediction information.
132 * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have
133 * been removed to avoid namespace clashes.
136 /* The LIKELY and UNLIKELY macros let the programmer give hints to
137 * the compiler about the expected result of an expression. Some compilers
138 * can use this information for optimizations.
140 * The PCB_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
141 * putting assignments inside the test.
143 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
144 #define PCB_BOOLEAN_EXPR(expr) \
145 __extension__ ({ \
146 int _boolean_var_; \
147 if (expr) \
148 _boolean_var_ = 1; \
149 else \
150 _boolean_var_ = 0; \
151 _boolean_var_; \
153 #define LIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 1))
154 #define UNLIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 0))
155 #else
156 #define LIKELY(expr) (expr)
157 #define UNLIKELY(expr) (expr)
158 #endif
161 /* ---------------------------------------------------------------------------
162 * Do not change the following definitions even if they're not very
163 * nice. It allows us to have functions act on these "base types" and
164 * not need to know what kind of actual object they're working on.
167 /* Any object that uses the "object flags" defined in const.h, or
168 exists as an object on the pcb, MUST be defined using this as the
169 first fields, either directly or through ANYLINEFIELDS. */
170 #define ANYOBJECTFIELDS \
171 BoxType BoundingBox; \
172 long int ID; \
173 FlagType Flags; \
174 // struct LibraryEntryType *net
176 /* Lines, pads, and rats all use this so they can be cross-cast. */
177 #define ANYLINEFIELDS \
178 ANYOBJECTFIELDS; \
179 Coord Thickness, \
180 Clearance; \
181 PointType Point1, \
182 Point2
184 /* ---------------------------------------------------------------------------
185 * some useful values of our widgets
187 typedef struct /* holds information about output window */
189 hidGC bgGC, /* background and foreground; */
190 fgGC, /* changed from some routines */
191 pmGC; /* depth 1 pixmap GC to store clip */
193 OutputType;
195 /* ----------------------------------------------------------------------
196 * layer group. A layer group identifies layers which are always switched
197 * on/off together.
199 typedef struct
201 Cardinal Number[MAX_LAYER], /* number of entries per groups */
202 Entries[MAX_LAYER][MAX_LAYER + 2];
203 } LayerGroupType;
205 struct BoxType /* a bounding box */
207 Coord X1, Y1; /* upper left */
208 Coord X2, Y2; /* and lower right corner */
211 typedef struct
213 Coord x, y;
214 Coord width, height;
215 } RectangleType;
217 typedef struct
219 char *name;
220 char *value;
221 } AttributeType;
223 struct AttributeListType
225 int Number, Max;
226 AttributeType *List;
229 /* ---------------------------------------------------------------------------
230 * the basic object types supported by PCB
233 /* All on-pcb objects (elements, lines, pads, vias, rats, etc) are
234 based on this. */
235 typedef struct {
236 ANYOBJECTFIELDS;
237 } AnyObjectType;
239 typedef struct /* a line/polygon point */
241 Coord X, Y, X2, Y2; /* so Point type can be cast as BoxType */
242 long int ID;
243 } PointType;
245 /* Lines, rats, pads, etc. */
246 typedef struct {
247 ANYLINEFIELDS;
248 } AnyLineObjectType;
250 typedef struct /* holds information about one line */
252 ANYLINEFIELDS;
253 char *Number;
254 } LineType;
256 typedef struct
258 ANYOBJECTFIELDS;
259 int Scale; /* text scaling in percent */
260 Coord X, Y; /* origin */
261 BYTE Direction;
262 char *TextString; /* string */
263 void *Element;
264 } TextType;
266 struct polygon_st /* holds information about a polygon */
268 ANYOBJECTFIELDS;
269 Cardinal PointN, /* number of points in polygon */
270 PointMax; /* max number from malloc() */
271 POLYAREA *Clipped; /* the clipped region of this polygon */
272 PLINE *NoHoles; /* the polygon broken into hole-less regions */
273 int NoHolesValid; /* Is the NoHoles polygon up to date? */
274 PointType *Points; /* data */
275 Cardinal *HoleIndex; /* Index of hole data within the Points array */
276 Cardinal HoleIndexN; /* number of holes in polygon */
277 Cardinal HoleIndexMax; /* max number from malloc() */
281 typedef struct /* holds information about arcs */
283 ANYOBJECTFIELDS;
284 Coord Thickness, Clearance;
285 PointType Point1;
286 PointType Point2;
287 Coord Width, Height, /* length of axis */
288 X, Y; /* center coordinates */
289 Angle StartAngle, Delta; /* the two limiting angles in degrees */
290 } ArcType;
292 struct rtree
294 struct rtree_node *root;
295 int size; /* number of entries in tree */
298 typedef struct /* holds information about one layer */
300 char *Name; /* layer name */
301 Cardinal LineN, /* number of lines */
302 TextN, /* labels */
303 PolygonN, /* polygons */
304 ArcN; /* and arcs */
305 GList *Line;
306 GList *Text;
307 GList *Polygon;
308 GList *Arc;
309 rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree;
310 bool On; /* visible flag */
311 char *Color, /* color */
312 *SelectedColor;
313 AttributeListType Attributes;
314 int no_drc; /* whether to ignore the layer when checking the design rules */
316 LayerType;
318 typedef struct /* a rat-line */
320 ANYLINEFIELDS;
321 Cardinal group1, group2; /* the layer group each point is on */
322 } RatType;
324 struct pad_st /* a SMD pad */
326 ANYLINEFIELDS;
327 Coord Mask;
328 char *Name, *Number; /* 'Line' */
329 void *Element;
330 void *Spare;
333 struct pin_st
335 ANYOBJECTFIELDS;
336 Coord Thickness, Clearance, Mask, DrillingHole;
337 Coord X, Y; /* center and diameter */
338 char *Name, *Number;
339 void *Element;
340 void *Spare;
343 /* This is the extents of a Pin or Via, depending on whether it's a
344 hole or not. */
345 #define PIN_SIZE(pinptr) (TEST_FLAG(HOLEFLAG, (pinptr)) \
346 ? (pinptr)->DrillingHole \
347 : (pinptr)->Thickness)
349 typedef struct
351 ANYOBJECTFIELDS;
352 TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */
353 /* description text */
354 /* name on PCB second, */
355 /* value third */
356 /* see macro.h */
357 Coord MarkX, MarkY; /* position mark */
358 Cardinal PinN; /* number of pins */
359 Cardinal PadN; /* number of pads */
360 Cardinal LineN; /* number of lines */
361 Cardinal ArcN; /* number of arcs */
362 GList *Pin;
363 GList *Pad;
364 GList *Line;
365 GList *Arc;
366 BoxType VBox;
367 AttributeListType Attributes;
368 } ElementType;
370 /* ---------------------------------------------------------------------------
371 * symbol and font related stuff
373 typedef struct /* a single symbol */
375 LineType *Line;
376 bool Valid;
377 Cardinal LineN, /* number of lines */
378 LineMax;
379 Coord Width, Height, /* size of cell */
380 Delta; /* distance to next symbol */
381 } SymbolType;
383 typedef struct /* complete set of symbols */
385 Coord MaxHeight, /* maximum cell width and height */
386 MaxWidth;
387 BoxType DefaultSymbol; /* the default symbol is a filled box */
388 SymbolType Symbol[MAX_FONTPOSITION + 1];
389 bool Valid;
390 } FontType;
392 typedef struct /* holds all objects */
394 Cardinal ViaN, /* number of vias */
395 ElementN, /* and elements */
396 RatN; /* and rat-lines */
397 int LayerN; /* number of layers in this board */
398 GList *Via;
399 GList *Element;
400 GList *Rat;
401 rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */
402 *rat_tree;
403 struct PCBType *pcb;
404 LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */
405 int polyClip;
406 } DataType;
408 typedef struct /* holds drill information */
410 Coord DrillSize; /* this drill's diameter */
411 Cardinal ElementN, /* the number of elements using this drill size */
412 ElementMax, /* max number of elements from malloc() */
413 PinCount, /* number of pins drilled this size */
414 ViaCount, /* number of vias drilled this size */
415 UnplatedCount, /* number of these holes that are unplated */
416 PinN, /* number of drill coordinates in the list */
417 PinMax; /* max number of coordinates from malloc() */
418 PinType **Pin; /* coordinates to drill */
419 ElementType **Element; /* a pointer to an array of element pointers */
420 } DrillType;
422 typedef struct /* holds a range of Drill Infos */
424 Cardinal DrillN, /* number of drill sizes */
425 DrillMax; /* max number from malloc() */
426 DrillType *Drill; /* plated holes */
427 } DrillInfoType;
429 typedef struct
431 Coord Thick, /* line thickness */
432 Diameter, /* via diameter */
433 Hole, /* via drill hole */
434 Keepaway; /* min. separation from other nets */
435 char *Name;
436 int index;
437 } RouteStyleType;
439 /* ---------------------------------------------------------------------------
440 * structure used by library routines
442 typedef struct
444 char *ListEntry; /* the string for the selection box */
445 char *AllocatedMemory, /* pointer to allocated memory; all others */
446 /* point to parts of the string */
447 *Template, /* m4 template name */
448 *Package, /* package */
449 *Value, /* the value field */
450 *Description; /* some descritional text */
451 } LibraryEntryType;
453 /* If the internal flag is set, the only field that is valid is Name,
454 and the struct is allocated with malloc instead of
455 CreateLibraryEntry. These "internal" entries are used for
456 electrical paths that aren't yet assigned to a real net. */
458 typedef struct
460 char *Name, /* name of the menu entry */
461 *directory, /* Directory name library elements are from */
462 *Style; /* routing style */
463 Cardinal EntryN, /* number of objects */
464 EntryMax; /* number of reserved memory locations */
465 LibraryEntryType *Entry; /* the entries */
466 char flag; /* used by the netlist window to enable/disable nets */
467 char internal; /* if set, this is an internal-only entry, not
468 part of the global netlist. */
469 } LibraryMenuType;
471 typedef struct
473 Cardinal MenuN; /* number of objects */
474 Cardinal MenuMax; /* number of reserved memory locations */
475 LibraryMenuType *Menu; /* the entries */
476 } LibraryType;
479 /* The PCBType struct holds information about board layout most of which is
480 | saved with the layout. A new PCB layout struct is first initialized
481 | with values from the user configurable Settings struct and then reset
482 | to the saved layout values when a layout is loaded.
483 | This struct is also used for the remove list and for buffer handling
485 typedef struct PCBType
487 long ID; /* see macro.h */
488 FlagType Flags;
489 char *Name, /* name of board */
490 *Filename, /* name of file (from load) */
491 *PrintFilename, /* from print dialog */
492 *Netlistname, /* name of netlist file */
493 ThermStyle; /* type of thermal to place with thermal tool */
494 bool Changed, /* layout has been changed */
495 ViaOn, /* visibility flags */
496 ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */
497 RatDraw; /* we're drawing rats */
498 char *ViaColor, /* some colors */
499 *ViaSelectedColor,
500 *PinColor,
501 *PinSelectedColor,
502 *PinNameColor,
503 *ElementColor,
504 *RatColor,
505 *InvisibleObjectsColor,
506 *InvisibleMarkColor,
507 *ElementSelectedColor,
508 *RatSelectedColor, *ConnectedColor, *FoundColor, *WarnColor, *MaskColor;
509 long CursorX, /* cursor position as saved with layout */
510 CursorY, Clipping;
511 Coord Bloat, /* drc sizes saved with layout */
512 Shrink, minWid, minSlk, minDrill, minRing;
513 Coord GridOffsetX, /* as saved with layout */
514 GridOffsetY;
515 /* TODO: Set this always to MAX_COORD, no saving needed.
516 Kept for compatibility and until the GUI code can deal
517 with the dynamic extent. */
518 Coord MaxWidth, MaxHeight; /* allowed size */
519 Coord ExtentMinX, ExtentMinY, /* extent, defined by the outline layer */
520 ExtentMaxX, ExtentMaxY;
522 Coord Grid; /* used grid with offsets */
523 double IsleArea, /* minimum poly island to retain */
524 ThermScale; /* scale factor used with thermals */
525 FontType Font;
526 LayerGroupType LayerGroups;
527 RouteStyleType RouteStyle[NUM_STYLES];
528 LibraryType NetlistLib;
529 AttributeListType Attributes;
530 DataType *Data; /* entire database */
532 bool is_footprint; /* If set, the user has loaded a footprint, not a pcb. */
534 PCBType;
536 typedef struct /* information about the paste buffer */
538 Coord X, Y; /* offset */
539 BoxType BoundingBox;
540 DataType *Data; /* data; not all members of PCBType */
541 /* are used */
542 } BufferType;
544 /* ---------------------------------------------------------------------------
545 * some types for cursor drawing, setting of block and lines
546 * as well as for merging of elements
548 typedef struct /* rubberband lines for element moves */
550 LayerType *Layer; /* layer that holds the line */
551 LineType *Line; /* the line itself */
552 PointType *MovedPoint; /* and finally the point */
553 } RubberbandType;
555 typedef struct /* current marked line */
557 PointType Point1, /* start- and end-position */
558 Point2;
559 long int State;
560 bool draw;
561 } AttachedLineType;
563 typedef struct /* currently marked block */
565 PointType Point1, /* start- and end-position */
566 Point2;
567 long int State;
568 bool otherway;
569 } AttachedBoxType;
571 typedef struct /* currently attached object */
573 Coord X, Y; /* saved position when MOVE_MODE */
574 BoxType BoundingBox;
575 long int Type, /* object type */
576 State;
577 void *Ptr1, /* three pointers to data, see */
578 *Ptr2, /* search.c */
579 *Ptr3;
580 Cardinal RubberbandN, /* number of lines in array */
581 RubberbandMax;
582 RubberbandType *Rubberband;
583 } AttachedObjectType;
585 enum crosshair_shape
587 Basic_Crosshair_Shape = 0, /* 4-ray */
588 Union_Jack_Crosshair_Shape, /* 8-ray */
589 Dozen_Crosshair_Shape, /* 12-ray */
590 Crosshair_Shapes_Number
593 typedef struct /* holds cursor information */
595 hidGC GC, /* GC for cursor drawing */
596 AttachGC; /* and for displaying buffer contents */
597 Coord X, Y, /* position in PCB coordinates */
598 MinX, MinY, /* lowest and highest coordinates */
599 MaxX, MaxY;
600 AttachedLineType AttachedLine; /* data of new lines... */
601 AttachedBoxType AttachedBox;
602 PolygonType AttachedPolygon;
603 AttachedObjectType AttachedObject; /* data of attached objects */
604 enum crosshair_shape shape; /* shape of crosshair */
605 } CrosshairType;
607 typedef struct
609 bool status;
610 Coord X, Y;
611 } MarkType;
613 /* ---------------------------------------------------------------------------
614 * our resources
615 * most of them are used as default when a new design is started
617 typedef struct /* some resources... */
619 const Unit *grid_unit;
620 Increments *increments;
622 int verbose;
624 char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */
625 *CrosshairColor, /* different object colors */
626 *CrossColor,
627 *ViaColor,
628 *ViaSelectedColor,
629 *PinColor,
630 *PinSelectedColor,
631 *PinNameColor,
632 *ElementColor,
633 *RatColor,
634 *InvisibleObjectsColor,
635 *InvisibleMarkColor,
636 *ElementSelectedColor,
637 *RatSelectedColor,
638 *ConnectedColor,
639 *FoundColor,
640 *OffLimitColor,
641 *GridColor,
642 *LayerColor[MAX_LAYER],
643 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
644 Coord ViaThickness, /* some preset values */
645 ViaDrillingHole, LineThickness, RatThickness, Keepaway, /* default size of a new layout */
646 MaxWidth, MaxHeight,
647 AlignmentDistance, Bloat, /* default drc sizes */
648 Shrink, minWid, minSlk, minDrill, minRing;
649 int TextScale; /* text scaling in % */
650 Coord Grid; /* grid in pcb-units */
651 double IsleArea; /* polygon min area */
652 int PinoutNameLength, /* max displayed length of a pinname */
653 Volume, /* the speakers volume -100..100 */
654 CharPerLine, /* width of an output line in characters */
655 Mode, /* currently active mode */
656 BufferNumber; /* number of the current buffer */
657 int BackupInterval; /* time between two backups in seconds */
658 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
659 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
660 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
661 *Groups, /* string with layergroups */
662 *Routes, /* string with route styles */
663 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
664 *BackgroundImage, /* PPM file for board background */
665 *ScriptFilename, /* PCB Actions script to execute on startup */
666 *ActionString, /* PCB Actions string to execute on startup */
667 *FabAuthor, /* Full name of author for FAB drawings */
668 *GnetlistProgram, /* gnetlist program name */
669 *MakeProgram, /* make program name */
670 *InitialLayerStack; /* If set, the initial layer stack is set to this */
671 Coord PinoutOffsetX, /* offset of origin */
672 PinoutOffsetY;
673 Coord PinoutTextOffsetX, /* offset of text from pin center */
674 PinoutTextOffsetY;
675 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
676 LayerGroupType LayerGroups; /* default layer groups */
677 bool ClearLine, FullPoly,
678 UniqueNames, /* force unique names */
679 SnapPin, /* snap to pins and pads */
680 ShowSolderSide, /* mirror output */
681 SaveLastCommand, /* save the last command entered by user */
682 SaveInTMP, /* always save data in /tmp */
683 DrawGrid, /* draw grid points */
684 RatWarn, /* rats nest has set warnings */
685 StipplePolygons, /* draw polygons with stipple */
686 AllDirectionLines, /* enable lines to all directions */
687 RubberBandMode, /* move, rotate use rubberband connections */
688 SwapStartDirection, /* change starting direction after each click */
689 ShowDRC, /* show drc region on crosshair */
690 AutoDRC, /* */
691 ShowNumber, /* pinout shows number */
692 OrthogonalMoves, /* */
693 ResetAfterElement, /* reset connections after each element */
694 liveRouting, /* autorouter shows tracks in progress */
695 RingBellWhenFinished, /* flag if a signal should be */
696 /* produced when searching of */
697 /* connections is done */
698 AutoPlace; /* flag which says we should force placement of the
699 windows on startup */
701 SettingType;
703 /* ----------------------------------------------------------------------
704 * pointer to low-level copy, move and rotate functions
706 typedef struct
708 void *(*Line) (LayerType *, LineType *);
709 void *(*Text) (LayerType *, TextType *);
710 void *(*Polygon) (LayerType *, PolygonType *);
711 void *(*Via) (PinType *);
712 void *(*Element) (ElementType *);
713 void *(*ElementName) (ElementType *);
714 void *(*Pin) (ElementType *, PinType *);
715 void *(*Pad) (ElementType *, PadType *);
716 void *(*LinePoint) (LayerType *, LineType *, PointType *);
717 void *(*Point) (LayerType *, PolygonType *, PointType *);
718 void *(*Arc) (LayerType *, ArcType *);
719 void *(*Rat) (RatType *);
720 } ObjectFunctionType;
722 /* ---------------------------------------------------------------------------
723 * structure used by device drivers
726 typedef struct /* holds a connection */
728 Coord X, Y; /* coordinate of connection */
729 long int type; /* type of object in ptr1 - 3 */
730 void *ptr1, *ptr2; /* the object of the connection */
731 Cardinal group; /* the layer group of the connection */
732 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
733 } ConnectionType;
735 typedef struct /* holds a net of connections */
737 Cardinal ConnectionN, /* the number of connections contained */
738 ConnectionMax; /* max connections from malloc */
739 ConnectionType *Connection;
740 RouteStyleType *Style;
741 } NetType;
743 typedef struct /* holds a list of nets */
745 Cardinal NetN, /* the number of subnets contained */
746 NetMax; /* max subnets from malloc */
747 NetType *Net;
748 } NetListType;
750 typedef struct /* holds a list of net lists */
752 Cardinal NetListN, /* the number of net lists contained */
753 NetListMax; /* max net lists from malloc */
754 NetListType *NetList;
755 } NetListListType;
757 typedef struct /* holds a generic list of pointers */
759 Cardinal PtrN, /* the number of pointers contained */
760 PtrMax; /* max subnets from malloc */
761 void **Ptr;
762 } PointerListType;
764 typedef struct
766 Cardinal BoxN, /* the number of boxes contained */
767 BoxMax; /* max boxes from malloc */
768 BoxType *Box;
770 } BoxListType;
772 struct drc_violation_st
774 char *title;
775 char *explanation;
776 Coord x, y;
777 Angle angle;
778 int have_measured;
779 Coord measured_value;
780 Coord required_value;
781 int object_count;
782 long int *object_id_list;
783 int *object_type_list;
786 /* ---------------------------------------------------------------------------
787 * define supported types of undo operations
788 * note these must be separate bits now
790 #define UNDO_CHANGENAME 0x0001 /* change of names */
791 #define UNDO_MOVE 0x0002 /* moving objects */
792 #define UNDO_REMOVE 0x0004 /* removing objects */
793 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
794 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
795 #define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */
796 #define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */
797 #define UNDO_ROTATE 0x0080 /* rotations */
798 #define UNDO_CREATE 0x0100 /* creation of objects */
799 #define UNDO_MOVETOLAYER 0x0200 /* moving objects to */
800 #define UNDO_FLAG 0x0400 /* toggling SELECTED flag */
801 #define UNDO_CHANGESIZE 0x0800 /* change size of object */
802 #define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */
803 #define UNDO_MIRROR 0x2000 /* change side of board */
804 #define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */
805 #define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */
806 #define UNDO_CHANGEANGLES 0x10000 /* change arc angles */
807 #define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */
808 #define UNDO_CLEAR 0x40000 /* clear/restore to polygons */
809 #define UNDO_NETLISTCHANGE 0x80000 /* netlist change */
812 /* ---------------------------------------------------------------------------
813 * add a macro for wrapping RCS ID's in so that ident will still work
814 * but we won't get as many compiler warnings
817 #ifndef GCC_VERSION
818 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
819 #endif /* GCC_VERSION */
821 #if GCC_VERSION > 2007
822 #define ATTRIBUTE_UNUSED __attribute__((unused))
823 #else
824 #define ATTRIBUTE_UNUSED
825 #endif
827 /* ---------------------------------------------------------------------------
828 * Macros called by various action routines to show usage or to report
829 * a syntax error and fail
831 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
832 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
834 /* ---------------------------------------------------------------------------
835 * Variables with absolute paths to various directories. These are deduced
836 * at runtime to allow pcb to be relocatable
838 extern char *bindir; /* The dir in which PCB installation was found */
839 extern char *pcblibdir; /* The system M4 fp directory */
840 extern char *pcblibpath; /* The search path for M4 fps */
841 extern char *pcbtreedir; /* The system newlib fp directory */
842 extern char *pcbtreepath; /* The search path for newlib fps */
843 extern char *exec_prefix;
844 extern char *homedir;
846 #endif /* PCB_GLOBAL_H */