cvs: ZendEngine2 / zend_API.c zend_API.h
| From: | Andrei Zmievski | Date: | Tue, 17 Oct 2006 17:56:42 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.c zend_API.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5331@lists.php.net to get a copy of this message | ||
andrei Tue Oct 17 17:56:42 2006 UTC
Modified files:
/ZendEngine2 zend_API.c zend_API.h
Log:
Implement add_utf8_property_* API.
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.411&r2=1.412&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.411 ZendEngine2/zend_API.c:1.412
--- ZendEngine2/zend_API.c:1.411 Fri Oct 13 14:52:19 2006
+++ ZendEngine2/zend_API.c Tue Oct 17 17:56:42 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.411 2006/10/13 14:52:19 andrei Exp $ */
+/* $Id: zend_API.c,v 1.412 2006/10/17 17:56:42 andrei Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -1709,6 +1709,18 @@
return SUCCESS;
}
+ZEND_API int add_utf8_property_zval_ex(zval *arg, char *key, uint key_len, zval *value)
+{
+ zval *z_key;
+
+ MAKE_STD_ZVAL(z_key);
+ ZVAL_UTF8_STRINGL(z_key, key, key_len-1, ZSTR_DUPLICATE);
+
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value TSRMLS_CC);
+ zval_ptr_dtor(&z_key);
+ return SUCCESS;
+}
+
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC)
{
int name_len;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.262&r2=1.263&diff_format=u
Index: ZendEngine2/zend_API.h
diff -u ZendEngine2/zend_API.h:1.262 ZendEngine2/zend_API.h:1.263
--- ZendEngine2/zend_API.h:1.262 Wed Oct 11 18:37:31 2006
+++ ZendEngine2/zend_API.h Tue Oct 17 17:56:42 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.h,v 1.262 2006/10/11 18:37:31 andrei Exp $ */
+/* $Id: zend_API.h,v 1.263 2006/10/17 17:56:42 andrei Exp $ */
#ifndef ZEND_API_H
#define ZEND_API_H
@@ -897,6 +897,132 @@
#define add_utf8_assoc_text(__arg, __key, __str, __duplicate) add_utf8_assoc_test_ex(__arg, __key,
strlen(__key)+1, __str, __duplicate)
#define add_utf8_assoc_textl(__arg, __key, __str, __length, __duplicate)
add_utf8_assoc_textl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
+ZEND_API int add_utf8_property_zval_ex(zval *arg, char *key, uint key_len, zval *value);
+
+#define add_utf8_property_null_ex(arg, key, key_len) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_NULL(___tmp); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_long_ex(arg, key, key_len, n) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_LONG(___tmp, n); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_bool_ex(arg, key, key_len, b) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_BOOL(___tmp, b); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_resource_ex(arg, key, key_len, r) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_RESOURCE(___tmp, r); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_double_ex(arg, key, key_len, d) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_DOUBLE(___tmp, d); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_stringl_ex(arg, key, key_len, str, length, duplicate) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_STRINGL(___tmp, str, length, duplicate); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_unicode_ex(arg, key, key_len, str, duplicate) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_UNICODE(___tmp, str, duplicate); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_unicodel_ex(arg, key, key_len, str, length, duplicate) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_UNICODEL(___tmp, str, length, duplicate); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_zstr_ex(arg, key, key_len, type, str, duplicate) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_ZSTR(___tmp, str, type, duplicate); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \
+ zval *___tmp; \
+ MAKE_STD_ZVAL(___tmp); \
+ ZVAL_ZSTRL(___tmp, str, length, type, duplicate); \
+ add_utf8_property_zval_ex(arg, key, key_len, ___tmp); \
+ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
+ } while (0)
+#define add_utf8_property_text_ex(arg, key, key_len, str, duplicate) do { \
+ if (UG(unicode)) { \
+ add_utf8_property_unicode_ex(arg, key, key_len, (str).u, duplicate); \
+ } else { \
+ add_utf8_property_string_ex(arg, key, key_len, (str).s, duplicate); \
+ } \
+ } while (0)
+#define add_utf8_property_textl_ex(arg, key, key_len, str, length, duplicate) do { \
+ if (UG(unicode)) { \
+ add_utf8_property_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
+ } else { \
+ add_utf8_property_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
+ } \
+ } while (0)
+
+#define add_utf8_property_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \
+ if (UG(unicode)) { \
+ UChar *___u_str = zend_ascii_to_unicode((str), (length)+1 ZEND_FILE_LINE_CC); \
+ if ((flags) & ZSTR_AUTOFREE) { \
+ efree(str); \
+ } \
+ add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, length, 0); \
+ } else { \
+ add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) &
ZSTR_DUPLICATE); \
+ } \
+ } while (0)
+#define add_utf8_property_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \
+ if (UG(unicode)) { \
+ UErrorCode ___status = U_ZERO_ERROR; \
+ UChar *___u_str; \
+ int ___u_len; \
+ zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str,
&___u_len, str, length, &___status); \
+ if ((flags) & ZSTR_AUTOFREE) { \
+ efree(str); \
+ } \
+ add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
+ } else { \
+ add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) &
ZSTR_DUPLICATE); \
+ } \
+ } while (0)
+#define add_utf8_property_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \
+ if (UG(unicode)) { \
+ UErrorCode ___status = U_ZERO_ERROR; \
+ UChar *___u_str; \
+ int ___u_len; \
+ zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length,
&___status); \
+ if ((flags) & ZSTR_AUTOFREE) { \
+ efree(str); \
+ } \
+ add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
+ } else { \
+ add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) &
ZSTR_DUPLICATE); \
+ } \
+ } while (0)
ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_len, zval *value);