]> pd.if.org Git - pccts/blob - h/config.h
auto commit for import
[pccts] / h / config.h
1 #ifndef CONFIG_H
2 #define CONFIG_H
3 /*
4  * config.h (for ANTLR, DLG, and SORCERER)
5  *
6  * This is a simple configuration file that doesn't have config stuff
7  * in it, but it's a start.
8  *
9  * SOFTWARE RIGHTS
10  *
11  * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
12  * Set (PCCTS) -- PCCTS is in the public domain.  An individual or
13  * company may do whatever they wish with source code distributed with
14  * PCCTS or the code generated by PCCTS, including the incorporation of
15  * PCCTS, or its output, into commerical software.
16  * 
17  * We encourage users to develop software with PCCTS.  However, we do ask
18  * that credit is given to us for developing PCCTS.  By "credit",
19  * we mean that if you incorporate our source code into one of your
20  * programs (commercial product, research project, or otherwise) that you
21  * acknowledge this fact somewhere in the documentation, research report,
22  * etc...  If you like PCCTS and have developed a nice tool with the
23  * output, please mention that you developed it using PCCTS.  In
24  * addition, we ask that this header remain intact in our source code.
25  * As long as these guidelines are kept, we expect to continue enhancing
26  * this system and expect to make other tools available as they are
27  * completed.
28  *
29  * Used by PCCTS 1.33 (SORCERER 1.00B11 and up)
30  * Terence Parr
31  * Parr Research Corporation
32  * with Purdue University and AHPCRC, University of Minnesota
33  * 1989-1995
34  */
35
36 /* This file knows about the following ``environments''
37         UNIX (default)
38         DOS  (use #define PC)
39         MAC  (use #define MPW; has a few things for THINK C, Metrowerks)
40  */
41
42 /* should test __STDC__ for 1, but some compilers don't set value, just def */
43 #ifdef __STDC__
44 #define __USE_PROTOS
45 #endif
46 #ifdef __cplusplus
47 #ifndef __USE_PROTOS
48 #define __USE_PROTOS
49 #endif
50 #endif
51
52 /*
53 *  Define PC32 if in a 32-bit PC environment (e.g. extended DOS or Win32).
54 *  The macros tested here are defined by Watcom, Microsoft, Borland,
55 *  and djgpp, respectively, when they are used as 32-bit compilers.
56 *  Users of these compilers *must* be sure to define PC in their
57 *  makefiles for this to work correctly.
58 */
59 #ifdef PC
60 # if (defined(__WATCOM__) || defined(_WIN32) || defined(__WIN32__) || \       
61    defined(__GNUC__) || defined(__GNUG__))
62 #     ifndef PC32
63 #        define PC32
64 #     endif
65 #  endif
66 #endif
67
68 #ifdef PC
69 #define ATOKEN_H                        "AToken.h"
70 #define ATOKPTR_H                       "ATokPtr.h"
71 #define ATOKPTR_C                       "ATokPtr.cpp"
72 #define ATOKENBUFFER_H          "ATokBuf.h"
73 #define ATOKENBUFFER_C          "ATokBuf.cpp"
74 #define ATOKENSTREAM_H          "ATokStr.h"
75 #define APARSER_H                       "AParser.h"
76 #define APARSER_C                       "AParser.cpp"
77 #define ASTBASE_H                       "ASTBase.h"
78 #define ASTBASE_C                   "ASTBase.cpp"
79 #define PCCTSAST_C                      "PCCTSAST.cpp"
80 #define LIST_C                          "List.cpp"
81 #define DLEXERBASE_H            "DLexBase.h"
82 #define DLEXERBASE_C            "DLexBase.cpp"
83 #define DLEXER_C                        "DLexer.cpp"
84 #define STREESUPPORT_C          "STreeSup.C"
85 #else
86 #define ATOKEN_H                        "AToken.h"
87 #define ATOKPTR_H                       "ATokPtr.h"
88 #define ATOKPTR_C                       "ATokPtr.cpp"
89 #define ATOKENBUFFER_H          "ATokenBuffer.h"
90 #define ATOKENBUFFER_C          "ATokenBuffer.cpp"
91 #define ATOKENSTREAM_H          "ATokenStream.h"
92 #define APARSER_H                       "AParser.h"
93 #define APARSER_C                       "AParser.cpp"
94 #define ASTBASE_H                       "ASTBase.h"
95 #define ASTBASE_C                   "ASTBase.cpp"
96 #define PCCTSAST_C                      "PCCTSAST.cpp"
97 #define LIST_C                          "List.cpp"
98 #define DLEXERBASE_H            "DLexerBase.h"
99 #define DLEXERBASE_C            "DLexerBase.cpp"
100 #define DLEXER_C                        "DLexer.cpp"
101 #define STREESUPPORT_C          "STreeSupport.cpp"
102 #endif
103
104 /* SORCERER Stuff */
105 #ifdef PC
106 #define STPARSER_H                      "STreePar.h"
107 #define STPARSER_C                      "STreePar.C"
108 #else
109 #define STPARSER_H                      "STreeParser.h"
110 #define STPARSER_C                      "STreeParser.cpp"
111 #endif
112
113 #ifdef MPW
114 #define CPP_FILE_SUFFIX         ".cp"
115 #define CPP_FILE_SUFFIX_NO_DOT  "cp"
116 #define OBJ_FILE_SUFFIX         ".o"
117 #else
118 #ifdef PC
119 #define CPP_FILE_SUFFIX         ".cpp"
120 #define CPP_FILE_SUFFIX_NO_DOT  "cpp"
121 #define OBJ_FILE_SUFFIX         ".obj"
122 #else
123 #define CPP_FILE_SUFFIX         ".cpp"
124 #define CPP_FILE_SUFFIX_NO_DOT  "cpp"
125 #define OBJ_FILE_SUFFIX         ".o"
126 #endif
127 #endif
128
129 /* User may redefine how line information looks */
130 #define LineInfoFormatStr "# %d \"%s\"\n"
131
132 #ifdef MPW              /* Macintosh Programmer's Workshop */
133 #define ErrHdr "File \"%s\"; Line %d #"
134 #else
135 #define ErrHdr "%s, line %d:"
136 #endif
137
138
139 /* must assume old K&R cpp here, can't use #if defined(..)... */
140
141 #ifdef MPW
142 #define TopDirectory    ":"
143 #define DirectorySymbol ":"
144 #define OutputDirectoryOption "Directory where all output files should go (default=\":\")"
145 #else
146 #ifdef PC
147 #define TopDirectory    "."
148 #define DirectorySymbol "\\"
149 #define OutputDirectoryOption "Directory where all output files should go (default=\".\")"
150 #else
151 #define TopDirectory    "."
152 #define DirectorySymbol "/"
153 #define OutputDirectoryOption "Directory where all output files should go (default=\".\")"
154 #endif
155 #endif
156
157 #ifdef MPW
158
159 /* Make sure we have prototypes for all functions under MPW */
160
161 #include <string.h>
162 #include <stdlib.h>
163 #include <CursorCtl.h>
164 #ifdef __cplusplus
165 extern "C" {
166 #endif
167 extern void fsetfileinfo (char *filename, unsigned long newcreator, unsigned long newtype);
168 #ifdef __cplusplus
169 }
170 #endif
171
172 /* File creators for various popular development environments */
173
174 #define MAC_FILE_CREATOR 'MPS '   /* MPW Text files */
175 #if 0
176 #define MAC_FILE_CREATOR 'KAHL'   /* THINK C/Symantec C++ Text files */
177 #endif
178 #if 0
179 #define MAC_FILE_CREATOR 'MMCC'   /* Metrowerks C/C++ Text files */
180 #endif
181
182 #endif
183
184 #ifdef MPW
185 #define DAWDLE  SpinCursor(1)
186 #else
187 #define DAWDLE
188 #endif
189
190 #ifdef __cplusplus
191 inline
192 #else
193 static
194 #endif
195 #ifdef MPW
196 void special_inits()
197 {
198   InitCursorCtl((acurHandle) 0);
199 }
200 #else
201 void special_inits()
202 {
203 }
204 #endif
205
206 #ifdef __cplusplus
207 inline
208 #else
209 static
210 #endif
211 #ifdef MPW
212 void special_fopen_actions(char * /* s */)
213 {
214   fsetfileinfo (s, MAC_FILE_CREATOR, 'TEXT');
215 }
216 #else
217 void
218 #ifdef __USE_PROTOS
219 special_fopen_actions(char *s)
220 #else
221 special_fopen_actions(s)
222 char *s;
223 #endif
224 {
225 }
226 #endif
227
228 /* Define usable bits for set.c stuff */
229 #define BytesPerWord    sizeof(unsigned)
230 #define WORDSIZE                (sizeof(unsigned)*8)
231 #define LogWordSize     (WORDSIZE==16?4:5)
232
233 #ifndef TRUE
234 #define TRUE 1
235 #endif
236 #ifndef FALSE
237 #define FALSE 0
238 #endif
239
240 #ifdef VAXC
241 #define PCCTS_EXIT_SUCCESS 1
242 #define PCCTS_EXIT_FAILURE 0
243 #define zzDIE           return 0;
244 #define zzDONE  return 1;
245
246 #else /* !VAXC */
247
248 #define PCCTS_EXIT_SUCCESS 0
249 #define PCCTS_EXIT_FAILURE 1
250 #define zzDIE           return 1;
251 #define zzDONE  return 0;
252
253 #endif
254
255 #ifdef USER_ZZMODE_STACK
256 # ifndef ZZSTACK_MAX_MODE
257 #  define  ZZSTACK_MAX_MODE 32
258 # endif
259 # define  ZZMAXSTK (ZZSTACK_MAX_MODE * 2)
260 #endif
261
262 #endif