Add support for filling / thindrawing raw polygons to the HID interface
[geda-pcb/gde.git] / src / global.h
blob93af49b6caed3af3c75663d54ce8a8fb60e48ed0
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
25 * RCS: $Id$
27 /* 15 Oct 2008 Ineiev: add different crosshair shapes */
29 /* definition of types
32 /* Change History:
33 * 10/11/96 11:37 AJF Added support for a Text() driver function.
34 * This was done out of a pressing need to force text to be printed on the
35 * silkscreen layer. Perhaps the design is not the best.
38 #ifndef __GLOBAL_INCLUDED__
39 #define __GLOBAL_INCLUDED__
41 #include "const.h"
42 #include "macro.h"
43 #include "polyarea.h"
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48 #include <strings.h>
49 #include <stdarg.h>
50 #include <math.h>
51 #include <ctype.h>
52 #include <sys/types.h>
54 typedef struct BoxType BoxType, *BoxTypePtr;
55 typedef struct polygon_st PolygonType, *PolygonTypePtr;
57 #include "hid.h"
59 #define _(S) (S)
61 typedef int LocationType;
62 typedef int BDimension; /* big dimension */
65 #ifndef XtSpecificationRelease
66 typedef unsigned int Cardinal;
67 typedef char Boolean;
68 /*typedef unsigned int Pixel;*/
69 typedef char *String;
70 typedef short Position;
71 typedef short Dimension;
72 #endif
73 typedef unsigned char BYTE;
75 #define True 1
76 #define False 0
78 /* Nobody should know about the internals of this except the macros in
79 macros.h that access it. This structure must be simple-assignable
80 for now. */
81 typedef struct
83 unsigned long f; /* generic flags */
84 unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */
85 } FlagType, *FlagTypePtr;
87 #ifndef __GNUC__
88 #define __FUNCTION1(a,b) a ":" #b
89 #define __FUNCTION2(a,b) __FUNCTION1(a,b)
90 #define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__)
91 #endif
93 /* ---------------------------------------------------------------------------
94 * Do not change the following definitions even if they're not very
95 * nice. It allows us to have functions act on these "base types" and
96 * not need to know what kind of actual object they're working on.
99 /* Any object that uses the "object flags" defined in const.h, or
100 exists as an object on the pcb, MUST be defined using this as the
101 first fields, either directly or through ANYLINEFIELDS. */
102 #define ANYOBJECTFIELDS \
103 BoxType BoundingBox; \
104 long int ID; \
105 FlagType Flags; \
106 struct LibraryEntryType *net
108 /* Lines, pads, and rats all use this so they can be cross-cast. */
109 #define ANYLINEFIELDS \
110 ANYOBJECTFIELDS; \
111 BDimension Thickness, \
112 Clearance; \
113 PointType Point1, \
114 Point2
116 /* ---------------------------------------------------------------------------
117 * some useful values of our widgets
119 typedef struct /* holds information about output window */
121 hidGC bgGC, /* background and foreground; */
122 fgGC, /* changed from some routines */
123 pmGC, /* depth 1 pixmap GC to store clip */
124 GridGC; /* for the grid */
126 int Width, /* sizes of output window (porthole) */
127 Height;
128 int oldObjState, /* Helpers for GetLocation */
129 oldLineState, oldBoxState;
131 OutputType, *OutputTypePtr;
133 /* ----------------------------------------------------------------------
134 * layer group. A layer group identifies layers which are always switched
135 * on/off together.
137 typedef struct
139 Cardinal Number[MAX_LAYER], /* number of entries per groups */
140 Entries[MAX_LAYER][MAX_LAYER + 2];
141 } LayerGroupType, *LayerGroupTypePtr;
143 struct BoxType /* a bounding box */
145 LocationType X1, Y1, /* upper left */
146 X2, Y2; /* and lower right corner */
149 typedef struct
151 LocationType x, y;
152 int width, height;
153 } RectangleType, *RectangleTypePtr;
155 typedef struct
157 char *name;
158 char *value;
159 } AttributeType, *AttributeTypePtr;
161 typedef struct
163 int Number, Max;
164 AttributeType *List;
165 } AttributeListType, *AttributeListTypePtr;
167 /* ---------------------------------------------------------------------------
168 * the basic object types supported by PCB
171 /* All on-pcb objects (elements, lines, pads, vias, rats, etc) are
172 based on this. */
173 typedef struct {
174 ANYOBJECTFIELDS;
175 } AnyObjectType, *AnyObjectTypePtr;
177 typedef struct /* a line/polygon point */
179 LocationType X, Y, X2, Y2; /* so Point type can be cast as BoxType */
180 long int ID;
181 } PointType, *PointTypePtr;
183 /* Lines, rats, pads, etc. */
184 typedef struct {
185 ANYLINEFIELDS;
186 } AnyLineObjectType, *AnyLineObjectTypePtr;
188 typedef struct /* holds information about one line */
190 ANYLINEFIELDS;
191 char *Number;
192 } LineType, *LineTypePtr;
194 typedef struct
196 ANYOBJECTFIELDS;
197 BDimension Scale; /* text scaling in percent */
198 LocationType X, /* origin */
200 BYTE Direction;
201 char *TextString; /* string */
202 void *Element;
203 } TextType, *TextTypePtr;
205 struct polygon_st /* holds information about a polygon */
207 ANYOBJECTFIELDS;
208 Cardinal PointN, /* number of points in polygon */
209 PointMax; /* max number from malloc() */
210 POLYAREA *Clipped; /* the clipped region of this polygon */
211 PointTypePtr Points; /* data */
214 typedef struct /* holds information about arcs */
216 ANYOBJECTFIELDS;
217 BDimension Thickness, Clearance;
218 LocationType Width, /* length of axis */
219 Height, X, /* center coordinates */
221 long int StartAngle, /* the two limiting angles in degrees */
222 Delta;
223 } ArcType, *ArcTypePtr;
225 typedef struct
227 struct rtree_node *root;
228 int size; /* number of entries in tree */
229 } rtree_t;
231 typedef struct /* holds information about one layer */
233 char *Name; /* layer name */
234 Cardinal LineN, /* number of lines */
235 TextN, /* labels */
236 PolygonN, /* polygons */
237 ArcN, /* and arcs */
238 LineMax, /* max number from malloc() */
239 TextMax, PolygonMax, ArcMax;
240 LineTypePtr Line; /* pointer to additional structures */
241 TextTypePtr Text;
242 PolygonTypePtr Polygon;
243 ArcTypePtr Arc;
244 rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree;
245 Boolean On; /* visible flag */
246 char *Color, /* color */
247 *SelectedColor;
249 LayerType, *LayerTypePtr;
251 typedef struct /* a rat-line */
253 ANYLINEFIELDS;
254 Cardinal group1, group2; /* the layer group each point is on */
255 } RatType, *RatTypePtr;
257 typedef struct /* a SMD pad */
259 ANYLINEFIELDS;
260 BDimension Mask;
261 char *Name, *Number; /* 'Line' */
262 void *Element;
263 void *Spare;
264 } PadType, *PadTypePtr;
266 typedef struct
268 ANYOBJECTFIELDS;
269 BDimension Thickness, Clearance, Mask, DrillingHole;
270 LocationType X, /* center and diameter */
272 char *Name, *Number;
273 void *Element;
274 void *Spare;
275 } PinType, *PinTypePtr, **PinTypeHandle;
277 typedef struct
279 ANYOBJECTFIELDS;
280 TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */
281 /* description text */
282 /* name on PCB second, */
283 /* value third */
284 /* see macro.h */
285 LocationType MarkX, /* position mark */
286 MarkY;
287 Cardinal PinN, /* number of pins, lines and arcs */
288 PinMax, PadN, PadMax, LineN, LineMax, ArcN, ArcMax;
289 PinTypePtr Pin; /* pin description */
290 PadTypePtr Pad; /* pad description of SMD components */
291 LineTypePtr Line;
292 ArcTypePtr Arc;
293 BoxType VBox;
294 AttributeListType Attributes;
295 } ElementType, *ElementTypePtr, **ElementTypeHandle;
297 /* ---------------------------------------------------------------------------
298 * symbol and font related stuff
300 typedef struct /* a single symbol */
302 LineTypePtr Line;
303 Boolean Valid;
304 Cardinal LineN, /* number of lines */
305 LineMax;
306 BDimension Width, /* size of cell */
307 Height, Delta; /* distance to next symbol in 0.00001'' */
308 } SymbolType, *SymbolTypePtr;
310 typedef struct /* complete set of symbols */
312 LocationType MaxHeight, /* maximum cell width and height */
313 MaxWidth;
314 BoxType DefaultSymbol; /* the default symbol is a filled box */
315 SymbolType Symbol[MAX_FONTPOSITION + 1];
316 Boolean Valid;
317 } FontType, *FontTypePtr;
319 typedef struct /* holds all objects */
321 Cardinal ViaN, /* number of vias */
322 ViaMax, /* max number from malloc() */
323 ElementN, /* and elements */
324 ElementMax, /* max number from malloc() */
325 RatN, /* and rat-lines */
326 RatMax;
327 int LayerN; /* number of layers in this board */
328 PinTypePtr Via; /* pointer to object data */
329 ElementTypePtr Element;
330 RatTypePtr Rat;
331 rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */
332 *rat_tree;
333 struct PCBType *pcb;
334 LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */
335 } DataType, *DataTypePtr;
337 typedef struct /* holds drill information */
339 BDimension DrillSize; /* this drill's diameter */
340 Cardinal ElementN, /* the number of elements using this drill size */
341 ElementMax, /* max number of elements from malloc() */
342 PinCount, /* number of pins drilled this size */
343 ViaCount, /* number of vias drilled this size */
344 UnplatedCount, /* number of these holes that are unplated */
345 PinN, /* number of drill coordinates in the list */
346 PinMax; /* max number of coordinates from malloc() */
347 PinTypePtr *Pin; /* coordinates to drill */
348 ElementTypePtr *Element; /* a pointer to an array of element pointers */
349 } DrillType, *DrillTypePtr;
351 typedef struct /* holds a range of Drill Infos */
353 Cardinal DrillN, /* number of drill sizes */
354 DrillMax; /* max number from malloc() */
355 DrillTypePtr Drill; /* plated holes */
356 } DrillInfoType, *DrillInfoTypePtr;
358 typedef struct
360 BDimension Thick, /* line thickness */
361 Diameter, /* via diameter */
362 Hole, /* via drill hole */
363 Keepaway; /* min. separation from other nets */
364 char *Name;
365 int index;
366 } RouteStyleType, *RouteStyleTypePtr;
368 /* ---------------------------------------------------------------------------
369 * structure used by library routines
371 typedef struct
373 char *ListEntry; /* the string for the selection box */
374 char *AllocatedMemory, /* pointer to allocated memory; all others */
375 /* point to parts of the string */
376 *Template, /* m4 template name */
377 *Package, /* package */
378 *Value, /* the value field */
379 *Description; /* some descritional text */
380 } LibraryEntryType, *LibraryEntryTypePtr;
382 /* If the internal flag is set, the only field that is valid is Name,
383 and the struct is allocated with malloc instead of
384 CreateLibraryEntry. These "internal" entries are used for
385 electrical paths that aren't yet assigned to a real net. */
387 typedef struct
389 char *Name, /* name of the menu entry */
390 *directory, /* Directory name library elements are from */
391 *Style; /* routing style */
392 Cardinal EntryN, /* number of objects */
393 EntryMax; /* number of reserved memory locations */
394 LibraryEntryTypePtr Entry; /* the entries */
395 char flag; /* used by the netlist window to enable/disable nets */
396 char internal; /* if set, this is an internal-only entry, not
397 part of the global netlist. */
398 } LibraryMenuType, *LibraryMenuTypePtr;
400 typedef struct
402 Cardinal MenuN; /* number of objects */
403 Cardinal MenuMax; /* number of reserved memory locations */
404 LibraryMenuTypePtr Menu; /* the entries */
405 } LibraryType, *LibraryTypePtr;
408 /* The PCBType struct holds information about board layout most of which is
409 | saved with the layout. A new PCB layout struct is first initialized
410 | with values from the user configurable Settings struct and then reset
411 | to the saved layout values when a layout is loaded.
412 | This struct is also used for the remove list and for buffer handling
414 typedef struct PCBType
416 long ID; /* see macro.h */
417 FlagType Flags;
418 char *Name, /* name of board */
419 *Filename, /* name of file (from load) */
420 *PrintFilename, /* from print dialog */
421 *Netlistname, /* name of netlist file */
422 ThermStyle; /* type of thermal to place with thermal tool */
423 Boolean Changed, /* layout has been changed */
424 ViaOn, /* visibility flags */
425 ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */
426 RatDraw; /* we're drawing rats */
427 char *ViaColor, /* some colors */
428 *ViaSelectedColor,
429 *PinColor,
430 *PinSelectedColor,
431 *PinNameColor,
432 *ElementColor,
433 *RatColor,
434 *InvisibleObjectsColor,
435 *InvisibleMarkColor,
436 *ElementSelectedColor,
437 *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor;
438 long CursorX, /* cursor position as saved with layout */
439 CursorY, Clipping;
440 int Bloat, /* drc sizes saved with layout */
441 Shrink, minWid, minSlk, minDrill, minRing;
442 int GridOffsetX, /* as saved with layout */
443 GridOffsetY, MaxWidth, /* allowed size */
444 MaxHeight;
446 double Grid, /* used grid with offsets */
447 Zoom, /* zoom factor */
448 IsleArea, /* minimum poly island to retain */
449 ThermScale; /* scale factor used with thermals */
450 FontType Font;
451 LayerGroupType LayerGroups;
452 RouteStyleType RouteStyle[NUM_STYLES];
453 LibraryType NetlistLib;
454 AttributeListType Attributes;
455 DataTypePtr Data; /* entire database */
457 PCBType, *PCBTypePtr;
459 typedef struct /* information about the paste buffer */
461 LocationType X, /* offset */
463 BoxType BoundingBox;
464 DataTypePtr Data; /* data; not all members of PCBType */
465 /* are used */
466 } BufferType, *BufferTypePtr;
468 /* ---------------------------------------------------------------------------
469 * some types for cursor drawing, setting of block and lines
470 * as well as for merging of elements
472 typedef struct /* rubberband lines for element moves */
474 LayerTypePtr Layer; /* layer that holds the line */
475 LineTypePtr Line; /* the line itself */
476 PointTypePtr MovedPoint; /* and finally the point */
477 } RubberbandType, *RubberbandTypePtr;
479 typedef struct /* current marked line */
481 PointType Point1, /* start- and end-position */
482 Point2;
483 long int State;
484 Boolean draw;
485 } AttachedLineType, *AttachedLineTypePtr;
487 typedef struct /* currently marked block */
489 PointType Point1, /* start- and end-position */
490 Point2;
491 long int State;
492 Boolean otherway;
493 } AttachedBoxType, *AttachedBoxTypePtr;
495 typedef struct /* currently attached object */
497 LocationType X, /* saved position when MOVE_MODE */
498 Y; /* was entered */
499 BoxType BoundingBox;
500 long int Type, /* object type */
501 State;
502 void *Ptr1, /* three pointers to data, see */
503 *Ptr2, /* search.c */
504 *Ptr3;
505 Cardinal RubberbandN, /* number of lines in array */
506 RubberbandMax;
507 RubberbandTypePtr Rubberband;
508 } AttachedObjectType, *AttachedObjectTypePtr;
510 enum crosshair_shape
512 Basic_Crosshair_Shape = 0, /* 4-ray */
513 Union_Jack_Crosshair_Shape, /* 8-ray */
514 Dozen_Crosshair_Shape, /* 12-ray */
515 Crosshair_Shapes_Number
518 typedef struct /* holds cursor information */
520 hidGC GC, /* GC for cursor drawing */
521 AttachGC; /* and for displaying buffer contents */
522 LocationType X, /* position in PCB coordinates */
523 Y, MinX, /* lowest and highest coordinates */
524 MinY, MaxX, MaxY;
525 Boolean On; /* flag for 'is visible' */
526 AttachedLineType AttachedLine; /* data of new lines... */
527 AttachedBoxType AttachedBox;
528 PolygonType AttachedPolygon;
529 AttachedObjectType AttachedObject; /* data of attached objects */
530 enum crosshair_shape shape; /* shape of crosshair */
531 } CrosshairType, *CrosshairTypePtr;
533 typedef struct
535 Boolean status;
536 long int X, Y;
537 } MarkType, *MarkTypePtr;
539 /* ---------------------------------------------------------------------------
540 * our resources
541 * most of them are used as default when a new design is started
543 typedef struct /* some resources... */
545 Boolean grid_units_mm;
547 int verbose;
549 char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */
550 *CrosshairColor, /* different object colors */
551 *CrossColor,
552 *ViaColor,
553 *ViaSelectedColor,
554 *PinColor,
555 *PinSelectedColor,
556 *PinNameColor,
557 *ElementColor,
558 *RatColor,
559 *InvisibleObjectsColor,
560 *InvisibleMarkColor,
561 *ElementSelectedColor,
562 *RatSelectedColor,
563 *ConnectedColor,
564 *OffLimitColor,
565 *GridColor,
566 *LayerColor[MAX_LAYER],
567 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
568 int ViaThickness, /* some preset values */
569 ViaDrillingHole, LineThickness, RatThickness, Keepaway, MaxWidth, /* default size of a new layout */
570 MaxHeight, TextScale, /* text scaling in % */
571 AlignmentDistance, Bloat, /* default drc sizes */
572 Shrink, minWid, minSlk, minDrill, minRing;
573 double Grid, /* grid 0.001'' */
574 IsleArea, /* polygon min area */
575 grid_increment_mm, /* key g and <shift>g value for mil units */
576 grid_increment_mil, /* key g and <shift>g value for mil units */
577 size_increment_mm, /* key s and <shift>s value for mil units */
578 size_increment_mil, /* key s and <shift>s value for mil units */
579 line_increment_mm, line_increment_mil, clear_increment_mm, clear_increment_mil, Zoom, /* number of shift operations for zooming */
580 PinoutZoom; /* same for pinout windows */
581 int PinoutNameLength, /* max displayed length of a pinname */
582 Volume, /* the speakers volume -100..100 */
583 CharPerLine, /* width of an output line in characters */
584 Mode, /* currently active mode */
585 BufferNumber, /* number of the current buffer */
586 GridFactor; /* factor used for grid-drawing */
587 int BackupInterval; /* time between two backups in seconds */
588 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
589 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
590 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
591 *Groups, /* string with layergroups */
592 *Routes, /* string with route styles */
593 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
594 *Media, *MenuFile, /* file containing menu definitions */
595 *BackgroundImage, /* PPM file for board background */
596 *ScriptFilename, /* PCB Actions script to execute on startup */
597 *ActionString, /* PCB Actions string to execute on startup */
598 *FabAuthor, /* Full name of author for FAB drawings */
599 *InitialLayerStack; /* If set, the initial layer stack is set to this */
600 Boolean DumpMenuFile; /* dump internal menu definitions */
601 LocationType PinoutOffsetX, /* offset of origin */
602 PinoutOffsetY;
603 int PinoutTextOffsetX, /* offset of text from pin center */
604 PinoutTextOffsetY;
605 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
606 LayerGroupType LayerGroups; /* default layer groups */
607 Boolean ClearLine, FullPoly,
608 UniqueNames, /* force unique names */
609 SnapPin, /* snap to pins and pads */
610 ShowSolderSide, /* mirror output */
611 SaveLastCommand, /* save the last command entered by user */
612 SaveInTMP, /* always save data in /tmp */
613 DrawGrid, /* draw grid points */
614 RatWarn, /* rats nest has set warnings */
615 StipplePolygons, /* draw polygons with stipple */
616 AllDirectionLines, /* enable lines to all directions */
617 RubberBandMode, /* move, rotate use rubberband connections */
618 SwapStartDirection, /* change starting direction after each click */
619 ShowDRC, /* show drc region on crosshair */
620 AutoDRC, /* */
621 ShowNumber, /* pinout shows number */
622 OrthogonalMoves, /* */
623 ResetAfterElement, /* reset connections after each element */
624 liveRouting, /* autorouter shows tracks in progress */
625 RingBellWhenFinished, /* flag if a signal should be */
626 /* produced when searching of */
627 /* connections is done */
628 AutoPlace; /* flag which says we should force placement of the
629 windows on startup */
630 int HistorySize, /* FIXME? Used in hid/xaw code only. */
631 init_done;
633 SettingType, *SettingTypePtr;
635 /* ----------------------------------------------------------------------
636 * pointer to low-level copy, move and rotate functions
638 typedef struct
640 void *(*Line) (LayerTypePtr, LineTypePtr);
641 void *(*Text) (LayerTypePtr, TextTypePtr);
642 void *(*Polygon) (LayerTypePtr, PolygonTypePtr);
643 void *(*Via) (PinTypePtr);
644 void *(*Element) (ElementTypePtr);
645 void *(*ElementName) (ElementTypePtr);
646 void *(*Pin) (ElementTypePtr, PinTypePtr);
647 void *(*Pad) (ElementTypePtr, PadTypePtr);
648 void *(*LinePoint) (LayerTypePtr, LineTypePtr, PointTypePtr);
649 void *(*Point) (LayerTypePtr, PolygonTypePtr, PointTypePtr);
650 void *(*Arc) (LayerTypePtr, ArcTypePtr);
651 void *(*Rat) (RatTypePtr);
652 } ObjectFunctionType, *ObjectFunctionTypePtr;
654 /* ---------------------------------------------------------------------------
655 * structure used by device drivers
658 typedef struct /* holds a connection */
660 LocationType X, Y; /* coordinate of connection */
661 long int type; /* type of object in ptr1 - 3 */
662 void *ptr1, *ptr2; /* the object of the connection */
663 Cardinal group; /* the layer group of the connection */
664 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
665 } ConnectionType, *ConnectionTypePtr;
667 typedef struct /* holds a net of connections */
669 Cardinal ConnectionN, /* the number of connections contained */
670 ConnectionMax; /* max connections from malloc */
671 ConnectionTypePtr Connection;
672 RouteStyleTypePtr Style;
673 } NetType, *NetTypePtr;
675 typedef struct /* holds a list of nets */
677 Cardinal NetN, /* the number of subnets contained */
678 NetMax; /* max subnets from malloc */
679 NetTypePtr Net;
680 } NetListType, *NetListTypePtr;
682 typedef struct /* holds a list of net lists */
684 Cardinal NetListN, /* the number of net lists contained */
685 NetListMax; /* max net lists from malloc */
686 NetListTypePtr NetList;
687 } NetListListType, *NetListListTypePtr;
689 typedef struct /* holds a generic list of pointers */
691 Cardinal PtrN, /* the number of pointers contained */
692 PtrMax; /* max subnets from malloc */
693 void **Ptr;
694 } PointerListType, *PointerListTypePtr;
696 typedef struct
698 Cardinal BoxN, /* the number of boxes contained */
699 BoxMax; /* max boxes from malloc */
700 BoxTypePtr Box;
702 } BoxListType, *BoxListTypePtr;
705 /* ---------------------------------------------------------------------------
706 * define supported types of undo operations
707 * note these must be separate bits now
709 #define UNDO_CHANGENAME 0x0001 /* change of names */
710 #define UNDO_MOVE 0x0002 /* moving objects */
711 #define UNDO_REMOVE 0x0004 /* removing objects */
712 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
713 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
714 #define UNDO_ROTATE 0x0020 /* rotations */
715 #define UNDO_CREATE 0x0040 /* creation of objects */
716 #define UNDO_MOVETOLAYER 0x0080 /* moving objects to */
717 #define UNDO_FLAG 0x0100 /* toggling SELECTED flag */
718 #define UNDO_CHANGESIZE 0x0200 /* change size of object */
719 #define UNDO_CHANGE2NDSIZE 0x0400 /* change 2ndSize of object */
720 #define UNDO_MIRROR 0x0800 /* change side of board */
721 #define UNDO_CHANGECLEARSIZE 0x1000 /* change clearance size */
722 #define UNDO_CHANGEMASKSIZE 0x2000 /* change mask size */
723 #define UNDO_CHANGEANGLES 0x4000 /* change arc angles */
724 #define UNDO_LAYERCHANGE 0x8000 /* layer new/delete/move */
725 #define UNDO_CLEAR 0x10000 /* clear/restore to polygons */
726 #define UNDO_NETLISTCHANGE 0x20000 /* netlist change */
729 /* ---------------------------------------------------------------------------
730 * add a macro for wrapping RCS ID's in so that ident will still work
731 * but we won't get as many compiler warnings
734 #ifndef GCC_VERSION
735 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
736 #endif /* GCC_VERSION */
738 #if GCC_VERSION > 2007
739 #define ATTRIBUTE_UNUSED __attribute__((unused))
740 #else
741 #define ATTRIBUTE_UNUSED
742 #endif
744 #define RCSID(x) static char *rcsid ATTRIBUTE_UNUSED = x
746 /* ---------------------------------------------------------------------------
747 * Macros called by various action routines to show usage or to report
748 * a syntax error and fail
750 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
751 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
753 /* ---------------------------------------------------------------------------
754 * Variables with absolute paths to various directories. These are deduced
755 * at runtime to allow pcb to be relocatable
757 extern char *bindir;
758 extern char *pcblibdir;
759 extern char *pcblibpath;
760 extern char *pcbtreedir;
761 extern char *pcbtreepath;
762 extern char *exec_prefix;
763 extern char *homedir;
765 #endif /* __GLOBAL_INCLUDED__ */