home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 342b.lha / cpp / cppdef.h < prev    next >
C/C++ Source or Header  |  1990-01-26  |  11KB  |  439 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.  * OK_SIZEOF    Permits sizeof in #if preprocessor expressions.
  158.  *        According to K&R V2 (page 232), this is not allowed.
  159.  *
  160.  * S_CHAR etc.    Define the sizeof the basic TARGET machine word types.
  161.  *        By default, sizes are set to the values for the HOST
  162.  *        computer.  If this is inappropriate, see the code in
  163.  *        cpp3.c for details on what to change.  Also, if you
  164.  *        have a machine where sizeof (signed int) differs from
  165.  *        sizeof (unsigned int), you will have to edit code and
  166.  *        tables in cpp3.c (and extend the -S option definition.)
  167.  *
  168.  * CPP_LIBRARY    May be defined if you have a site-specific include directory
  169.  *        which is to be searched *before* the operating-system
  170.  *        specific directories.
  171.  */
  172.  
  173. #if TARGET == SYS_LATTICE
  174. /*
  175.  * We assume the operating system is pcdos for the IBM-PC.
  176.  * We also assume the small model (just like the PDP-11)
  177.  */
  178. #define MACHINE         "i8086"
  179. #define SYSTEM            "pcdos"
  180. #endif
  181.  
  182. #if TARGET == SYS_ONYX
  183. #define MACHINE         "z8000"
  184. #define SYSTEM            "unix"
  185. #endif
  186.  
  187. #if TARGET == SYS_VMS
  188. #define MACHINE         "vax"
  189. #define SYSTEM            "vms"
  190. #define COMPILER        "vax11c"
  191. #endif
  192.  
  193. #if TARGET == SYS_RSX
  194. #define MACHINE         "pdp11"
  195. #define SYSTEM            "rsx"
  196. #define COMPILER        "decus"
  197. #endif
  198.  
  199. #if TARGET == SYS_RT11
  200. #define MACHINE         "pdp11"
  201. #define SYSTEM            "rt11"
  202. #define COMPILER        "decus"
  203. #endif
  204.  
  205. #if TARGET == SYS_AMIGADOS
  206. #define MACHINE         "amiga", "m68000"
  207. #define SYSTEM            "amigados"
  208. #ifdef manx
  209. #define COMPILER        "manx"
  210. #endif
  211. #ifdef lattice
  212. #define COMPILER        "lattice"
  213. #endif
  214. #ifdef pdc
  215. #define COMPILER        "pdc", "__PDC__"
  216. #endif
  217. #endif
  218.  
  219. #if TARGET == SYS_68000
  220. /*
  221.  * All three machine designators have been seen in various systems.
  222.  * Warning -- compilers differ as to sizeof (int).  cpp3 assumes that
  223.  * sizeof (int) == 2
  224.  */
  225. #define MACHINE         "M68000", "m68000", "m68k"
  226. #define SYSTEM            "unix"
  227. #endif
  228.  
  229. #if    TARGET == SYS_UNIX
  230. #define SYSTEM            "unix"
  231. #ifdef    pdp11
  232. #define MACHINE         "pdp11"
  233. #endif
  234. #ifdef    vax
  235. #define MACHINE         "vax"
  236. #endif
  237. #endif
  238.  
  239. /*
  240.  * defaults
  241.  */
  242.  
  243. #ifndef MSG_PREFIX
  244. #define MSG_PREFIX        "cpp: "
  245. #endif
  246.  
  247. #ifndef LINE_PREFIX
  248. #ifdef    decus
  249. #define LINE_PREFIX        ""
  250. #else
  251. #define LINE_PREFIX        "line"
  252. #endif
  253. #endif
  254.  
  255. /*
  256.  * OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
  257.  * COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for
  258.  * an old-style preprocessor.
  259.  */
  260.  
  261. #if    OLD_PREPROCESSOR
  262. #define OK_DOLLAR        FALSE
  263. #define OK_CONCAT        FALSE
  264. #define COMMENT_INVISIBLE    TRUE
  265. #define STRING_FORMAL        TRUE
  266. #endif
  267.  
  268. /*
  269.  * RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
  270.  */
  271. #ifndef RECURSION_LIMIT
  272. #define RECURSION_LIMIT 1000
  273. #endif
  274.  
  275. /*
  276.  * BITS_CHAR may be defined to set the number of bits per character.
  277.  * it is needed only for multi-byte character constants.
  278.  */
  279. #ifndef BITS_CHAR
  280. #define BITS_CHAR        8
  281. #endif
  282.  
  283. /*
  284.  * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series)
  285.  * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits.
  286.  * It is set FALSE on machines (such as the PDP-11 and Vax-11)
  287.  * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits.
  288.  * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
  289.  * [I *seems* to be the other way around, according to the code /OIS]
  290.  */
  291. #ifndef BIG_ENDIAN
  292. #define BIG_ENDIAN        FALSE
  293. #endif
  294.  
  295. /*
  296.  * COMMENT_INVISIBLE may be defined to allow "old-style" comment
  297.  * processing, whereby the comment becomes a zero-length token
  298.  * delimiter.  This permitted tokens to be concatenated in macro
  299.  * expansions.    This was removed from the Draft Ansi Standard.
  300.  */
  301. #ifndef COMMENT_INVISIBLE
  302. #define COMMENT_INVISIBLE    FALSE
  303. #endif
  304.  
  305. /*
  306.  * STRING_FORMAL may be defined to allow recognition of macro parameters
  307.  * anywhere in replacement strings.  This was removed from the Draft Ansi
  308.  * Standard and a limited recognition capability added.
  309.  */
  310. #ifndef STRING_FORMAL
  311. #define STRING_FORMAL        FALSE
  312. #endif
  313.  
  314. /*
  315.  * OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
  316.  * This is a permitted extension to the Ansi Standard and is required
  317.  * for e.g., VMS, RSX-11M, etc.   It should be set FALSE if cpp is
  318.  * used to preprocess assembler source on Unix systems.  OLD_PREPROCESSOR
  319.  * sets OK_DOLLAR FALSE for that reason.
  320.  */
  321. #ifndef OK_DOLLAR
  322. #define OK_DOLLAR        TRUE
  323. #endif
  324.  
  325. /*
  326.  * OK_CONCAT enables (one possible implementation of) token concatenation.
  327.  * If cpp is used to preprocess Unix assembler source, this should be
  328.  * set FALSE as the concatenation character, #, is used by the assembler.
  329.  */
  330. #ifndef OK_CONCAT
  331. #define OK_CONCAT        TRUE
  332. #endif
  333.  
  334. /*
  335.  * OK_DATE may be enabled to predefine today's date as a string
  336.  * at the start of each compilation.  This is apparently not permitted
  337.  * by the Draft Ansi Standard.
  338.  */
  339. #ifndef OK_DATE
  340. #define OK_DATE     TRUE
  341. #endif
  342.  
  343. /*
  344.  * OK_SIZEOF may be defined to allow sizeof(type) in #if expressions.
  345.  * Actually, it is none of the preprocessors business how large these
  346.  * things are, as they might be different with different compiler
  347.  * options. Also, according to K&R V2, page 232, it is nonstandard.
  348.  * This option was added in the PDC process, under no. *OIS*0.92*.
  349.  */
  350. #ifndef OK_SIZEOF
  351. #define OK_SIZEOF    FALSE
  352. #endif
  353.  
  354. /*
  355.  * Some common definitions.
  356.  */
  357.  
  358. #ifndef DEBUG
  359. #define DEBUG        FALSE
  360. #endif
  361.  
  362. /*
  363.  * The following definitions are used to allocate memory for
  364.  * work buffers.  In general, they should not be modified
  365.  * by implementors.
  366.  *
  367.  * PAR_MAC    The maximum number of #define parameters (31 per Standard)
  368.  *        Note: we need another one for strings.
  369.  * NBUFF    Input buffer size
  370.  * NWORK    Work buffer size -- the longest macro
  371.  *        must fit here after expansion.
  372.  * NEXP     The nesting depth of #if expressions
  373.  * NINCLUDE    The number of directories that may be specified
  374.  *        on a per-system basis, or by the -I option.
  375.  * BLK_NEST    The number of nested #if's permitted.
  376.  */
  377.  
  378. #ifndef PAR_MAC
  379. #define PAR_MAC        (31 + 1)
  380. #endif
  381.  
  382. #ifndef NBUFF
  383. #define NBUFF            512
  384. #endif
  385.  
  386. #ifndef NWORK
  387. #define NWORK            512
  388. #endif
  389.  
  390. #ifndef NEXP
  391. #define NEXP            128
  392. #endif
  393.  
  394. #ifndef NINCLUDE
  395. #define NINCLUDE          7
  396. #endif
  397.  
  398. #ifndef NPARMWORK
  399. #define NPARMWORK        (NWORK * 2)
  400. #endif
  401.  
  402. #ifndef BLK_NEST
  403. #define BLK_NEST        32
  404. #endif
  405.  
  406.  
  407. /*
  408.  * Some special constants.  These may need to be changed if cpp
  409.  * is ported to a wierd machine.
  410.  *
  411.  * NOTE: if cpp is run on a non-ascii machine, ALERT and VT may
  412.  * need to be changed.    They are used to implement the proposed
  413.  * ANSI standard C control characters '\a' and '\v' only.
  414.  * DEL is used to tag macro tokens to prevent #define foo foo
  415.  * from looping.  Note that we don't try to prevent more elaborate
  416.  * #define loops from occurring.
  417.  */
  418.  
  419. #ifndef ALERT
  420. #define ALERT            '\007'          /* '\a' is "Bell"       */
  421. #endif
  422.  
  423. #ifndef VT
  424. #define VT            '\013'          /* Vertical Tab CTRL/K  */
  425. #endif
  426.  
  427.  
  428. #ifndef FILE_LOCAL
  429. #ifdef    decus
  430. #define FILE_LOCAL        static
  431. #else
  432. #ifdef    vax11c
  433. #define FILE_LOCAL        static
  434. #else
  435. #define FILE_LOCAL                /* Others are global    */
  436. #endif
  437. #endif
  438. #endif
  439.