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