home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d0xx / d028 / cpp.lha / Cpp / cppdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-07-17  |  10.0 KB  |  421 lines

  1. /* Special macro based debugging package */
  2. /* Fred Fish, 14-Mar-86 */
  3. #ifdef DBUG
  4. #    include <local/dbug.h>
  5. #else
  6. #    define DBUG_ENTER(a1)
  7. #    define DBUG_RETURN(a1) return(a1)
  8. #    define DBUG_VOID_RETURN return
  9. #    define DBUG_EXECUTE(keyword,a1)
  10. #    define DBUG_2(keyword,format)
  11. #    define DBUG_3(keyword,format,a1)
  12. #    define DBUG_4(keyword,format,a1,a2)
  13. #    define DBUG_5(keyword,format,a1,a2,a3)
  14. #    define DBUG_PUSH(a1)
  15. #    define DBUG_POP()
  16. #    define DBUG_PROCESS(a1)
  17. #    define DBUG_FILE (stderr)
  18. #    define DBUG_SETJMP setjmp
  19. #    define DBUG_LONGJMP longjmp
  20. #endif
  21.  
  22. #ifdef EMACS
  23.  
  24. /* Use the Emacs config file to find out what type of machine */
  25.  
  26. #define NO_SHORTNAMES
  27. #include "../src/config.h"
  28.  
  29. /* Convert Emacs's conventions for BIG_ENDIAN to cpp's convention.  */
  30. #ifdef BIG_ENDIAN
  31. #undef BIG_ENDIAN
  32. #define BIG_ENDIAN TRUE
  33. #else /* not BIG_ENDIAN */
  34. #define BIG_ENDIAN FALSE
  35. #endif /* BIG_ENDIAN */
  36.  
  37. /* Emacs uses the names index and rindex and defines them as str(r)chr if nec;
  38.    cpp uses the opposite convention.  Here we flush the macro definitions for
  39.    Emacs and add the ones cpp wants.  */
  40.  
  41. #ifdef index
  42. #undef index
  43. #undef rindex
  44. #else /* index is not defined as a macro */
  45. #define strchr index
  46. #define strrchr rindex
  47. #endif /* index is not defined as a macro */
  48.  
  49. #define NBUFF 2048
  50. #define NWORK 2048
  51.  
  52. #endif /* EMACS */
  53.  
  54. /*
  55.  *           S y s t e m   D e p e n d e n t
  56.  *        D e f i n i t i o n s    f o r   C P P
  57.  *
  58.  * Definitions in this file may be edited to configure CPP for particular
  59.  * host operating systems and target configurations.
  60.  *
  61.  * NOTE: cpp assumes it is compiled by a compiler that supports macros
  62.  * with arguments.  If this is not the case (as for Decus C), #define
  63.  * nomacarg -- and provide function equivalents for all macros.
  64.  *
  65.  * cpp also assumes the host and target implement the Ascii character set.
  66.  * If this is not the case, you will have to do some editing here and there.
  67.  */
  68.  
  69. /*
  70.  * This redundant definition of TRUE and FALSE works around
  71.  * a limitation of Decus C.
  72.  */
  73. #ifndef    TRUE
  74. #define    TRUE            1
  75. #define    FALSE            0
  76. #endif
  77.  
  78. /*
  79.  * Define the HOST operating system.  This is needed so that
  80.  * cpp can use appropriate filename conventions.
  81.  */
  82. #define    SYS_UNKNOWN        0
  83. #define    SYS_UNIX        1
  84. #define    SYS_VMS            2
  85. #define    SYS_RSX            3
  86. #define    SYS_RT11        4
  87. #define    SYS_LATTICE        5
  88. #define    SYS_ONYX        6
  89. #define    SYS_68000        7
  90. #define SYS_AMIGADOS        8
  91.  
  92. #ifndef    HOST
  93. #ifdef    unix
  94. #define    HOST            SYS_UNIX
  95. #else
  96. #ifdef    vms
  97. #define    HOST            SYS_VMS
  98. #else
  99. #ifdef    rsx
  100. #define    HOST            SYS_RSX
  101. #else
  102. #ifdef    rt11
  103. #define    HOST            SYS_RT11
  104. #else
  105. #ifdef    amiga
  106. #define HOST            SYS_AMIGADOS
  107. #endif
  108. #endif
  109. #endif
  110. #endif
  111. #endif
  112. #endif
  113.  
  114. #ifndef    HOST
  115. #define    HOST            SYS_UNKNOWN
  116. #endif
  117.  
  118. /*
  119.  * We assume that the target is the same as the host system
  120.  */
  121. #ifndef    TARGET
  122. #define    TARGET            HOST
  123. #endif
  124.  
  125. /*
  126.  * In order to predefine machine-dependent constants,
  127.  * several strings are defined here:
  128.  *
  129.  * MACHINE    defines the target cpu (by name)
  130.  * SYSTEM    defines the target operating system
  131.  * COMPILER    defines the target compiler
  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_AMIGADOS
  203. #define MACHINE            "amiga"
  204. #define SYSTEM            "amigados"
  205. #ifdef manx
  206. #define COMPILER        "manx"
  207. #endif
  208. #ifdef lattice
  209. #define COMPILER        "lattice"
  210. #endif
  211. #endif
  212.  
  213. #if TARGET == SYS_68000
  214. /*
  215.  * All three machine designators have been seen in various systems.
  216.  * Warning -- compilers differ as to sizeof (int).  cpp3 assumes that
  217.  * sizeof (int) == 2
  218.  */
  219. #define    MACHINE            "M68000", "m68000", "m68k"
  220. #define    SYSTEM            "unix"
  221. #endif
  222.  
  223. #if    TARGET == SYS_UNIX
  224. #define    SYSTEM            "unix"
  225. #ifdef    pdp11
  226. #define    MACHINE            "pdp11"
  227. #endif
  228. #ifdef    vax
  229. #define    MACHINE            "vax"
  230. #endif
  231. #endif
  232.  
  233. /*
  234.  * defaults
  235.  */
  236.  
  237. #ifndef MSG_PREFIX
  238. #define MSG_PREFIX        "cpp: "
  239. #endif
  240.  
  241. #ifndef LINE_PREFIX
  242. #ifdef    decus
  243. #define    LINE_PREFIX        ""
  244. #else
  245. #define LINE_PREFIX        "line"
  246. #endif
  247. #endif
  248.  
  249. /*
  250.  * OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
  251.  * COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for
  252.  * an old-style preprocessor.
  253.  */
  254.  
  255. #if    OLD_PREPROCESSOR
  256. #define    OK_DOLLAR        FALSE
  257. #define    OK_CONCAT        FALSE
  258. #define    COMMENT_INVISIBLE    TRUE
  259. #define    STRING_FORMAL        TRUE
  260. #endif
  261.  
  262. /*
  263.  * RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
  264.  */
  265. #ifndef    RECURSION_LIMIT
  266. #define    RECURSION_LIMIT    1000
  267. #endif
  268.  
  269. /*
  270.  * BITS_CHAR may be defined to set the number of bits per character.
  271.  * it is needed only for multi-byte character constants.
  272.  */
  273. #ifndef    BITS_CHAR
  274. #define    BITS_CHAR        8
  275. #endif
  276.  
  277. /*
  278.  * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series)
  279.  * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits.
  280.  * It is set FALSE on machines (such as the PDP-11 and Vax-11)
  281.  * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits.
  282.  * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
  283.  */
  284. #ifndef    BIG_ENDIAN
  285. #define    BIG_ENDIAN         FALSE
  286. #endif
  287.  
  288. /*
  289.  * COMMENT_INVISIBLE may be defined to allow "old-style" comment
  290.  * processing, whereby the comment becomes a zero-length token
  291.  * delimiter.  This permitted tokens to be concatenated in macro
  292.  * expansions.  This was removed from the Draft Ansi Standard.
  293.  */
  294. #ifndef    COMMENT_INVISIBLE
  295. #define    COMMENT_INVISIBLE    FALSE
  296. #endif
  297.  
  298. /*
  299.  * STRING_FORMAL may be defined to allow recognition of macro parameters
  300.  * anywhere in replacement strings.  This was removed from the Draft Ansi
  301.  * Standard and a limited recognition capability added.
  302.  */
  303. #ifndef    STRING_FORMAL
  304. #define    STRING_FORMAL        FALSE
  305. #endif
  306.  
  307. /*
  308.  * OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
  309.  * This is a permitted extension to the Ansi Standard and is required
  310.  * for e.g., VMS, RSX-11M, etc.   It should be set FALSE if cpp is
  311.  * used to preprocess assembler source on Unix systems.  OLD_PREPROCESSOR
  312.  * sets OK_DOLLAR FALSE for that reason.
  313.  */
  314. #ifndef    OK_DOLLAR
  315. #define    OK_DOLLAR        TRUE
  316. #endif
  317.  
  318. /*
  319.  * OK_CONCAT enables (one possible implementation of) token concatenation.
  320.  * If cpp is used to preprocess Unix assembler source, this should be
  321.  * set FALSE as the concatenation character, #, is used by the assembler.
  322.  */
  323. #ifndef    OK_CONCAT
  324. #define    OK_CONCAT        TRUE
  325. #endif
  326.  
  327. /*
  328.  * OK_DATE may be enabled to predefine today's date as a string
  329.  * at the start of each compilation.  This is apparently not permitted
  330.  * by the Draft Ansi Standard.
  331.  */
  332. #ifndef    OK_DATE
  333. #define    OK_DATE        TRUE
  334. #endif
  335.  
  336. /*
  337.  * Some common definitions.
  338.  */
  339.  
  340. #ifndef    DEBUG
  341. #define    DEBUG            FALSE
  342. #endif
  343.  
  344. /*
  345.  * The following definitions are used to allocate memory for
  346.  * work buffers.  In general, they should not be modified
  347.  * by implementors.
  348.  *
  349.  * PAR_MAC    The maximum number of #define parameters (31 per Standard)
  350.  *        Note: we need another one for strings.
  351.  * NBUFF    Input buffer size
  352.  * NWORK    Work buffer size -- the longest macro
  353.  *        must fit here after expansion.
  354.  * NEXP        The nesting depth of #if expressions
  355.  * NINCLUDE    The number of directories that may be specified
  356.  *        on a per-system basis, or by the -I option.
  357.  * BLK_NEST    The number of nested #if's permitted.
  358.  */
  359.  
  360. #ifndef PAR_MAC
  361. #define    PAR_MAC           (31 + 1)
  362. #endif
  363.  
  364. #ifndef NBUFF
  365. #define    NBUFF            512
  366. #endif
  367.  
  368. #ifndef NWORK
  369. #define    NWORK            512
  370. #endif
  371.  
  372. #ifndef NEXP
  373. #define    NEXP            128
  374. #endif
  375.  
  376. #ifndef NINCLUDE
  377. #define    NINCLUDE          7
  378. #endif
  379.  
  380. #ifndef NPARMWORK
  381. #define    NPARMWORK        (NWORK * 2)
  382. #endif
  383.  
  384. #ifndef BLK_NEST
  385. #define    BLK_NEST        32
  386. #endif
  387.  
  388.  
  389. /*
  390.  * Some special constants.  These may need to be changed if cpp
  391.  * is ported to a wierd machine.
  392.  *
  393.  * NOTE: if cpp is run on a non-ascii machine, ALERT and VT may
  394.  * need to be changed.  They are used to implement the proposed
  395.  * ANSI standard C control characters '\a' and '\v' only.
  396.  * DEL is used to tag macro tokens to prevent #define foo foo
  397.  * from looping.  Note that we don't try to prevent more elaborate
  398.  * #define loops from occurring.
  399.  */
  400.  
  401. #ifndef    ALERT
  402. #define    ALERT            '\007'        /* '\a' is "Bell"    */
  403. #endif
  404.  
  405. #ifndef    VT
  406. #define    VT            '\013'        /* Vertical Tab CTRL/K    */
  407. #endif
  408.  
  409.  
  410. #ifndef    FILE_LOCAL
  411. #ifdef    decus
  412. #define    FILE_LOCAL        static
  413. #else
  414. #ifdef    vax11c
  415. #define    FILE_LOCAL        static
  416. #else
  417. #define    FILE_LOCAL                /* Others are global    */
  418. #endif
  419. #endif
  420. #endif
  421.