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