Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python2....
File: pyport.h
#ifndef Py_PYPORT_H
[0] Fix | Delete
#define Py_PYPORT_H
[1] Fix | Delete
[2] Fix | Delete
#include "pyconfig.h" /* include for defines */
[3] Fix | Delete
[4] Fix | Delete
/* Some versions of HP-UX & Solaris need inttypes.h for int32_t,
[5] Fix | Delete
INT32_MAX, etc. */
[6] Fix | Delete
#ifdef HAVE_INTTYPES_H
[7] Fix | Delete
#include <inttypes.h>
[8] Fix | Delete
#endif
[9] Fix | Delete
[10] Fix | Delete
#ifdef HAVE_STDINT_H
[11] Fix | Delete
#include <stdint.h>
[12] Fix | Delete
#endif
[13] Fix | Delete
[14] Fix | Delete
/**************************************************************************
[15] Fix | Delete
Symbols and macros to supply platform-independent interfaces to basic
[16] Fix | Delete
C language & library operations whose spellings vary across platforms.
[17] Fix | Delete
[18] Fix | Delete
Please try to make documentation here as clear as possible: by definition,
[19] Fix | Delete
the stuff here is trying to illuminate C's darkest corners.
[20] Fix | Delete
[21] Fix | Delete
Config #defines referenced here:
[22] Fix | Delete
[23] Fix | Delete
SIGNED_RIGHT_SHIFT_ZERO_FILLS
[24] Fix | Delete
Meaning: To be defined iff i>>j does not extend the sign bit when i is a
[25] Fix | Delete
signed integral type and i < 0.
[26] Fix | Delete
Used in: Py_ARITHMETIC_RIGHT_SHIFT
[27] Fix | Delete
[28] Fix | Delete
Py_DEBUG
[29] Fix | Delete
Meaning: Extra checks compiled in for debug mode.
[30] Fix | Delete
Used in: Py_SAFE_DOWNCAST
[31] Fix | Delete
[32] Fix | Delete
HAVE_UINTPTR_T
[33] Fix | Delete
Meaning: The C9X type uintptr_t is supported by the compiler
[34] Fix | Delete
Used in: Py_uintptr_t
[35] Fix | Delete
[36] Fix | Delete
HAVE_LONG_LONG
[37] Fix | Delete
Meaning: The compiler supports the C type "long long"
[38] Fix | Delete
Used in: PY_LONG_LONG
[39] Fix | Delete
[40] Fix | Delete
**************************************************************************/
[41] Fix | Delete
[42] Fix | Delete
[43] Fix | Delete
/* For backward compatibility only. Obsolete, do not use. */
[44] Fix | Delete
#ifdef HAVE_PROTOTYPES
[45] Fix | Delete
#define Py_PROTO(x) x
[46] Fix | Delete
#else
[47] Fix | Delete
#define Py_PROTO(x) ()
[48] Fix | Delete
#endif
[49] Fix | Delete
#ifndef Py_FPROTO
[50] Fix | Delete
#define Py_FPROTO(x) Py_PROTO(x)
[51] Fix | Delete
#endif
[52] Fix | Delete
[53] Fix | Delete
/* typedefs for some C9X-defined synonyms for integral types.
[54] Fix | Delete
*
[55] Fix | Delete
* The names in Python are exactly the same as the C9X names, except with a
[56] Fix | Delete
* Py_ prefix. Until C9X is universally implemented, this is the only way
[57] Fix | Delete
* to ensure that Python gets reliable names that don't conflict with names
[58] Fix | Delete
* in non-Python code that are playing their own tricks to define the C9X
[59] Fix | Delete
* names.
[60] Fix | Delete
*
[61] Fix | Delete
* NOTE: don't go nuts here! Python has no use for *most* of the C9X
[62] Fix | Delete
* integral synonyms. Only define the ones we actually need.
[63] Fix | Delete
*/
[64] Fix | Delete
[65] Fix | Delete
#ifdef HAVE_LONG_LONG
[66] Fix | Delete
#ifndef PY_LONG_LONG
[67] Fix | Delete
#define PY_LONG_LONG long long
[68] Fix | Delete
#if defined(LLONG_MAX)
[69] Fix | Delete
/* If LLONG_MAX is defined in limits.h, use that. */
[70] Fix | Delete
#define PY_LLONG_MIN LLONG_MIN
[71] Fix | Delete
#define PY_LLONG_MAX LLONG_MAX
[72] Fix | Delete
#define PY_ULLONG_MAX ULLONG_MAX
[73] Fix | Delete
#elif defined(__LONG_LONG_MAX__)
[74] Fix | Delete
/* Otherwise, if GCC has a builtin define, use that. */
[75] Fix | Delete
#define PY_LLONG_MAX __LONG_LONG_MAX__
[76] Fix | Delete
#define PY_LLONG_MIN (-PY_LLONG_MAX-1)
[77] Fix | Delete
#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL)
[78] Fix | Delete
#else
[79] Fix | Delete
/* Otherwise, rely on two's complement. */
[80] Fix | Delete
#define PY_ULLONG_MAX (~0ULL)
[81] Fix | Delete
#define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1))
[82] Fix | Delete
#define PY_LLONG_MIN (-PY_LLONG_MAX-1)
[83] Fix | Delete
#endif /* LLONG_MAX */
[84] Fix | Delete
#endif
[85] Fix | Delete
#endif /* HAVE_LONG_LONG */
[86] Fix | Delete
[87] Fix | Delete
/* a build with 30-bit digits for Python long integers needs an exact-width
[88] Fix | Delete
* 32-bit unsigned integer type to store those digits. (We could just use
[89] Fix | Delete
* type 'unsigned long', but that would be wasteful on a system where longs
[90] Fix | Delete
* are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines
[91] Fix | Delete
* uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
[92] Fix | Delete
* However, it doesn't set HAVE_UINT32_T, so we do that here.
[93] Fix | Delete
*/
[94] Fix | Delete
#ifdef uint32_t
[95] Fix | Delete
#define HAVE_UINT32_T 1
[96] Fix | Delete
#endif
[97] Fix | Delete
[98] Fix | Delete
#ifdef HAVE_UINT32_T
[99] Fix | Delete
#ifndef PY_UINT32_T
[100] Fix | Delete
#define PY_UINT32_T uint32_t
[101] Fix | Delete
#endif
[102] Fix | Delete
#endif
[103] Fix | Delete
[104] Fix | Delete
/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
[105] Fix | Delete
* long integer implementation, when 30-bit digits are enabled.
[106] Fix | Delete
*/
[107] Fix | Delete
#ifdef uint64_t
[108] Fix | Delete
#define HAVE_UINT64_T 1
[109] Fix | Delete
#endif
[110] Fix | Delete
[111] Fix | Delete
#ifdef HAVE_UINT64_T
[112] Fix | Delete
#ifndef PY_UINT64_T
[113] Fix | Delete
#define PY_UINT64_T uint64_t
[114] Fix | Delete
#endif
[115] Fix | Delete
#endif
[116] Fix | Delete
[117] Fix | Delete
/* Signed variants of the above */
[118] Fix | Delete
#ifdef int32_t
[119] Fix | Delete
#define HAVE_INT32_T 1
[120] Fix | Delete
#endif
[121] Fix | Delete
[122] Fix | Delete
#ifdef HAVE_INT32_T
[123] Fix | Delete
#ifndef PY_INT32_T
[124] Fix | Delete
#define PY_INT32_T int32_t
[125] Fix | Delete
#endif
[126] Fix | Delete
#endif
[127] Fix | Delete
[128] Fix | Delete
#ifdef int64_t
[129] Fix | Delete
#define HAVE_INT64_T 1
[130] Fix | Delete
#endif
[131] Fix | Delete
[132] Fix | Delete
#ifdef HAVE_INT64_T
[133] Fix | Delete
#ifndef PY_INT64_T
[134] Fix | Delete
#define PY_INT64_T int64_t
[135] Fix | Delete
#endif
[136] Fix | Delete
#endif
[137] Fix | Delete
[138] Fix | Delete
/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
[139] Fix | Delete
the necessary integer types are available, and we're on a 64-bit platform
[140] Fix | Delete
(as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */
[141] Fix | Delete
[142] Fix | Delete
#ifndef PYLONG_BITS_IN_DIGIT
[143] Fix | Delete
#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \
[144] Fix | Delete
defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8)
[145] Fix | Delete
#define PYLONG_BITS_IN_DIGIT 30
[146] Fix | Delete
#else
[147] Fix | Delete
#define PYLONG_BITS_IN_DIGIT 15
[148] Fix | Delete
#endif
[149] Fix | Delete
#endif
[150] Fix | Delete
[151] Fix | Delete
/* uintptr_t is the C9X name for an unsigned integral type such that a
[152] Fix | Delete
* legitimate void* can be cast to uintptr_t and then back to void* again
[153] Fix | Delete
* without loss of information. Similarly for intptr_t, wrt a signed
[154] Fix | Delete
* integral type.
[155] Fix | Delete
*/
[156] Fix | Delete
#ifdef HAVE_UINTPTR_T
[157] Fix | Delete
typedef uintptr_t Py_uintptr_t;
[158] Fix | Delete
typedef intptr_t Py_intptr_t;
[159] Fix | Delete
[160] Fix | Delete
#elif SIZEOF_VOID_P <= SIZEOF_INT
[161] Fix | Delete
typedef unsigned int Py_uintptr_t;
[162] Fix | Delete
typedef int Py_intptr_t;
[163] Fix | Delete
[164] Fix | Delete
#elif SIZEOF_VOID_P <= SIZEOF_LONG
[165] Fix | Delete
typedef unsigned long Py_uintptr_t;
[166] Fix | Delete
typedef long Py_intptr_t;
[167] Fix | Delete
[168] Fix | Delete
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
[169] Fix | Delete
typedef unsigned PY_LONG_LONG Py_uintptr_t;
[170] Fix | Delete
typedef PY_LONG_LONG Py_intptr_t;
[171] Fix | Delete
[172] Fix | Delete
#else
[173] Fix | Delete
# error "Python needs a typedef for Py_uintptr_t in pyport.h."
[174] Fix | Delete
#endif /* HAVE_UINTPTR_T */
[175] Fix | Delete
[176] Fix | Delete
/* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) ==
[177] Fix | Delete
* sizeof(size_t). C99 doesn't define such a thing directly (size_t is an
[178] Fix | Delete
* unsigned integral type). See PEP 353 for details.
[179] Fix | Delete
*/
[180] Fix | Delete
#ifdef HAVE_SSIZE_T
[181] Fix | Delete
typedef ssize_t Py_ssize_t;
[182] Fix | Delete
#elif SIZEOF_VOID_P == SIZEOF_SIZE_T
[183] Fix | Delete
typedef Py_intptr_t Py_ssize_t;
[184] Fix | Delete
#else
[185] Fix | Delete
# error "Python needs a typedef for Py_ssize_t in pyport.h."
[186] Fix | Delete
#endif
[187] Fix | Delete
[188] Fix | Delete
/* Largest possible value of size_t.
[189] Fix | Delete
SIZE_MAX is part of C99, so it might be defined on some
[190] Fix | Delete
platforms. If it is not defined, (size_t)-1 is a portable
[191] Fix | Delete
definition for C89, due to the way signed->unsigned
[192] Fix | Delete
conversion is defined. */
[193] Fix | Delete
#ifdef SIZE_MAX
[194] Fix | Delete
#define PY_SIZE_MAX SIZE_MAX
[195] Fix | Delete
#else
[196] Fix | Delete
#define PY_SIZE_MAX ((size_t)-1)
[197] Fix | Delete
#endif
[198] Fix | Delete
[199] Fix | Delete
/* Largest positive value of type Py_ssize_t. */
[200] Fix | Delete
#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))
[201] Fix | Delete
/* Smallest negative value of type Py_ssize_t. */
[202] Fix | Delete
#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)
[203] Fix | Delete
[204] Fix | Delete
#if SIZEOF_PID_T > SIZEOF_LONG
[205] Fix | Delete
# error "Python doesn't support sizeof(pid_t) > sizeof(long)"
[206] Fix | Delete
#endif
[207] Fix | Delete
[208] Fix | Delete
/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
[209] Fix | Delete
* format to convert an argument with the width of a size_t or Py_ssize_t.
[210] Fix | Delete
* C99 introduced "z" for this purpose, but not all platforms support that;
[211] Fix | Delete
* e.g., MS compilers use "I" instead.
[212] Fix | Delete
*
[213] Fix | Delete
* These "high level" Python format functions interpret "z" correctly on
[214] Fix | Delete
* all platforms (Python interprets the format string itself, and does whatever
[215] Fix | Delete
* the platform C requires to convert a size_t/Py_ssize_t argument):
[216] Fix | Delete
*
[217] Fix | Delete
* PyString_FromFormat
[218] Fix | Delete
* PyErr_Format
[219] Fix | Delete
* PyString_FromFormatV
[220] Fix | Delete
*
[221] Fix | Delete
* Lower-level uses require that you interpolate the correct format modifier
[222] Fix | Delete
* yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for
[223] Fix | Delete
* example,
[224] Fix | Delete
*
[225] Fix | Delete
* Py_ssize_t index;
[226] Fix | Delete
* fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index);
[227] Fix | Delete
*
[228] Fix | Delete
* That will expand to %ld, or %Id, or to something else correct for a
[229] Fix | Delete
* Py_ssize_t on the platform.
[230] Fix | Delete
*/
[231] Fix | Delete
#ifndef PY_FORMAT_SIZE_T
[232] Fix | Delete
# if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__)
[233] Fix | Delete
# define PY_FORMAT_SIZE_T ""
[234] Fix | Delete
# elif SIZEOF_SIZE_T == SIZEOF_LONG
[235] Fix | Delete
# define PY_FORMAT_SIZE_T "l"
[236] Fix | Delete
# elif defined(MS_WINDOWS)
[237] Fix | Delete
# define PY_FORMAT_SIZE_T "I"
[238] Fix | Delete
# else
[239] Fix | Delete
# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T"
[240] Fix | Delete
# endif
[241] Fix | Delete
#endif
[242] Fix | Delete
[243] Fix | Delete
/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for
[244] Fix | Delete
* the long long type instead of the size_t type. It's only available
[245] Fix | Delete
* when HAVE_LONG_LONG is defined. The "high level" Python format
[246] Fix | Delete
* functions listed above will interpret "lld" or "llu" correctly on
[247] Fix | Delete
* all platforms.
[248] Fix | Delete
*/
[249] Fix | Delete
#ifdef HAVE_LONG_LONG
[250] Fix | Delete
# ifndef PY_FORMAT_LONG_LONG
[251] Fix | Delete
# if defined(MS_WIN64) || defined(MS_WINDOWS)
[252] Fix | Delete
# define PY_FORMAT_LONG_LONG "I64"
[253] Fix | Delete
# else
[254] Fix | Delete
# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
[255] Fix | Delete
# endif
[256] Fix | Delete
# endif
[257] Fix | Delete
#endif
[258] Fix | Delete
[259] Fix | Delete
/* Py_LOCAL can be used instead of static to get the fastest possible calling
[260] Fix | Delete
* convention for functions that are local to a given module.
[261] Fix | Delete
*
[262] Fix | Delete
* Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining,
[263] Fix | Delete
* for platforms that support that.
[264] Fix | Delete
*
[265] Fix | Delete
* If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more
[266] Fix | Delete
* "aggressive" inlining/optimization is enabled for the entire module. This
[267] Fix | Delete
* may lead to code bloat, and may slow things down for those reasons. It may
[268] Fix | Delete
* also lead to errors, if the code relies on pointer aliasing. Use with
[269] Fix | Delete
* care.
[270] Fix | Delete
*
[271] Fix | Delete
* NOTE: You can only use this for functions that are entirely local to a
[272] Fix | Delete
* module; functions that are exported via method tables, callbacks, etc,
[273] Fix | Delete
* should keep using static.
[274] Fix | Delete
*/
[275] Fix | Delete
[276] Fix | Delete
#undef USE_INLINE /* XXX - set via configure? */
[277] Fix | Delete
[278] Fix | Delete
#if defined(_MSC_VER)
[279] Fix | Delete
#if defined(PY_LOCAL_AGGRESSIVE)
[280] Fix | Delete
/* enable more aggressive optimization for visual studio */
[281] Fix | Delete
#pragma optimize("agtw", on)
[282] Fix | Delete
#endif
[283] Fix | Delete
/* ignore warnings if the compiler decides not to inline a function */
[284] Fix | Delete
#pragma warning(disable: 4710)
[285] Fix | Delete
/* fastest possible local call under MSVC */
[286] Fix | Delete
#define Py_LOCAL(type) static type __fastcall
[287] Fix | Delete
#define Py_LOCAL_INLINE(type) static __inline type __fastcall
[288] Fix | Delete
#elif defined(USE_INLINE)
[289] Fix | Delete
#define Py_LOCAL(type) static type
[290] Fix | Delete
#define Py_LOCAL_INLINE(type) static inline type
[291] Fix | Delete
#else
[292] Fix | Delete
#define Py_LOCAL(type) static type
[293] Fix | Delete
#define Py_LOCAL_INLINE(type) static type
[294] Fix | Delete
#endif
[295] Fix | Delete
[296] Fix | Delete
/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks
[297] Fix | Delete
* are often very short. While most platforms have highly optimized code for
[298] Fix | Delete
* large transfers, the setup costs for memcpy are often quite high. MEMCPY
[299] Fix | Delete
* solves this by doing short copies "in line".
[300] Fix | Delete
*/
[301] Fix | Delete
[302] Fix | Delete
#if defined(_MSC_VER)
[303] Fix | Delete
#define Py_MEMCPY(target, source, length) do { \
[304] Fix | Delete
size_t i_, n_ = (length); \
[305] Fix | Delete
char *t_ = (void*) (target); \
[306] Fix | Delete
const char *s_ = (void*) (source); \
[307] Fix | Delete
if (n_ >= 16) \
[308] Fix | Delete
memcpy(t_, s_, n_); \
[309] Fix | Delete
else \
[310] Fix | Delete
for (i_ = 0; i_ < n_; i_++) \
[311] Fix | Delete
t_[i_] = s_[i_]; \
[312] Fix | Delete
} while (0)
[313] Fix | Delete
#else
[314] Fix | Delete
#define Py_MEMCPY memcpy
[315] Fix | Delete
#endif
[316] Fix | Delete
[317] Fix | Delete
#include <stdlib.h>
[318] Fix | Delete
[319] Fix | Delete
#ifdef HAVE_IEEEFP_H
[320] Fix | Delete
#include <ieeefp.h> /* needed for 'finite' declaration on some platforms */
[321] Fix | Delete
#endif
[322] Fix | Delete
[323] Fix | Delete
#include <math.h> /* Moved here from the math section, before extern "C" */
[324] Fix | Delete
[325] Fix | Delete
/********************************************
[326] Fix | Delete
* WRAPPER FOR <time.h> and/or <sys/time.h> *
[327] Fix | Delete
********************************************/
[328] Fix | Delete
[329] Fix | Delete
#ifdef TIME_WITH_SYS_TIME
[330] Fix | Delete
#include <sys/time.h>
[331] Fix | Delete
#include <time.h>
[332] Fix | Delete
#else /* !TIME_WITH_SYS_TIME */
[333] Fix | Delete
#ifdef HAVE_SYS_TIME_H
[334] Fix | Delete
#include <sys/time.h>
[335] Fix | Delete
#else /* !HAVE_SYS_TIME_H */
[336] Fix | Delete
#include <time.h>
[337] Fix | Delete
#endif /* !HAVE_SYS_TIME_H */
[338] Fix | Delete
#endif /* !TIME_WITH_SYS_TIME */
[339] Fix | Delete
[340] Fix | Delete
[341] Fix | Delete
/******************************
[342] Fix | Delete
* WRAPPER FOR <sys/select.h> *
[343] Fix | Delete
******************************/
[344] Fix | Delete
[345] Fix | Delete
/* NB caller must include <sys/types.h> */
[346] Fix | Delete
[347] Fix | Delete
#ifdef HAVE_SYS_SELECT_H
[348] Fix | Delete
[349] Fix | Delete
#include <sys/select.h>
[350] Fix | Delete
[351] Fix | Delete
#endif /* !HAVE_SYS_SELECT_H */
[352] Fix | Delete
[353] Fix | Delete
/*******************************
[354] Fix | Delete
* stat() and fstat() fiddling *
[355] Fix | Delete
*******************************/
[356] Fix | Delete
[357] Fix | Delete
/* We expect that stat and fstat exist on most systems.
[358] Fix | Delete
* It's confirmed on Unix, Mac and Windows.
[359] Fix | Delete
* If you don't have them, add
[360] Fix | Delete
* #define DONT_HAVE_STAT
[361] Fix | Delete
* and/or
[362] Fix | Delete
* #define DONT_HAVE_FSTAT
[363] Fix | Delete
* to your pyconfig.h. Python code beyond this should check HAVE_STAT and
[364] Fix | Delete
* HAVE_FSTAT instead.
[365] Fix | Delete
* Also
[366] Fix | Delete
* #define HAVE_SYS_STAT_H
[367] Fix | Delete
* if <sys/stat.h> exists on your platform, and
[368] Fix | Delete
* #define HAVE_STAT_H
[369] Fix | Delete
* if <stat.h> does.
[370] Fix | Delete
*/
[371] Fix | Delete
#ifndef DONT_HAVE_STAT
[372] Fix | Delete
#define HAVE_STAT
[373] Fix | Delete
#endif
[374] Fix | Delete
[375] Fix | Delete
#ifndef DONT_HAVE_FSTAT
[376] Fix | Delete
#define HAVE_FSTAT
[377] Fix | Delete
#endif
[378] Fix | Delete
[379] Fix | Delete
#ifdef RISCOS
[380] Fix | Delete
#include <sys/types.h>
[381] Fix | Delete
#include "unixstuff.h"
[382] Fix | Delete
#endif
[383] Fix | Delete
[384] Fix | Delete
#ifdef HAVE_SYS_STAT_H
[385] Fix | Delete
#if defined(PYOS_OS2) && defined(PYCC_GCC)
[386] Fix | Delete
#include <sys/types.h>
[387] Fix | Delete
#endif
[388] Fix | Delete
#include <sys/stat.h>
[389] Fix | Delete
#elif defined(HAVE_STAT_H)
[390] Fix | Delete
#include <stat.h>
[391] Fix | Delete
#endif
[392] Fix | Delete
[393] Fix | Delete
#if defined(PYCC_VACPP)
[394] Fix | Delete
/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
[395] Fix | Delete
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
[396] Fix | Delete
#endif
[397] Fix | Delete
[398] Fix | Delete
#ifndef S_ISREG
[399] Fix | Delete
#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
[400] Fix | Delete
#endif
[401] Fix | Delete
[402] Fix | Delete
#ifndef S_ISDIR
[403] Fix | Delete
#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
[404] Fix | Delete
#endif
[405] Fix | Delete
[406] Fix | Delete
[407] Fix | Delete
#ifdef __cplusplus
[408] Fix | Delete
/* Move this down here since some C++ #include's don't like to be included
[409] Fix | Delete
inside an extern "C" */
[410] Fix | Delete
extern "C" {
[411] Fix | Delete
#endif
[412] Fix | Delete
[413] Fix | Delete
[414] Fix | Delete
/* Py_ARITHMETIC_RIGHT_SHIFT
[415] Fix | Delete
* C doesn't define whether a right-shift of a signed integer sign-extends
[416] Fix | Delete
* or zero-fills. Here a macro to force sign extension:
[417] Fix | Delete
* Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J)
[418] Fix | Delete
* Return I >> J, forcing sign extension. Arithmetically, return the
[419] Fix | Delete
* floor of I/2**J.
[420] Fix | Delete
* Requirements:
[421] Fix | Delete
* I should have signed integer type. In the terminology of C99, this can
[422] Fix | Delete
* be either one of the five standard signed integer types (signed char,
[423] Fix | Delete
* short, int, long, long long) or an extended signed integer type.
[424] Fix | Delete
* J is an integer >= 0 and strictly less than the number of bits in the
[425] Fix | Delete
* type of I (because C doesn't define what happens for J outside that
[426] Fix | Delete
* range either).
[427] Fix | Delete
* TYPE used to specify the type of I, but is now ignored. It's been left
[428] Fix | Delete
* in for backwards compatibility with versions <= 2.6 or 3.0.
[429] Fix | Delete
* Caution:
[430] Fix | Delete
* I may be evaluated more than once.
[431] Fix | Delete
*/
[432] Fix | Delete
#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS
[433] Fix | Delete
#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \
[434] Fix | Delete
((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J))
[435] Fix | Delete
#else
[436] Fix | Delete
#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J))
[437] Fix | Delete
#endif
[438] Fix | Delete
[439] Fix | Delete
/* Py_FORCE_EXPANSION(X)
[440] Fix | Delete
* "Simply" returns its argument. However, macro expansions within the
[441] Fix | Delete
* argument are evaluated. This unfortunate trickery is needed to get
[442] Fix | Delete
* token-pasting to work as desired in some cases.
[443] Fix | Delete
*/
[444] Fix | Delete
#define Py_FORCE_EXPANSION(X) X
[445] Fix | Delete
[446] Fix | Delete
/* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW)
[447] Fix | Delete
* Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this
[448] Fix | Delete
* assert-fails if any information is lost.
[449] Fix | Delete
* Caution:
[450] Fix | Delete
* VALUE may be evaluated more than once.
[451] Fix | Delete
*/
[452] Fix | Delete
#ifdef Py_DEBUG
[453] Fix | Delete
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \
[454] Fix | Delete
(assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
[455] Fix | Delete
#else
[456] Fix | Delete
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
[457] Fix | Delete
#endif
[458] Fix | Delete
[459] Fix | Delete
/* Py_SET_ERRNO_ON_MATH_ERROR(x)
[460] Fix | Delete
* If a libm function did not set errno, but it looks like the result
[461] Fix | Delete
* overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno
[462] Fix | Delete
* to 0 before calling a libm function, and invoke this macro after,
[463] Fix | Delete
* passing the function result.
[464] Fix | Delete
* Caution:
[465] Fix | Delete
* This isn't reliable. See Py_OVERFLOWED comments.
[466] Fix | Delete
* X is evaluated more than once.
[467] Fix | Delete
*/
[468] Fix | Delete
#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64))
[469] Fix | Delete
#define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM;
[470] Fix | Delete
#else
[471] Fix | Delete
#define _Py_SET_EDOM_FOR_NAN(X) ;
[472] Fix | Delete
#endif
[473] Fix | Delete
#define Py_SET_ERRNO_ON_MATH_ERROR(X) \
[474] Fix | Delete
do { \
[475] Fix | Delete
if (errno == 0) { \
[476] Fix | Delete
if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \
[477] Fix | Delete
errno = ERANGE; \
[478] Fix | Delete
else _Py_SET_EDOM_FOR_NAN(X) \
[479] Fix | Delete
} \
[480] Fix | Delete
} while(0)
[481] Fix | Delete
[482] Fix | Delete
/* Py_SET_ERANGE_IF_OVERFLOW(x)
[483] Fix | Delete
* An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility.
[484] Fix | Delete
*/
[485] Fix | Delete
#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X)
[486] Fix | Delete
[487] Fix | Delete
/* Py_ADJUST_ERANGE1(x)
[488] Fix | Delete
* Py_ADJUST_ERANGE2(x, y)
[489] Fix | Delete
* Set errno to 0 before calling a libm function, and invoke one of these
[490] Fix | Delete
* macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful
[491] Fix | Delete
* for functions returning complex results). This makes two kinds of
[492] Fix | Delete
* adjustments to errno: (A) If it looks like the platform libm set
[493] Fix | Delete
* errno=ERANGE due to underflow, clear errno. (B) If it looks like the
[494] Fix | Delete
* platform libm overflowed but didn't set errno, force errno to ERANGE. In
[495] Fix | Delete
* effect, we're trying to force a useful implementation of C89 errno
[496] Fix | Delete
* behavior.
[497] Fix | Delete
* Caution:
[498] Fix | Delete
* This isn't reliable. See Py_OVERFLOWED comments.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function