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