]> granicus.if.org Git - php/commitdiff
- MFH: Export DateTime and DateTimeZone class entries so that external
authorDerick Rethans <derick@php.net>
Thu, 6 Nov 2008 09:45:58 +0000 (09:45 +0000)
committerDerick Rethans <derick@php.net>
Thu, 6 Nov 2008 09:45:58 +0000 (09:45 +0000)
  extensions can make use of it as well.

ext/date/lib/parse_date.c
ext/date/php_date.c
ext/date/php_date.h

index 1d2c78192050532a9c70e6632c508efaa61214f4..8a2f34a2471acdcbb8850f033b262b8bf326313c 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Wed Nov  5 11:30:55 2008 */
+/* Generated by re2c 0.13.5 on Wed Nov  5 11:44:09 2008 */
 #line 1 "ext/date/lib/parse_date.re"
 /*
    +----------------------------------------------------------------------+
index 3772c0bbfb8cbcb0ed0c3f92a664a2d29d66ea48..a1cdb224d43034b070fbfd929a9f604046bb5991 100644 (file)
@@ -556,55 +556,22 @@ PHP_INI_END()
 
 zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;
 
+
+PHPAPI zend_class_entry *php_date_get_date_ce(void)
+{
+       return date_ce_date;
+}
+
+PHPAPI zend_class_entry *php_date_get_timezone_ce(void)
+{
+       return date_ce_timezone;
+}
+
 static zend_object_handlers date_object_handlers_date;
 static zend_object_handlers date_object_handlers_timezone;
 static zend_object_handlers date_object_handlers_interval;
 static zend_object_handlers date_object_handlers_period;
 
-typedef struct _php_date_obj php_date_obj;
-typedef struct _php_timezone_obj php_timezone_obj;
-typedef struct _php_interval_obj php_interval_obj;
-typedef struct _php_period_obj php_period_obj;
-
-struct _php_date_obj {
-       zend_object   std;
-       timelib_time *time;
-       HashTable    *props;
-};
-
-struct _php_timezone_obj {
-       zend_object     std;
-       int             initialized;
-       int             type;
-       union {
-               timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
-               timelib_sll     utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
-               struct                      /* TIMELIB_ZONETYPE_ABBR */
-               {
-                       timelib_sll  utc_offset;
-                       char        *abbr;
-                       int          dst;
-               } z;
-       } tzi;
-};
-
-struct _php_interval_obj {
-       zend_object       std;
-       timelib_rel_time *diff;
-       HashTable        *props;
-       int               initialized;
-};
-
-struct _php_period_obj {
-       zend_object       std;
-       timelib_time     *start;
-       timelib_time     *end;
-       timelib_rel_time *interval;
-       int               recurrences;
-       int               initialized;
-       int               include_start_date;
-};
-
 #define DATE_SET_CONTEXT \
        zval *object; \
        object = getThis(); \
@@ -2609,7 +2576,7 @@ PHP_METHOD(DateTime, __wakeup)
 /* }}} */
 
 /* Helper function used to add an associative array of warnings and errors to a zval */
-void zval_from_error_container(zval *z, timelib_error_container *error)
+static void zval_from_error_container(zval *z, timelib_error_container *error)
 {
        int   i;
        zval *element;
index 9c063bd62a33ef89059540e70f58b2e6134b4c92..caa792f06d0766f51697f1a0a5217fd293135816 100644 (file)
@@ -101,6 +101,50 @@ PHP_MINIT_FUNCTION(date);
 PHP_MSHUTDOWN_FUNCTION(date);
 PHP_MINFO_FUNCTION(date);
 
+typedef struct _php_date_obj php_date_obj;
+typedef struct _php_timezone_obj php_timezone_obj;
+typedef struct _php_interval_obj php_interval_obj;
+typedef struct _php_period_obj php_period_obj;
+
+struct _php_date_obj {
+       zend_object   std;
+       timelib_time *time;
+       HashTable    *props;
+};
+
+struct _php_timezone_obj {
+       zend_object     std;
+       int             initialized;
+       int             type;
+       union {
+               timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
+               timelib_sll     utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
+               struct                      /* TIMELIB_ZONETYPE_ABBR */
+               {
+                       timelib_sll  utc_offset;
+                       char        *abbr;
+                       int          dst;
+               } z;
+       } tzi;
+};
+
+struct _php_interval_obj {
+       zend_object       std;
+       timelib_rel_time *diff;
+       HashTable        *props;
+       int               initialized;
+};
+
+struct _php_period_obj {
+       zend_object       std;
+       timelib_time     *start;
+       timelib_time     *end;
+       timelib_rel_time *interval;
+       int               recurrences;
+       int               initialized;
+       int               include_start_date;
+};
+
 ZEND_BEGIN_MODULE_GLOBALS(date)
        char      *default_timezone;
        char      *timezone;
@@ -128,4 +172,8 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
 PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
 PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D);
 
+/* Grabbing CE's so that other exts can use the date objects too */
+PHPAPI zend_class_entry *php_date_get_date_ce(void);
+PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
+
 #endif /* PHP_DATE_H */