xref: /trunk/main/rsc/source/rscpp/cppdef.h (revision 9eab2a37)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 /*
25  * This redundant definition of TRUE and FALSE works around
26  * a limitation of Decus C.
27  */
28 #ifndef TRUE
29 #define TRUE                    1
30 #define FALSE                   0
31 #endif
32 
33 /*
34  * Define the HOST operating system.  This is needed so that
35  * cpp can use appropriate filename conventions.
36  */
37 #define SYS_UNKNOWN             0
38 #define SYS_UNIX                1
39 #define SYS_VMS                 2
40 #define SYS_RSX                 3
41 #define SYS_RT11                4
42 #define SYS_LATTICE             5
43 #define SYS_ONYX                6
44 #define SYS_68000               7
45 
46 #ifndef HOST
47 #ifdef  unix
48 #define HOST                    SYS_UNIX
49 #else
50 #ifdef  vms
51 #define HOST                    SYS_VMS
52 #else
53 #ifdef  rsx
54 #define HOST                    SYS_RSX
55 #else
56 #ifdef  rt11
57 #define HOST                    SYS_RT11
58 #endif
59 #endif
60 #endif
61 #endif
62 #endif
63 
64 #ifndef HOST
65 #define HOST                    SYS_UNKNOWN
66 #endif
67 
68 /*
69  * We assume that the target is the same as the host system
70  */
71 #ifndef TARGET
72 #define TARGET                  HOST
73 #endif
74 
75 /*
76  * In order to predefine machine-dependent constants,
77  * several strings are defined here:
78  *
79  * MACHINE      defines the target cpu (by name)
80  * SYSTEM       defines the target operating system
81  * COMPILER     defines the target compiler
82  *
83  *      The above may be #defined as "" if they are not wanted.
84  *      They should not be #defined as NULL.
85  *
86  * LINE_PREFIX  defines the # output line prefix, if not "line"
87  *              This should be defined as "" if cpp is to replace
88  *              the "standard" C pre-processor.
89  *
90  * FILE_LOCAL   marks functions which are referenced only in the
91  *              file they reside.  Some C compilers allow these
92  *              to be marked "static" even though they are referenced
93  *              by "extern" statements elsewhere.
94  *
95  * OK_DOLLAR    Should be set TRUE if $ is a valid alphabetic character
96  *              in identifiers (default), or zero if $ is invalid.
97  *              Default is TRUE.
98  *
99  * OK_CONCAT    Should be set TRUE if # may be used to concatenate
100  *              tokens in macros (per the Ansi Draft Standard) or
101  *              FALSE for old-style # processing (needed if cpp is
102  *              to process assembler source code).
103  *
104  * OK_DATE      Predefines the compilation date if set TRUE.
105  *              Not permitted by the Nov. 12, 1984 Draft Standard.
106  *
107  * S_CHAR etc.  Define the sizeof the basic TARGET machine word types.
108  *              By default, sizes are set to the values for the HOST
109  *              computer.  If this is inappropriate, see the code in
110  *              cpp3.c for details on what to change.  Also, if you
111  *              have a machine where sizeof (signed int) differs from
112  *              sizeof (unsigned int), you will have to edit code and
113  *              tables in cpp3.c (and extend the -S option definition.)
114  *
115  * CPP_LIBRARY  May be defined if you have a site-specific include directory
116  *              which is to be searched *before* the operating-system
117  *              specific directories.
118  */
119 
120 #if TARGET == SYS_LATTICE
121 /*
122  * We assume the operating system is pcdos for the IBM-PC.
123  * We also assume the small model (just like the PDP-11)
124  */
125 #define MACHINE                 "i8086"
126 #define SYSTEM                  "pcdos"
127 #endif
128 
129 #if TARGET == SYS_ONYX
130 #define MACHINE                 "z8000"
131 #define SYSTEM                  "unix"
132 #endif
133 
134 #if TARGET == SYS_VMS
135 #define MACHINE                 "vax"
136 #define SYSTEM                  "vms"
137 #define COMPILER                "vax11c"
138 #endif
139 
140 #if TARGET == SYS_RSX
141 #define MACHINE                 "pdp11"
142 #define SYSTEM                  "rsx"
143 #define COMPILER                "decus"
144 #endif
145 
146 #if TARGET == SYS_RT11
147 #define MACHINE                 "pdp11"
148 #define SYSTEM                  "rt11"
149 #define COMPILER                "decus"
150 #endif
151 
152 #if TARGET == SYS_68000 || defined(M68000) || defined(m68000) || defined(m68k)
153 /*
154  * All three machine designators have been seen in various systems.
155  * Warning -- compilers differ as to sizeof (int).  cpp3 assumes that
156  * sizeof (int) == 2
157  */
158 #define MACHINE                 "M68000", "m68000", "m68k"
159 #define SYSTEM                  "unix"
160 #endif
161 
162 #if     TARGET == SYS_UNIX
163 #define SYSTEM                  "unix"
164 #ifdef  pdp11
165 #define MACHINE                 "pdp11"
166 #endif
167 #ifdef  vax
168 #define MACHINE                 "vax"
169 #endif
170 #endif
171 
172 /*
173  * defaults
174  */
175 
176 #ifndef MSG_PREFIX
177 #define MSG_PREFIX              "cpp: "
178 #endif
179 
180 #ifndef LINE_PREFIX
181 #define LINE_PREFIX             ""
182 #endif
183 
184 /*
185  * OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
186  * COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for
187  * an old-style preprocessor.
188  */
189 
190 #ifndef OLD_PREPROCESSOR
191 #define OLD_PREPROCESSOR        FALSE
192 #endif
193 
194 #if     OLD_PREPROCESSOR
195 #define OK_DOLLAR               FALSE
196 #define OK_CONCAT               TRUE
197 #define COMMENT_INVISIBLE       TRUE
198 #define STRING_FORMAL           TRUE
199 #define IDMAX                   63      /* actually, seems to be unlimited */
200 #endif
201 
202 /*
203  * RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
204  */
205 #ifndef RECURSION_LIMIT
206 #define RECURSION_LIMIT 1000
207 #endif
208 
209 /*
210  * BITS_CHAR may be defined to set the number of bits per character.
211  * it is needed only for multi-byte character constants.
212  */
213 #ifndef BITS_CHAR
214 #define BITS_CHAR               8
215 #endif
216 
217 /*
218  * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series)
219  * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits.
220  * It is set FALSE on machines (such as the PDP-11 and Vax-11)
221  * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits.
222  * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
223  */
224 #ifndef BIG_ENDIAN
225 #define BIG_ENDIAN              FALSE
226 #endif
227 
228 /*
229  * COMMENT_INVISIBLE may be defined to allow "old-style" comment
230  * processing, whereby the comment becomes a zero-length token
231  * delimiter.  This permitted tokens to be concatenated in macro
232  * expansions.  This was removed from the Draft Ansi Standard.
233  */
234 #ifndef COMMENT_INVISIBLE
235 #define COMMENT_INVISIBLE       FALSE
236 #endif
237 
238 /*
239  * STRING_FORMAL may be defined to allow recognition of macro parameters
240  * anywhere in replacement strings.  This was removed from the Draft Ansi
241  * Standard and a limited recognition capability added.
242  */
243 #ifndef STRING_FORMAL
244 #define STRING_FORMAL           FALSE
245 #endif
246 
247 /*
248  * OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
249  * This is a permitted extension to the Ansi Standard and is required
250  * for e.g., VMS, RSX-11M, etc.   It should be set FALSE if cpp is
251  * used to preprocess assembler source on Unix systems.  OLD_PREPROCESSOR
252  * sets OK_DOLLAR FALSE for that reason.
253  */
254 #ifndef OK_DOLLAR
255 #define OK_DOLLAR               TRUE
256 #endif
257 
258 /*
259  * OK_CONCAT enables (one possible implementation of) token concatenation.
260  * If cpp is used to preprocess Unix assembler source, this should be
261  * set FALSE as the concatenation character, #, is used by the assembler.
262  */
263 #ifndef OK_CONCAT
264 #define OK_CONCAT               TRUE
265 #endif
266 
267 /*
268  * OK_DATE may be enabled to predefine today's date as a string
269  * at the start of each compilation.  This is apparently not permitted
270  * by the Draft Ansi Standard.
271  */
272 #ifndef OK_DATE
273 #define OK_DATE         TRUE
274 #endif
275 
276 /*
277  * The following definitions are used to allocate memory for
278  * work buffers.  In general, they should not be modified
279  * by implementors.
280  *
281  * PAR_MAC      The maximum number of #define parameters (31 per Standard)
282  *              Note: we need another one for strings.
283  * IDMAX        The longest identifier, 31 per Ansi Standard
284  * NBUFF        Input buffer size
285  * NWORK        Work buffer size -- the longest macro
286  *              must fit here after expansion.
287  * NEXP         The nesting depth of #if expressions
288  * NINCLUDE     The number of directories that may be specified
289  *              on a per-system basis, or by the -I option.
290  * BLK_NEST     The number of nested #if's permitted.
291  * NFWORK		FileNameWorkBuffer (added by erAck, was NWORK)
292  */
293 
294 #ifndef IDMAX
295 #define IDMAX                    127
296 #endif
297 #ifdef SOLAR
298 #define PAR_MAC           (253 + 1)
299 #else
300 #define PAR_MAC            (31 + 1)
301 #endif
302 /* ER 13.06.95 19:33
303  da Makros im file->buffer expandiert werden, muss NBUFF mindestens NWORK sein
304 #define NWORK                   4096
305 #define NBUFF                   4096
306  */
307 /* ER 13.06.95 20:05  NWORK wg. grooossen Makros in *.src erhoeht,
308  da wir bald 10 Sprachen haben werden gleich ordentlich reingehauen.. */
309 #define NWORK                   128000
310 #define NBUFF                   NWORK
311 #define NFWORK					1024
312 #define NEXP                    128
313 #define NINCLUDE        100
314 #define NPARMWORK               (NWORK * 2)
315 #define BLK_NEST                32
316 
317 
318 #ifndef ALERT
319 #ifdef EBCDIC
320 #define ALERT					'\057'
321 #else
322 #define ALERT                   '\007'          /* '\a' is "Bell"       */
323 #endif
324 #endif
325 
326 #ifndef VT
327 #define VT                      '\013'          /* Vertical Tab CTRL/K  */
328 #endif
329 
330 
331 #ifndef FILE_LOCAL
332 #ifdef  decus
333 #define FILE_LOCAL              static
334 #else
335 #ifdef  vax11c
336 #define FILE_LOCAL              static
337 #else
338 #define FILE_LOCAL                              /* Others are global    */
339 #endif
340 #endif
341 #endif
342 
343