[BACK]Return to system.H CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / windows / mcpp

Annotation of OpenXM_contrib2/windows/mcpp/system.H, Revision 1.1

1.1     ! ohara       1: /* $OpenXM$ */
        !             2: /*-
        !             3:  * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
        !             4:  * All rights reserved.
        !             5:  *
        !             6:  * Some parts of this code are derived from the public domain software
        !             7:  * DECUS cpp (1984,1985) written by Martin Minow.
        !             8:  *
        !             9:  * Redistribution and use in source and binary forms, with or without
        !            10:  * modification, are permitted provided that the following conditions
        !            11:  * are met:
        !            12:  * 1. Redistributions of source code must retain the above copyright
        !            13:  *    notice, this list of conditions and the following disclaimer.
        !            14:  * 2. Redistributions in binary form must reproduce the above copyright
        !            15:  *    notice, this list of conditions and the following disclaimer in the
        !            16:  *    documentation and/or other materials provided with the distribution.
        !            17:  *
        !            18:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
        !            19:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            20:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            21:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
        !            22:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            23:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            24:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            25:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            26:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            27:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            28:  * SUCH DAMAGE.
        !            29:  */
        !            30:
        !            31: /*
        !            32:  *                          S Y S T E M . H
        !            33:  *                  S y s t e m   D e p e n d e n t
        !            34:  *              D e f i n i t i o n s   f o r   M C P P
        !            35:  *
        !            36:  * Definitions in this file may be edited to configure MCPP for particular
        !            37:  * operating systems and compiler configurations.
        !            38:  *
        !            39:  * Note:  MCPP assumes the system implement the Ascii character set.
        !            40:  * If this is not the case, you will have to do some editing here and there.
        !            41:  */
        !            42:
        !            43: #define SYSTEM_H
        !            44:
        !            45: #if     HAVE_CONFIG_H
        !            46: #include    "configed.H"
        !            47: #else
        !            48: #include    "noconfig.H"
        !            49: #endif
        !            50:
        !            51: /* Some system has a wrong definition of UCHAR_MAX.  See cpp-test.html#5.1.3 */
        !            52: #if     UCHARMAX < -255
        !            53: /* The definition of UCHARMAX (possibly UCHAR_MAX too) is wrong.    */
        !            54: /* Define it as a signed int value, not as an unsigned value.       */
        !            55: #undef  UCHARMAX
        !            56: #define UCHARMAX    ((1 << CHAR_BIT) - 1)
        !            57: #endif
        !            58:
        !            59: /*
        !            60:  *      PART 1 and PART 2 are defined in the above header files.
        !            61:  */
        !            62:
        !            63: /*
        !            64:  *      P A R T   1     Configurations for target-operating-system
        !            65:  *                      and target-compiler.
        !            66:  */
        !            67:
        !            68: /*
        !            69:  *      P A R T   2     Configurations for host-compiler.
        !            70:  */
        !            71:
        !            72: /*
        !            73:  *      P A R T   3     Configurations for default settings, typedefs and
        !            74:  *                      translation limits.
        !            75:  */
        !            76:
        !            77: /*
        !            78:  * The variable 'mcpp_mode' specifies the mode of preprocessing as one of
        !            79:  *          OLD_PREP, KR, STD, or POST_STD.
        !            80:  *      Those modes have many differences each other --
        !            81:  *          i.e. handling of translation phases; handling of some
        !            82:  *          preprocessing tokens; availability of some directives; way of
        !            83:  *          macro expansion;
        !            84:  *          -- as follows.
        !            85:  *
        !            86:  * KR       Actual arguments of a macro are expanded (after substitution)
        !            87:  *          with rest of the replacement text and the subsequent source text.
        !            88:  *      ## in macro definition has no significance to cpp.  The surrounding
        !            89:  *          tokens are macro-expanded separately.  Also, # has no significance
        !            90:  *          to cpp.  The following token is expanded.
        !            91:  *      Directly or intermediately recursive macro call causes an error.
        !            92:  *      <backslash><newline> sequence is deleted only in string literals
        !            93:  *          and in #define directive lines.
        !            94:  *      sizeof (type) can be used in #if line.
        !            95:  *      KR corresponds to the "K&R 1st."
        !            96:  *
        !            97:  * OLD_PREP     In addition to the KR specifications, this mode has the
        !            98:  *          following characteristics (and some others).
        !            99:  *      Converts comment to 0 space instead of 1 space.
        !           100:  *      Expands the parameter like spelling in string literal as a macro.
        !           101:  *      Does not check unmatched pair of '"' or '\''.
        !           102:  *      OLD_PREP corresponts to "Reiser model" cpp.
        !           103:  *
        !           104:  * STD      Standard conforming mode.
        !           105:  *      <backslash><newline> sequence is always deleted after trigraph
        !           106:  *          conversion and before tokenization.
        !           107:  *      Digraph sequences are recognized as tokens.
        !           108:  *      Actual arguments of a macro are expanded separately prior to
        !           109:  *          re-scanning of the replacement text.
        !           110:  *      The name in the replacement text once expanded is not re-expanded,
        !           111:  *          thus preventing recursive death.
        !           112:  *      ## in macro definition concatenates tokens.  The tokens are not
        !           113:  *          expanded.  The concatenated token is expanded by rescanning.
        !           114:  *      # in macro definition stringizes the following argument.  The argument
        !           115:  *          is not expanded.  \ is inserted before " and \ in or surrounding
        !           116:  *          the string literal or character constant.
        !           117:  *      An expanded macro is surrounded by spaces to prevent unintended
        !           118:  *          token merging.
        !           119:  *
        !           120:  * POST_STD     This mode simplifies the behavior of STD mode as follows.
        !           121:  *      1. Digraph sequences are converted in translation phase 1, as
        !           122:  *          alternate characters rather than as tokens.
        !           123:  *      2. A space is inserted as a token separator between any tokens in
        !           124:  *          a source (except a macro name and the next '(' in macro
        !           125:  *          definition): thus simplifying tokenization, test of macro
        !           126:  *          redefinition and macro expansion, especially "stringization".
        !           127:  *      3. Test of macro redefinition ignores difference of parameter names,
        !           128:  *          test of which has little utility and not a little overhead.
        !           129:  *      4. #if expression forbids character constants, which have little
        !           130:  *          portability, little utility and not a little overhead.
        !           131:  *      5. Rescanning of a macro expansion is limited in the replacement
        !           132:  *          text, rest of the source file is not scanned, thus making the
        !           133:  *          syntax of "function-like" macro call more similar to that of
        !           134:  *          function call.
        !           135:  *      6. Argument of #include directive in <header.h> form is an obsolescent
        !           136:  *          feature.
        !           137:  *      7. '$' or so are not treated specially in #define directive.
        !           138:  *      8. Trigraphs, UCN (universal-character name) are not recognized.
        !           139:  *      9. Multi-byte characters in an identifier are not recognized.
        !           140:  *
        !           141:  * The following specifications are available when mode is STD or POST_STD.
        !           142:  *      preprocessing number token, digraphs,
        !           143:  *      #pragma (#pragma MCPP put_defines, #pragma MCPP warning
        !           144:  *          , #pragma MCPP debug) directive,
        !           145:  *      #error directive,
        !           146:  *      #if defined operator, #elif directive,
        !           147:  *      predefined macros __FILE__, __LINE__, __DATE__, __TIME__
        !           148:  *          , __STDC__, __STDC_VERSION__, __STDC_HOSTED__,
        !           149:  *      wide character constant, wide character string literal,
        !           150:  *      _Pragma() operator, variable-arguments macro,
        !           151:  *      macro as an argument of #include, #line directives,
        !           152:  *      escape sequences \x[hex-digits], \a, \v,
        !           153:  *      '+' option (C++ preprocessing),
        !           154:  *      'S<n>' option (re-defines __STDC__ as <n>, unpredefine some macros),
        !           155:  *      'V<n>' option (re-defines __STDC_VERSION__ or __cplusplus as <n>),
        !           156:  *      'h<n>' option (re-defines __STDC_HOSTED__ as <n>).
        !           157:  * The following specifications are available only in STD mode.
        !           158:  *      Trigraphs and UCN,
        !           159:  *      Multi-byte characters in an identifier.
        !           160:  * The following specifications are available only in KR and OLD_PREP modes.
        !           161:  *      #assert, #asm, #endasm, #put_defines, #debug and some other older
        !           162:  *          directives,
        !           163:  *      argument of #line directive other than decimal-digits.
        !           164:  */
        !           165:
        !           166: /* The values of 'mcpp_mode'.   */
        !           167: #define OLD_PREP            1           /* "Reiser" cpp mode    */
        !           168: #define KR                  2           /* K&R 1st mode         */
        !           169: #define STD                 3           /* Standard moce        */
        !           170: #define POST_STD            9           /* Special mode of MCPP */
        !           171:
        !           172: /*
        !           173:  * TRIGRAPHS_INIT   Initial value for the -3 option.  If TRUE -3
        !           174:  *              disables trigraphs, if FALSE -3 enables them.
        !           175:  * DIGRAPHS_INIT    Initial value for the -2 option.  If TRUE -2
        !           176:  *              disables digraphs, if FALSE -2 enables them.
        !           177:  * OK_UCN       Enable recognition of Universal-Character-Name sequence
        !           178:  *              by -V199901L option.
        !           179:  * OK_MBIDENT   Enable multi-byte characters in identifier by -V199901L
        !           180:  *              option.
        !           181:  * EXPAND_PRAGMA    Enable macro expansion of #pragma line (even in modes
        !           182:  *              other than C99).
        !           183:  * expr_t, uexpr_t      Type of maximum integer:
        !           184:  *              long long (unsigned long long) or longer.
        !           185:  * EXPR_MAX should be defined to the maximum value of uexpr_t.
        !           186:  */
        !           187: #define TRIGRAPHS_INIT      FALSE
        !           188: #define DIGRAPHS_INIT       FALSE
        !           189: #ifndef EXPAND_PRAGMA
        !           190: #define EXPAND_PRAGMA       FALSE
        !           191: #endif
        !           192: #define OK_UCN              TRUE
        !           193: #define OK_MBIDENT          FALSE
        !           194:
        !           195: #if     HAVE_INTMAX_T
        !           196: #if     HAVE_STDINT_H
        !           197: #include    "stdint.h"
        !           198: #elif   HAVE_INTTYPES_H
        !           199: #include    "inttypes.h"
        !           200: #endif
        !           201: typedef intmax_t    expr_t;
        !           202: typedef uintmax_t   uexpr_t;
        !           203: #else
        !           204: #if     HAVE_LONG_LONG
        !           205: #if     (HOST_COMPILER == MSC && _MSC_VER < 1500) || HOST_COMPILER == BORLANDC
        !           206: typedef __int64             expr_t;
        !           207: typedef unsigned __int64    uexpr_t;
        !           208: #else
        !           209: typedef long long           expr_t;
        !           210: typedef unsigned long long  uexpr_t;
        !           211: #endif
        !           212: #else   /* !HAVE_LONG_LONG  */
        !           213: typedef unsigned long   uexpr_t;
        !           214: typedef long            expr_t;
        !           215: #endif  /* HAVE_LONG_LONG   */
        !           216: #endif  /* HAVE_INTMAX_T    */
        !           217:
        !           218: #if     HAVE_INTMAX_T
        !           219: #define EXPR_MAX            UINTMAX_MAX
        !           220: #elif   HAVE_LONG_LONG
        !           221: #if     (HOST_COMPILER == MSC && _MSC_VER < 1400) || HOST_COMPILER == BORLANDC
        !           222: #define EXPR_MAX            0xFFFFFFFFFFFFFFFFui64
        !           223: #else
        !           224: #define EXPR_MAX            0xFFFFFFFFFFFFFFFFULL
        !           225: #endif
        !           226: #else
        !           227: #define EXPR_MAX            4294967295UL
        !           228: #endif
        !           229:
        !           230: /*
        !           231:  * Translation limits.
        !           232:  * The following definitions are used to allocate memory for work buffers.
        !           233:  *
        !           234:  * NWORK        Output buffer size.  Set this size according to your compiler-
        !           235:  *              proper.  Length of string literal should be less than NWORK
        !           236:  *              - 1.
        !           237:  *              Nevertheless, when COMPILER == GNUC || COMPILER == MSC, mcpp
        !           238:  *              uses NMACWORK as output buffer size because GNUC and Visual C
        !           239:  *              can accept very long line.
        !           240:  * NBUFF        Input buffer size after line concatenation by <backslash>
        !           241:  *              <newline>.
        !           242:  * NMACWORK     Internal work buffer size for macro definition and expansion.
        !           243:  * IDMAX        The longest identifier length.
        !           244:  * NMACPARS     The maximum number of #define parameters.
        !           245:  *              NOTE: Must be NMACPARS <= UCHARMAX.
        !           246:  * NEXP         The maximum nesting depth of #if expressions.
        !           247:  * BLK_NEST     The number of nested #if's permitted.
        !           248:  * INCLUDE_NEST The maximum nesting depth of #include.  This is needed to
        !           249:  *              prevent infinite recursive inclusion.
        !           250:  * RESCAN_LIMIT The maximum rescan times of macro expansion in STD or POST_STD
        !           251:  *              modes.
        !           252:  * PRESTD_RESCAN_LIMIT  The maximum rescan times of macro expansion in KR or
        !           253:  *              OLD_PREP modes..
        !           254:  *
        !           255:  * NBUFF should not be smaller than NWORK.
        !           256:  * NMACWORK should not be smaller than NWORK * 2.
        !           257:  *
        !           258:  * SBSIZE defines the number of hash-table slots for the macro symbol table.
        !           259:  * It must be a power of 2.
        !           260:  *
        !           261:  * MKDEP_INIT   The initial maximum number of filenames in a dependency line
        !           262:  *              of output of -M* option.  The maximum number is dynamically
        !           263:  *              enlarged in execution.
        !           264:  */
        !           265:
        !           266: #ifndef IDMAX
        !           267: #define IDMAX               0x400
        !           268: #endif
        !           269: #ifndef NMACPARS
        !           270: #define NMACPARS            0xFF
        !           271: #endif
        !           272: #ifndef NEXP
        !           273: #define NEXP                0x100
        !           274: #endif
        !           275: #ifndef BLK_NEST
        !           276: #define BLK_NEST            0x100
        !           277: #endif
        !           278: #ifndef INCLUDE_NEST
        !           279: #define INCLUDE_NEST        0x100
        !           280: #endif
        !           281: #ifndef RESCAN_LIMIT
        !           282: #define RESCAN_LIMIT        0x40
        !           283: #endif
        !           284: #ifndef PRESTD_RESCAN_LIMIT
        !           285: #define PRESTD_RESCAN_LIMIT 0x100
        !           286: #endif
        !           287: #ifndef NBUFF
        !           288: #define NBUFF               0x10000     /* Must be NWORK <= NBUFF   */
        !           289: #endif
        !           290: #ifndef NWORK
        !           291: #define NWORK               NBUFF       /* 0x1000, 0x4000, 0x10000, ..  */
        !           292: #endif
        !           293: #ifndef NMACWORK
        !           294: #define NMACWORK            (NWORK * 4) /* Must be NWORK * 2 <= NMACWORK    */
        !           295: #endif
        !           296: #ifndef SBSIZE
        !           297: #define SBSIZE              0x400
        !           298: #endif
        !           299: #ifndef MKDEP_INIT
        !           300: #define MKDEP_INIT          0x100
        !           301: #endif
        !           302:
        !           303: #if     UCHARMAX < NMACPARS
        !           304:     #error  "NMACPARS should not be greater than UCHARMAX"
        !           305: #endif
        !           306:
        !           307: #if     NBUFF < NWORK
        !           308:     #error   "NBUFF must be same or greater than NWORK"
        !           309: #endif
        !           310: #if     NMACWORK < NWORK * 2
        !           311:     #error   "NMACWORK must be same or greater than NWORK * 2"
        !           312: #endif
        !           313:
        !           314: #define SBMASK  (SBSIZE - 1)
        !           315: #if     (SBSIZE ^ SBMASK) != ((SBSIZE * 2) - 1)
        !           316:     #error  "SBSIZE must be a power of 2 !"
        !           317: #endif
        !           318:
        !           319: /*
        !           320:  * Translation limits required by the Standard.
        !           321:  *
        !           322:  * *90MIN   limits specified by C90.
        !           323:  * *99MIN   limits specified by C99.
        !           324:  * *_CPLUS_MIN  limits recommended by C++ (ISO 1998/07 Standard).
        !           325:  *
        !           326:  * SLEN*MIN     Characters in a logical source line
        !           327:  *              and characters in a string literal or wide string literal
        !           328:  *              (after concatenation).
        !           329:  * IDLEN*MIN    Significant initial characters in an internal identifier
        !           330:  *              or a macro name.
        !           331:  * NMACPARS*MIN     Parameters in one macro definition.
        !           332:  *              Arguments in one macro invocation.
        !           333:  * EXP_NEST*MIN     Nesting levels of parenthesized expressions in a full
        !           334:  *              expression.
        !           335:  * BLK_NEST*MIN     Nesting levels of conditional inclusion.
        !           336:  * INCLUDE_NEST*MIN     Nesting levels for #include files.
        !           337:  * NMACRO*MIN   Macro identifiers simultaneously defined in one translation
        !           338:  *              unit.
        !           339:  */
        !           340: #define SLEN90MIN           0x1FD
        !           341: #define IDLEN90MIN          0x1F
        !           342: #define NMACPARS90MIN       0x1F
        !           343: #define EXP_NEST90MIN       0x20
        !           344: #define BLK_NEST90MIN       8
        !           345: #define INCLUDE_NEST90MIN   8
        !           346: #define NMACRO90MIN         0x400
        !           347:
        !           348: #define SLEN99MIN           0xFFF
        !           349: #define IDLEN99MIN          0x3F
        !           350: #define NMACPARS99MIN       0x7F
        !           351: #define EXP_NEST99MIN       0x3F
        !           352: #define BLK_NEST99MIN       0x3F
        !           353: #define INCLUDE_NEST99MIN   0xF
        !           354: #define NMACRO99MIN         0xFFF
        !           355:
        !           356: #define SLEN_CPLUS_MIN      0x10000
        !           357: #define IDLEN_CPLUS_MIN     0x400
        !           358: #define NMACPARS_CPLUS_MIN  0x100
        !           359: #define EXP_NEST_CPLUS_MIN  0x100
        !           360: #define BLK_NEST_CPLUS_MIN  0x100
        !           361: #define INCLUDE_NEST_CPLUS_MIN  0x100
        !           362: #define NMACRO_CPLUS_MIN    0x10000
        !           363:
        !           364: /* LINE99LIMIT  means the line number limit of C99  */
        !           365: #define LINE99LIMIT         0x7FFFFFFF
        !           366:
        !           367: /*
        !           368:  * STDC     This macro is used for the predefined __STDC__.
        !           369:  * STDC_VERSION     is used for the value of __STDC_VERSION__.
        !           370:  * STDC_HOSTED      is used for the value of __STDC_HOSTED__.
        !           371:  */
        !           372: #if     IDMAX < IDLEN90MIN || NBUFF < SLEN90MIN + 3
        !           373:             || NWORK < SLEN90MIN + 2 || NMACPARS < NMACPARS90MIN
        !           374:             || NEXP < EXP_NEST90MIN || BLK_NEST < BLK_NEST90MIN
        !           375: #define STDC                0
        !           376: #endif
        !           377: #ifndef STDC
        !           378: #define STDC                1       /* 1 : for ISO 9899:1990 or later   */
        !           379: #endif
        !           380:
        !           381: #ifndef STDC_VERSION
        !           382: #define STDC_VERSION        0L      /* 199409L  : For conforming
        !           383:             implementation to ISO 9899:1990 / Amendment 1:1995
        !           384:             199901L : For C99   */
        !           385: #endif
        !           386: #ifndef STDC_HOSTED
        !           387: #define STDC_HOSTED         1       /* 1 : for hosted implementation,
        !           388:             0 : for free-standing implementation (C99 specification)    */
        !           389: #endif
        !           390:
        !           391: /*
        !           392:  * CPLUS specifies the default value of the pre-defined macro __cplusplus
        !           393:  * for C++ processing.
        !           394:  * The value can be changed by -V<n> option.
        !           395:  */
        !           396: #define CPLUS               1       /* 199711L for C++ Standard     */
        !           397:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>