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