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