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