Remove superfluous check that unsigned int is nonnegative.
[geda-pcb/whiteaudio.git] / src / global.h
blob7b2839610d2b78fb401e6a9f3b89f0d9d714853a
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, MaxWidth, /* allowed size */
515 MaxHeight;
517 Coord Grid; /* used grid with offsets */
518 double Zoom, /* zoom factor */
519 IsleArea, /* minimum poly island to retain */
520 ThermScale; /* scale factor used with thermals */
521 FontType Font;
522 LayerGroupType LayerGroups;
523 RouteStyleType RouteStyle[NUM_STYLES];
524 LibraryType NetlistLib;
525 AttributeListType Attributes;
526 DataType *Data; /* entire database */
528 bool is_footprint; /* If set, the user has loaded a footprint, not a pcb. */
530 PCBType;
532 typedef struct /* information about the paste buffer */
534 Coord X, Y; /* offset */
535 BoxType BoundingBox;
536 DataType *Data; /* data; not all members of PCBType */
537 /* are used */
538 } BufferType;
540 /* ---------------------------------------------------------------------------
541 * some types for cursor drawing, setting of block and lines
542 * as well as for merging of elements
544 typedef struct /* rubberband lines for element moves */
546 LayerType *Layer; /* layer that holds the line */
547 LineType *Line; /* the line itself */
548 PointType *MovedPoint; /* and finally the point */
549 } RubberbandType;
551 typedef struct /* current marked line */
553 PointType Point1, /* start- and end-position */
554 Point2;
555 long int State;
556 bool draw;
557 } AttachedLineType;
559 typedef struct /* currently marked block */
561 PointType Point1, /* start- and end-position */
562 Point2;
563 long int State;
564 bool otherway;
565 } AttachedBoxType;
567 typedef struct /* currently attached object */
569 Coord X, Y; /* saved position when MOVE_MODE */
570 BoxType BoundingBox;
571 long int Type, /* object type */
572 State;
573 void *Ptr1, /* three pointers to data, see */
574 *Ptr2, /* search.c */
575 *Ptr3;
576 Cardinal RubberbandN, /* number of lines in array */
577 RubberbandMax;
578 RubberbandType *Rubberband;
579 } AttachedObjectType;
581 enum crosshair_shape
583 Basic_Crosshair_Shape = 0, /* 4-ray */
584 Union_Jack_Crosshair_Shape, /* 8-ray */
585 Dozen_Crosshair_Shape, /* 12-ray */
586 Crosshair_Shapes_Number
589 typedef struct /* holds cursor information */
591 hidGC GC, /* GC for cursor drawing */
592 AttachGC; /* and for displaying buffer contents */
593 Coord X, Y, /* position in PCB coordinates */
594 MinX, MinY, /* lowest and highest coordinates */
595 MaxX, MaxY;
596 AttachedLineType AttachedLine; /* data of new lines... */
597 AttachedBoxType AttachedBox;
598 PolygonType AttachedPolygon;
599 AttachedObjectType AttachedObject; /* data of attached objects */
600 enum crosshair_shape shape; /* shape of crosshair */
601 } CrosshairType;
603 typedef struct
605 bool status;
606 Coord X, Y;
607 } MarkType;
609 /* ---------------------------------------------------------------------------
610 * our resources
611 * most of them are used as default when a new design is started
613 typedef struct /* some resources... */
615 const Unit *grid_unit;
616 Increments *increments;
618 int verbose;
620 char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */
621 *CrosshairColor, /* different object colors */
622 *CrossColor,
623 *ViaColor,
624 *ViaSelectedColor,
625 *PinColor,
626 *PinSelectedColor,
627 *PinNameColor,
628 *ElementColor,
629 *RatColor,
630 *InvisibleObjectsColor,
631 *InvisibleMarkColor,
632 *ElementSelectedColor,
633 *RatSelectedColor,
634 *ConnectedColor,
635 *OffLimitColor,
636 *GridColor,
637 *LayerColor[MAX_LAYER],
638 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
639 Coord ViaThickness, /* some preset values */
640 ViaDrillingHole, LineThickness, RatThickness, Keepaway, /* default size of a new layout */
641 MaxWidth, MaxHeight,
642 AlignmentDistance, Bloat, /* default drc sizes */
643 Shrink, minWid, minSlk, minDrill, minRing;
644 int TextScale; /* text scaling in % */
645 Coord Grid; /* grid in pcb-units */
646 double Zoom,
647 IsleArea, /* polygon min area */
648 PinoutZoom; /* same for pinout windows */
649 int PinoutNameLength, /* max displayed length of a pinname */
650 Volume, /* the speakers volume -100..100 */
651 CharPerLine, /* width of an output line in characters */
652 Mode, /* currently active mode */
653 BufferNumber; /* number of the current buffer */
654 int BackupInterval; /* time between two backups in seconds */
655 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
656 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
657 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
658 *Groups, /* string with layergroups */
659 *Routes, /* string with route styles */
660 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
661 *BackgroundImage, /* PPM file for board background */
662 *ScriptFilename, /* PCB Actions script to execute on startup */
663 *ActionString, /* PCB Actions string to execute on startup */
664 *FabAuthor, /* Full name of author for FAB drawings */
665 *GnetlistProgram, /* gnetlist program name */
666 *MakeProgram, /* make program name */
667 *InitialLayerStack; /* If set, the initial layer stack is set to this */
668 Coord PinoutOffsetX, /* offset of origin */
669 PinoutOffsetY;
670 Coord PinoutTextOffsetX, /* offset of text from pin center */
671 PinoutTextOffsetY;
672 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
673 LayerGroupType LayerGroups; /* default layer groups */
674 bool ClearLine, FullPoly,
675 UniqueNames, /* force unique names */
676 SnapPin, /* snap to pins and pads */
677 ShowSolderSide, /* mirror output */
678 SaveLastCommand, /* save the last command entered by user */
679 SaveInTMP, /* always save data in /tmp */
680 DrawGrid, /* draw grid points */
681 RatWarn, /* rats nest has set warnings */
682 StipplePolygons, /* draw polygons with stipple */
683 AllDirectionLines, /* enable lines to all directions */
684 RubberBandMode, /* move, rotate use rubberband connections */
685 SwapStartDirection, /* change starting direction after each click */
686 ShowDRC, /* show drc region on crosshair */
687 AutoDRC, /* */
688 ShowNumber, /* pinout shows number */
689 OrthogonalMoves, /* */
690 ResetAfterElement, /* reset connections after each element */
691 liveRouting, /* autorouter shows tracks in progress */
692 RingBellWhenFinished, /* flag if a signal should be */
693 /* produced when searching of */
694 /* connections is done */
695 AutoPlace; /* flag which says we should force placement of the
696 windows on startup */
698 SettingType;
700 /* ----------------------------------------------------------------------
701 * pointer to low-level copy, move and rotate functions
703 typedef struct
705 void *(*Line) (LayerType *, LineType *);
706 void *(*Text) (LayerType *, TextType *);
707 void *(*Polygon) (LayerType *, PolygonType *);
708 void *(*Via) (PinType *);
709 void *(*Element) (ElementType *);
710 void *(*ElementName) (ElementType *);
711 void *(*Pin) (ElementType *, PinType *);
712 void *(*Pad) (ElementType *, PadType *);
713 void *(*LinePoint) (LayerType *, LineType *, PointType *);
714 void *(*Point) (LayerType *, PolygonType *, PointType *);
715 void *(*Arc) (LayerType *, ArcType *);
716 void *(*Rat) (RatType *);
717 } ObjectFunctionType;
719 /* ---------------------------------------------------------------------------
720 * structure used by device drivers
723 typedef struct /* holds a connection */
725 Coord X, Y; /* coordinate of connection */
726 long int type; /* type of object in ptr1 - 3 */
727 void *ptr1, *ptr2; /* the object of the connection */
728 Cardinal group; /* the layer group of the connection */
729 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
730 } ConnectionType;
732 typedef struct /* holds a net of connections */
734 Cardinal ConnectionN, /* the number of connections contained */
735 ConnectionMax; /* max connections from malloc */
736 ConnectionType *Connection;
737 RouteStyleType *Style;
738 } NetType;
740 typedef struct /* holds a list of nets */
742 Cardinal NetN, /* the number of subnets contained */
743 NetMax; /* max subnets from malloc */
744 NetType *Net;
745 } NetListType;
747 typedef struct /* holds a list of net lists */
749 Cardinal NetListN, /* the number of net lists contained */
750 NetListMax; /* max net lists from malloc */
751 NetListType *NetList;
752 } NetListListType;
754 typedef struct /* holds a generic list of pointers */
756 Cardinal PtrN, /* the number of pointers contained */
757 PtrMax; /* max subnets from malloc */
758 void **Ptr;
759 } PointerListType;
761 typedef struct
763 Cardinal BoxN, /* the number of boxes contained */
764 BoxMax; /* max boxes from malloc */
765 BoxType *Box;
767 } BoxListType;
769 struct drc_violation_st
771 char *title;
772 char *explanation;
773 Coord x, y;
774 Angle angle;
775 int have_measured;
776 Coord measured_value;
777 Coord required_value;
778 int object_count;
779 long int *object_id_list;
780 int *object_type_list;
783 /* ---------------------------------------------------------------------------
784 * define supported types of undo operations
785 * note these must be separate bits now
787 #define UNDO_CHANGENAME 0x0001 /* change of names */
788 #define UNDO_MOVE 0x0002 /* moving objects */
789 #define UNDO_REMOVE 0x0004 /* removing objects */
790 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
791 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
792 #define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */
793 #define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */
794 #define UNDO_ROTATE 0x0080 /* rotations */
795 #define UNDO_CREATE 0x0100 /* creation of objects */
796 #define UNDO_MOVETOLAYER 0x0200 /* moving objects to */
797 #define UNDO_FLAG 0x0400 /* toggling SELECTED flag */
798 #define UNDO_CHANGESIZE 0x0800 /* change size of object */
799 #define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */
800 #define UNDO_MIRROR 0x2000 /* change side of board */
801 #define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */
802 #define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */
803 #define UNDO_CHANGEANGLES 0x10000 /* change arc angles */
804 #define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */
805 #define UNDO_CLEAR 0x40000 /* clear/restore to polygons */
806 #define UNDO_NETLISTCHANGE 0x80000 /* netlist change */
809 /* ---------------------------------------------------------------------------
810 * add a macro for wrapping RCS ID's in so that ident will still work
811 * but we won't get as many compiler warnings
814 #ifndef GCC_VERSION
815 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
816 #endif /* GCC_VERSION */
818 #if GCC_VERSION > 2007
819 #define ATTRIBUTE_UNUSED __attribute__((unused))
820 #else
821 #define ATTRIBUTE_UNUSED
822 #endif
824 /* ---------------------------------------------------------------------------
825 * Macros called by various action routines to show usage or to report
826 * a syntax error and fail
828 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
829 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
831 /* ---------------------------------------------------------------------------
832 * Variables with absolute paths to various directories. These are deduced
833 * at runtime to allow pcb to be relocatable
835 extern char *bindir; /* The dir in which PCB installation was found */
836 extern char *pcblibdir; /* The system M4 fp directory */
837 extern char *pcblibpath; /* The search path for M4 fps */
838 extern char *pcbtreedir; /* The system newlib fp directory */
839 extern char *pcbtreepath; /* The search path for newlib fps */
840 extern char *exec_prefix;
841 extern char *homedir;
843 #endif /* PCB_GLOBAL_H */