andrei Tue Sep 13 16:24:06 2005 EDT Modified files: /php-src README.UNICODE-UPGRADES Log: http://cvs.php.net/diff.php/php-src/README.UNICODE-UPGRADES?r1=1.1&r2=1.2&ty=u Index: php-src/README.UNICODE-UPGRADES diff -u php-src/README.UNICODE-UPGRADES:1.1 php-src/README.UNICODE-UPGRADES:1.2 --- php-src/README.UNICODE-UPGRADES:1.1 Tue Sep 13 12:21:47 2005 +++ php-src/README.UNICODE-UPGRADES Tue Sep 13 16:24:02 2005 @@ -114,6 +114,29 @@ full listing (add_*_ascii_string_*, add_*_rt_string_*, add_*_unicode_*, add_*_binary_*). +UBYTES() macro can be used to obtain the number of bytes necessary to store +the given number of UChar's. The typical usage is: + + char *constant_name = colon + (UG(unicode)?UBYTES(2):2); + + +Memory Allocation +----------------- + +For ease of use and to reduce possible bugs, there are memory allocation +functions specific to Unicode strings. Please use them at all times when +allocating UChar's. + + eumalloc(size) + eurealloc(ptr, size) + eustrndup(s, length) + eustrdup(s) + + peumalloc(size, persistent) + peurealloc(ptr, size, persistent) + +The size parameter refers to the number of UChar's, not bytes. + Hashes ------ @@ -135,6 +158,22 @@ version. It returns the key as a char* pointer, you can can cast it appropriately based on the key type. +Identifiers and Class Entries +----------------------------- + +In Unicode mode all the identifiers are Unicode strings. This means that +while various structures such as zend_class_entry, zend_function, etc store +the identifier name as a char* pointer, it will actually point to UChar* +string. Be careful when accessing the names of classes, functions, and such +-- always check UG(unicode) before using them. + +In addition, zend_class_entry has a u_twin field that points to its Unicode +counterpart in UG(unicode) mode. Use U_CLASS_ENTRY() macro to access the +correct class entry, e.g.: + + ce = U_CLASS_ENTRY(default_exception_ce); + + References ==========
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php