home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / cool.lha / ice / pisces / cpp / cppdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-04  |  10.7 KB  |  457 lines

  1.  
  2. /*  Change History
  3.  *  19-Jan-90  DKM  Support for MVS and EBCDIC character set
  4.  *  04-May-90  MJF  Added predefined constant "sun"
  5.  */
  6.  
  7. #ifdef EMACS
  8.  
  9. /* Use the Emacs config file to find out what type of machine */
  10.  
  11. #define NO_SHORTNAMES
  12. #include "../src/config.h"
  13.  
  14. /* Convert Emacs's conventions for BIG_ENDIAN to cpp's convention.  */
  15. #ifdef BIG_ENDIAN
  16. #undef BIG_ENDIAN
  17. #define BIG_ENDIAN TRUE
  18. #else /* not BIG_ENDIAN */
  19. #define BIG_ENDIAN FALSE
  20. #endif /* BIG_ENDIAN */
  21.  
  22. /* Emacs uses the names index and rindex and defines them as str(r)chr if nec;
  23.    cpp uses the opposite convention.  Here we flush the macro definitions for
  24.    Emacs and add the ones cpp wants.  */
  25.  
  26. #ifdef index
  27. #undef index
  28. #undef rindex
  29. #else /* index is not defined as a macro */
  30. #define strchr index
  31. #define strrchr rindex
  32. #endif /* index is not defined as a macro */
  33.  
  34. #define NBUFF 2048
  35. #define NWORK 2048
  36.  
  37. #endif /* EMACS */
  38.  
  39. /*
  40.  *           S y s t e m   D e p e n d e n t
  41.  *        D e f i n i t i o n s    f o r   C P P
  42.  *
  43.  * Definitions in this file may be edited to configure CPP for particular
  44.  * host operating systems and target configurations.
  45.  *
  46.  * NOTE: cpp assumes it is compiled by a compiler that supports macros
  47.  * with arguments.  If this is not the case (as for Decus C), #define
  48.  * nomacarg -- and provide function equivalents for all macros.
  49.  *
  50.  * cpp also assumes the host and target implement the Ascii character set.
  51.  * If this is not the case, you will have to do some editing here and there.
  52.  */
  53.  
  54. /*
  55.  * This redundant definition of TRUE and FALSE works around
  56.  * a limitation of Decus C.
  57.  */
  58. #ifndef    TRUE
  59. #define    TRUE            1
  60. #define    FALSE            0
  61. #endif
  62.  
  63. /*
  64.  * Define the HOST operating system.  This is needed so that
  65.  * cpp can use appropriate filename conventions.
  66.  */
  67. #define    SYS_UNKNOWN        0
  68. #define    SYS_UNIX        1
  69. #define    SYS_VMS            2
  70. #define    SYS_RSX            3
  71. #define    SYS_RT11        4
  72. #define    SYS_LATTICE        5
  73. #define    SYS_ONYX        6
  74. #define    SYS_68000        7
  75. #define    SYS_OS2         8
  76. #define    SYS_XENIX         9
  77. #define SYS_MVS                 10
  78.  
  79. /* Both ASCII and EBCDIC machines are supported  */
  80. #define ASCII                   0
  81. #define EBCDIC                  1
  82.  
  83. #ifndef    HOST
  84. #ifdef    unix
  85. #define    HOST            SYS_UNIX
  86. #else
  87. #ifdef    vms
  88. #define    HOST            SYS_VMS
  89. #else
  90. #ifdef    rsx
  91. #define    HOST            SYS_RSX
  92. #else
  93. #ifdef    rt11
  94. #define    HOST            SYS_RT11
  95. #else
  96. #if defined(DOS) || defined(MSDOS)
  97. #define    HOST            SYS_OS2
  98. #else
  99. #ifdef    M_XENIX
  100. #define    HOST            SYS_XENIX
  101. #else
  102. #ifdef    SYS_OSVS
  103. #define    HOST            SYS_MVS
  104. #endif
  105. #endif
  106. #endif
  107. #endif
  108. #endif
  109. #endif
  110. #endif
  111. #endif
  112.  
  113. #ifndef    HOST
  114. #define    HOST            SYS_UNKNOWN
  115. #endif
  116.  
  117. /*
  118.  * We assume that the target is the same as the host system
  119.  */
  120. #ifndef    TARGET
  121. #define    TARGET            HOST
  122. #endif
  123.  
  124. /*
  125.  * In order to predefine machine-dependent constants,
  126.  * several strings are defined here:
  127.  *
  128.  * MACHINE    defines the target cpu (by name)
  129.  * SYSTEM    defines the target operating system
  130.  * COMPILER    defines the target compiler
  131.  * CHARSET      character set used, ASCII or EBCDIC (defaults ASCII).
  132.  *
  133.  *    The above may be #defined as "" if they are not wanted.
  134.  *    They should not be #defined as NULL.
  135.  *
  136.  * LINE_PREFIX    defines the # output line prefix, if not "line"
  137.  *        This should be defined as "" if cpp is to replace
  138.  *        the "standard" C pre-processor.
  139.  *
  140.  * FILE_LOCAL    marks functions which are referenced only in the
  141.  *        file they reside.  Some C compilers allow these
  142.  *        to be marked "static" even though they are referenced
  143.  *        by "extern" statements elsewhere.
  144.  *
  145.  * OK_DOLLAR    Should be set TRUE if $ is a valid alphabetic character
  146.  *        in identifiers (default), or zero if $ is invalid.
  147.  *        Default is TRUE.
  148.  *
  149.  * OK_CONCAT    Should be set TRUE if ## may be used to concatenate
  150.  *        tokens in macros (per the Ansi Draft Standard) or
  151.  *        FALSE for old-style # processing (needed if cpp is
  152.  *        to process assembler source code).
  153.  *
  154.  * OK_DATE    Predefines the compilation date if set TRUE.
  155.  *        Not permitted by the Nov. 12, 1984 Draft Standard.
  156.  *
  157.  * S_CHAR etc.    Define the sizeof the basic TARGET machine word types.
  158.  *        By default, sizes are set to the values for the HOST
  159.  *        computer.  If this is inappropriate, see the code in
  160.  *        cpp3.c for details on what to change.  Also, if you
  161.  *        have a machine where sizeof (signed int) differs from
  162.  *        sizeof (unsigned int), you will have to edit code and
  163.  *        tables in cpp3.c (and extend the -S option definition.)
  164.  *
  165.  * CPP_LIBRARY    May be defined if you have a site-specific include directory
  166.  *        which is to be searched *before* the operating-system
  167.  *        specific directories.
  168.  */
  169.  
  170. #if TARGET == SYS_LATTICE
  171. /*
  172.  * We assume the operating system is pcdos for the IBM-PC.
  173.  * We also assume the small model (just like the PDP-11)
  174.  */
  175. #define MACHINE            "i8086"
  176. #define    SYSTEM            "pcdos"
  177. #endif
  178.  
  179. #if TARGET == SYS_ONYX
  180. #define    MACHINE            "z8000"
  181. #define    SYSTEM            "unix"
  182. #endif
  183.  
  184. #if TARGET == SYS_VMS
  185. #define    MACHINE            "vax"
  186. #define    SYSTEM            "vms"
  187. #define    COMPILER        "vax11c"
  188. #endif
  189.  
  190. #if TARGET == SYS_RSX
  191. #define    MACHINE            "pdp11"
  192. #define    SYSTEM            "rsx"
  193. #define    COMPILER        "decus"
  194. #endif
  195.  
  196. #if TARGET == SYS_RT11
  197. #define    MACHINE            "pdp11"
  198. #define    SYSTEM            "rt11"
  199. #define    COMPILER        "decus"
  200. #endif
  201.  
  202. #if TARGET == SYS_XENIX
  203. #define    MACHINE            "I80386"
  204. #define    SYSTEM            "M_XENIX"
  205. #define    COMPILER        "XENIXC"
  206. #endif
  207.  
  208. #if TARGET == SYS_OS2
  209. #define    MACHINE            "I80386"
  210. #define    SYSTEM            "DOS"
  211. #define    COMPILER        "IBMC2"
  212. #endif
  213.  
  214. #if TARGET == SYS_MVS
  215. #define    MACHINE            "IBM370"
  216. #define    SYSTEM            "MVS"
  217. #define    COMPILER        "SAS/C"
  218. #define CHARSET                 EBCDIC
  219. #endif
  220.  
  221. #if TARGET == SYS_68000
  222. /*
  223.  * All three machine designators have been seen in various systems.
  224.  * Warning -- compilers differ as to sizeof (int).  cpp3 assumes that
  225.  * sizeof (int) == 2
  226.  */
  227. #define    MACHINE            "M68000", "m68000", "m68k"
  228. #define    SYSTEM            "unix"
  229. #endif
  230.  
  231. #if    TARGET == SYS_UNIX
  232. #define    SYSTEM            "unix"
  233. #ifdef    pdp11
  234. #define    MACHINE            "pdp11"
  235. #endif
  236. #ifdef    vax
  237. #define    MACHINE            "vax"
  238. #endif
  239. #ifdef  sparc
  240. #define MACHINE                 "sparc"
  241. #endif
  242. #ifdef  sun
  243. #define TARGET_ARCH             "sun"
  244. #endif
  245. #endif
  246.  
  247. /*
  248.  * defaults
  249.  */
  250.  
  251. #ifndef CHARSET
  252. #define CHARSET                 ASCII
  253. #endif
  254.  
  255. #ifndef MSG_PREFIX
  256. #define MSG_PREFIX        "cpp: "
  257. #endif
  258.  
  259. #ifndef LINE_PREFIX
  260. #ifdef    decus
  261. #define    LINE_PREFIX        ""
  262. #else
  263. #define LINE_PREFIX        "line"
  264. #endif
  265. #endif
  266.  
  267. /* create a string that can be shoved on the preset symbols list
  268.  * so programs running this cpp can test for ASCII or EBCDIC too.
  269.  */
  270. #if CHARSET == EBCDIC
  271. #define CH_SET                  "EBCDIC"
  272. #else
  273. #define CH_SET                  "ASCII"
  274. #endif
  275.  
  276.  
  277. /*
  278.  * OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
  279.  * COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for
  280.  * an old-style preprocessor.
  281.  */
  282.  
  283. #if    OLD_PREPROCESSOR
  284. #define    OK_DOLLAR        FALSE
  285. #define    OK_CONCAT        FALSE
  286. #define    COMMENT_INVISIBLE    TRUE
  287. #define    STRING_FORMAL        TRUE
  288. #endif
  289.  
  290. /*
  291.  * RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
  292.  */
  293. #ifndef    RECURSION_LIMIT
  294. #define    RECURSION_LIMIT    1000
  295. #endif
  296.  
  297. /*
  298.  * BITS_CHAR may be defined to set the number of bits per character.
  299.  * it is needed only for multi-byte character constants.
  300.  */
  301. #ifndef    BITS_CHAR
  302. #define    BITS_CHAR        8
  303. #endif
  304.  
  305. /*
  306.  * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series)
  307.  * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits.
  308.  * It is set FALSE on machines (such as the PDP-11 and Vax-11)
  309.  * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits.
  310.  * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
  311.  */
  312. #ifndef    BIG_ENDIAN
  313. #if HOST == SYS_MVS
  314. #define BIG_ENDIAN              TRUE      /* Is this right??? */
  315. #else
  316. #define    BIG_ENDIAN         FALSE
  317. #endif
  318. #endif
  319.  
  320. /*
  321.  * COMMENT_INVISIBLE may be defined to allow "old-style" comment
  322.  * processing, whereby the comment becomes a zero-length token
  323.  * delimiter.  This permitted tokens to be concatenated in macro
  324.  * expansions.  This was removed from the Draft Ansi Standard.
  325.  */
  326. #ifndef    COMMENT_INVISIBLE
  327. #define    COMMENT_INVISIBLE    FALSE
  328. #endif
  329.  
  330. /*
  331.  * STRING_FORMAL may be defined to allow recognition of macro parameters
  332.  * anywhere in replacement strings.  This was removed from the Draft Ansi
  333.  * Standard and a limited recognition capability added.
  334.  */
  335. #ifndef    STRING_FORMAL
  336. #define    STRING_FORMAL        FALSE
  337. #endif
  338.  
  339. /*
  340.  * OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
  341.  * This is a permitted extension to the Ansi Standard and is required
  342.  * for e.g., VMS, RSX-11M, etc.   It should be set FALSE if cpp is
  343.  * used to preprocess assembler source on Unix systems.  OLD_PREPROCESSOR
  344.  * sets OK_DOLLAR FALSE for that reason.
  345.  */
  346. #ifndef    OK_DOLLAR
  347. #define    OK_DOLLAR        TRUE
  348. #endif
  349.  
  350. /*
  351.  * OK_CONCAT enables (one possible implementation of) token concatenation.
  352.  * If cpp is used to preprocess Unix assembler source, this should be
  353.  * set FALSE as the concatenation character, #, is used by the assembler.
  354.  */
  355. #ifndef    OK_CONCAT
  356. #define    OK_CONCAT        TRUE
  357. #endif
  358.  
  359. /*
  360.  * OK_DATE may be enabled to predefine today's date as a string
  361.  * at the start of each compilation.  This is apparently not permitted
  362.  * by the Draft Ansi Standard.
  363.  */
  364. #ifndef    OK_DATE
  365. #define    OK_DATE        TRUE
  366. #endif
  367.  
  368. /*
  369.  * Some common definitions.
  370.  */
  371.  
  372. #ifndef    DEBUG
  373. #define    DEBUG            FALSE
  374. #endif
  375.  
  376. /*
  377.  * The following definitions are used to allocate memory for
  378.  * work buffers.  In general, they should not be modified
  379.  * by implementors.
  380.  *
  381.  * PAR_MAC    The maximum number of #define parameters (31 per Standard)
  382.  *        Note: we need another one for strings.
  383.  * NBUFF    Input buffer size
  384.  * NWORK    Work buffer size -- the longest macro
  385.  *        must fit here after expansion.
  386.  * NEXP        The nesting depth of #if expressions
  387.  * NINCLUDE    The number of directories that may be specified
  388.  *        on a per-system basis, or by the -I option.
  389.  * BLK_NEST    The number of nested #if's permitted.
  390.  */
  391.  
  392. #ifndef PAR_MAC
  393. #define    PAR_MAC           (31 + 1)
  394. #endif
  395.  
  396. #ifndef NBUFF
  397. #define    NBUFF            512
  398. #endif
  399.  
  400. #ifndef NWORK
  401. #define    NWORK            4096
  402. #endif
  403.  
  404. #ifndef NEXP
  405. #define    NEXP            128
  406. #endif
  407.  
  408. #ifndef NINCLUDE
  409. #define    NINCLUDE        16
  410. #endif
  411.  
  412. #ifndef NPARMWORK
  413. #define    NPARMWORK        (NBUFF * 2)
  414. #endif
  415.  
  416. #ifndef BLK_NEST
  417. #define    BLK_NEST        32
  418. #endif
  419.  
  420.  
  421. /*
  422.  * Some special constants.  These may need to be changed if cpp
  423.  * is ported to a wierd machine.
  424.  *
  425.  * NOTE: if cpp is run on a non-ascii machine, ALERT and VT may
  426.  * need to be changed.  They are used to implement the proposed
  427.  * ANSI standard C control characters '\a' and '\v' only.
  428.  * DEL is used to tag macro tokens to prevent #define foo foo
  429.  * from looping.  Note that we don't try to prevent more elaborate
  430.  * #define loops from occurring.
  431.  */
  432.  
  433. #ifndef    ALERT
  434. # if CHARSET == EBCDIC
  435. #    define ALERT                   '\057'      /* EBCDIC '\a' Bell */
  436. # else
  437. #    define ALERT            '\007'    /* ASCII  '\a' Bell */
  438. #endif
  439. #endif
  440.  
  441. #ifndef    VT
  442. #define    VT            '\013'        /* Vertical Tab CTRL/K    */
  443. #endif
  444.  
  445.  
  446. #ifndef    FILE_LOCAL
  447. #ifdef    decus
  448. #define    FILE_LOCAL        static
  449. #else
  450. #ifdef    vax11c
  451. #define    FILE_LOCAL        static
  452. #else
  453. #define    FILE_LOCAL                /* Others are global    */
  454. #endif
  455. #endif
  456. #endif
  457.