Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/python2....
File: datetime.h
/* datetime.h
[0] Fix | Delete
*/
[1] Fix | Delete
[2] Fix | Delete
#ifndef DATETIME_H
[3] Fix | Delete
#define DATETIME_H
[4] Fix | Delete
#ifdef __cplusplus
[5] Fix | Delete
extern "C" {
[6] Fix | Delete
#endif
[7] Fix | Delete
[8] Fix | Delete
/* Fields are packed into successive bytes, each viewed as unsigned and
[9] Fix | Delete
* big-endian, unless otherwise noted:
[10] Fix | Delete
*
[11] Fix | Delete
* byte offset
[12] Fix | Delete
* 0 year 2 bytes, 1-9999
[13] Fix | Delete
* 2 month 1 byte, 1-12
[14] Fix | Delete
* 3 day 1 byte, 1-31
[15] Fix | Delete
* 4 hour 1 byte, 0-23
[16] Fix | Delete
* 5 minute 1 byte, 0-59
[17] Fix | Delete
* 6 second 1 byte, 0-59
[18] Fix | Delete
* 7 usecond 3 bytes, 0-999999
[19] Fix | Delete
* 10
[20] Fix | Delete
*/
[21] Fix | Delete
[22] Fix | Delete
/* # of bytes for year, month, and day. */
[23] Fix | Delete
#define _PyDateTime_DATE_DATASIZE 4
[24] Fix | Delete
[25] Fix | Delete
/* # of bytes for hour, minute, second, and usecond. */
[26] Fix | Delete
#define _PyDateTime_TIME_DATASIZE 6
[27] Fix | Delete
[28] Fix | Delete
/* # of bytes for year, month, day, hour, minute, second, and usecond. */
[29] Fix | Delete
#define _PyDateTime_DATETIME_DATASIZE 10
[30] Fix | Delete
[31] Fix | Delete
[32] Fix | Delete
typedef struct
[33] Fix | Delete
{
[34] Fix | Delete
PyObject_HEAD
[35] Fix | Delete
long hashcode; /* -1 when unknown */
[36] Fix | Delete
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
[37] Fix | Delete
int seconds; /* 0 <= seconds < 24*3600 is invariant */
[38] Fix | Delete
int microseconds; /* 0 <= microseconds < 1000000 is invariant */
[39] Fix | Delete
} PyDateTime_Delta;
[40] Fix | Delete
[41] Fix | Delete
typedef struct
[42] Fix | Delete
{
[43] Fix | Delete
PyObject_HEAD /* a pure abstract base class */
[44] Fix | Delete
} PyDateTime_TZInfo;
[45] Fix | Delete
[46] Fix | Delete
[47] Fix | Delete
/* The datetime and time types have hashcodes, and an optional tzinfo member,
[48] Fix | Delete
* present if and only if hastzinfo is true.
[49] Fix | Delete
*/
[50] Fix | Delete
#define _PyTZINFO_HEAD \
[51] Fix | Delete
PyObject_HEAD \
[52] Fix | Delete
long hashcode; \
[53] Fix | Delete
char hastzinfo; /* boolean flag */
[54] Fix | Delete
[55] Fix | Delete
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
[56] Fix | Delete
* convenient to cast to, when getting at the hastzinfo member of objects
[57] Fix | Delete
* starting with _PyTZINFO_HEAD.
[58] Fix | Delete
*/
[59] Fix | Delete
typedef struct
[60] Fix | Delete
{
[61] Fix | Delete
_PyTZINFO_HEAD
[62] Fix | Delete
} _PyDateTime_BaseTZInfo;
[63] Fix | Delete
[64] Fix | Delete
/* All time objects are of PyDateTime_TimeType, but that can be allocated
[65] Fix | Delete
* in two ways, with or without a tzinfo member. Without is the same as
[66] Fix | Delete
* tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an
[67] Fix | Delete
* internal struct used to allocate the right amount of space for the
[68] Fix | Delete
* "without" case.
[69] Fix | Delete
*/
[70] Fix | Delete
#define _PyDateTime_TIMEHEAD \
[71] Fix | Delete
_PyTZINFO_HEAD \
[72] Fix | Delete
unsigned char data[_PyDateTime_TIME_DATASIZE];
[73] Fix | Delete
[74] Fix | Delete
typedef struct
[75] Fix | Delete
{
[76] Fix | Delete
_PyDateTime_TIMEHEAD
[77] Fix | Delete
} _PyDateTime_BaseTime; /* hastzinfo false */
[78] Fix | Delete
[79] Fix | Delete
typedef struct
[80] Fix | Delete
{
[81] Fix | Delete
_PyDateTime_TIMEHEAD
[82] Fix | Delete
PyObject *tzinfo;
[83] Fix | Delete
} PyDateTime_Time; /* hastzinfo true */
[84] Fix | Delete
[85] Fix | Delete
[86] Fix | Delete
/* All datetime objects are of PyDateTime_DateTimeType, but that can be
[87] Fix | Delete
* allocated in two ways too, just like for time objects above. In addition,
[88] Fix | Delete
* the plain date type is a base class for datetime, so it must also have
[89] Fix | Delete
* a hastzinfo member (although it's unused there).
[90] Fix | Delete
*/
[91] Fix | Delete
typedef struct
[92] Fix | Delete
{
[93] Fix | Delete
_PyTZINFO_HEAD
[94] Fix | Delete
unsigned char data[_PyDateTime_DATE_DATASIZE];
[95] Fix | Delete
} PyDateTime_Date;
[96] Fix | Delete
[97] Fix | Delete
#define _PyDateTime_DATETIMEHEAD \
[98] Fix | Delete
_PyTZINFO_HEAD \
[99] Fix | Delete
unsigned char data[_PyDateTime_DATETIME_DATASIZE];
[100] Fix | Delete
[101] Fix | Delete
typedef struct
[102] Fix | Delete
{
[103] Fix | Delete
_PyDateTime_DATETIMEHEAD
[104] Fix | Delete
} _PyDateTime_BaseDateTime; /* hastzinfo false */
[105] Fix | Delete
[106] Fix | Delete
typedef struct
[107] Fix | Delete
{
[108] Fix | Delete
_PyDateTime_DATETIMEHEAD
[109] Fix | Delete
PyObject *tzinfo;
[110] Fix | Delete
} PyDateTime_DateTime; /* hastzinfo true */
[111] Fix | Delete
[112] Fix | Delete
[113] Fix | Delete
/* Apply for date and datetime instances. */
[114] Fix | Delete
#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
[115] Fix | Delete
((PyDateTime_Date*)o)->data[1])
[116] Fix | Delete
#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2])
[117] Fix | Delete
#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3])
[118] Fix | Delete
[119] Fix | Delete
#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4])
[120] Fix | Delete
#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5])
[121] Fix | Delete
#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6])
[122] Fix | Delete
#define PyDateTime_DATE_GET_MICROSECOND(o) \
[123] Fix | Delete
((((PyDateTime_DateTime*)o)->data[7] << 16) | \
[124] Fix | Delete
(((PyDateTime_DateTime*)o)->data[8] << 8) | \
[125] Fix | Delete
((PyDateTime_DateTime*)o)->data[9])
[126] Fix | Delete
[127] Fix | Delete
/* Apply for time instances. */
[128] Fix | Delete
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
[129] Fix | Delete
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
[130] Fix | Delete
#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
[131] Fix | Delete
#define PyDateTime_TIME_GET_MICROSECOND(o) \
[132] Fix | Delete
((((PyDateTime_Time*)o)->data[3] << 16) | \
[133] Fix | Delete
(((PyDateTime_Time*)o)->data[4] << 8) | \
[134] Fix | Delete
((PyDateTime_Time*)o)->data[5])
[135] Fix | Delete
[136] Fix | Delete
[137] Fix | Delete
/* Define structure for C API. */
[138] Fix | Delete
typedef struct {
[139] Fix | Delete
/* type objects */
[140] Fix | Delete
PyTypeObject *DateType;
[141] Fix | Delete
PyTypeObject *DateTimeType;
[142] Fix | Delete
PyTypeObject *TimeType;
[143] Fix | Delete
PyTypeObject *DeltaType;
[144] Fix | Delete
PyTypeObject *TZInfoType;
[145] Fix | Delete
[146] Fix | Delete
/* constructors */
[147] Fix | Delete
PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
[148] Fix | Delete
PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
[149] Fix | Delete
PyObject*, PyTypeObject*);
[150] Fix | Delete
PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
[151] Fix | Delete
PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
[152] Fix | Delete
[153] Fix | Delete
/* constructors for the DB API */
[154] Fix | Delete
PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*);
[155] Fix | Delete
PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*);
[156] Fix | Delete
[157] Fix | Delete
} PyDateTime_CAPI;
[158] Fix | Delete
[159] Fix | Delete
#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
[160] Fix | Delete
[161] Fix | Delete
[162] Fix | Delete
/* "magic" constant used to partially protect against developer mistakes. */
[163] Fix | Delete
#define DATETIME_API_MAGIC 0x414548d5
[164] Fix | Delete
[165] Fix | Delete
#ifdef Py_BUILD_CORE
[166] Fix | Delete
[167] Fix | Delete
/* Macros for type checking when building the Python core. */
[168] Fix | Delete
#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType)
[169] Fix | Delete
#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType)
[170] Fix | Delete
[171] Fix | Delete
#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
[172] Fix | Delete
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType)
[173] Fix | Delete
[174] Fix | Delete
#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
[175] Fix | Delete
#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType)
[176] Fix | Delete
[177] Fix | Delete
#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
[178] Fix | Delete
#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType)
[179] Fix | Delete
[180] Fix | Delete
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
[181] Fix | Delete
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType)
[182] Fix | Delete
[183] Fix | Delete
#else
[184] Fix | Delete
[185] Fix | Delete
/* Define global variable for the C API and a macro for setting it. */
[186] Fix | Delete
static PyDateTime_CAPI *PyDateTimeAPI = NULL;
[187] Fix | Delete
[188] Fix | Delete
#define PyDateTime_IMPORT \
[189] Fix | Delete
PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
[190] Fix | Delete
[191] Fix | Delete
/* Macros for type checking when not building the Python core. */
[192] Fix | Delete
#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
[193] Fix | Delete
#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType)
[194] Fix | Delete
[195] Fix | Delete
#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
[196] Fix | Delete
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType)
[197] Fix | Delete
[198] Fix | Delete
#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
[199] Fix | Delete
#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType)
[200] Fix | Delete
[201] Fix | Delete
#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
[202] Fix | Delete
#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType)
[203] Fix | Delete
[204] Fix | Delete
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
[205] Fix | Delete
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType)
[206] Fix | Delete
[207] Fix | Delete
/* Macros for accessing constructors in a simplified fashion. */
[208] Fix | Delete
#define PyDate_FromDate(year, month, day) \
[209] Fix | Delete
PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
[210] Fix | Delete
[211] Fix | Delete
#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
[212] Fix | Delete
PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
[213] Fix | Delete
min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
[214] Fix | Delete
[215] Fix | Delete
#define PyTime_FromTime(hour, minute, second, usecond) \
[216] Fix | Delete
PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
[217] Fix | Delete
Py_None, PyDateTimeAPI->TimeType)
[218] Fix | Delete
[219] Fix | Delete
#define PyDelta_FromDSU(days, seconds, useconds) \
[220] Fix | Delete
PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
[221] Fix | Delete
PyDateTimeAPI->DeltaType)
[222] Fix | Delete
[223] Fix | Delete
/* Macros supporting the DB API. */
[224] Fix | Delete
#define PyDateTime_FromTimestamp(args) \
[225] Fix | Delete
PyDateTimeAPI->DateTime_FromTimestamp( \
[226] Fix | Delete
(PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
[227] Fix | Delete
[228] Fix | Delete
#define PyDate_FromTimestamp(args) \
[229] Fix | Delete
PyDateTimeAPI->Date_FromTimestamp( \
[230] Fix | Delete
(PyObject*) (PyDateTimeAPI->DateType), args)
[231] Fix | Delete
[232] Fix | Delete
#endif /* Py_BUILD_CORE */
[233] Fix | Delete
[234] Fix | Delete
#ifdef __cplusplus
[235] Fix | Delete
}
[236] Fix | Delete
#endif
[237] Fix | Delete
#endif
[238] Fix | Delete
[239] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function