1 /* SCCS-info %W% %E% */
2 
3 /*--------------------------------------------------------------------*/
4 /*                                                                    */
5 /*              VCG : Visualization of Compiler Graphs                */
6 /*              --------------------------------------                */
7 /*                                                                    */
8 /*   file:         globals.h                                          */
9 /*   version:      1.00.00                                            */
10 /*   creation:     1.4.1993                                           */
11 /*   author:       I. Lemke  (...-Version 0.99.99)                    */
12 /*                 G. Sander (Version 1.00.00-...)                    */
13 /*                 Universitaet des Saarlandes, 66041 Saarbruecken    */
14 /*                 ESPRIT Project #5399 Compare                       */
15 /*   description:  Global definitions and setup                       */
16 /*   status:       in work                                            */
17 /*                                                                    */
18 /*--------------------------------------------------------------------*/
19 
20 /* $Id: globals.h.tpl,v 3.7 1994/11/23 14:50:47 sander Exp sander $ */
21 
22 /*
23  *   Copyright (C) 1993-2005 Saarland University
24  *
25  *  This program and documentation is free software; you can redistribute
26  *  it under the terms of the  GNU General Public License as published by
27  *  the  Free Software Foundation;  either version 2  of the License,  or
28  *  (at your option) any later version.
29  *
30  *  This  program  is  distributed  in  the hope that it will be useful,
31  *  but  WITHOUT ANY WARRANTY;  without  even  the  implied  warranty of
32  *  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE.  See  the
33  *  GNU General Public License for more details.
34  *
35  *  You  should  have  received a copy of the GNU General Public License
36  *  along  with  this  program;  if  not,  write  to  the  Free Software
37  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
38  *
39  *  The software is available per anonymous ftp at ftp.cs.uni-sb.de.
40  *  Contact  sander@cs.uni-sb.de  for additional information.
41  */
42 
43 
44 /* $Log: globals.h.tpl,v $
45 # Revision 3.7  1994/11/23  14:50:47  sander
46 # #include <limits.h> added to get MAX_INT and MIN_INT.
47 #
48 # Revision 3.6  1994/08/08  16:01:47  sander
49 # Attributes xraster, xlraster, yraster added.
50 #
51 # Revision 3.5  1994/08/02  15:36:12  sander
52 # CHECKNODE option added to allow tracing of properties
53 # of one single node. For debugging only.
54 #
55 # Revision 3.4  1994/06/07  14:09:59  sander
56 # Splines implemented.
57 # HP-UX, Linux, AIX, Sun-Os, IRIX compatibility tested.
58 # The tool is now ready to be distributed.
59 #
60 # Revision 3.3  1994/05/16  08:56:03  sander
61 # shape attribute (boxes, rhombs, ellipses, triangles) added.
62 #
63 # Revision 3.2  1994/03/02  11:48:54  sander
64 # Layoutalgoritms mindepthslow, maxdepthslow, minindegree, ... mandegree
65 # added.
66 # Anchors and nearedges are not anymore allowed to be intermixed.
67 # Escapes in strings are now allowed.
68 #
69 # Revision 3.1  1994/03/01  10:59:55  sander
70 # Copyright and Gnu Licence message added.
71 # Problem with "nearedges: no" and "selfloops" solved.
72 #
73 # Revision 1.2  1994/01/21  19:43:42  sander
74 # New started with release 1.2 from the scratch.
75 # Old and useless comments removed.
76 #
77  *
78  */
79 
80 /*   This file contains the setup of the tool for the C compiler.
81  *   It is included into every other C file.
82  *   Please adapt corresponding to your configuration.
83  */
84 
85 #ifndef GLOBALS_H
86 #define	GLOBALS_H
87 
88 /*------------- Please change according to your configuration --------*/
89 
90 /*   Ansi C compiler or K&R C compiler ?
91  *   Mainly, this causes to use prototypes or not. Note that the Suntool
92  *   include files on some systems are Non-Ansi and may cause confusion.
93  *   See the corresponding comments in the Makefile.
94  *   Ansi C compiler set __STDC__, but Non-Ansi compilers may set this, too.
95  *   Thus we use our own flag ANSI_C.
96  */
97 
98 /* #ifdef __STDC__==1
99  * #define ANSI_C
100  * #endif
101  */
102 
103 /* #define ANSI_C */
104 /* #undef  ANSI_C */
105 #define ANSI_C
106 
107 /*   The Gnu CC sometimes does not have a standard library.
108  *   In this case, the include files might be wrong.
109  *   To get fewer messages on -Wall, define NO_STDINCLUDES
110  *   with Gnu CC.
111  */
112 
113 #undef NO_STDINCLUDES
114 
115 
116 /*   User Signals available or not ?
117  *   Unix provides signals SIGUSR1 and SIGUSR2 (30, 31), which are used
118  *   to control animations from external. If signal() or free signals are
119  *   not available (e.g. on Non-Unix systems), then undefine USR_SIGNAL.
120  */
121 
122 #define USR_SIGNAL
123 /* #undef  USR_SIGNAL */
124 
125 
126 /* Good quicksort available or not ?
127  * If there exist a good randomized quicksort `qsort' in the library,
128  * please use it. But if the quicksort in the library is slow, or not
129  * randomized, define OWN_QUICKSORT. We often have to sort presorted
130  * arrays.
131  * Note: If OWN_QUICKSORT is defined, not all calls of `qsort' are
132  * exchanged, but only the critical ones.
133  */
134 
135 /* #undef OWN_QUICKSORT  */
136 #define OWN_QUICKSORT
137 
138 
139 /*   Window system Sunview or X11 ?
140  *   Sunview is fast, but does not support remote window displaying.
141  *   X11 (R5) is a little bit slower, but supports remote display.
142  *   Do not define both !!!
143  */
144 
145 /* #define SUNVIEW */
146 /* #undef  X11     */
147 /* #undef  SUNVIEW */
148 /* #define X11     */
149 #define X11
150 
151 
152 /*   Required alignment for structs (power of 2). IALIGN is the appropriate
153  *   bit mask to generate the alignment. Because we use floats in structs,
154  *   mostly an alignment of 8 is appropriate.
155  */
156 
157 #ifndef ALIGN
158 /* #define ALIGN  8 */
159 #define ALIGN  8
160 #define IALIGN (ALIGN-1)
161 #endif
162 
163 
164 /*   Memory block size for memory allocation in bytes. The allocation
165  *   mechanism allocates blocks of this size, and dynamically increases
166  *   the number of blocks, if more memory is necessary.
167  *   Do not set the blocksize too small. For instance the tool does not
168  *   work with blockssize less than 1 KB. Propose for good performance:
169  *   256 KB minimal.
170  */
171 
172 /* Blocks of 1 Megabyte */
173 
174 /* #define MEMBLOCKSIZE 1048576 */
175 #define MEMBLOCKSIZE 1048576
176 
177 
178 /*   The default font for X11. Not needed at the Sunview installation.
179  *   Please insert an appropriate font of about 14 to 17 dot size.
180  */
181 
182 #ifdef X11
183 #define VCG_DEFAULT_FONT "-*-courier-*-*-*--14-*-*-*-*-*-*-*"
184 #endif
185 
186 
187 /*   Whether the input focus grab is actively or not.
188  *   If NOINPUTFOCUS, the VCG tool does not grab actively the input
189  *   focus. Depending on the window manager, this may cause that
190  *   the keypresses are ignored afterwards, unless the mouse pointer
191  *   is once moved out of the window and back into it.
192  *   On the other side, some installations cause a fatal error or
193  *   strange behaviour, if the VCG tool actively grabs the input
194  *   focus.
195  *   The conservative definement is #define NOINPUTFOCUS.
196  */
197 
198 #ifdef X11
199 #define NOINPUTFOCUS
200 #endif
201 
202 
203 /*   Debugging On or Off ?
204  *   We have three kinds of debugging:
205  *      a) Behaviour tracing: a lot of messages nearly on every
206  *         function entry are produced if DEBUG is switched on.
207  *      b) Assertion checking: only if an assertion fails, an
208  *         appropriate message is produced.
209  *      c) Node tracing: This is basically the same as the behaviour
210  *	   tracing. At each function entry, the status of a node
211  *	   will be printed. This happens if CHECKNODE is defined.
212  *	   See step0 for the selection of the node to be traced.
213  *   Behaviour or node tracing is only needed in very serious cases.
214  *   The macros "debuggingmessage" can be redefined to do some special
215  *   tests on every entry.
216  *   Assertion checking can always be done, because it is silent
217  *   as long as no error occurs. But it consumes runtime.
218  *   This all can also be defined in the head of a module before
219  *   #include "globals.h", to debug only this module.
220  */
221 
222 /* for internal debugging */
223 #undef DEBUG
224 #undef CHECKNODE
225 /* for assertion checking at runtime */
226 #define CHECK_ASSERTIONS
227 
228 
229 /*
230  *  If you prefer the system assert.h, then define ASSERT_AVAIL.
231  */
232 
233 /* #define ASSERT_AVAIL   */
234 #undef  ASSERT_AVAIL
235 
236 /*  Check and printout the timing of phases.
237  *  If CHECK_TIMING is defined, time measurement is done at some
238  *  critical points. This is only for me, to fine tune the
239  *  preformance. (GS)
240  */
241 
242 #undef CHECK_TIMING
243 
244 /*---------------------------- End of Changes ------------------------*/
245 
246 /* Maximal and minimal positive integer */
247 
248 #include <limits.h>
249 
250 #ifndef MAXINT
251 #ifdef INT_MAX
252 #define MAXINT  INT_MAX
253 #else
254 #define MAXINT  32767
255 #endif
256 #endif
257 
258 #ifndef MININT
259 #ifdef INT_MIN
260 #define MININT  INT_MIN
261 #else
262 #define MININT  -32767
263 #endif
264 #endif
265 
266 #ifndef MAXLONG
267 #ifdef LONG_MAX
268 #define MAXLONG LONG_MAX
269 #else
270 #define MAXLONG 32767
271 #endif
272 #endif
273 
274 #ifndef MINLONG
275 #ifdef LONG_MIN
276 #define MINLONG LONG_MIN
277 #else
278 #define MINLONG -32767
279 #endif
280 #endif
281 
282 
283 /* Prototype support */
284 
285 #ifdef ANSI_C
286 #define	_PP(x) x
287 #else
288 #define	_PP(x) ()
289 #endif
290 
291 #ifndef NULL
292 #define NULL	0
293 #endif
294 
295 /* Aix CC and OSF does not understand const's */
296 
297 #ifdef OSF
298 #define const
299 #endif
300 #ifdef AIXCC
301 #define const
302 #endif
303 
304 /* Default Window system is X11 */
305 
306 #ifdef SUNVIEW
307 #ifdef X11
308 #undef SUNVIEW
309 #endif
310 #else
311 #ifndef X11
312 #define X11
313 #endif
314 #endif
315 
316 #ifdef X11
317 #define FAST_X11_DRAWING
318 #endif
319 
320 /* Debugging messages */
321 
322 #ifdef DEBUG
323 #define debugmessage(a,b) {FPRINTF(stderr,"Debug: %s %s\n",a,b);}
324 #else
325 #define debugmessage(a,b) /**/
326 #endif
327 
328 #ifdef CHECKNODE
329 #define DEBUG
330 #undef debugmessage
331 #define debugmessage(a,b) { \
332 	FPRINTF(stderr,"Debug: %s %s &",a,b); \
333 	if (debug_checknode)  \
334 		FPRINTF(stderr,"Checknode: |%s|\n",NTITLE(debug_checknode)); \
335 	FPRINTF(stderr,"\n"); \
336 }
337 #endif
338 
339 /* Assertions */
340 
341 #ifndef CHECK_ASSERTIONS
342 #define NDEBUG
343 #endif
344 #ifdef DEBUG
345 #undef NDEBUG
346 #endif
347 
348 #ifdef ASSERT_AVAIL
349 #include <assert.h>
350 #else
351 # ifndef NDEBUG
352 # define assert(ex)  {if (!(ex)) {\
353    FPRINTF(stderr,"Assertion failed: file \"%s\", line %d\n",\
354          __FILE__, __LINE__); \
355    FPRINTF(stderr,"This is a bug! Please contact sander@cs.uni-sb.de !\n");\
356    exit(1);}}
357 # else
358 # define assert(ex)
359 # endif
360 # endif
361 
362 
363 /* To make lint happy */
364 
365 #define PRINTF  (void)printf
366 #define FPRINTF (void)fprintf
367 #define SPRINTF (void)sprintf
368 #define FCLOSE  (void)fclose
369 #define FFLUSH  (void)fflush
370 #define FREE    (void)free
371 
372 /* To make ANSI C compiler with -Wall more happy */
373 
374 #ifdef ANSI_C
375 #ifdef NO_STDINCLUDES
376 int    fprintf(FILE *stream, const char *format, ...);
377 int    printf(const char *format, ...);
378 int    scanf(const char *format, ...);
379 int    atoi(char *x);
380 double atof(char *x);
381 int    islower(int s);
382 int    isupper(int s);
383 int    tolower(int s);
384 int    toupper(int s);
385 void   bcopy(void *b1,void *b2,int length);
386 int    fputs(const char *s, FILE *stream);
387 size_t fwrite(const void *ptr, size_t s, size_t n, FILE *stream);
388 int    fclose(FILE *stream);
389 FILE  *fopen(const char *filename, const char *mode);
390 void   system(char *string);
391 int    fflush(FILE *stream);
392 int    getppid(void);
393 #ifdef X11
394 char   *getwd(char pn[]);
395 #endif
396 int    fgetc(FILE *stream);
397 #endif
398 #endif
399 
400 #define gstoint(x) ((int)(x))
401 #ifdef HPUX
402 #define alloca(x) (malloc(x))
403 #define getwd(h)  (getcwd(h,MAXPATHLEN-1))
404 #endif
405 
406 #ifdef VMS
407 #define alloca(x) (malloc(x))
408 #endif
409 
410 /*--------------------------------------------------------------------*/
411 
412 #endif /* GLOBALS_H */
413 
414