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 4:01PM messages near this date
[PHP-CVS] cvs: php-src /ext/unicode php_property.h property.c unicode.c | [PHP-CVS] cvs: php-src /ext/unicode php_property.h property.c unicode.c
andrei		Mon May  8 23:01:20 2006 UTC

  Modified files:              
    /php-src/ext/unicode	php_property.h property.c unicode.c 
  Log:
  Been a long day..
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/php_property.h?r1=1.6&r2=1.7&diff_format=
u
Index: php-src/ext/unicode/php_property.h
diff -u php-src/ext/unicode/php_property.h:1.6 php-src/ext/unicode/php_property.h:1.7
--- php-src/ext/unicode/php_property.h:1.6	Mon May  8 22:23:57 2006
+++ php-src/ext/unicode/php_property.h	Mon May  8 23:01:20 2006
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_property.h,v 1.6 2006/05/08 22:23:57 andrei Exp $ */ 
+/* $Id: php_property.h,v 1.7 2006/05/08 23:01:20 andrei Exp $ */ 
 
 #ifndef PHP_PROPERTY_H
 #define PHP_PROPERTY_H
@@ -80,6 +80,8 @@
 PHP_FUNCTION(char_get_property_max_value);
 PHP_FUNCTION(char_get_property_name);
 PHP_FUNCTION(char_get_property_from_name);
+PHP_FUNCTION(char_get_property_value_name);
+PHP_FUNCTION(char_get_property_value_from_name);
 
 #endif /* PHP_PROPERTY_H */
 
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/property.c?r1=1.10&r2=1.11&diff_format=u
Index: php-src/ext/unicode/property.c
diff -u php-src/ext/unicode/property.c:1.10 php-src/ext/unicode/property.c:1.11
--- php-src/ext/unicode/property.c:1.10	Mon May  8 22:23:57 2006
+++ php-src/ext/unicode/property.c	Mon May  8 23:01:20 2006
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: property.c,v 1.10 2006/05/08 22:23:57 andrei Exp $ */ 
+/* $Id: property.c,v 1.11 2006/05/08 23:01:20 andrei Exp $ */ 
 
 #include "php_unicode.h"
 
@@ -548,7 +548,6 @@
 	} else {
 		RETURN_FALSE;
 	}
-
 }
 
 PHP_FUNCTION(char_get_property_from_name)
@@ -581,6 +580,60 @@
 	RETURN_LONG(prop);
 }
 
+PHP_FUNCTION(char_get_property_value_name)
+{
+	long 		 prop;
+	long		 value;
+	long		 name_choice = U_LONG_PROPERTY_NAME;
+	const char	*name;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|l", &prop, &value, &name_choice) 
== FAILURE) {
+		return;
+	}
+
+	if (name_choice < 0) {
+		name_choice = U_LONG_PROPERTY_NAME;
+	}
+
+	name = u_getPropertyValueName((UProperty) prop, (int32_t) value, (UPropertyNameChoice) nam
e_choice);
+	if (name) {
+		RETURN_ASCII_STRING((char *)name, ZSTR_DUPLICATE);
+	} else {
+		RETURN_FALSE;
+	}
+}
+
+PHP_FUNCTION(char_get_property_value_from_name)
+{
+	long		prop;
+	void	   *name;
+	int			name_len;
+	zend_uchar	name_type;
+	char	   *buf;
+	long		value;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lt", &prop, &name, &name_len, &name_
type) == FAILURE) {
+		return;
+	}
+
+	if (name_type == IS_UNICODE) {
+		buf = zend_unicode_to_ascii(name, name_len TSRMLS_CC);
+		if (buf == NULL) {
+			php_error(E_WARNING, "Property value name has to consist only of ASCII characters");
+			RETURN_FALSE;
+		}
+	} else {
+		buf = (char *) name;
+	}
+
+	value = u_getPropertyValueEnum((UProperty)prop, buf);
+	if (name_type == IS_UNICODE) {
+		efree(buf);
+	}
+
+	RETURN_LONG(value);
+}
+
 /* }}} */
 
 /*
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/unicode.c?r1=1.31&r2=1.32&diff_format=u
Index: php-src/ext/unicode/unicode.c
diff -u php-src/ext/unicode/unicode.c:1.31 php-src/ext/unicode/unicode.c:1.32
--- php-src/ext/unicode/unicode.c:1.31	Mon May  8 22:23:57 2006
+++ php-src/ext/unicode/unicode.c	Mon May  8 23:01:20 2006
@@ -15,7 +15,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: unicode.c,v 1.31 2006/05/08 22:23:57 andrei Exp $ */ 
+/* $Id: unicode.c,v 1.32 2006/05/08 23:01:20 andrei Exp $ */ 
 
 #include "php_unicode.h"
 #include "zend_unicode.h"
@@ -292,6 +292,8 @@
 	PHP_FE(char_get_property_max_value, NULL)
 	PHP_FE(char_get_property_name, 		NULL)
 	PHP_FE(char_get_property_from_name,	NULL)
+	PHP_FE(char_get_property_value_name, NULL)
+	PHP_FE(char_get_property_value_from_name, 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