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