Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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