Annotation of embedaddon/php/ext/date/php_date.h, revision 1.1.1.2
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1997-2012 The PHP Group |
6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.01 of the PHP license, |
8: | that is bundled with this package in the file LICENSE, and is |
9: | available through the world-wide-web at the following url: |
10: | http://www.php.net/license/3_01.txt |
11: | If you did not receive a copy of the PHP license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@php.net so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Authors: Derick Rethans <derick@derickrethans.nl> |
16: +----------------------------------------------------------------------+
17: */
18:
1.1.1.2 ! misho 19: /* $Id$ */
1.1 misho 20:
21: #ifndef PHP_DATE_H
22: #define PHP_DATE_H
23:
24: #include "lib/timelib.h"
25: #include "Zend/zend_hash.h"
26:
27: extern zend_module_entry date_module_entry;
28: #define phpext_date_ptr &date_module_entry
29:
30: PHP_FUNCTION(date);
31: PHP_FUNCTION(idate);
32: PHP_FUNCTION(gmdate);
33: PHP_FUNCTION(strtotime);
34:
35: PHP_FUNCTION(mktime);
36: PHP_FUNCTION(gmmktime);
37:
38: PHP_FUNCTION(checkdate);
39:
40: #ifdef HAVE_STRFTIME
41: PHP_FUNCTION(strftime);
42: PHP_FUNCTION(gmstrftime);
43: #endif
44:
45: PHP_FUNCTION(time);
46: PHP_FUNCTION(localtime);
47: PHP_FUNCTION(getdate);
48:
49: /* Advanced Interface */
50: PHP_METHOD(DateTime, __construct);
51: PHP_METHOD(DateTime, __wakeup);
52: PHP_METHOD(DateTime, __set_state);
53: PHP_FUNCTION(date_create);
54: PHP_FUNCTION(date_create_from_format);
55: PHP_FUNCTION(date_parse);
56: PHP_FUNCTION(date_parse_from_format);
57: PHP_FUNCTION(date_get_last_errors);
58: PHP_FUNCTION(date_format);
59: PHP_FUNCTION(date_modify);
60: PHP_FUNCTION(date_add);
61: PHP_FUNCTION(date_sub);
62: PHP_FUNCTION(date_timezone_get);
63: PHP_FUNCTION(date_timezone_set);
64: PHP_FUNCTION(date_offset_get);
65: PHP_FUNCTION(date_diff);
66:
67: PHP_FUNCTION(date_time_set);
68: PHP_FUNCTION(date_date_set);
69: PHP_FUNCTION(date_isodate_set);
70: PHP_FUNCTION(date_timestamp_set);
71: PHP_FUNCTION(date_timestamp_get);
72:
73: PHP_METHOD(DateTimeZone, __construct);
74: PHP_FUNCTION(timezone_open);
75: PHP_FUNCTION(timezone_name_get);
76: PHP_FUNCTION(timezone_name_from_abbr);
77: PHP_FUNCTION(timezone_offset_get);
78: PHP_FUNCTION(timezone_transitions_get);
79: PHP_FUNCTION(timezone_location_get);
80: PHP_FUNCTION(timezone_identifiers_list);
81: PHP_FUNCTION(timezone_abbreviations_list);
82: PHP_FUNCTION(timezone_version_get);
83:
84: PHP_METHOD(DateInterval, __construct);
85: PHP_METHOD(DateInterval, __wakeup);
86: PHP_METHOD(DateInterval, __set_state);
87: PHP_FUNCTION(date_interval_format);
88: PHP_FUNCTION(date_interval_create_from_date_string);
89:
90: PHP_METHOD(DatePeriod, __construct);
91:
92: /* Options and Configuration */
93: PHP_FUNCTION(date_default_timezone_set);
94: PHP_FUNCTION(date_default_timezone_get);
95:
96: /* Astro functions */
97: PHP_FUNCTION(date_sunrise);
98: PHP_FUNCTION(date_sunset);
99: PHP_FUNCTION(date_sun_info);
100:
101: PHP_RINIT_FUNCTION(date);
102: PHP_RSHUTDOWN_FUNCTION(date);
103: PHP_MINIT_FUNCTION(date);
104: PHP_MSHUTDOWN_FUNCTION(date);
105: PHP_MINFO_FUNCTION(date);
106:
107: typedef struct _php_date_obj php_date_obj;
108: typedef struct _php_timezone_obj php_timezone_obj;
109: typedef struct _php_interval_obj php_interval_obj;
110: typedef struct _php_period_obj php_period_obj;
111:
112: struct _php_date_obj {
113: zend_object std;
114: timelib_time *time;
115: HashTable *props;
116: };
117:
118: struct _php_timezone_obj {
119: zend_object std;
120: int initialized;
121: int type;
122: union {
123: timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
124: timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
125: struct /* TIMELIB_ZONETYPE_ABBR */
126: {
127: timelib_sll utc_offset;
128: char *abbr;
129: int dst;
130: } z;
131: } tzi;
132: };
133:
134: struct _php_interval_obj {
135: zend_object std;
136: timelib_rel_time *diff;
137: HashTable *props;
138: int initialized;
139: };
140:
141: struct _php_period_obj {
142: zend_object std;
143: timelib_time *start;
144: timelib_time *current;
145: timelib_time *end;
146: timelib_rel_time *interval;
147: int recurrences;
148: int initialized;
149: int include_start_date;
150: };
151:
152: ZEND_BEGIN_MODULE_GLOBALS(date)
153: char *default_timezone;
154: char *timezone;
155: HashTable *tzcache;
156: timelib_error_container *last_errors;
157: ZEND_END_MODULE_GLOBALS(date)
158:
159: #ifdef ZTS
160: #define DATEG(v) TSRMG(date_globals_id, zend_date_globals *, v)
161: #else
162: #define DATEG(v) (date_globals.v)
163: #endif
164:
165: /* Backwards compability wrapper */
166: PHPAPI signed long php_parse_date(char *string, signed long *now);
167: PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
1.1.1.2 ! misho 168: PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
1.1 misho 169: #if HAVE_STRFTIME
170: #define _php_strftime php_strftime
171: PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
172: #endif
173: PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
174:
175: /* Mechanism to set new TZ database */
176: PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
177: PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D);
178:
179: /* Grabbing CE's so that other exts can use the date objects too */
180: PHPAPI zend_class_entry *php_date_get_date_ce(void);
181: PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
182:
183: /* Functions for creating DateTime objects, and initializing them from a string */
184: PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
185: PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC);
186:
187:
188: #endif /* PHP_DATE_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>