ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-cvs
php-cvs
[PHP-CVS] cvs: php-src /ext/unicode php_property.h property.c unicode.c
by Andrei Zmievski other posts by this author
May 8 2006 2:54PM messages near this date
[PHP-CVS] cvs: php-src /ext/unicode property.c | [PHP-CVS] cvs: php-src /ext/unicode php_property.h property.c unicode.c
andrei		Mon May  8 21:54:44 2006 UTC

  Modified files:              
    /php-src/ext/unicode	php_property.h property.c unicode.c 
  Log:
  A few more property functinos.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/php_property.h?r1=1.4&r2=1.5&diff_format=
u
Index: php-src/ext/unicode/php_property.h
diff -u php-src/ext/unicode/php_property.h:1.4 php-src/ext/unicode/php_property.h:1.5
--- php-src/ext/unicode/php_property.h:1.4	Thu May  4 18:37:12 2006
+++ php-src/ext/unicode/php_property.h	Mon May  8 21:54:44 2006
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_property.h,v 1.4 2006/05/04 18:37:12 andrei Exp $ */ 
+/* $Id: php_property.h,v 1.5 2006/05/08 21:54:44 andrei Exp $ */ 
 
 #ifndef PHP_PROPERTY_H
 #define PHP_PROPERTY_H
@@ -69,11 +69,16 @@
  * Other functions
  */
 
-PHP_FUNCTION(char_to_digit);
 PHP_FUNCTION(char_from_digit);
 PHP_FUNCTION(char_from_name);
 PHP_FUNCTION(char_get_name);
 
+PHP_FUNCTION(char_has_binary_property);
+PHP_FUNCTION(char_get_property_value);
+PHP_FUNCTION(char_get_property_value);
+PHP_FUNCTION(char_get_property_min_value);
+PHP_FUNCTION(char_get_property_max_value);
+
 #endif /* PHP_PROPERTY_H */
 
 
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/property.c?r1=1.8&r2=1.9&diff_format=u
Index: php-src/ext/unicode/property.c
diff -u php-src/ext/unicode/property.c:1.8 php-src/ext/unicode/property.c:1.9
--- php-src/ext/unicode/property.c:1.8	Thu May  4 21:22:30 2006
+++ php-src/ext/unicode/property.c	Mon May  8 21:54:44 2006
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: property.c,v 1.8 2006/05/04 21:22:30 andrei Exp $ */ 
+/* $Id: property.c,v 1.9 2006/05/08 21:54:44 andrei Exp $ */ 
 
 #include "php_unicode.h"
 
@@ -442,6 +442,84 @@
 
 /* }}} */
 
+/* {{{ Other property functions */
+
+PHP_FUNCTION(char_has_binary_property)
+{
+	UChar 		*str = NULL;
+	int    		 str_len;
+	long   		 prop;
+	UProperty	 uprop; 
+	int			 offset = 0;
+	zend_bool	 result = 1;
+	UChar32		 ch;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ul", &str, &str_len, &prop) == FAILU
RE) {
+		return;
+	}
+
+	if (str_len == 0) {
+		RETURN_FALSE;
+	}
+
+	uprop = (UProperty)prop;
+
+	while (offset < str_len && result) {
+		U16_NEXT(str, offset, str_len, ch);
+		result = u_hasBinaryProperty(ch, uprop);
+	}
+
+	RETURN_BOOL(result);
+}
+
+PHP_FUNCTION(char_get_property_value)
+{
+	UChar	   *str;
+	int			str_len;
+	int			offset = 0;
+	UChar32		ch;
+	long		prop;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ul", &str, &str_len, &prop) == FAILU
RE) {
+		return;
+	}
+
+	if (str_len == 0) {
+		RETURN_FALSE;
+	}
+
+	U16_NEXT(str, offset, str_len, ch);
+
+	if (prop > = UCHAR_BINARY_START && prop < UCHAR_BINARY_LIMIT) {
+		RETURN_BOOL((zend_bool)u_getIntPropertyValue(ch, (UProperty)prop));
+	} else {
+		RETURN_LONG(u_getIntPropertyValue(ch, (UProperty)prop));
+	}
+}
+
+PHP_FUNCTION(char_get_property_min_value)
+{
+	long prop;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &prop) == FAILURE) {
+		return;
+	}
+	
+	RETURN_LONG(u_getIntPropertyMinValue((UProperty)prop));
+}
+
+PHP_FUNCTION(char_get_property_max_value)
+{
+	long prop;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &prop) == FAILURE) {
+		return;
+	}
+	
+	RETURN_LONG(u_getIntPropertyMaxValue((UProperty)prop));
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/unicode.c?r1=1.29&r2=1.30&diff_format=u
Index: php-src/ext/unicode/unicode.c
diff -u php-src/ext/unicode/unicode.c:1.29 php-src/ext/unicode/unicode.c:1.30
--- php-src/ext/unicode/unicode.c:1.29	Fri May  5 20:56:21 2006
+++ php-src/ext/unicode/unicode.c	Mon May  8 21:54:44 2006
@@ -15,7 +15,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: unicode.c,v 1.29 2006/05/05 20:56:21 andrei Exp $ */ 
+/* $Id: unicode.c,v 1.30 2006/05/08 21:54:44 andrei Exp $ */ 
 
 #include "php_unicode.h"
 #include "zend_unicode.h"
@@ -283,9 +283,13 @@
 	PHP_FE(char_get_type,	 			NULL)
 	PHP_FE(char_is_valid, 				NULL)
 
-	PHP_FE(char_from_digit, NULL)
-	PHP_FE(char_from_name, NULL)
-	PHP_FE(char_get_name, NULL)
+	PHP_FE(char_from_digit, 			NULL)
+	PHP_FE(char_from_name, 				NULL)
+	PHP_FE(char_get_name, 				NULL)
+	PHP_FE(char_has_binary_property, 	NULL)
+	PHP_FE(char_get_property_value, 	NULL)
+	PHP_FE(char_get_property_min_value, NULL)
+	PHP_FE(char_get_property_max_value, NULL)
 
 	{ NULL, NULL, NULL }
 };

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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved