Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Include/pyport.h

    r10 r391  
    33
    44#include "pyconfig.h" /* include for defines */
     5
     6/* Some versions of HP-UX & Solaris need inttypes.h for int32_t,
     7   INT32_MAX, etc. */
     8#ifdef HAVE_INTTYPES_H
     9#include <inttypes.h>
     10#endif
    511
    612#ifdef HAVE_STDINT_H
     
    8187#endif /* HAVE_LONG_LONG */
    8288
     89/* a build with 30-bit digits for Python long integers needs an exact-width
     90 * 32-bit unsigned integer type to store those digits.  (We could just use
     91 * type 'unsigned long', but that would be wasteful on a system where longs
     92 * are 64-bits.)  On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines
     93 * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
     94 * However, it doesn't set HAVE_UINT32_T, so we do that here.
     95 */
     96#ifdef uint32_t
     97#define HAVE_UINT32_T 1
     98#endif
     99
     100#ifdef HAVE_UINT32_T
     101#ifndef PY_UINT32_T
     102#define PY_UINT32_T uint32_t
     103#endif
     104#endif
     105
     106/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
     107 * long integer implementation, when 30-bit digits are enabled.
     108 */
     109#ifdef uint64_t
     110#define HAVE_UINT64_T 1
     111#endif
     112
     113#ifdef HAVE_UINT64_T
     114#ifndef PY_UINT64_T
     115#define PY_UINT64_T uint64_t
     116#endif
     117#endif
     118
     119/* Signed variants of the above */
     120#ifdef int32_t
     121#define HAVE_INT32_T 1
     122#endif
     123
     124#ifdef HAVE_INT32_T
     125#ifndef PY_INT32_T
     126#define PY_INT32_T int32_t
     127#endif
     128#endif
     129
     130#ifdef int64_t
     131#define HAVE_INT64_T 1
     132#endif
     133
     134#ifdef HAVE_INT64_T
     135#ifndef PY_INT64_T
     136#define PY_INT64_T int64_t
     137#endif
     138#endif
     139
     140/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
     141   the necessary integer types are available, and we're on a 64-bit platform
     142   (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */
     143
     144#ifndef PYLONG_BITS_IN_DIGIT
     145#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \
     146     defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8)
     147#define PYLONG_BITS_IN_DIGIT 30
     148#else
     149#define PYLONG_BITS_IN_DIGIT 15
     150#endif
     151#endif
     152
    83153/* uintptr_t is the C9X name for an unsigned integral type such that a
    84154 * legitimate void* can be cast to uintptr_t and then back to void* again
     
    87157 */
    88158#ifdef HAVE_UINTPTR_T
    89 typedef uintptr_t       Py_uintptr_t;
    90 typedef intptr_t        Py_intptr_t;
     159typedef uintptr_t       Py_uintptr_t;
     160typedef intptr_t        Py_intptr_t;
    91161
    92162#elif SIZEOF_VOID_P <= SIZEOF_INT
    93 typedef unsigned int    Py_uintptr_t;
    94 typedef int             Py_intptr_t;
     163typedef unsigned int    Py_uintptr_t;
     164typedef int             Py_intptr_t;
    95165
    96166#elif SIZEOF_VOID_P <= SIZEOF_LONG
    97 typedef unsigned long   Py_uintptr_t;
    98 typedef long            Py_intptr_t;
     167typedef unsigned long   Py_uintptr_t;
     168typedef long            Py_intptr_t;
    99169
    100170#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
    101 typedef unsigned PY_LONG_LONG   Py_uintptr_t;
    102 typedef PY_LONG_LONG            Py_intptr_t;
     171typedef unsigned PY_LONG_LONG   Py_uintptr_t;
     172typedef PY_LONG_LONG            Py_intptr_t;
    103173
    104174#else
     
    111181 */
    112182#ifdef HAVE_SSIZE_T
    113 typedef ssize_t         Py_ssize_t;
     183typedef ssize_t         Py_ssize_t;
    114184#elif SIZEOF_VOID_P == SIZEOF_SIZE_T
    115 typedef Py_intptr_t     Py_ssize_t;
     185typedef Py_intptr_t     Py_ssize_t;
    116186#else
    117187#   error "Python needs a typedef for Py_ssize_t in pyport.h."
     
    121191   SIZE_MAX is part of C99, so it might be defined on some
    122192   platforms. If it is not defined, (size_t)-1 is a portable
    123    definition for C89, due to the way signed->unsigned 
     193   definition for C89, due to the way signed->unsigned
    124194   conversion is defined. */
    125195#ifdef SIZE_MAX
     
    173243#endif
    174244
     245/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for
     246 * the long long type instead of the size_t type.  It's only available
     247 * when HAVE_LONG_LONG is defined. The "high level" Python format
     248 * functions listed above will interpret "lld" or "llu" correctly on
     249 * all platforms.
     250 */
     251#ifdef HAVE_LONG_LONG
     252#   ifndef PY_FORMAT_LONG_LONG
     253#       if defined(MS_WIN64) || defined(MS_WINDOWS)
     254#           define PY_FORMAT_LONG_LONG "I64"
     255#       else
     256#           error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
     257#       endif
     258#   endif
     259#endif
     260
    175261/* Py_LOCAL can be used instead of static to get the fastest possible calling
    176262 * convention for functions that are local to a given module.
     
    197283#pragma optimize("agtw", on)
    198284#endif
    199 /* ignore warnings if the compiler decides not to inline a function */ 
     285/* ignore warnings if the compiler decides not to inline a function */
    200286#pragma warning(disable: 4710)
    201287/* fastest possible local call under MSVC */
     
    217303
    218304#if defined(_MSC_VER)
    219 #define Py_MEMCPY(target, source, length) do {                          \
    220                 size_t i_, n_ = (length);                               \
    221                 char *t_ = (void*) (target);                            \
    222                 const char *s_ = (void*) (source);                      \
    223                 if (n_ >= 16)                                           \
    224                         memcpy(t_, s_, n_);                             \
    225                 else                                                    \
    226                         for (i_ = 0; i_ < n_; i_++)                     \
    227                                 t_[i_] = s_[i_];                        \
    228         } while (0)
     305#define Py_MEMCPY(target, source, length) do {                          \
     306        size_t i_, n_ = (length);                                       \
     307        char *t_ = (void*) (target);                                    \
     308        const char *s_ = (void*) (source);                              \
     309        if (n_ >= 16)                                                   \
     310            memcpy(t_, s_, n_);                                         \
     311        else                                                            \
     312            for (i_ = 0; i_ < n_; i_++)                                 \
     313                t_[i_] = s_[i_];                                        \
     314    } while (0)
    229315#else
    230316#define Py_MEMCPY memcpy
     
    232318
    233319#include <stdlib.h>
     320
     321#ifdef HAVE_IEEEFP_H
     322#include <ieeefp.h>  /* needed for 'finite' declaration on some platforms */
     323#endif
    234324
    235325#include <math.h> /* Moved here from the math section, before extern "C" */
     
    328418 * or zero-fills.  Here a macro to force sign extension:
    329419 * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J)
    330  *    Return I >> J, forcing sign extension.
     420 *    Return I >> J, forcing sign extension.  Arithmetically, return the
     421 *    floor of I/2**J.
    331422 * Requirements:
    332  *    I is of basic signed type TYPE (char, short, int, long, or long long).
    333  *    TYPE is one of char, short, int, long, or long long, although long long
    334  *    must not be used except on platforms that support it.
    335  *    J is an integer >= 0 and strictly less than the number of bits in TYPE
    336  *    (because C doesn't define what happens for J outside that range either).
     423 *    I should have signed integer type.  In the terminology of C99, this can
     424 *    be either one of the five standard signed integer types (signed char,
     425 *    short, int, long, long long) or an extended signed integer type.
     426 *    J is an integer >= 0 and strictly less than the number of bits in the
     427 *    type of I (because C doesn't define what happens for J outside that
     428 *    range either).
     429 *    TYPE used to specify the type of I, but is now ignored.  It's been left
     430 *    in for backwards compatibility with versions <= 2.6 or 3.0.
    337431 * Caution:
    338432 *    I may be evaluated more than once.
     
    340434#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS
    341435#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \
    342         ((I) < 0 ? ~((~(unsigned TYPE)(I)) >> (J)) : (I) >> (J))
     436    ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J))
    343437#else
    344438#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J))
     
    360454#ifdef Py_DEBUG
    361455#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \
    362         (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
     456    (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
    363457#else
    364458#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
     
    380474#endif
    381475#define Py_SET_ERRNO_ON_MATH_ERROR(X) \
    382         do { \
    383                 if (errno == 0) { \
    384                         if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \
    385                                 errno = ERANGE; \
    386                         else _Py_SET_EDOM_FOR_NAN(X) \
    387                 } \
    388         } while(0)
     476    do { \
     477        if (errno == 0) { \
     478            if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \
     479                errno = ERANGE; \
     480            else _Py_SET_EDOM_FOR_NAN(X) \
     481        } \
     482    } while(0)
    389483
    390484/* Py_SET_ERANGE_ON_OVERFLOW(x)
     
    407501 *    X and Y may be evaluated more than once.
    408502 */
    409 #define Py_ADJUST_ERANGE1(X)                                            \
    410         do {                                                            \
    411                 if (errno == 0) {                                       \
    412                         if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL)  \
    413                                 errno = ERANGE;                         \
    414                 }                                                       \
    415                 else if (errno == ERANGE && (X) == 0.0)                 \
    416                         errno = 0;                                      \
    417         } while(0)
    418 
    419 #define Py_ADJUST_ERANGE2(X, Y)                                         \
    420         do {                                                            \
    421                 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL ||        \
    422                     (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) {        \
    423                                 if (errno == 0)                         \
    424                                         errno = ERANGE;                 \
    425                 }                                                       \
    426                 else if (errno == ERANGE)                               \
    427                         errno = 0;                                      \
    428         } while(0)
     503#define Py_ADJUST_ERANGE1(X)                                            \
     504    do {                                                                \
     505        if (errno == 0) {                                               \
     506            if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL)              \
     507                errno = ERANGE;                                         \
     508        }                                                               \
     509        else if (errno == ERANGE && (X) == 0.0)                         \
     510            errno = 0;                                                  \
     511    } while(0)
     512
     513#define Py_ADJUST_ERANGE2(X, Y)                                         \
     514    do {                                                                \
     515        if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL ||                \
     516            (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) {                \
     517                        if (errno == 0)                                 \
     518                                errno = ERANGE;                         \
     519        }                                                               \
     520        else if (errno == ERANGE)                                       \
     521            errno = 0;                                                  \
     522    } while(0)
     523
     524/*  The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are
     525 *  required to support the short float repr introduced in Python 3.1) require
     526 *  that the floating-point unit that's being used for arithmetic operations
     527 *  on C doubles is set to use 53-bit precision.  It also requires that the
     528 *  FPU rounding mode is round-half-to-even, but that's less often an issue.
     529 *
     530 *  If your FPU isn't already set to 53-bit precision/round-half-to-even, and
     531 *  you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should
     532 *
     533 *     #define HAVE_PY_SET_53BIT_PRECISION 1
     534 *
     535 *  and also give appropriate definitions for the following three macros:
     536 *
     537 *    _PY_SET_53BIT_PRECISION_START : store original FPU settings, and
     538 *        set FPU to 53-bit precision/round-half-to-even
     539 *    _PY_SET_53BIT_PRECISION_END : restore original FPU settings
     540 *    _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to
     541 *        use the two macros above.
     542 *
     543 * The macros are designed to be used within a single C function: see
     544 * Python/pystrtod.c for an example of their use.
     545 */
     546
     547/* get and set x87 control word for gcc/x86 */
     548#ifdef HAVE_GCC_ASM_FOR_X87
     549#define HAVE_PY_SET_53BIT_PRECISION 1
     550/* _Py_get/set_387controlword functions are defined in Python/pymath.c */
     551#define _Py_SET_53BIT_PRECISION_HEADER                          \
     552    unsigned short old_387controlword, new_387controlword
     553#define _Py_SET_53BIT_PRECISION_START                                   \
     554    do {                                                                \
     555        old_387controlword = _Py_get_387controlword();                  \
     556        new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \
     557        if (new_387controlword != old_387controlword)                   \
     558            _Py_set_387controlword(new_387controlword);                 \
     559    } while (0)
     560#define _Py_SET_53BIT_PRECISION_END                             \
     561    if (new_387controlword != old_387controlword)               \
     562        _Py_set_387controlword(old_387controlword)
     563#endif
     564
     565/* get and set x87 control word for VisualStudio/x86 */
     566#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
     567#define HAVE_PY_SET_53BIT_PRECISION 1
     568#define _Py_SET_53BIT_PRECISION_HEADER \
     569    unsigned int old_387controlword, new_387controlword, out_387controlword
     570/* We use the __control87_2 function to set only the x87 control word.
     571   The SSE control word is unaffected. */
     572#define _Py_SET_53BIT_PRECISION_START                                   \
     573    do {                                                                \
     574        __control87_2(0, 0, &old_387controlword, NULL);                 \
     575        new_387controlword =                                            \
     576          (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \
     577        if (new_387controlword != old_387controlword)                   \
     578            __control87_2(new_387controlword, _MCW_PC | _MCW_RC,        \
     579                          &out_387controlword, NULL);                   \
     580    } while (0)
     581#define _Py_SET_53BIT_PRECISION_END                                     \
     582    do {                                                                \
     583        if (new_387controlword != old_387controlword)                   \
     584            __control87_2(old_387controlword, _MCW_PC | _MCW_RC,        \
     585                          &out_387controlword, NULL);                   \
     586    } while (0)
     587#endif
     588
     589/* default definitions are empty */
     590#ifndef HAVE_PY_SET_53BIT_PRECISION
     591#define _Py_SET_53BIT_PRECISION_HEADER
     592#define _Py_SET_53BIT_PRECISION_START
     593#define _Py_SET_53BIT_PRECISION_END
     594#endif
     595
     596/* If we can't guarantee 53-bit precision, don't use the code
     597   in Python/dtoa.c, but fall back to standard code.  This
     598   means that repr of a float will be long (17 sig digits).
     599
     600   Realistically, there are two things that could go wrong:
     601
     602   (1) doubles aren't IEEE 754 doubles, or
     603   (2) we're on x86 with the rounding precision set to 64-bits
     604       (extended precision), and we don't know how to change
     605       the rounding precision.
     606 */
     607
     608#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \
     609    !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \
     610    !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
     611#define PY_NO_SHORT_FLOAT_REPR
     612#endif
     613
     614/* double rounding is symptomatic of use of extended precision on x86.  If
     615   we're seeing double rounding, and we don't have any mechanism available for
     616   changing the FPU rounding precision, then don't use Python/dtoa.c. */
     617#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION)
     618#define PY_NO_SHORT_FLOAT_REPR
     619#endif
    429620
    430621/* Py_DEPRECATED(version)
     
    436627 */
    437628#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
    438                           (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
     629              (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
    439630#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
    440631#else
     
    462653
    463654#ifdef HAVE__GETPTY
    464 #include <sys/types.h>          /* we need to import mode_t */
     655#include <sys/types.h>          /* we need to import mode_t */
    465656extern char * _getpty(int *, int, mode_t, int);
    466657#endif
     
    469660   if TCGETA, TCSETA, TCSETAW, or TCSETAF are used.  sys/termio.h must
    470661   be included before termios.h or it will generate an error. */
    471 #ifdef HAVE_SYS_TERMIO_H
     662#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux)
    472663#include <sys/termio.h>
    473664#endif
    474665
    475666#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY)
    476 #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H)
     667#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H)
    477668/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
    478669   functions, even though they are included in libutil. */
     
    513704#include <osreldate.h>
    514705#if __FreeBSD_version > 500039
     706# define _PY_PORT_CTYPE_UTF8_ISSUE
     707#endif
     708#endif
     709
     710
     711#if defined(__APPLE__)
     712# define _PY_PORT_CTYPE_UTF8_ISSUE
     713#endif
     714
     715#ifdef _PY_PORT_CTYPE_UTF8_ISSUE
    515716#include <ctype.h>
    516717#include <wctype.h>
     
    530731#define toupper(c) towupper(btowc(c))
    531732#endif
    532 #endif
    533733
    534734
     
    553753*/
    554754#if defined(__CYGWIN__) || defined(__BEOS__) || defined(__OS2__)
    555 #       define HAVE_DECLSPEC_DLL
     755#       define HAVE_DECLSPEC_DLL
    556756#endif
    557757
    558758/* only get special linkage if built as shared or platform is Cygwin */
    559759#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)
    560 #       if defined(HAVE_DECLSPEC_DLL)
    561 #               ifdef Py_BUILD_CORE
    562 #                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
    563 #                       define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
    564                         /* module init functions inside the core need no external linkage */
    565                         /* except for Cygwin to handle embedding (FIXME: BeOS too?) */
    566 #                       if defined(__CYGWIN__) || defined(__OS2__)
    567 #                               define PyMODINIT_FUNC __declspec(dllexport) void
    568 #                       else /* __CYGWIN__ */
    569 #                               define PyMODINIT_FUNC void
    570 #                       endif /* __CYGWIN__ */
    571 #               else /* Py_BUILD_CORE */
    572                         /* Building an extension module, or an embedded situation */
    573                         /* public Python functions and data are imported */
    574                         /* Under Cygwin, auto-import functions to prevent compilation */
    575                         /* failures similar to http://python.org/doc/FAQ.html#3.24 */
    576 #                       if !defined(__CYGWIN__) && !defined(__OS2__)
    577 #                               define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
    578 #                       endif /* !__CYGWIN__ */
    579 #                       if !defined(__OS2__)
    580 #                       define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
    581 #                       endif /* !__OS2__ */
    582                         /* module init functions outside the core must be exported */
    583 #                       if defined(__cplusplus)
    584 #                               define PyMODINIT_FUNC extern "C" __declspec(dllexport) void
    585 #                       else /* __cplusplus */
    586 #                               define PyMODINIT_FUNC __declspec(dllexport) void
    587 #                       endif /* __cplusplus */
    588 #               endif /* Py_BUILD_CORE */
    589 #       endif /* HAVE_DECLSPEC */
     760#       if defined(HAVE_DECLSPEC_DLL)
     761#               ifdef Py_BUILD_CORE
     762#                       define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
     763#                       define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
     764        /* module init functions inside the core need no external linkage */
     765        /* except for Cygwin to handle embedding (FIXME: BeOS too?) */
     766#                       if defined(__CYGWIN__) || defined(__OS2__)
     767#                               define PyMODINIT_FUNC __declspec(dllexport) void
     768#                       else /* __CYGWIN__ */
     769#                               define PyMODINIT_FUNC void
     770#                       endif /* __CYGWIN__ */
     771#               else /* Py_BUILD_CORE */
     772        /* Building an extension module, or an embedded situation */
     773        /* public Python functions and data are imported */
     774        /* Under Cygwin, auto-import functions to prevent compilation */
     775        /* failures similar to those described at the bottom of 4.1: */
     776        /* http://docs.python.org/extending/windows.html#a-cookbook-approach */
     777#                       if !defined(__CYGWIN__) && !defined(__OS2__)
     778#                               define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
     779#                       endif /* !__CYGWIN__ */
     780#                       if !defined(__OS2__)
     781#                               define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
     782#                       endif /* !__OS2__ */
     783        /* module init functions outside the core must be exported */
     784#                       if defined(__cplusplus)
     785#                               define PyMODINIT_FUNC extern "C" __declspec(dllexport) void
     786#                       else /* __cplusplus */
     787#                               define PyMODINIT_FUNC __declspec(dllexport) void
     788#                       endif /* __cplusplus */
     789#               endif /* Py_BUILD_CORE */
     790#       endif /* HAVE_DECLSPEC */
    590791#endif /* Py_ENABLE_SHARED */
    591792
    592793/* If no external linkage macros defined by now, create defaults */
    593794#ifndef PyAPI_FUNC
    594 #       define PyAPI_FUNC(RTYPE) RTYPE
     795#       define PyAPI_FUNC(RTYPE) RTYPE
    595796#endif
    596797#ifndef PyAPI_DATA
    597 #       define PyAPI_DATA(RTYPE) extern RTYPE
     798#       define PyAPI_DATA(RTYPE) extern RTYPE
    598799#endif
    599800#ifndef PyMODINIT_FUNC
    600 #       if defined(__cplusplus)
    601 #               define PyMODINIT_FUNC extern "C" void
    602 #       else /* __cplusplus */
    603 #               define PyMODINIT_FUNC void
    604 #       endif /* __cplusplus */
     801#       if defined(__cplusplus)
     802#               define PyMODINIT_FUNC extern "C" void
     803#       else /* __cplusplus */
     804#               define PyMODINIT_FUNC void
     805#       endif /* __cplusplus */
    605806#endif
    606807
    607808/* Deprecated DL_IMPORT and DL_EXPORT macros */
    608809#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL)
    609 #       if defined(Py_BUILD_CORE)
    610 #               define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
    611 #               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
    612 #       else
    613 #               define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
    614 #               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
    615 #       endif
     810#       if defined(Py_BUILD_CORE)
     811#               define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
     812#               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
     813#       else
     814#               define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
     815#               define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
     816#       endif
    616817#endif
    617818#ifndef DL_EXPORT
    618 #       define DL_EXPORT(RTYPE) RTYPE
     819#       define DL_EXPORT(RTYPE) RTYPE
    619820#endif
    620821#ifndef DL_IMPORT
    621 #       define DL_IMPORT(RTYPE) RTYPE
     822#       define DL_IMPORT(RTYPE) RTYPE
    622823#endif
    623824/* End of deprecated DL_* macros */
     
    628829#if 0 /* disabled and probably obsolete */
    629830
    630 #ifndef FD_SETSIZE
    631 #define FD_SETSIZE      256
     831#ifndef FD_SETSIZE
     832#define FD_SETSIZE      256
    632833#endif
    633834
     
    636837typedef long fd_mask;
    637838
    638 #define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */
     839#define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */
    639840#ifndef howmany
    640 #define howmany(x, y)   (((x)+((y)-1))/(y))
     841#define howmany(x, y)   (((x)+((y)-1))/(y))
    641842#endif /* howmany */
    642843
    643 typedef struct fd_set {
    644         fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
     844typedef struct fd_set {
     845    fd_mask     fds_bits[howmany(FD_SETSIZE, NFDBITS)];
    645846} fd_set;
    646847
    647 #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
    648 #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
    649 #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
    650 #define FD_ZERO(p)      memset((char *)(p), '\0', sizeof(*(p)))
     848#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
     849#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
     850#define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
     851#define FD_ZERO(p)      memset((char *)(p), '\0', sizeof(*(p)))
    651852
    652853#endif /* FD_SET */
Note: See TracChangeset for help on using the changeset viewer.