[Python-checkins] python/dist/src/Include datetime.h,1.3,1.4

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年1月10日 19:39:13 -0800


Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv21453/python/Include
Modified Files:
	datetime.h 
Log Message:
Got rid of the internal datetimetz type.
Index: datetime.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/datetime.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** datetime.h	11 Jan 2003 00:15:53 -0000	1.3
--- datetime.h	11 Jan 2003 03:39:11 -0000	1.4
***************
*** 43,53 ****
 } PyDateTime_TZInfo;
 
- typedef struct
- {
- 	PyObject_HEAD
- 	long hashcode;
- 	unsigned char data[_PyDateTime_DATE_DATASIZE];
- } PyDateTime_Date;
- 
 
 /* The datetime and time types have hashcodes, and an optional tzinfo member,
--- 43,46 ----
***************
*** 89,111 ****
 } PyDateTime_Time;		/* hastzinfo true */
 
- /* XXX The date type will be reworked similarly. */
 
 typedef struct
 {
! 	PyObject_HEAD
! 	long hashcode;
 	unsigned char data[_PyDateTime_DATETIME_DATASIZE];
- } PyDateTime_DateTime;
 
 typedef struct
 {
! 	PyObject_HEAD
! 	long hashcode;
! 	unsigned char data[_PyDateTime_DATETIME_DATASIZE];
 	PyObject *tzinfo;
! } PyDateTime_DateTimeTZ;
 
 
! /* Apply for date, datetime, and datetimetz instances. */
 #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
 ((PyDateTime_Date*)o)->data[1])
--- 82,114 ----
 } PyDateTime_Time;		/* hastzinfo true */
 
 
+ /* All datetime objects are of PyDateTime_DateTimeType, but that can be
+ * allocated in two ways too, just like for time objects above. In addition,
+ * the plain date type is a base class for datetime, so it must also have
+ * a hastzinfo member (although it's unused there).
+ */
 typedef struct
 {
! 	_PyTZINFO_HEAD
! 	unsigned char data[_PyDateTime_DATE_DATASIZE];
! } PyDateTime_Date;
! 
! #define _PyDateTime_DATETIMEHEAD	\
! 	_PyTZINFO_HEAD			\
 	unsigned char data[_PyDateTime_DATETIME_DATASIZE];
 
 typedef struct
 {
! 	_PyDateTime_DATETIMEHEAD
! } _PyDateTime_BaseDateTime;	/* hastzinfo false */
! 
! typedef struct
! {
! 	_PyDateTime_DATETIMEHEAD
 	PyObject *tzinfo;
! } PyDateTime_DateTime;		/* hastzinfo true */
 
 
! /* Apply for date and datetime instances. */
 #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
 ((PyDateTime_Date*)o)->data[1])
***************
*** 135,141 ****
 #define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
 #define PyDateTime_CheckExact(op) ((op)->ob_type == &PyDateTime_DateTimeType)
- 
- #define PyDateTimeTZ_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeTZType)
- #define PyDateTimeTZ_CheckExact(op) ((op)->ob_type == &PyDateTime_DateTimeTZType)
 
 #define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
--- 138,141 ----

AltStyle によって変換されたページ (->オリジナル) /