andrei Sun Mar 26 21:23:00 2006 UTC Modified files: /php-src/ext/unicode unicode.c Log: Add unicode_get_error_mode() and unicode_get_subst_char(). http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/unicode.c?r1=1.16&r2=1.17&diff_format=u Index: php-src/ext/unicode/unicode.c diff -u php-src/ext/unicode/unicode.c:1.16 php-src/ext/unicode/unicode.c:1.17 --- php-src/ext/unicode/unicode.c:1.16 Sun Mar 26 11:06:24 2006 +++ php-src/ext/unicode/unicode.c Sun Mar 26 21:22:59 2006 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: unicode.c,v 1.16 2006/03/26 11:06:24 derick Exp $ */ +/* $Id: unicode.c,v 1.17 2006/03/26 21:22:59 andrei Exp $ */ #include "php_unicode.h" #if HAVE_UNICODE @@ -174,6 +174,43 @@ zend_update_converters_error_behavior(TSRMLS_C); RETURN_TRUE; } +/* }}} */ + +/* {{{ proto int unicode_get_error_mode(int direction) U + Returns global conversion error mode for the specified conversion direction */ +PHP_FUNCTION(unicode_get_error_mode) +{ + zend_conv_direction direction; + long tmp; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tmp) == FAILURE) { + return; + } + direction = (zend_conv_direction) tmp; + + if (direction == ZEND_FROM_UNICODE) { + RETURN_LONG(UG(from_error_mode)); + } else if (direction == ZEND_TO_UNICODE) { + RETURN_LONG(UG(to_error_mode)); + } else { + php_error(E_WARNING, "Invalid conversion direction value"); + RETURN_FALSE; + } +} +/* }}} */ + +/* {{{ proto string unicode_get_subst_char() U + Returns global substitution character for conversion from Unicode to codepage */ +PHP_FUNCTION(unicode_get_subst_char) +{ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; + } + + RETURN_UNICODE(UG(from_subst_char), 1); +} +/* }}} */ + /* {{{ unicode_functions[] */ zend_function_entry unicode_functions[] = { @@ -184,6 +221,8 @@ PHP_FE(unicode_encode, NULL) PHP_FE(unicode_set_error_mode, NULL) PHP_FE(unicode_set_subst_char, NULL) + PHP_FE(unicode_get_error_mode, NULL) + PHP_FE(unicode_get_subst_char, NULL) PHP_FE(collator_create, NULL) PHP_FE(collator_compare, NULL) { NULL, NULL, NULL }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php