home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nethack-3.1 / sys / unix / cpp1.shr / cppdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-26  |  9.0 KB  |  380 lines

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