GME  13
config.h
Go to the documentation of this file.
00001 #ifndef CONFIG_H
00002 #define CONFIG_H
00003 /*
00004  * config.h (for ANTLR, DLG, and SORCERER)
00005  *
00006  * This is a simple configuration file that doesn't have config stuff
00007  * in it, but it's a start.
00008  *
00009  * SOFTWARE RIGHTS
00010  *
00011  * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
00012  * Set (PCCTS) -- PCCTS is in the public domain.  An individual or
00013  * company may do whatever they wish with source code distributed with
00014  * PCCTS or the code generated by PCCTS, including the incorporation of
00015  * PCCTS, or its output, into commerical software.
00016  *
00017  * We encourage users to develop software with PCCTS.  However, we do ask
00018  * that credit is given to us for developing PCCTS.  By "credit",
00019  * we mean that if you incorporate our source code into one of your
00020  * programs (commercial product, research project, or otherwise) that you
00021  * acknowledge this fact somewhere in the documentation, research report,
00022  * etc...  If you like PCCTS and have developed a nice tool with the
00023  * output, please mention that you developed it using PCCTS.  In
00024  * addition, we ask that this header remain intact in our source code.
00025  * As long as these guidelines are kept, we expect to continue enhancing
00026  * this system and expect to make other tools available as they are
00027  * completed.
00028  *
00029  * Used by PCCTS 1.33 (SORCERER 1.00B11 and up)
00030  * Terence Parr
00031  * Parr Research Corporation
00032  * with Purdue University and AHPCRC, University of Minnesota
00033  * 1989-1998
00034  */
00035 
00036 /* This file knows about the following ``environments''
00037         UNIX (default)
00038         DOS  (use #define PC)
00039         MAC  (use #define MPW; has a few things for THINK C, Metrowerks)
00040  */
00041 
00042 /* should test __STDC__ for 1, but some compilers don't set value, just def */
00043 #ifdef __STDC__
00044 #define __USE_PROTOS
00045 #endif
00046 #ifdef __cplusplus
00047 #ifndef __USE_PROTOS
00048 #define __USE_PROTOS
00049 #endif
00050 #endif
00051 
00052 #include <stdlib.h>
00053 
00054 /* largest file name size */
00055 
00056 #ifdef _MAX_PATH
00057 #define MaxFileName             _MAX_PATH /* MR9 RJV: MAX_PATH defined in stdlib.h (MSVC++ 5.0) */
00058 #else
00059 #define MaxFileName             300
00060 #endif
00061 
00062 /*
00063 *  Define PC32 if in a 32-bit PC environment (e.g. extended DOS or Win32).
00064 *  The macros tested here are defined by Watcom, Microsoft, Borland,
00065 *  and djgpp, respectively, when they are used as 32-bit compilers.
00066 *  Users of these compilers *must* be sure to define PC in their
00067 *  makefiles for this to work correctly.
00068 */
00069 #ifdef PC
00070 # if (defined(__WATCOM__) || defined(_WIN32) || defined(__WIN32__) || \
00071    defined(__GNUC__) || defined(__GNUG__))
00072 #     ifndef PC32
00073 #        define PC32
00074 #     endif
00075 #  endif
00076 #endif
00077 
00078 /* MR1  10-Apr-97  Default for PC is short file names                               */
00079 /* MR1             Default for non-PC is long file names                                */
00080 /* MR1             Can override via command line option LONGFILENAMES           */
00081 
00082 #ifndef LONGFILENAMES
00083 #ifndef PC
00084 #define LONGFILENAMES
00085 #endif
00086 #endif
00087 
00088 #ifndef LONGFILENAMES
00089 #define ATOKEN_H                        "AToken.h"
00090 #define ATOKPTR_H                       "ATokPtr.h"
00091 #define ATOKPTR_C                       "ATokPtr.cpp"
00092 #define ATOKENBUFFER_H          "ATokBuf.h"
00093 #define ATOKENBUFFER_C      "ATokBuf.cpp"
00094 #define ATOKENSTREAM_H          "ATokStr.h"
00095 #define APARSER_H                       "AParser.h"
00096 #define APARSER_C           "AParser.cpp"
00097 #define ASTBASE_H                       "ASTBase.h"
00098 #define ASTBASE_C           "ASTBase.cpp"
00099 #define PCCTSAST_C          "PCCTSAST.cpp"
00100 #define LIST_C              "List.cpp"
00101 #define DLEXERBASE_H            "DLexBase.h"
00102 #define DLEXERBASE_C        "DLexBase.cpp"
00103 #define DLEXER_C            "DLexer.cpp"
00104 #define STREESUPPORT_C          "STreeSup.C"
00105 #else
00106 #define ATOKEN_H                        "AToken.h"
00107 #define ATOKPTR_H                       "ATokPtr.h"
00108 #define ATOKPTR_C                       "ATokPtr.cpp"
00109 #define ATOKENBUFFER_H          "ATokenBuffer.h"
00110 #define ATOKENBUFFER_C          "ATokenBuffer.cpp"
00111 #define ATOKENSTREAM_H          "ATokenStream.h"
00112 #define APARSER_H                       "AParser.h"
00113 #define APARSER_C                       "AParser.cpp"
00114 #define ASTBASE_H                       "ASTBase.h"
00115 #define ASTBASE_C                   "ASTBase.cpp"
00116 #define PCCTSAST_C                      "PCCTSAST.cpp"
00117 #define LIST_C                          "List.cpp"
00118 #define DLEXERBASE_H            "DLexerBase.h"
00119 #define DLEXERBASE_C            "DLexerBase.cpp"
00120 #define DLEXER_C                        "DLexer.cpp"
00121 #define STREESUPPORT_C          "STreeSupport.cpp"
00122 #endif
00123 
00124 /* SORCERER Stuff */
00125 
00126 /* MR8 6-Aug-97     Change from ifdef PC to ifndef LONGFILENAMES            */
00127 
00128 #ifndef LONGFILENAMES
00129 #define STPARSER_H                      "STreePar.h"
00130 #define STPARSER_C                      "STreePar.C"
00131 #else
00132 #define STPARSER_H                      "STreeParser.h"
00133 #define STPARSER_C                      "STreeParser.cpp"
00134 #endif
00135 
00136 #ifdef MPW
00137 #define CPP_FILE_SUFFIX         ".cp"
00138 #define CPP_FILE_SUFFIX_NO_DOT  "cp"
00139 #define OBJ_FILE_SUFFIX         ".o"
00140 #else
00141 #ifdef PC
00142 #define CPP_FILE_SUFFIX         ".cpp"
00143 #define CPP_FILE_SUFFIX_NO_DOT  "cpp"
00144 #define OBJ_FILE_SUFFIX         ".obj"
00145 #else
00146 #ifdef __VMS
00147 #define CPP_FILE_SUFFIX         ".cpp"
00148 #define CPP_FILE_SUFFIX_NO_DOT  "cpp"
00149 #define OBJ_FILE_SUFFIX         ".obj"
00150 #else
00151 #define CPP_FILE_SUFFIX         ".cpp"
00152 #define CPP_FILE_SUFFIX_NO_DOT  "cpp"
00153 #define OBJ_FILE_SUFFIX         ".o"
00154 #endif
00155 #endif
00156 #endif
00157 
00158 /* User may redefine how line information looks */     /* make it #line MR7 */
00159 #define LineInfoFormatStr "#line %d \"%s\"\n"
00160 
00161 #ifdef MPW              /* Macintosh Programmer's Workshop */
00162 #define ErrHdr "File \"%s\"; Line %d #"
00163 #else
00164 #define ErrHdr "%s, line %d:"
00165 #endif
00166 
00167 
00168 /* must assume old K&R cpp here, can't use #if defined(..)... */
00169 
00170 #ifdef MPW
00171 #define TopDirectory    ":"
00172 #define DirectorySymbol ":"
00173 #define OutputDirectoryOption "Directory where all output files should go (default=\":\")"
00174 #else
00175 #ifdef PC
00176 #define TopDirectory    "."
00177 #define DirectorySymbol "\\"
00178 #define OutputDirectoryOption "Directory where all output files should go (default=\".\")"
00179 #else
00180 #define TopDirectory    "."
00181 #define DirectorySymbol "/"
00182 #define OutputDirectoryOption "Directory where all output files should go (default=\".\")"
00183 #endif
00184 #endif
00185 
00186 #ifdef MPW
00187 
00188 /* Make sure we have prototypes for all functions under MPW */
00189 
00190 #include <string.h>
00191 #include <stdlib.h>
00192 /* MR6 2-Jun-97 Fixes false dependency caused by VC++ #include scanner  */
00193 /* MR6             Reported by Brad Schick (schick@interaccess.com)     */
00194 #define MPW_CursorCtl_Header <CursorCtl.h>
00195 #include MPW_CursorCtl_Header
00196 #ifdef __cplusplus
00197 extern "C" {
00198 #endif
00199 extern void fsetfileinfo (char *filename, unsigned long newcreator, unsigned long newtype);
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203 
00204 /* File creators for various popular development environments */
00205 
00206 #define MAC_FILE_CREATOR 'MPS '   /* MPW Text files */
00207 #if 0
00208 #define MAC_FILE_CREATOR 'KAHL'   /* THINK C/Symantec C++ Text files */
00209 #endif
00210 #if 0
00211 #define MAC_FILE_CREATOR 'MMCC'   /* Metrowerks C/C++ Text files */
00212 #endif
00213 
00214 #endif
00215 
00216 #ifdef MPW
00217 #define DAWDLE  SpinCursor(1)
00218 #else
00219 #define DAWDLE
00220 #endif
00221 
00222 #ifdef MPW
00223 #define SPECIAL_INITS
00224 #define SPECIAL_FOPEN
00225 #endif
00226 
00227 #ifdef MPW
00228 #ifdef __cplusplus
00229 inline
00230 #else
00231 static
00232 #endif
00233 void special_inits()
00234 {
00235   InitCursorCtl((acurHandle) 0);
00236 }
00237 #endif
00238 
00239 #ifdef MPW
00240 #ifdef __cplusplus
00241 inline
00242 #else
00243 static
00244 #endif
00245 void special_fopen_actions(char * /* s */)
00246 {
00247   fsetfileinfo (s, MAC_FILE_CREATOR, 'TEXT');
00248 }
00249 #endif
00250 
00251 /* Define usable bits for set.c stuff */
00252 #define BytesPerWord    sizeof(unsigned)
00253 #define WORDSIZE                (sizeof(unsigned)*8)
00254 #define LogWordSize     (WORDSIZE==16?4:5)
00255 
00256 #ifndef TRUE
00257 #define TRUE 1
00258 #endif
00259 #ifndef FALSE
00260 #define FALSE 0
00261 #endif
00262 
00263 #if defined(VAXC) || defined(__VMS)
00264 #include <ssdef.h>
00265 #define PCCTS_EXIT_SUCCESS 1
00266 #define PCCTS_EXIT_FAILURE SS$_ABORT
00267 #define zzDIE           return SS$_ABORT;
00268 #define zzDONE  return 1;
00269 
00270 #else /* !VAXC and !__VMS */
00271 
00272 #define PCCTS_EXIT_SUCCESS 0
00273 #define PCCTS_EXIT_FAILURE 1
00274 #define zzDIE           return 1;
00275 #define zzDONE  return 0;
00276 
00277 #endif
00278 
00279 #ifdef USER_ZZMODE_STACK
00280 # ifndef ZZSTACK_MAX_MODE
00281 #  define  ZZSTACK_MAX_MODE 32
00282 # endif
00283 # define  ZZMAXSTK (ZZSTACK_MAX_MODE * 2)
00284 #endif
00285 
00286 #endif