Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 220 lines (173 sloc) 9.993 kB
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
8775a37 @felipensp - Year++
felipensp authored
5 | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
6 +----------------------------------------------------------------------+
d863d52 Update headers.
Sebastian Bergmann authored
7 | This source file is subject to version 2.00 of the Zend license, |
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
d863d52 Update headers.
Sebastian Bergmann authored
10 | http://www.zend.com/license/2_00.txt. |
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Author: Zeev Suraski <zeev@zend.com> |
16 +----------------------------------------------------------------------+
17 */
18
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
19 /* $Id$ */
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
20
21 #ifndef ZEND_INI_H
22 #define ZEND_INI_H
23
24 #define ZEND_INI_USER (1<<0)
25 #define ZEND_INI_PERDIR (1<<1)
26 #define ZEND_INI_SYSTEM (1<<2)
27
28 #define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
29
31775e9 @zsuraski Add missing #define's
zsuraski authored
30 #ifndef XtOffsetOf
31 # if defined(CRAY) || (defined(__arm) && !defined(LINUX))
32 # ifdef __STDC__
4f6c95d @zsuraski Whitespace
zsuraski authored
33 # define XtOffset(p_type, field) _Offsetof(p_type, field)
31775e9 @zsuraski Add missing #define's
zsuraski authored
34 # else
35 # ifdef CRAY2
4f6c95d @zsuraski Whitespace
zsuraski authored
36 # define XtOffset(p_type, field) \
31775e9 @zsuraski Add missing #define's
zsuraski authored
37 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
38
39 # else /* !CRAY2 */
40
4f6c95d @zsuraski Whitespace
zsuraski authored
41 # define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
31775e9 @zsuraski Add missing #define's
zsuraski authored
42
43 # endif /* !CRAY2 */
44 # endif /* __STDC__ */
45 # else /* ! (CRAY || __arm) */
46
4f6c95d @zsuraski Whitespace
zsuraski authored
47 # define XtOffset(p_type, field) \
31775e9 @zsuraski Add missing #define's
zsuraski authored
48 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
49
50 # endif /* !CRAY */
51
52 # ifdef offsetof
4f6c95d @zsuraski Whitespace
zsuraski authored
53 # define XtOffsetOf(s_type, field) offsetof(s_type, field)
31775e9 @zsuraski Add missing #define's
zsuraski authored
54 # else
4f6c95d @zsuraski Whitespace
zsuraski authored
55 # define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
31775e9 @zsuraski Add missing #define's
zsuraski authored
56 # endif
57
58 #endif
59
13c2254 partially revert previous commit and
Harald Radi authored
60 #define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
61 #define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
62
63 struct _zend_ini_entry {
64 int module_number;
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
65 int modifiable;
13c2254 partially revert previous commit and
Harald Radi authored
66 char *name;
67 uint name_length;
68 ZEND_INI_MH((*on_modify));
69 void *mh_arg1;
70 void *mh_arg2;
71 void *mh_arg3;
72
73 char *value;
74 uint value_length;
75
76 char *orig_value;
77 uint orig_value_length;
5ea77bc MFB: Fixed bug #43677 (Inconsistent behaviour of include_path set with
Ilia Alshanetsky authored
78 int orig_modifiable;
13c2254 partially revert previous commit and
Harald Radi authored
79 int modified;
80
81 void (*displayer)(zend_ini_entry *ini_entry, int type);
82 };
83
6a1d011 Silence some compile warnings
foobar authored
84 BEGIN_EXTERN_C()
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
85 ZEND_API int zend_ini_startup(TSRMLS_D);
86 ZEND_API int zend_ini_shutdown(TSRMLS_D);
424e98f @zsuraski Implemented compatibility mode
zsuraski authored
87 ZEND_API int zend_ini_global_shutdown(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
88 ZEND_API int zend_ini_deactivate(TSRMLS_D);
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
89
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
90 ZEND_API int zend_copy_ini_directives(TSRMLS_D);
54d5305 @zsuraski Make the INI mechanism thread safe (or at least thread safer :)
zsuraski authored
91
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
92 ZEND_API void zend_ini_sort_entries(TSRMLS_D);
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
93
6c810b0 Improved memory usage by movig constants to read only memory. (Dmitry…
Dmitry Stogov authored
94 ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
0b7fdbb @zsuraski More TSRMLS_FETCH work
zsuraski authored
95 ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored
96 ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
2a528a1 - No need to break binary compatibility here
Jani Taskinen authored
97 ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
338a12a MFH: Nuked unnecessary TSRMLS_FETCH() call
Jani Taskinen authored
98 ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC);
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
99 ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
100 ZEND_API void display_ini_entries(zend_module_entry *module);
101
102 ZEND_API long zend_ini_long(char *name, uint name_length, int orig);
103 ZEND_API double zend_ini_double(char *name, uint name_length, int orig);
104 ZEND_API char *zend_ini_string(char *name, uint name_length, int orig);
43e7784 Add zend_ini_string_ex so that the you can differentiate between NULL…
Scott MacVicar authored
105 ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists);
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
106
107 ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
dfe57b0 @zsuraski Remove unnecessary code, fix phpinfo()
zsuraski authored
108
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
109 ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb);
110 ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
111 ZEND_API ZEND_INI_DISP(display_link_numbers);
6a1d011 Silence some compile warnings
foobar authored
112 END_EXTERN_C()
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
113
6c810b0 Improved memory usage by movig constants to read only memory. (Dmitry…
Dmitry Stogov authored
114 #define ZEND_INI_BEGIN() static const zend_ini_entry ini_entries[] = {
5ea77bc MFB: Fixed bug #43677 (Inconsistent behaviour of include_path set with
Ilia Alshanetsky authored
115 #define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, NULL } };
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
116
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
117 #define ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, displayer) \
5ea77bc MFB: Fixed bug #43677 (Inconsistent behaviour of include_path set with
Ilia Alshanetsky authored
118 { 0, modifiable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer },
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
119
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
120 #define ZEND_INI_ENTRY3(name, default_value, modifiable, on_modify, arg1, arg2, arg3) \
121 ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, NULL)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
122
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
123 #define ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, arg1, arg2, displayer) \
124 ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL, displayer)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
125
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
126 #define ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, arg1, arg2) \
127 ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
128
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
129 #define ZEND_INI_ENTRY1_EX(name, default_value, modifiable, on_modify, arg1, displayer) \
130 ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, NULL, NULL, displayer)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
131
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
132 #define ZEND_INI_ENTRY1(name, default_value, modifiable, on_modify, arg1) \
133 ZEND_INI_ENTRY1_EX(name, default_value, modifiable, on_modify, arg1, NULL)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
134
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
135 #define ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, displayer) \
136 ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, NULL, NULL, NULL, displayer)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
137
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
138 #define ZEND_INI_ENTRY(name, default_value, modifiable, on_modify) \
139 ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, NULL)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
140
141 #ifdef ZTS
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
142 #define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
143 ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
144 #define STD_ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr, displayer) \
145 ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
146 #define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
147 ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
148 #else
67502a2 @andigutmans - modifyable -> modifiable
andigutmans authored
149 #define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
150 ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
151 #define STD_ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr, displayer) \
152 ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
153 #define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
154 ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
155 #endif
156
157 #define INI_INT(name) zend_ini_long((name), sizeof(name), 0)
158 #define INI_FLT(name) zend_ini_double((name), sizeof(name), 0)
43e7784 Add zend_ini_string_ex so that the you can differentiate between NULL…
Scott MacVicar authored
159 #define INI_STR(name) zend_ini_string_ex((name), sizeof(name), 0, NULL)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
160 #define INI_BOOL(name) ((zend_bool) INI_INT(name))
161
162 #define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name), 1)
163 #define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name), 1)
164 #define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name), 1)
165 #define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
166
e8ac55d @zsuraski More TSRMLS_FETCH work
zsuraski authored
167 #define REGISTER_INI_ENTRIES() zend_register_ini_entries(ini_entries, module_number TSRMLS_CC)
0b7fdbb @zsuraski More TSRMLS_FETCH work
zsuraski authored
168 #define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries(module_number TSRMLS_CC)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
169 #define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
170
171 #define REGISTER_INI_DISPLAYER(name, displayer) zend_ini_register_displayer((name), sizeof(name), displayer)
172 #define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, zend_ini_boolean_displayer_cb)
173
174 /* Standard message handlers */
6a1d011 Silence some compile warnings
foobar authored
175 BEGIN_EXTERN_C()
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
176 ZEND_API ZEND_INI_MH(OnUpdateBool);
3c9155e Renamed OnUpdateInt -> OnUpdateLong to prevent further misunderstandi…
foobar authored
177 ZEND_API ZEND_INI_MH(OnUpdateLong);
b85f134 Ensure that OnUpdateLongGEZero is greater or equal to 0.
Ilia Alshanetsky authored
178 ZEND_API ZEND_INI_MH(OnUpdateLongGEZero);
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
179 ZEND_API ZEND_INI_MH(OnUpdateReal);
180 ZEND_API ZEND_INI_MH(OnUpdateString);
181 ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
6a1d011 Silence some compile warnings
foobar authored
182 END_EXTERN_C()
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
183
184 #define ZEND_INI_DISPLAY_ORIG 1
185 #define ZEND_INI_DISPLAY_ACTIVE 2
186
187 #define ZEND_INI_STAGE_STARTUP (1<<0)
188 #define ZEND_INI_STAGE_SHUTDOWN (1<<1)
189 #define ZEND_INI_STAGE_ACTIVATE (1<<2)
190 #define ZEND_INI_STAGE_DEACTIVATE (1<<3)
191 #define ZEND_INI_STAGE_RUNTIME (1<<4)
0ad8523 @smalyshev add stage for .htaccess
smalyshev authored
192 #define ZEND_INI_STAGE_HTACCESS (1<<5)
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
193
6b4c369 @zsuraski Generalization work
zsuraski authored
194 /* INI parsing engine */
09b6f37 MFH:
Jani Taskinen authored
195 typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC);
6a1d011 Silence some compile warnings
foobar authored
196 BEGIN_EXTERN_C()
09b6f37 MFH:
Jani Taskinen authored
197 ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC);
198 ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg TSRMLS_DC);
6a1d011 Silence some compile warnings
foobar authored
199 END_EXTERN_C()
ef498a2 @wez linkage for C++
wez authored
200
09b6f37 MFH:
Jani Taskinen authored
201 /* INI entries */
202 #define ZEND_INI_PARSER_ENTRY 1 /* Normal entry: foo = bar */
203 #define ZEND_INI_PARSER_SECTION 2 /* Section: [foobar] */
204 #define ZEND_INI_PARSER_POP_ENTRY 3 /* Offset entry: foo[] = bar */
6b4c369 @zsuraski Generalization work
zsuraski authored
205
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
206 typedef struct _zend_ini_parser_param {
207 zend_ini_parser_cb_t ini_parser_cb;
208 void *arg;
209 } zend_ini_parser_param;
210
1fd0913 @zsuraski Initial steps to move the INI mechanism to the Zend engine
zsuraski authored
211 #endif /* ZEND_INI_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
212
213 /*
214 * Local variables:
215 * tab-width: 4
216 * c-basic-offset: 4
217 * indent-tabs-mode: t
218 * End:
219 */
Something went wrong with that request. Please try again.