(no commit message)
[geda-pcb/pcjc2.git] / src / global.h
blobd858beceeb3993ccffa9197a0efd46dacdc15a87
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 #include "gettext.h"
81 #if defined (ENABLE_NLS)
82 /* When an empty string is used for msgid, the functions may return a nonempty
83 string. */
84 # define _(S) (S[0] != '\0') ? gettext(S) : S
85 # define N_(S) gettext_noop(S)
86 # define C_(C, S) pgettext(C, S)
87 #else
88 # define _(S) S
89 # define N_(S) S
90 # define C_(C, S) S
91 #endif /* ENABLE_NLS */
93 /* This is used by the lexer/parser */
94 typedef struct {
95 int ival;
96 Coord bval;
97 double dval;
98 char has_units;
99 } PLMeasure;
101 #ifndef XtSpecificationRelease
102 typedef unsigned int Cardinal;
103 /*typedef unsigned int Pixel;*/
104 typedef char *String;
105 typedef short Position;
106 typedef short Dimension;
107 #endif
108 typedef unsigned char BYTE;
110 /* Nobody should know about the internals of this except the macros in
111 macros.h that access it. This structure must be simple-assignable
112 for now. */
113 typedef struct
115 unsigned long f; /* generic flags */
116 unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */
117 } FlagType;
119 #ifndef __GNUC__
120 #define __FUNCTION1(a,b) a ":" #b
121 #define __FUNCTION2(a,b) __FUNCTION1(a,b)
122 #define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__)
123 #endif
126 /* ---------------------------------------------------------------------------
127 * Macros to annotate branch-prediction information.
128 * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have
129 * been removed to avoid namespace clashes.
132 /* The LIKELY and UNLIKELY macros let the programmer give hints to
133 * the compiler about the expected result of an expression. Some compilers
134 * can use this information for optimizations.
136 * The PCB_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
137 * putting assignments inside the test.
139 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
140 #define PCB_BOOLEAN_EXPR(expr) \
141 __extension__ ({ \
142 int _boolean_var_; \
143 if (expr) \
144 _boolean_var_ = 1; \
145 else \
146 _boolean_var_ = 0; \
147 _boolean_var_; \
149 #define LIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 1))
150 #define UNLIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 0))
151 #else
152 #define LIKELY(expr) (expr)
153 #define UNLIKELY(expr) (expr)
154 #endif
157 /* ---------------------------------------------------------------------------
158 * Do not change the following definitions even if they're not very
159 * nice. It allows us to have functions act on these "base types" and
160 * not need to know what kind of actual object they're working on.
163 /* Any object that uses the "object flags" defined in const.h, or
164 exists as an object on the pcb, MUST be defined using this as the
165 first fields, either directly or through ANYLINEFIELDS. */
166 #define ANYOBJECTFIELDS \
167 BoxType BoundingBox; \
168 long int ID; \
169 FlagType Flags; \
170 // struct LibraryEntryType *net
172 /* Lines, pads, and rats all use this so they can be cross-cast. */
173 #define ANYLINEFIELDS \
174 ANYOBJECTFIELDS; \
175 Coord Thickness, \
176 Clearance; \
177 PointType Point1, \
178 Point2
180 /* ---------------------------------------------------------------------------
181 * some useful values of our widgets
183 typedef struct /* holds information about output window */
185 hidGC bgGC, /* background and foreground; */
186 fgGC, /* changed from some routines */
187 pmGC; /* depth 1 pixmap GC to store clip */
189 OutputType;
191 /* ----------------------------------------------------------------------
192 * layer group. A layer group identifies layers which are always switched
193 * on/off together.
195 typedef struct
197 Cardinal Number[MAX_GROUP], /* number of entries per groups */
198 Entries[MAX_GROUP][MAX_LAYER + 2];
199 } LayerGroupType;
201 struct BoxType /* a bounding box */
203 Coord X1, Y1; /* upper left */
204 Coord X2, Y2; /* and lower right corner */
207 typedef struct
209 Coord x, y;
210 Coord width, height;
211 } RectangleType;
213 typedef struct
215 char *name;
216 char *value;
217 } AttributeType;
219 struct AttributeListType
221 int Number, Max;
222 AttributeType *List;
225 /* ---------------------------------------------------------------------------
226 * the basic object types supported by PCB
229 /* All on-pcb objects (elements, lines, pads, vias, rats, etc) are
230 based on this. */
231 typedef struct {
232 ANYOBJECTFIELDS;
233 } AnyObjectType;
235 typedef struct /* a line/polygon point */
237 Coord X, Y, X2, Y2; /* so Point type can be cast as BoxType */
238 long int ID;
239 } PointType;
241 /* Lines, rats, pads, etc. */
242 typedef struct {
243 ANYLINEFIELDS;
244 } AnyLineObjectType;
246 typedef struct /* holds information about one line */
248 ANYLINEFIELDS;
249 char *Number;
250 } LineType;
252 typedef struct
254 ANYOBJECTFIELDS;
255 int Scale; /* text scaling in percent */
256 Coord X, Y; /* origin */
257 BYTE Direction;
258 char *TextString; /* string */
259 void *Element;
260 } TextType;
262 struct polygon_st /* holds information about a polygon */
264 ANYOBJECTFIELDS;
265 Cardinal PointN, /* number of points in polygon */
266 PointMax; /* max number from malloc() */
267 POLYAREA *Clipped; /* the clipped region of this polygon */
268 PLINE *NoHoles; /* the polygon broken into hole-less regions */
269 int NoHolesValid; /* Is the NoHoles polygon up to date? */
270 PointType *Points; /* data */
271 Cardinal *HoleIndex; /* Index of hole data within the Points array */
272 Cardinal HoleIndexN; /* number of holes in polygon */
273 Cardinal HoleIndexMax; /* max number from malloc() */
277 typedef struct /* holds information about arcs */
279 ANYOBJECTFIELDS;
280 Coord Thickness, Clearance;
281 PointType Point1;
282 PointType Point2;
283 Coord Width, Height, /* length of axis */
284 X, Y; /* center coordinates */
285 Angle StartAngle, Delta; /* the two limiting angles in degrees */
286 } ArcType;
288 struct rtree
290 struct rtree_node *root;
291 int size; /* number of entries in tree */
294 typedef struct /* holds information about one layer */
296 char *Name; /* layer name */
297 Cardinal LineN, /* number of lines */
298 TextN, /* labels */
299 PolygonN, /* polygons */
300 ArcN; /* and arcs */
301 GList *Line;
302 GList *Text;
303 GList *Polygon;
304 GList *Arc;
305 rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree;
306 bool On; /* visible flag */
307 char *Color, /* color */
308 *SelectedColor;
309 AttributeListType Attributes;
310 int no_drc; /* whether to ignore the layer when checking the design rules */
312 LayerType;
314 typedef struct /* a rat-line */
316 ANYLINEFIELDS;
317 Cardinal group1, group2; /* the layer group each point is on */
318 } RatType;
320 struct pad_st /* a SMD pad */
322 ANYLINEFIELDS;
323 Coord Mask;
324 char *Name, *Number; /* 'Line' */
325 void *Element;
326 void *Spare;
329 struct pin_st
331 ANYOBJECTFIELDS;
332 Coord Thickness, Clearance, Mask, DrillingHole;
333 Coord X, Y; /* center and diameter */
334 char *Name, *Number;
335 void *Element;
336 void *Spare;
339 /* This is the extents of a Pin or Via, depending on whether it's a
340 hole or not. */
341 #define PIN_SIZE(pinptr) (TEST_FLAG(HOLEFLAG, (pinptr)) \
342 ? (pinptr)->DrillingHole \
343 : (pinptr)->Thickness)
345 typedef struct
347 ANYOBJECTFIELDS;
348 TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */
349 /* description text */
350 /* name on PCB second, */
351 /* value third */
352 /* see macro.h */
353 Coord MarkX, MarkY; /* position mark */
354 Cardinal PinN; /* number of pins */
355 Cardinal PadN; /* number of pads */
356 Cardinal LineN; /* number of lines */
357 Cardinal ArcN; /* number of arcs */
358 GList *Pin;
359 GList *Pad;
360 GList *Line;
361 GList *Arc;
362 BoxType VBox;
363 AttributeListType Attributes;
364 } ElementType;
366 /* ---------------------------------------------------------------------------
367 * symbol and font related stuff
369 typedef struct /* a single symbol */
371 LineType *Line;
372 bool Valid;
373 Cardinal LineN, /* number of lines */
374 LineMax;
375 Coord Width, Height, /* size of cell */
376 Delta; /* distance to next symbol */
377 } SymbolType;
379 typedef struct /* complete set of symbols */
381 Coord MaxHeight, /* maximum cell width and height */
382 MaxWidth;
383 BoxType DefaultSymbol; /* the default symbol is a filled box */
384 SymbolType Symbol[MAX_FONTPOSITION + 1];
385 bool Valid;
386 } FontType;
388 typedef struct /* holds all objects */
390 Cardinal ViaN, /* number of vias */
391 ElementN, /* and elements */
392 RatN; /* and rat-lines */
393 int LayerN; /* number of layers in this board */
394 GList *Via;
395 GList *Element;
396 GList *Rat;
397 rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */
398 *rat_tree;
399 struct PCBType *pcb;
400 LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */
401 int polyClip;
402 } DataType;
404 typedef struct /* holds drill information */
406 Coord DrillSize; /* this drill's diameter */
407 Cardinal ElementN, /* the number of elements using this drill size */
408 ElementMax, /* max number of elements from malloc() */
409 PinCount, /* number of pins drilled this size */
410 ViaCount, /* number of vias drilled this size */
411 UnplatedCount, /* number of these holes that are unplated */
412 PinN, /* number of drill coordinates in the list */
413 PinMax; /* max number of coordinates from malloc() */
414 PinType **Pin; /* coordinates to drill */
415 ElementType **Element; /* a pointer to an array of element pointers */
416 } DrillType;
418 typedef struct /* holds a range of Drill Infos */
420 Cardinal DrillN, /* number of drill sizes */
421 DrillMax; /* max number from malloc() */
422 DrillType *Drill; /* plated holes */
423 } DrillInfoType;
425 typedef struct
427 Coord Thick, /* line thickness */
428 Diameter, /* via diameter */
429 Hole, /* via drill hole */
430 Keepaway; /* min. separation from other nets */
431 char *Name;
432 int index;
433 } RouteStyleType;
435 /* ---------------------------------------------------------------------------
436 * structure used by library routines
438 typedef struct
440 char *ListEntry; /* the string for the selection box */
441 char *AllocatedMemory, /* pointer to allocated memory; all others */
442 /* point to parts of the string */
443 *Template, /* m4 template name */
444 *Package, /* package */
445 *Value, /* the value field */
446 *Description; /* some descritional text */
447 } LibraryEntryType;
449 /* If the internal flag is set, the only field that is valid is Name,
450 and the struct is allocated with malloc instead of
451 CreateLibraryEntry. These "internal" entries are used for
452 electrical paths that aren't yet assigned to a real net. */
454 typedef struct
456 char *Name, /* name of the menu entry */
457 *directory, /* Directory name library elements are from */
458 *Style; /* routing style */
459 Cardinal EntryN, /* number of objects */
460 EntryMax; /* number of reserved memory locations */
461 LibraryEntryType *Entry; /* the entries */
462 char flag; /* used by the netlist window to enable/disable nets */
463 char internal; /* if set, this is an internal-only entry, not
464 part of the global netlist. */
465 } LibraryMenuType;
467 typedef struct
469 Cardinal MenuN; /* number of objects */
470 Cardinal MenuMax; /* number of reserved memory locations */
471 LibraryMenuType *Menu; /* the entries */
472 } LibraryType;
475 /* The PCBType struct holds information about board layout most of which is
476 | saved with the layout. A new PCB layout struct is first initialized
477 | with values from the user configurable Settings struct and then reset
478 | to the saved layout values when a layout is loaded.
479 | This struct is also used for the remove list and for buffer handling
481 typedef struct PCBType
483 long ID; /* see macro.h */
484 FlagType Flags;
485 char *Name, /* name of board */
486 *Filename, /* name of file (from load) */
487 *PrintFilename, /* from print dialog */
488 *Netlistname, /* name of netlist file */
489 ThermStyle; /* type of thermal to place with thermal tool */
490 bool Changed, /* layout has been changed */
491 ViaOn, /* visibility flags */
492 ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */
493 RatDraw; /* we're drawing rats */
494 char *ViaColor, /* some colors */
495 *ViaSelectedColor,
496 *PinColor,
497 *PinSelectedColor,
498 *PinNameColor,
499 *ElementColor,
500 *RatColor,
501 *InvisibleObjectsColor,
502 *InvisibleMarkColor,
503 *ElementSelectedColor,
504 *RatSelectedColor, *ConnectedColor, *FoundColor, *WarnColor, *MaskColor;
505 long CursorX, /* cursor position as saved with layout */
506 CursorY, Clipping;
507 Coord Bloat, /* drc sizes saved with layout */
508 Shrink, minWid, minSlk, minDrill, minRing;
509 Coord GridOffsetX, /* as saved with layout */
510 GridOffsetY, MaxWidth, /* allowed size */
511 MaxHeight;
513 Coord Grid; /* used grid with offsets */
514 double IsleArea, /* minimum poly island to retain */
515 ThermScale; /* scale factor used with thermals */
516 FontType Font;
517 LayerGroupType LayerGroups;
518 RouteStyleType RouteStyle[NUM_STYLES];
519 LibraryType NetlistLib;
520 AttributeListType Attributes;
521 DataType *Data; /* entire database */
523 bool is_footprint; /* If set, the user has loaded a footprint, not a pcb. */
525 PCBType;
527 typedef struct /* information about the paste buffer */
529 Coord X, Y; /* offset */
530 BoxType BoundingBox;
531 DataType *Data; /* data; not all members of PCBType */
532 /* are used */
533 } BufferType;
535 /* ---------------------------------------------------------------------------
536 * some types for cursor drawing, setting of block and lines
537 * as well as for merging of elements
539 typedef struct /* rubberband lines for element moves */
541 LayerType *Layer; /* layer that holds the line */
542 LineType *Line; /* the line itself */
543 PointType *MovedPoint; /* and finally the point */
544 } RubberbandType;
546 typedef struct /* current marked line */
548 PointType Point1, /* start- and end-position */
549 Point2;
550 long int State;
551 bool draw;
552 } AttachedLineType;
554 typedef struct /* currently marked block */
556 PointType Point1, /* start- and end-position */
557 Point2;
558 long int State;
559 bool otherway;
560 } AttachedBoxType;
562 typedef struct /* currently attached object */
564 Coord X, Y; /* saved position when MOVE_MODE */
565 BoxType BoundingBox;
566 long int Type, /* object type */
567 State;
568 void *Ptr1, /* three pointers to data, see */
569 *Ptr2, /* search.c */
570 *Ptr3;
571 Cardinal RubberbandN, /* number of lines in array */
572 RubberbandMax;
573 RubberbandType *Rubberband;
574 } AttachedObjectType;
576 enum crosshair_shape
578 Basic_Crosshair_Shape = 0, /* 4-ray */
579 Union_Jack_Crosshair_Shape, /* 8-ray */
580 Dozen_Crosshair_Shape, /* 12-ray */
581 Crosshair_Shapes_Number
584 typedef struct /* holds cursor information */
586 hidGC GC, /* GC for cursor drawing */
587 AttachGC; /* and for displaying buffer contents */
588 Coord X, Y, /* position in PCB coordinates */
589 MinX, MinY, /* lowest and highest coordinates */
590 MaxX, MaxY;
591 AttachedLineType AttachedLine; /* data of new lines... */
592 AttachedBoxType AttachedBox;
593 PolygonType AttachedPolygon;
594 AttachedObjectType AttachedObject; /* data of attached objects */
595 enum crosshair_shape shape; /* shape of crosshair */
596 } CrosshairType;
598 typedef struct
600 bool status;
601 Coord X, Y;
602 } MarkType;
604 /* ---------------------------------------------------------------------------
605 * our resources
606 * most of them are used as default when a new design is started
608 typedef struct /* some resources... */
610 const Unit *grid_unit;
611 Increments *increments;
613 int verbose;
615 char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */
616 *CrosshairColor, /* different object colors */
617 *CrossColor,
618 *ViaColor,
619 *ViaSelectedColor,
620 *PinColor,
621 *PinSelectedColor,
622 *PinNameColor,
623 *ElementColor,
624 *RatColor,
625 *InvisibleObjectsColor,
626 *InvisibleMarkColor,
627 *ElementSelectedColor,
628 *RatSelectedColor,
629 *ConnectedColor,
630 *FoundColor,
631 *OffLimitColor,
632 *GridColor,
633 *LayerColor[MAX_LAYER],
634 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
635 Coord ViaThickness, /* some preset values */
636 ViaDrillingHole, LineThickness, RatThickness, Keepaway, /* default size of a new layout */
637 MaxWidth, MaxHeight,
638 AlignmentDistance, Bloat, /* default drc sizes */
639 Shrink, minWid, minSlk, minDrill, minRing;
640 int TextScale; /* text scaling in % */
641 Coord Grid; /* grid in pcb-units */
642 double IsleArea; /* polygon min area */
643 int PinoutNameLength, /* max displayed length of a pinname */
644 Volume, /* the speakers volume -100..100 */
645 CharPerLine, /* width of an output line in characters */
646 Mode, /* currently active mode */
647 BufferNumber; /* number of the current buffer */
648 int BackupInterval; /* time between two backups in seconds */
649 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
650 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
651 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
652 *Groups, /* string with layergroups */
653 *Routes, /* string with route styles */
654 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
655 *BackgroundImage, /* PPM file for board background */
656 *ScriptFilename, /* PCB Actions script to execute on startup */
657 *ActionString, /* PCB Actions string to execute on startup */
658 *FabAuthor, /* Full name of author for FAB drawings */
659 *GnetlistProgram, /* gnetlist program name */
660 *MakeProgram, /* make program name */
661 *InitialLayerStack; /* If set, the initial layer stack is set to this */
662 Coord PinoutOffsetX, /* offset of origin */
663 PinoutOffsetY;
664 Coord PinoutTextOffsetX, /* offset of text from pin center */
665 PinoutTextOffsetY;
666 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
667 LayerGroupType LayerGroups; /* default layer groups */
668 bool ClearLine, FullPoly,
669 UniqueNames, /* force unique names */
670 SnapPin, /* snap to pins and pads */
671 ShowBottomSide, /* mirror output */
672 SaveLastCommand, /* save the last command entered by user */
673 SaveInTMP, /* always save data in /tmp */
674 SaveMetricOnly, /* save with mm suffix only, not mil/mm hybrid */
675 DrawGrid, /* draw grid points */
676 RatWarn, /* rats nest has set warnings */
677 StipplePolygons, /* draw polygons with stipple */
678 AllDirectionLines, /* enable lines to all directions */
679 RubberBandMode, /* move, rotate use rubberband connections */
680 SwapStartDirection, /* change starting direction after each click */
681 ShowDRC, /* show drc region on crosshair */
682 AutoDRC, /* */
683 ShowNumber, /* pinout shows number */
684 OrthogonalMoves, /* */
685 ResetAfterElement, /* reset connections after each element */
686 liveRouting, /* autorouter shows tracks in progress */
687 RingBellWhenFinished, /* flag if a signal should be */
688 /* produced when searching of */
689 /* connections is done */
690 AutoPlace; /* flag which says we should force placement of the
691 windows on startup */
693 SettingType;
695 /* ----------------------------------------------------------------------
696 * pointer to low-level copy, move and rotate functions
698 typedef struct
700 void *(*Line) (LayerType *, LineType *);
701 void *(*Text) (LayerType *, TextType *);
702 void *(*Polygon) (LayerType *, PolygonType *);
703 void *(*Via) (PinType *);
704 void *(*Element) (ElementType *);
705 void *(*ElementName) (ElementType *);
706 void *(*Pin) (ElementType *, PinType *);
707 void *(*Pad) (ElementType *, PadType *);
708 void *(*LinePoint) (LayerType *, LineType *, PointType *);
709 void *(*Point) (LayerType *, PolygonType *, PointType *);
710 void *(*Arc) (LayerType *, ArcType *);
711 void *(*Rat) (RatType *);
712 } ObjectFunctionType;
714 /* ---------------------------------------------------------------------------
715 * structure used by device drivers
718 typedef struct /* holds a connection */
720 Coord X, Y; /* coordinate of connection */
721 long int type; /* type of object in ptr1 - 3 */
722 void *ptr1, *ptr2; /* the object of the connection */
723 Cardinal group; /* the layer group of the connection */
724 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
725 } ConnectionType;
727 typedef struct /* holds a net of connections */
729 Cardinal ConnectionN, /* the number of connections contained */
730 ConnectionMax; /* max connections from malloc */
731 ConnectionType *Connection;
732 RouteStyleType *Style;
733 } NetType;
735 typedef struct /* holds a list of nets */
737 Cardinal NetN, /* the number of subnets contained */
738 NetMax; /* max subnets from malloc */
739 NetType *Net;
740 } NetListType;
742 typedef struct /* holds a list of net lists */
744 Cardinal NetListN, /* the number of net lists contained */
745 NetListMax; /* max net lists from malloc */
746 NetListType *NetList;
747 } NetListListType;
749 typedef struct /* holds a generic list of pointers */
751 Cardinal PtrN, /* the number of pointers contained */
752 PtrMax; /* max subnets from malloc */
753 void **Ptr;
754 } PointerListType;
756 typedef struct
758 Cardinal BoxN, /* the number of boxes contained */
759 BoxMax; /* max boxes from malloc */
760 BoxType *Box;
762 } BoxListType;
764 struct drc_violation_st
766 char *title;
767 char *explanation;
768 Coord x, y;
769 Angle angle;
770 int have_measured;
771 Coord measured_value;
772 Coord required_value;
773 int object_count;
774 long int *object_id_list;
775 int *object_type_list;
778 /* ---------------------------------------------------------------------------
779 * define supported types of undo operations
780 * note these must be separate bits now
782 #define UNDO_CHANGENAME 0x0001 /* change of names */
783 #define UNDO_MOVE 0x0002 /* moving objects */
784 #define UNDO_REMOVE 0x0004 /* removing objects */
785 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
786 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
787 #define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */
788 #define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */
789 #define UNDO_ROTATE 0x0080 /* rotations */
790 #define UNDO_CREATE 0x0100 /* creation of objects */
791 #define UNDO_MOVETOLAYER 0x0200 /* moving objects to */
792 #define UNDO_FLAG 0x0400 /* toggling SELECTED flag */
793 #define UNDO_CHANGESIZE 0x0800 /* change size of object */
794 #define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */
795 #define UNDO_MIRROR 0x2000 /* change side of board */
796 #define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */
797 #define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */
798 #define UNDO_CHANGEANGLES 0x10000 /* change arc angles */
799 #define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */
800 #define UNDO_CLEAR 0x40000 /* clear/restore to polygons */
801 #define UNDO_NETLISTCHANGE 0x80000 /* netlist change */
804 /* ---------------------------------------------------------------------------
805 * add a macro for wrapping RCS ID's in so that ident will still work
806 * but we won't get as many compiler warnings
809 #ifndef GCC_VERSION
810 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
811 #endif /* GCC_VERSION */
813 #if GCC_VERSION > 2007
814 #define ATTRIBUTE_UNUSED __attribute__((unused))
815 #else
816 #define ATTRIBUTE_UNUSED
817 #endif
819 /* ---------------------------------------------------------------------------
820 * Macros called by various action routines to show usage or to report
821 * a syntax error and fail
823 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
824 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
826 /* ---------------------------------------------------------------------------
827 * Variables with absolute paths to various directories. These are deduced
828 * at runtime to allow pcb to be relocatable
830 extern char *bindir; /* The dir in which PCB installation was found */
831 extern char *pcblibdir; /* The system M4 fp directory */
832 extern char *pcblibpath; /* The search path for M4 fps */
833 extern char *pcbtreedir; /* The system newlib fp directory */
834 extern char *pcbtreepath; /* The search path for newlib fps */
835 extern char *exec_prefix;
836 extern char *homedir;
838 #endif /* PCB_GLOBAL_H */