Make rtree_t type available to polygon1.c
[geda-pcb/gde.git] / src / global.h
blob4cf489a6a711a00b11cf6e46c80522c6033e4dde
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"
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string.h>
47 #include <strings.h>
48 #include <stdarg.h>
49 #include <math.h>
50 #include <ctype.h>
51 #include <sys/types.h>
53 typedef struct BoxType BoxType, *BoxTypePtr;
54 typedef struct polygon_st PolygonType, *PolygonTypePtr;
55 typedef struct drc_violation_st DrcViolationType, *DrcViolationTypePtr;
56 typedef struct rtree rtree_t;
58 #include "hid.h"
59 #include "polyarea.h"
61 #define _(S) (S)
63 typedef int LocationType;
64 typedef int BDimension; /* big dimension */
67 #ifndef XtSpecificationRelease
68 typedef unsigned int Cardinal;
69 typedef char Boolean;
70 /*typedef unsigned int Pixel;*/
71 typedef char *String;
72 typedef short Position;
73 typedef short Dimension;
74 #endif
75 typedef unsigned char BYTE;
77 #define True 1
78 #define False 0
80 /* Nobody should know about the internals of this except the macros in
81 macros.h that access it. This structure must be simple-assignable
82 for now. */
83 typedef struct
85 unsigned long f; /* generic flags */
86 unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */
87 } FlagType, *FlagTypePtr;
89 #ifndef __GNUC__
90 #define __FUNCTION1(a,b) a ":" #b
91 #define __FUNCTION2(a,b) __FUNCTION1(a,b)
92 #define __FUNCTION__ __FUNCTION2(__FILE__,__LINE__)
93 #endif
96 /* ---------------------------------------------------------------------------
97 * Macros to annotate branch-prediction information.
98 * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have
99 * been removed to avoid namespace clashes.
102 /* The LIKELY and UNLIKELY macros let the programmer give hints to
103 * the compiler about the expected result of an expression. Some compilers
104 * can use this information for optimizations.
106 * The _BOOLEAN_EXPR macro is intended to trigger a gcc warning when
107 * putting assignments inside the test.
109 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
110 #define _BOOLEAN_EXPR(expr) \
111 __extension__ ({ \
112 int _boolean_var_; \
113 if (expr) \
114 _boolean_var_ = 1; \
115 else \
116 _boolean_var_ = 0; \
117 _boolean_var_; \
119 #define LIKELY(expr) (__builtin_expect (_BOOLEAN_EXPR(expr), 1))
120 #define UNLIKELY(expr) (__builtin_expect (_BOOLEAN_EXPR(expr), 0))
121 #else
122 #define LIKELY(expr) (expr)
123 #define UNLIKELY(expr) (expr)
124 #endif
127 /* ---------------------------------------------------------------------------
128 * Do not change the following definitions even if they're not very
129 * nice. It allows us to have functions act on these "base types" and
130 * not need to know what kind of actual object they're working on.
133 /* Any object that uses the "object flags" defined in const.h, or
134 exists as an object on the pcb, MUST be defined using this as the
135 first fields, either directly or through ANYLINEFIELDS. */
136 #define ANYOBJECTFIELDS \
137 BoxType BoundingBox; \
138 long int ID; \
139 FlagType Flags; \
140 struct LibraryEntryType *net
142 /* Lines, pads, and rats all use this so they can be cross-cast. */
143 #define ANYLINEFIELDS \
144 ANYOBJECTFIELDS; \
145 BDimension Thickness, \
146 Clearance; \
147 PointType Point1, \
148 Point2
150 /* ---------------------------------------------------------------------------
151 * some useful values of our widgets
153 typedef struct /* holds information about output window */
155 hidGC bgGC, /* background and foreground; */
156 fgGC, /* changed from some routines */
157 pmGC, /* depth 1 pixmap GC to store clip */
158 GridGC; /* for the grid */
160 int Width, /* sizes of output window (porthole) */
161 Height;
162 int oldObjState, /* Helpers for GetLocation */
163 oldLineState, oldBoxState;
165 OutputType, *OutputTypePtr;
167 /* ----------------------------------------------------------------------
168 * layer group. A layer group identifies layers which are always switched
169 * on/off together.
171 typedef struct
173 Cardinal Number[MAX_LAYER], /* number of entries per groups */
174 Entries[MAX_LAYER][MAX_LAYER + 2];
175 } LayerGroupType, *LayerGroupTypePtr;
177 struct BoxType /* a bounding box */
179 LocationType X1, Y1, /* upper left */
180 X2, Y2; /* and lower right corner */
183 typedef struct
185 LocationType x, y;
186 int width, height;
187 } RectangleType, *RectangleTypePtr;
189 typedef struct
191 char *name;
192 char *value;
193 } AttributeType, *AttributeTypePtr;
195 typedef struct
197 int Number, Max;
198 AttributeType *List;
199 } AttributeListType, *AttributeListTypePtr;
201 /* ---------------------------------------------------------------------------
202 * the basic object types supported by PCB
205 /* All on-pcb objects (elements, lines, pads, vias, rats, etc) are
206 based on this. */
207 typedef struct {
208 ANYOBJECTFIELDS;
209 } AnyObjectType, *AnyObjectTypePtr;
211 typedef struct /* a line/polygon point */
213 LocationType X, Y, X2, Y2; /* so Point type can be cast as BoxType */
214 long int ID;
215 } PointType, *PointTypePtr;
217 /* Lines, rats, pads, etc. */
218 typedef struct {
219 ANYLINEFIELDS;
220 } AnyLineObjectType, *AnyLineObjectTypePtr;
222 typedef struct /* holds information about one line */
224 ANYLINEFIELDS;
225 char *Number;
226 } LineType, *LineTypePtr;
228 typedef struct
230 ANYOBJECTFIELDS;
231 BDimension Scale; /* text scaling in percent */
232 LocationType X, /* origin */
234 BYTE Direction;
235 char *TextString; /* string */
236 void *Element;
237 } TextType, *TextTypePtr;
239 struct polygon_st /* holds information about a polygon */
241 ANYOBJECTFIELDS;
242 Cardinal PointN, /* number of points in polygon */
243 PointMax; /* max number from malloc() */
244 POLYAREA *Clipped; /* the clipped region of this polygon */
245 PLINE *NoHoles; /* the polygon broken into hole-less regions */
246 int NoHolesValid; /* Is the NoHoles polygon up to date? */
247 PointTypePtr Points; /* data */
250 typedef struct /* holds information about arcs */
252 ANYOBJECTFIELDS;
253 BDimension Thickness, Clearance;
254 LocationType Width, /* length of axis */
255 Height, X, /* center coordinates */
257 long int StartAngle, /* the two limiting angles in degrees */
258 Delta;
259 } ArcType, *ArcTypePtr;
261 struct rtree
263 struct rtree_node *root;
264 int size; /* number of entries in tree */
267 typedef struct /* holds information about one layer */
269 char *Name; /* layer name */
270 Cardinal LineN, /* number of lines */
271 TextN, /* labels */
272 PolygonN, /* polygons */
273 ArcN, /* and arcs */
274 LineMax, /* max number from malloc() */
275 TextMax, PolygonMax, ArcMax;
276 LineTypePtr Line; /* pointer to additional structures */
277 TextTypePtr Text;
278 PolygonTypePtr Polygon;
279 ArcTypePtr Arc;
280 rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree;
281 Boolean On; /* visible flag */
282 char *Color, /* color */
283 *SelectedColor;
285 LayerType, *LayerTypePtr;
287 typedef struct /* a rat-line */
289 ANYLINEFIELDS;
290 Cardinal group1, group2; /* the layer group each point is on */
291 } RatType, *RatTypePtr;
293 typedef struct /* a SMD pad */
295 ANYLINEFIELDS;
296 BDimension Mask;
297 char *Name, *Number; /* 'Line' */
298 void *Element;
299 void *Spare;
300 } PadType, *PadTypePtr;
302 typedef struct
304 ANYOBJECTFIELDS;
305 BDimension Thickness, Clearance, Mask, DrillingHole;
306 LocationType X, /* center and diameter */
308 char *Name, *Number;
309 void *Element;
310 void *Spare;
311 } PinType, *PinTypePtr, **PinTypeHandle;
313 typedef struct
315 ANYOBJECTFIELDS;
316 TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */
317 /* description text */
318 /* name on PCB second, */
319 /* value third */
320 /* see macro.h */
321 LocationType MarkX, /* position mark */
322 MarkY;
323 Cardinal PinN, /* number of pins, lines and arcs */
324 PinMax, PadN, PadMax, LineN, LineMax, ArcN, ArcMax;
325 PinTypePtr Pin; /* pin description */
326 PadTypePtr Pad; /* pad description of SMD components */
327 LineTypePtr Line;
328 ArcTypePtr Arc;
329 BoxType VBox;
330 AttributeListType Attributes;
331 } ElementType, *ElementTypePtr, **ElementTypeHandle;
333 /* ---------------------------------------------------------------------------
334 * symbol and font related stuff
336 typedef struct /* a single symbol */
338 LineTypePtr Line;
339 Boolean Valid;
340 Cardinal LineN, /* number of lines */
341 LineMax;
342 BDimension Width, /* size of cell */
343 Height, Delta; /* distance to next symbol in 0.00001'' */
344 } SymbolType, *SymbolTypePtr;
346 typedef struct /* complete set of symbols */
348 LocationType MaxHeight, /* maximum cell width and height */
349 MaxWidth;
350 BoxType DefaultSymbol; /* the default symbol is a filled box */
351 SymbolType Symbol[MAX_FONTPOSITION + 1];
352 Boolean Valid;
353 } FontType, *FontTypePtr;
355 typedef struct /* holds all objects */
357 Cardinal ViaN, /* number of vias */
358 ViaMax, /* max number from malloc() */
359 ElementN, /* and elements */
360 ElementMax, /* max number from malloc() */
361 RatN, /* and rat-lines */
362 RatMax;
363 int LayerN; /* number of layers in this board */
364 PinTypePtr Via; /* pointer to object data */
365 ElementTypePtr Element;
366 RatTypePtr Rat;
367 rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */
368 *rat_tree;
369 struct PCBType *pcb;
370 LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */
371 } DataType, *DataTypePtr;
373 typedef struct /* holds drill information */
375 BDimension DrillSize; /* this drill's diameter */
376 Cardinal ElementN, /* the number of elements using this drill size */
377 ElementMax, /* max number of elements from malloc() */
378 PinCount, /* number of pins drilled this size */
379 ViaCount, /* number of vias drilled this size */
380 UnplatedCount, /* number of these holes that are unplated */
381 PinN, /* number of drill coordinates in the list */
382 PinMax; /* max number of coordinates from malloc() */
383 PinTypePtr *Pin; /* coordinates to drill */
384 ElementTypePtr *Element; /* a pointer to an array of element pointers */
385 } DrillType, *DrillTypePtr;
387 typedef struct /* holds a range of Drill Infos */
389 Cardinal DrillN, /* number of drill sizes */
390 DrillMax; /* max number from malloc() */
391 DrillTypePtr Drill; /* plated holes */
392 } DrillInfoType, *DrillInfoTypePtr;
394 typedef struct
396 BDimension Thick, /* line thickness */
397 Diameter, /* via diameter */
398 Hole, /* via drill hole */
399 Keepaway; /* min. separation from other nets */
400 char *Name;
401 int index;
402 } RouteStyleType, *RouteStyleTypePtr;
404 /* ---------------------------------------------------------------------------
405 * structure used by library routines
407 typedef struct
409 char *ListEntry; /* the string for the selection box */
410 char *AllocatedMemory, /* pointer to allocated memory; all others */
411 /* point to parts of the string */
412 *Template, /* m4 template name */
413 *Package, /* package */
414 *Value, /* the value field */
415 *Description; /* some descritional text */
416 } LibraryEntryType, *LibraryEntryTypePtr;
418 /* If the internal flag is set, the only field that is valid is Name,
419 and the struct is allocated with malloc instead of
420 CreateLibraryEntry. These "internal" entries are used for
421 electrical paths that aren't yet assigned to a real net. */
423 typedef struct
425 char *Name, /* name of the menu entry */
426 *directory, /* Directory name library elements are from */
427 *Style; /* routing style */
428 Cardinal EntryN, /* number of objects */
429 EntryMax; /* number of reserved memory locations */
430 LibraryEntryTypePtr Entry; /* the entries */
431 char flag; /* used by the netlist window to enable/disable nets */
432 char internal; /* if set, this is an internal-only entry, not
433 part of the global netlist. */
434 } LibraryMenuType, *LibraryMenuTypePtr;
436 typedef struct
438 Cardinal MenuN; /* number of objects */
439 Cardinal MenuMax; /* number of reserved memory locations */
440 LibraryMenuTypePtr Menu; /* the entries */
441 } LibraryType, *LibraryTypePtr;
444 /* The PCBType struct holds information about board layout most of which is
445 | saved with the layout. A new PCB layout struct is first initialized
446 | with values from the user configurable Settings struct and then reset
447 | to the saved layout values when a layout is loaded.
448 | This struct is also used for the remove list and for buffer handling
450 typedef struct PCBType
452 long ID; /* see macro.h */
453 FlagType Flags;
454 char *Name, /* name of board */
455 *Filename, /* name of file (from load) */
456 *PrintFilename, /* from print dialog */
457 *Netlistname, /* name of netlist file */
458 ThermStyle; /* type of thermal to place with thermal tool */
459 Boolean Changed, /* layout has been changed */
460 ViaOn, /* visibility flags */
461 ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */
462 RatDraw; /* we're drawing rats */
463 char *ViaColor, /* some colors */
464 *ViaSelectedColor,
465 *PinColor,
466 *PinSelectedColor,
467 *PinNameColor,
468 *ElementColor,
469 *RatColor,
470 *InvisibleObjectsColor,
471 *InvisibleMarkColor,
472 *ElementSelectedColor,
473 *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor;
474 long CursorX, /* cursor position as saved with layout */
475 CursorY, Clipping;
476 int Bloat, /* drc sizes saved with layout */
477 Shrink, minWid, minSlk, minDrill, minRing;
478 int GridOffsetX, /* as saved with layout */
479 GridOffsetY, MaxWidth, /* allowed size */
480 MaxHeight;
482 double Grid, /* used grid with offsets */
483 Zoom, /* zoom factor */
484 IsleArea, /* minimum poly island to retain */
485 ThermScale; /* scale factor used with thermals */
486 FontType Font;
487 LayerGroupType LayerGroups;
488 RouteStyleType RouteStyle[NUM_STYLES];
489 LibraryType NetlistLib;
490 AttributeListType Attributes;
491 DataTypePtr Data; /* entire database */
493 PCBType, *PCBTypePtr;
495 typedef struct /* information about the paste buffer */
497 LocationType X, /* offset */
499 BoxType BoundingBox;
500 DataTypePtr Data; /* data; not all members of PCBType */
501 /* are used */
502 } BufferType, *BufferTypePtr;
504 /* ---------------------------------------------------------------------------
505 * some types for cursor drawing, setting of block and lines
506 * as well as for merging of elements
508 typedef struct /* rubberband lines for element moves */
510 LayerTypePtr Layer; /* layer that holds the line */
511 LineTypePtr Line; /* the line itself */
512 PointTypePtr MovedPoint; /* and finally the point */
513 } RubberbandType, *RubberbandTypePtr;
515 typedef struct /* current marked line */
517 PointType Point1, /* start- and end-position */
518 Point2;
519 long int State;
520 Boolean draw;
521 } AttachedLineType, *AttachedLineTypePtr;
523 typedef struct /* currently marked block */
525 PointType Point1, /* start- and end-position */
526 Point2;
527 long int State;
528 Boolean otherway;
529 } AttachedBoxType, *AttachedBoxTypePtr;
531 typedef struct /* currently attached object */
533 LocationType X, /* saved position when MOVE_MODE */
534 Y; /* was entered */
535 BoxType BoundingBox;
536 long int Type, /* object type */
537 State;
538 void *Ptr1, /* three pointers to data, see */
539 *Ptr2, /* search.c */
540 *Ptr3;
541 Cardinal RubberbandN, /* number of lines in array */
542 RubberbandMax;
543 RubberbandTypePtr Rubberband;
544 } AttachedObjectType, *AttachedObjectTypePtr;
546 enum crosshair_shape
548 Basic_Crosshair_Shape = 0, /* 4-ray */
549 Union_Jack_Crosshair_Shape, /* 8-ray */
550 Dozen_Crosshair_Shape, /* 12-ray */
551 Crosshair_Shapes_Number
554 typedef struct /* holds cursor information */
556 hidGC GC, /* GC for cursor drawing */
557 AttachGC; /* and for displaying buffer contents */
558 LocationType X, /* position in PCB coordinates */
559 Y, MinX, /* lowest and highest coordinates */
560 MinY, MaxX, MaxY;
561 Boolean On; /* flag for 'is visible' */
562 AttachedLineType AttachedLine; /* data of new lines... */
563 AttachedBoxType AttachedBox;
564 PolygonType AttachedPolygon;
565 AttachedObjectType AttachedObject; /* data of attached objects */
566 enum crosshair_shape shape; /* shape of crosshair */
567 } CrosshairType, *CrosshairTypePtr;
569 typedef struct
571 Boolean status;
572 long int X, Y;
573 } MarkType, *MarkTypePtr;
575 /* ---------------------------------------------------------------------------
576 * our resources
577 * most of them are used as default when a new design is started
579 typedef struct /* some resources... */
581 Boolean grid_units_mm;
583 int verbose;
585 char *BlackColor, *WhiteColor, *BackgroundColor, /* background and cursor color ... */
586 *CrosshairColor, /* different object colors */
587 *CrossColor,
588 *ViaColor,
589 *ViaSelectedColor,
590 *PinColor,
591 *PinSelectedColor,
592 *PinNameColor,
593 *ElementColor,
594 *RatColor,
595 *InvisibleObjectsColor,
596 *InvisibleMarkColor,
597 *ElementSelectedColor,
598 *RatSelectedColor,
599 *ConnectedColor,
600 *OffLimitColor,
601 *GridColor,
602 *LayerColor[MAX_LAYER],
603 *LayerSelectedColor[MAX_LAYER], *WarnColor, *MaskColor;
604 int ViaThickness, /* some preset values */
605 ViaDrillingHole, LineThickness, RatThickness, Keepaway, MaxWidth, /* default size of a new layout */
606 MaxHeight, TextScale, /* text scaling in % */
607 AlignmentDistance, Bloat, /* default drc sizes */
608 Shrink, minWid, minSlk, minDrill, minRing;
609 double Grid, /* grid 0.001'' */
610 IsleArea, /* polygon min area */
611 grid_increment_mm, /* key g and <shift>g value for mil units */
612 grid_increment_mil, /* key g and <shift>g value for mil units */
613 size_increment_mm, /* key s and <shift>s value for mil units */
614 size_increment_mil, /* key s and <shift>s value for mil units */
615 line_increment_mm, line_increment_mil, clear_increment_mm, clear_increment_mil, Zoom, /* number of shift operations for zooming */
616 PinoutZoom; /* same for pinout windows */
617 int PinoutNameLength, /* max displayed length of a pinname */
618 Volume, /* the speakers volume -100..100 */
619 CharPerLine, /* width of an output line in characters */
620 Mode, /* currently active mode */
621 BufferNumber, /* number of the current buffer */
622 GridFactor; /* factor used for grid-drawing */
623 int BackupInterval; /* time between two backups in seconds */
624 char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */
625 *FileCommand, *ElementCommand, *PrintFile, *LibraryCommandDir, *LibraryCommand, *LibraryContentsCommand, *LibraryTree, /* path to library tree */
626 *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */
627 *Groups, /* string with layergroups */
628 *Routes, /* string with route styles */
629 *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *LibraryPath, *Size, /* geometry string for size */
630 *Media, *MenuFile, /* file containing menu definitions */
631 *BackgroundImage, /* PPM file for board background */
632 *ScriptFilename, /* PCB Actions script to execute on startup */
633 *ActionString, /* PCB Actions string to execute on startup */
634 *FabAuthor, /* Full name of author for FAB drawings */
635 *InitialLayerStack; /* If set, the initial layer stack is set to this */
636 Boolean DumpMenuFile; /* dump internal menu definitions */
637 LocationType PinoutOffsetX, /* offset of origin */
638 PinoutOffsetY;
639 int PinoutTextOffsetX, /* offset of text from pin center */
640 PinoutTextOffsetY;
641 RouteStyleType RouteStyle[NUM_STYLES]; /* default routing styles */
642 LayerGroupType LayerGroups; /* default layer groups */
643 Boolean ClearLine, FullPoly,
644 UniqueNames, /* force unique names */
645 SnapPin, /* snap to pins and pads */
646 ShowSolderSide, /* mirror output */
647 SaveLastCommand, /* save the last command entered by user */
648 SaveInTMP, /* always save data in /tmp */
649 DrawGrid, /* draw grid points */
650 RatWarn, /* rats nest has set warnings */
651 StipplePolygons, /* draw polygons with stipple */
652 AllDirectionLines, /* enable lines to all directions */
653 RubberBandMode, /* move, rotate use rubberband connections */
654 SwapStartDirection, /* change starting direction after each click */
655 ShowDRC, /* show drc region on crosshair */
656 AutoDRC, /* */
657 ShowNumber, /* pinout shows number */
658 OrthogonalMoves, /* */
659 ResetAfterElement, /* reset connections after each element */
660 liveRouting, /* autorouter shows tracks in progress */
661 RingBellWhenFinished, /* flag if a signal should be */
662 /* produced when searching of */
663 /* connections is done */
664 AutoPlace; /* flag which says we should force placement of the
665 windows on startup */
666 int HistorySize, /* FIXME? Used in hid/xaw code only. */
667 init_done;
669 SettingType, *SettingTypePtr;
671 /* ----------------------------------------------------------------------
672 * pointer to low-level copy, move and rotate functions
674 typedef struct
676 void *(*Line) (LayerTypePtr, LineTypePtr);
677 void *(*Text) (LayerTypePtr, TextTypePtr);
678 void *(*Polygon) (LayerTypePtr, PolygonTypePtr);
679 void *(*Via) (PinTypePtr);
680 void *(*Element) (ElementTypePtr);
681 void *(*ElementName) (ElementTypePtr);
682 void *(*Pin) (ElementTypePtr, PinTypePtr);
683 void *(*Pad) (ElementTypePtr, PadTypePtr);
684 void *(*LinePoint) (LayerTypePtr, LineTypePtr, PointTypePtr);
685 void *(*Point) (LayerTypePtr, PolygonTypePtr, PointTypePtr);
686 void *(*Arc) (LayerTypePtr, ArcTypePtr);
687 void *(*Rat) (RatTypePtr);
688 } ObjectFunctionType, *ObjectFunctionTypePtr;
690 /* ---------------------------------------------------------------------------
691 * structure used by device drivers
694 typedef struct /* holds a connection */
696 LocationType X, Y; /* coordinate of connection */
697 long int type; /* type of object in ptr1 - 3 */
698 void *ptr1, *ptr2; /* the object of the connection */
699 Cardinal group; /* the layer group of the connection */
700 LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */
701 } ConnectionType, *ConnectionTypePtr;
703 typedef struct /* holds a net of connections */
705 Cardinal ConnectionN, /* the number of connections contained */
706 ConnectionMax; /* max connections from malloc */
707 ConnectionTypePtr Connection;
708 RouteStyleTypePtr Style;
709 } NetType, *NetTypePtr;
711 typedef struct /* holds a list of nets */
713 Cardinal NetN, /* the number of subnets contained */
714 NetMax; /* max subnets from malloc */
715 NetTypePtr Net;
716 } NetListType, *NetListTypePtr;
718 typedef struct /* holds a list of net lists */
720 Cardinal NetListN, /* the number of net lists contained */
721 NetListMax; /* max net lists from malloc */
722 NetListTypePtr NetList;
723 } NetListListType, *NetListListTypePtr;
725 typedef struct /* holds a generic list of pointers */
727 Cardinal PtrN, /* the number of pointers contained */
728 PtrMax; /* max subnets from malloc */
729 void **Ptr;
730 } PointerListType, *PointerListTypePtr;
732 typedef struct
734 Cardinal BoxN, /* the number of boxes contained */
735 BoxMax; /* max boxes from malloc */
736 BoxTypePtr Box;
738 } BoxListType, *BoxListTypePtr;
740 struct drc_violation_st
742 char *title;
743 char *explanation;
744 int x;
745 int y;
746 int angle;
747 int have_measured;
748 double measured_value;
749 double required_value;
750 int value_digits;
751 const char *value_units;
752 int object_count;
753 long int *object_id_list;
754 int *object_type_list;
757 /* ---------------------------------------------------------------------------
758 * define supported types of undo operations
759 * note these must be separate bits now
761 #define UNDO_CHANGENAME 0x0001 /* change of names */
762 #define UNDO_MOVE 0x0002 /* moving objects */
763 #define UNDO_REMOVE 0x0004 /* removing objects */
764 #define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */
765 #define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */
766 #define UNDO_ROTATE 0x0020 /* rotations */
767 #define UNDO_CREATE 0x0040 /* creation of objects */
768 #define UNDO_MOVETOLAYER 0x0080 /* moving objects to */
769 #define UNDO_FLAG 0x0100 /* toggling SELECTED flag */
770 #define UNDO_CHANGESIZE 0x0200 /* change size of object */
771 #define UNDO_CHANGE2NDSIZE 0x0400 /* change 2ndSize of object */
772 #define UNDO_MIRROR 0x0800 /* change side of board */
773 #define UNDO_CHANGECLEARSIZE 0x1000 /* change clearance size */
774 #define UNDO_CHANGEMASKSIZE 0x2000 /* change mask size */
775 #define UNDO_CHANGEANGLES 0x4000 /* change arc angles */
776 #define UNDO_LAYERCHANGE 0x8000 /* layer new/delete/move */
777 #define UNDO_CLEAR 0x10000 /* clear/restore to polygons */
778 #define UNDO_NETLISTCHANGE 0x20000 /* netlist change */
781 /* ---------------------------------------------------------------------------
782 * add a macro for wrapping RCS ID's in so that ident will still work
783 * but we won't get as many compiler warnings
786 #ifndef GCC_VERSION
787 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
788 #endif /* GCC_VERSION */
790 #if GCC_VERSION > 2007
791 #define ATTRIBUTE_UNUSED __attribute__((unused))
792 #else
793 #define ATTRIBUTE_UNUSED
794 #endif
796 #define RCSID(x) static char *rcsid ATTRIBUTE_UNUSED = x
798 /* ---------------------------------------------------------------------------
799 * Macros called by various action routines to show usage or to report
800 * a syntax error and fail
802 #define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax))
803 #define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; }
805 /* ---------------------------------------------------------------------------
806 * Variables with absolute paths to various directories. These are deduced
807 * at runtime to allow pcb to be relocatable
809 extern char *bindir;
810 extern char *pcblibdir;
811 extern char *pcblibpath;
812 extern char *pcbtreedir;
813 extern char *pcbtreepath;
814 extern char *exec_prefix;
815 extern char *homedir;
817 #endif /* __GLOBAL_INCLUDED__ */