1 /*
2  *   Copyright (C) 1989-1992 Yale University
3  *
4  *   This work is distributed in the hope that it will be useful; you can
5  *   redistribute it and/or modify it under the terms of the
6  *   GNU General Public License as published by the Free Software Foundation;
7  *   either version 2 of the License,
8  *   or any later version, on the following conditions:
9  *
10  *   (a) YALE MAKES NO, AND EXPRESSLY DISCLAIMS
11  *   ALL, REPRESENTATIONS OR WARRANTIES THAT THE MANUFACTURE, USE, PRACTICE,
12  *   SALE OR
13  *   OTHER DISPOSAL OF THE SOFTWARE DOES NOT OR WILL NOT INFRINGE UPON ANY
14  *   PATENT OR
15  *   OTHER RIGHTS NOT VESTED IN YALE.
16  *
17  *   (b) YALE MAKES NO, AND EXPRESSLY DISCLAIMS ALL, REPRESENTATIONS AND
18  *   WARRANTIES
19  *   WHATSOEVER WITH RESPECT TO THE SOFTWARE, EITHER EXPRESS OR IMPLIED,
20  *   INCLUDING,
21  *   BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
22  *   PARTICULAR
23  *   PURPOSE.
24  *
25  *   (c) LICENSEE SHALL MAKE NO STATEMENTS, REPRESENTATION OR WARRANTIES
26  *   WHATSOEVER TO
27  *   ANY THIRD PARTIES THAT ARE INCONSISTENT WITH THE DISCLAIMERS BY YALE IN
28  *   ARTICLE
29  *   (a) AND (b) above.
30  *
31  *   (d) IN NO EVENT SHALL YALE, OR ITS TRUSTEES, DIRECTORS, OFFICERS,
32  *   EMPLOYEES AND
33  *   AFFILIATES BE LIABLE FOR DAMAGES OF ANY KIND, INCLUDING ECONOMIC DAMAGE OR
34  *   INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER YALE SHALL BE
35  *   ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT SHALL KNOW OF THE
36  *   POSSIBILITY OF THE FOREGOING.
37  *
38  */
39 
40 /* -----------------------------------------------------------------
41 FILE:	    globals.h
42 DESCRIPTION:This file contains the global definitions and typedefs
43 	    for the genrow program.
44 CONTENTS:
45 DATE:	    Aug  9, 1989
46 REVISIONS:  Feb 28, 1990 - added new fields to tiles for graphics.
47 	    Dec  7, 1990 - added force field and new variables for
48 		performing merges.
49 	    Fri Jan 25 17:50:54 PST 1991 - added mirror row feature.
50 	    Sat Feb 23 00:34:11 EST 1991 - added no macro move global.
51 	    Thu Mar  7 03:11:42 EST 1991 - added num_rowsG global.
52 	    Wed Apr 17 22:39:04 EDT 1991 - added wait_for_user global
53 		and orientation field for macro.
54 ----------------------------------------------------------------- */
55 #ifndef GLOBALS_H
56 #define GLOBALS_H
57 
58 
59 #ifndef GLOBAL_DEFS
60 #define EXTERN extern
61 
62 #else
63 #define EXTERN
64 #endif
65 
66 /* remove graphics lines of code if compile switch is on */
67 #ifdef NOGRAPHICS
68 #define G(x_xz)
69 
70 #else
71 #define G(x_xz)   x_xz
72 
73 #endif /* NOGRAPHICS */
74 
75 #define START 1
76 #define END 2
77 #define NOTHING 3
78 #define FROM_LEFT 4
79 #define FROM_RIGHT 5
80 #define FROM_TOP 6
81 #define FROM_BOTTOM 7
82 #define TO_LEFT 8
83 #define TO_RIGHT 9
84 #define TO_TOP 10
85 #define TO_BOTTOM 11
86 #define MAYBE_START 12
87 #define MAYBE_END 13
88 
89 #define MERGED_NONE 0
90 #define MERGED_UP   1
91 #define MERGED_DOWN 2
92 #define MERGED_LEFT 3
93 #define MERGED_RITE 4
94 
95 typedef struct tile_box {
96     INT name ;              /* index of the tile */
97     INT llx ;
98     INT lly ;
99     INT urx ;
100     INT ury ;
101     INT numrows ;
102     INT class ;
103     INT actual_row_height ;
104     INT add_no_more_than ; /* the xspan of the tile */
105     INT channel_separation ;
106     INT min_length ; /* the size of the minimum valid row */
107     INT max_length ; /* the maximum length of the block normally tile width - 2 */
108     INT row_start ;  /* offset from the beginning of the tile */
109     INT merged ;     /* direction of the merge */
110     BOOL illegal ;   /* FALSE means a legal tile to use */
111     BOOL force ;     /* force the number of rows */
112     BOOL mirror ;    /* mirror rows ?? */
113     BOOL allocated ; /* whether tile is currently allocated or freed */
114     struct tile_box *next ;
115     struct tile_box *prev ;
116 } TILE_BOX ;
117 
118 typedef struct macro_tile {
119     INT l ;
120     INT r ;
121     INT b ;
122     INT t ;
123     struct macro_tile *next ;
124 } MACRO_TILE ;
125 
126 typedef struct vertex_box {
127     INT x ;
128     INT y ;
129     INT class ;
130     INT macro ;
131     struct vertex_box *next ;
132 } *VERTEXPTR, VERTEX_BOX ;
133 
134 typedef struct macro_rec {
135     MACRO_TILE *tiles ;    /* the tiles of the macro */
136     INT num_vertices ;     /* number of vertices on macro */
137     VERTEXPTR *vertices ; /* the vertices of a macro */
138     INT xcenter ;
139     INT ycenter ;
140     INT xcenter_orig ;
141     INT ycenter_orig ;
142     INT left ;
143     INT right ;
144     INT bottom ;
145     INT top ;
146     INT orient ;
147 } MACROBOX, *MACROPTR ;
148 
149 typedef struct row_box {
150     INT llx ;
151     INT lly ;
152     INT urx ;
153     INT ury ;
154     INT class ;
155     INT seg ;
156     BOOL mirror ;    /* mirror rows ?? */
157     struct row_box *next_row ;
158     struct row_box *next_segment ;
159 } ROW_BOX ;
160 
161 /* ********************** global variables ************************ */
162 /* GENERAL GLOBAL VARIABLES */
163 EXTERN char *cktNameG ;
164 EXTERN BOOL graphicsG ;           /* TRUE if graphics are requested */
165 
166 /* DATA GLOBAL VARIABLES */
167 EXTERN  TILE_BOX *tile_listG ;    /* head of list of tiles */
168 EXTERN  TILE_BOX *last_tileG ;    /* end of list of tiles */
169 EXTERN  TILE_BOX *start_tileG;    /* current start of tiles */
170 EXTERN  MACROPTR *macroArrayG ;
171 EXTERN  MACROPTR *mergeArrayG ;   /* tiles that the user merged */
172 EXTERN  INT      num_macrosG ;    /* number of macros given */
173 EXTERN  INT      num_mergedG ;    /* number of merged tiles given */
174 EXTERN  INT      num_rowsG ;      /* user specified the number of rows */
175 EXTERN  INT      feeds_per_segG ; /* feed length per segment */
176 EXTERN  INT      flip_alternateG; /* flip alternate rows beginning at 1 or 2 */
177 EXTERN  INT      spacingG ;       /* spacing to macros */
178 EXTERN  BOOL     shortRowG ;      /* whether to keep short row */
179 EXTERN  BOOL     invalidG ;      /* whether configuration is ok */
180 EXTERN  BOOL     limitMergeG ;    /* whether to limit merge to 1 step */
181 EXTERN  BOOL     noMacroMoveG ;   /* when TRUE macros may not move */
182 EXTERN  BOOL     wait_for_userG;  /* normally wait for user */
183 EXTERN  BOOL     last_chanceG;    /* "last chance" timeout */
184 EXTERN  BOOL     memoryG ;        /* try to remember last state */
185 EXTERN  BOOL     no_outputG ;     /* when TRUE no .blk file */
186 /* ********************** end global variables ******************** */
187 
188 #endif /* GLOBALS_H */
189