Remove calls to SaveFindFlag()
[geda-pcb/pcjc2.git] / src / global.h
blob7b966dc53c2374d7b6bce4d7efb5599bbbc4fc17
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, *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 *OffLimitColor,
640 *GridColor,
641 *LayerColor[MAX_LAYER],
642 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
643 Coord ViaThickness, /* some preset values */
644 ViaDrillingHole, LineThickness, RatThickness, Keepaway, /* default size of a new layout */
645 MaxWidth, MaxHeight,
646 AlignmentDistance, Bloat, /* default drc sizes */
647 Shrink, minWid, minSlk, minDrill, minRing;
648 int TextScale; /* text scaling in % */
649 Coord Grid; /* grid in pcb-units */
650 double IsleArea; /* polygon min area */
651 int PinoutNameLength, /* max displayed length of a pinname */
652 Volume, /* the speakers volume -100..100 */
653 CharPerLine, /* width of an output line in characters */
654 Mode, /* currently active mode */
655 BufferNumber; /* number of the current buffer */
656 int BackupInterval; /* time between two backups in seconds */
657 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
658 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
659 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
660 *Groups, /* string with layergroups */
661 *Routes, /* string with route styles */
662 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
663 *BackgroundImage, /* PPM file for board background */
664 *ScriptFilename, /* PCB Actions script to execute on startup */
665 *ActionString, /* PCB Actions string to execute on startup */
666 *FabAuthor, /* Full name of author for FAB drawings */
667 *GnetlistProgram, /* gnetlist program name */
668 *MakeProgram, /* make program name */
669 *InitialLayerStack; /* If set, the initial layer stack is set to this */
670 Coord PinoutOffsetX, /* offset of origin */
671 PinoutOffsetY;
672 Coord PinoutTextOffsetX, /* offset of text from pin center */
673 PinoutTextOffsetY;
674 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
675 LayerGroupType LayerGroups; /* default layer groups */
676 bool ClearLine, FullPoly,
677 UniqueNames, /* force unique names */
678 SnapPin, /* snap to pins and pads */
679 ShowSolderSide, /* mirror output */
680 SaveLastCommand, /* save the last command entered by user */
681 SaveInTMP, /* always save data in /tmp */
682 DrawGrid, /* draw grid points */
683 RatWarn, /* rats nest has set warnings */
684 StipplePolygons, /* draw polygons with stipple */
685 AllDirectionLines, /* enable lines to all directions */
686 RubberBandMode, /* move, rotate use rubberband connections */
687 SwapStartDirection, /* change starting direction after each click */
688 ShowDRC, /* show drc region on crosshair */
689 AutoDRC, /* */
690 ShowNumber, /* pinout shows number */
691 OrthogonalMoves, /* */
692 ResetAfterElement, /* reset connections after each element */
693 liveRouting, /* autorouter shows tracks in progress */
694 RingBellWhenFinished, /* flag if a signal should be */
695 /* produced when searching of */
696 /* connections is done */
697 AutoPlace; /* flag which says we should force placement of the
698 windows on startup */
700 SettingType;
702 /* ----------------------------------------------------------------------
703 * pointer to low-level copy, move and rotate functions
705 typedef struct
707 void *(*Line) (LayerType *, LineType *);
708 void *(*Text) (LayerType *, TextType *);
709 void *(*Polygon) (LayerType *, PolygonType *);
710 void *(*Via) (PinType *);
711 void *(*Element) (ElementType *);
712 void *(*ElementName) (ElementType *);
713 void *(*Pin) (ElementType *, PinType *);
714 void *(*Pad) (ElementType *, PadType *);
715 void *(*LinePoint) (LayerType *, LineType *, PointType *);
716 void *(*Point) (LayerType *, PolygonType *, PointType *);
717 void *(*Arc) (LayerType *, ArcType *);
718 void *(*Rat) (RatType *);
719 } ObjectFunctionType;
721 /* ---------------------------------------------------------------------------
722 * structure used by device drivers
725 typedef struct /* holds a connection */
727 Coord X, Y; /* coordinate of connection */
728 long int type; /* type of object in ptr1 - 3 */
729 void *ptr1, *ptr2; /* the object of the connection */
730 Cardinal group; /* the layer group of the connection */
731 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
732 } ConnectionType;
734 typedef struct /* holds a net of connections */
736 Cardinal ConnectionN, /* the number of connections contained */
737 ConnectionMax; /* max connections from malloc */
738 ConnectionType *Connection;
739 RouteStyleType *Style;
740 } NetType;
742 typedef struct /* holds a list of nets */
744 Cardinal NetN, /* the number of subnets contained */
745 NetMax; /* max subnets from malloc */
746 NetType *Net;
747 } NetListType;
749 typedef struct /* holds a list of net lists */
751 Cardinal NetListN, /* the number of net lists contained */
752 NetListMax; /* max net lists from malloc */
753 NetListType *NetList;
754 } NetListListType;
756 typedef struct /* holds a generic list of pointers */
758 Cardinal PtrN, /* the number of pointers contained */
759 PtrMax; /* max subnets from malloc */
760 void **Ptr;
761 } PointerListType;
763 typedef struct
765 Cardinal BoxN, /* the number of boxes contained */
766 BoxMax; /* max boxes from malloc */
767 BoxType *Box;
769 } BoxListType;
771 struct drc_violation_st
773 char *title;
774 char *explanation;
775 Coord x, y;
776 Angle angle;
777 int have_measured;
778 Coord measured_value;
779 Coord required_value;
780 int object_count;
781 long int *object_id_list;
782 int *object_type_list;
785 /* ---------------------------------------------------------------------------
786 * define supported types of undo operations
787 * note these must be separate bits now
789 #define UNDO_CHANGENAME 0x0001 /* change of names */
790 #define UNDO_MOVE 0x0002 /* moving objects */
791 #define UNDO_REMOVE 0x0004 /* removing objects */
792 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
793 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
794 #define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */
795 #define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */
796 #define UNDO_ROTATE 0x0080 /* rotations */
797 #define UNDO_CREATE 0x0100 /* creation of objects */
798 #define UNDO_MOVETOLAYER 0x0200 /* moving objects to */
799 #define UNDO_FLAG 0x0400 /* toggling SELECTED flag */
800 #define UNDO_CHANGESIZE 0x0800 /* change size of object */
801 #define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */
802 #define UNDO_MIRROR 0x2000 /* change side of board */
803 #define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */
804 #define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */
805 #define UNDO_CHANGEANGLES 0x10000 /* change arc angles */
806 #define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */
807 #define UNDO_CLEAR 0x40000 /* clear/restore to polygons */
808 #define UNDO_NETLISTCHANGE 0x80000 /* netlist change */
811 /* ---------------------------------------------------------------------------
812 * add a macro for wrapping RCS ID's in so that ident will still work
813 * but we won't get as many compiler warnings
816 #ifndef GCC_VERSION
817 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
818 #endif /* GCC_VERSION */
820 #if GCC_VERSION > 2007
821 #define ATTRIBUTE_UNUSED __attribute__((unused))
822 #else
823 #define ATTRIBUTE_UNUSED
824 #endif
826 /* ---------------------------------------------------------------------------
827 * Macros called by various action routines to show usage or to report
828 * a syntax error and fail
830 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
831 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
833 /* ---------------------------------------------------------------------------
834 * Variables with absolute paths to various directories. These are deduced
835 * at runtime to allow pcb to be relocatable
837 extern char *bindir; /* The dir in which PCB installation was found */
838 extern char *pcblibdir; /* The system M4 fp directory */
839 extern char *pcblibpath; /* The search path for M4 fps */
840 extern char *pcbtreedir; /* The system newlib fp directory */
841 extern char *pcbtreepath; /* The search path for newlib fps */
842 extern char *exec_prefix;
843 extern char *homedir;
845 #endif /* PCB_GLOBAL_H */