andrei          Wed May  3 22:03:10 2006 UTC

  Modified files:              
    /php-src/ext/unicode        php_property.h property.c unicode.c 
  Log:
  Some more property functions.
  
  # I am pondering a different prefix..
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/php_property.h?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/unicode/php_property.h
diff -u php-src/ext/unicode/php_property.h:1.1 
php-src/ext/unicode/php_property.h:1.2
--- php-src/ext/unicode/php_property.h:1.1      Wed May  3 06:36:53 2006
+++ php-src/ext/unicode/php_property.h  Wed May  3 22:03:10 2006
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_property.h,v 1.1 2006/05/03 06:36:53 andrei Exp $ */ 
+/* $Id: php_property.h,v 1.2 2006/05/03 22:03:10 andrei Exp $ */ 
 
 #ifndef PHP_PROPERTY_H
 #define PHP_PROPERTY_H
@@ -53,6 +53,17 @@
 PHP_FUNCTION(unicode_is_u_uppercase);
 PHP_FUNCTION(unicode_is_u_lowercase);
 
+/*
+ * Single character property functions.
+ */
+
+PHP_FUNCTION(unicode_get_numeric_value);
+PHP_FUNCTION(unicode_get_combining_class);
+PHP_FUNCTION(unicode_get_digit_value);
+PHP_FUNCTION(unicode_get_mirror);
+PHP_FUNCTION(unicode_get_direction);
+PHP_FUNCTION(unicode_get_char_type);
+PHP_FUNCTION(unicode_is_char_valid);
 
 #endif /* PHP_PROPERTY_H */
 
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/property.c?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/unicode/property.c
diff -u php-src/ext/unicode/property.c:1.4 php-src/ext/unicode/property.c:1.5
--- php-src/ext/unicode/property.c:1.4  Tue May  2 22:43:52 2006
+++ php-src/ext/unicode/property.c      Wed May  3 22:03:10 2006
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: property.c,v 1.4 2006/05/02 22:43:52 andrei Exp $ */ 
+/* $Id: property.c,v 1.5 2006/05/03 22:03:10 andrei Exp $ */ 
 
 #include "php_unicode.h"
 
@@ -109,9 +109,7 @@
 
 /* }}} */
 
-/*
- * Additional binary property functions
- */
+/* {{{ Additional binary property functions */
 
 PHP_FUNCTION(unicode_is_title)
 {
@@ -178,6 +176,146 @@
        check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isULowercase);
 }
 
+/* }}} */
+
+/* {{{ Single character properties */
+
+PHP_FUNCTION(unicode_get_numeric_value)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0;
+       UChar32         ch;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+
+       RETURN_DOUBLE(u_getNumericValue(ch));
+}
+
+PHP_FUNCTION(unicode_get_combining_class)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0;
+       UChar32         ch;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+
+       RETURN_LONG((long)u_getCombiningClass(ch));
+}
+
+PHP_FUNCTION(unicode_get_digit_value)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0;
+       UChar32         ch;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+
+       RETURN_LONG(u_charDigitValue(ch));
+}
+
+PHP_FUNCTION(unicode_get_mirror)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0, buf_len;
+       UChar32         ch;
+       UChar       buf[3];
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+       buf_len = zend_codepoint_to_uchar(u_charMirror(ch), buf);
+
+       RETURN_UNICODEL(buf, buf_len, 1);
+}
+
+PHP_FUNCTION(unicode_get_direction)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0;
+       UChar32         ch;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+
+       RETURN_LONG((long)u_charDirection(ch));
+}
+
+PHP_FUNCTION(unicode_get_char_type)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0;
+       UChar32         ch;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+
+       RETURN_LONG(u_charType(ch));
+}
+
+PHP_FUNCTION(unicode_is_char_valid)
+{
+       UChar      *str;
+       int                     str_len;
+       int                     offset = 0;
+       UChar32         ch;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, 
&str_len) == FAILURE) {
+               return;
+       }
+
+       if (str_len == 0) {
+               RETURN_FALSE;
+       }
+       U16_NEXT(str, offset, str_len, ch);
+
+       RETURN_BOOL(U_IS_UNICODE_CHAR(ch));
+}
+
+/* }}} */
 
 /*
  * Local variables:
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/unicode.c?r1=1.25&r2=1.26&diff_format=u
Index: php-src/ext/unicode/unicode.c
diff -u php-src/ext/unicode/unicode.c:1.25 php-src/ext/unicode/unicode.c:1.26
--- php-src/ext/unicode/unicode.c:1.25  Tue May  2 22:43:52 2006
+++ php-src/ext/unicode/unicode.c       Wed May  3 22:03:10 2006
@@ -15,7 +15,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: unicode.c,v 1.25 2006/05/02 22:43:52 andrei Exp $ */ 
+/* $Id: unicode.c,v 1.26 2006/05/03 22:03:10 andrei Exp $ */ 
 
 #include "php_unicode.h"
 #include "zend_unicode.h"
@@ -276,6 +276,14 @@
        PHP_FE(unicode_is_u_uppercase,  NULL)
        PHP_FE(unicode_is_u_lowercase,  NULL)
 
+       PHP_FE(unicode_get_numeric_value,       NULL)
+       PHP_FE(unicode_get_combining_class, NULL)
+       PHP_FE(unicode_get_digit_value,         NULL)
+       PHP_FE(unicode_get_mirror,                      NULL)
+       PHP_FE(unicode_get_direction,           NULL)
+       PHP_FE(unicode_get_char_type,           NULL)
+       PHP_FE(unicode_is_char_valid,           NULL)
+
        { NULL, NULL, NULL }
 };
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to