2005-08-11 23:36:07 +00:00
|
|
|
/*
|
2005-08-12 09:10:04 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| PHP Version 6 |
|
2005-08-11 23:36:07 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 13:10:10 +00:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
2005-08-11 23:36:07 +00:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 13:10:10 +00:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
2005-08-11 23:36:07 +00:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Andrei Zmievski <andrei@php.net> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2005-08-12 09:10:04 +00:00
|
|
|
/* $Id$ */
|
2005-08-11 23:36:07 +00:00
|
|
|
|
|
|
|
#ifndef PHP_UNICODE_H
|
|
|
|
#define PHP_UNICODE_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <php.h>
|
|
|
|
|
|
|
|
#include <php_ini.h>
|
|
|
|
#include <SAPI.h>
|
|
|
|
#include <ext/standard/info.h>
|
|
|
|
|
|
|
|
extern zend_module_entry unicode_module_entry;
|
|
|
|
#define phpext_unicode_ptr &unicode_module_entry
|
|
|
|
|
|
|
|
#ifdef PHP_WIN32
|
2008-01-30 09:56:22 +00:00
|
|
|
# define PHP_UNICODE_API __declspec(dllexport)
|
|
|
|
#elif defined(__GNUC__) && __GNUC__ >= 4
|
|
|
|
# define PHP_UNICODE_API __attribute__ ((visibility("default")))
|
2005-08-11 23:36:07 +00:00
|
|
|
#else
|
2008-01-30 09:56:22 +00:00
|
|
|
# define PHP_UNICODE_API
|
2005-08-11 23:36:07 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
PHP_MINIT_FUNCTION(unicode);
|
|
|
|
PHP_MSHUTDOWN_FUNCTION(unicode);
|
|
|
|
PHP_RINIT_FUNCTION(unicode);
|
|
|
|
PHP_RSHUTDOWN_FUNCTION(unicode);
|
|
|
|
PHP_MINFO_FUNCTION(unicode);
|
|
|
|
|
|
|
|
#ifdef ZTS
|
|
|
|
#include "TSRM.h"
|
|
|
|
#endif
|
|
|
|
|
2006-05-04 16:49:33 +00:00
|
|
|
/*
|
|
|
|
* Because of ICU they are expanded to have _<version> suffix
|
2006-05-05 20:56:21 +00:00
|
|
|
* We don't want that.
|
2006-05-04 16:49:33 +00:00
|
|
|
*/
|
|
|
|
#undef locale_get_default
|
|
|
|
#undef locale_set_default
|
|
|
|
|
2006-04-21 19:35:26 +00:00
|
|
|
PHP_FUNCTION(locale_get_default);
|
|
|
|
PHP_FUNCTION(locale_set_default);
|
- Implemented basic collation support. For some reason "new Collator" gives segfaults when the object's collation resource is used.
- The following example shows what is implemented:
<?php
$orig = $strings = array(
'côte',
'cote',
'côté',
'coté',
'fluÃe',
'flüÃe',
);
echo "German phonebook:\n";
$c = collator_create( "de@collation=phonebook" );
foreach($c->sort($strings) as $string) {
echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
? "With" : "Without", " french accent sorting order\n";
echo "\nFrench with options:\n";
$c = collator_create( "fr" );
$c->setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
$c->setAttribute(Collator::CASE_LEVEL, Collator::ON);
$c->setStrength(Collator::SECONDARY);
foreach($c->sort($strings) as $string) {
echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
? "With" : "Without", " french accent sorting order\n";
?>
2006-03-26 11:06:24 +00:00
|
|
|
PHP_FUNCTION(collator_create);
|
|
|
|
PHP_FUNCTION(collator_compare);
|
|
|
|
PHP_FUNCTION(collator_sort);
|
|
|
|
PHP_FUNCTION(collator_set_strength);
|
|
|
|
PHP_FUNCTION(collator_set_attribute);
|
|
|
|
PHP_FUNCTION(collator_get_strength);
|
|
|
|
PHP_FUNCTION(collator_get_attribute);
|
2006-04-21 21:10:01 +00:00
|
|
|
PHP_FUNCTION(collator_get_default);
|
|
|
|
PHP_FUNCTION(collator_set_default);
|
- Implemented basic collation support. For some reason "new Collator" gives segfaults when the object's collation resource is used.
- The following example shows what is implemented:
<?php
$orig = $strings = array(
'côte',
'cote',
'côté',
'coté',
'fluÃe',
'flüÃe',
);
echo "German phonebook:\n";
$c = collator_create( "de@collation=phonebook" );
foreach($c->sort($strings) as $string) {
echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
? "With" : "Without", " french accent sorting order\n";
echo "\nFrench with options:\n";
$c = collator_create( "fr" );
$c->setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
$c->setAttribute(Collator::CASE_LEVEL, Collator::ON);
$c->setStrength(Collator::SECONDARY);
foreach($c->sort($strings) as $string) {
echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
? "With" : "Without", " french accent sorting order\n";
?>
2006-03-26 11:06:24 +00:00
|
|
|
PHP_METHOD(collator, __construct);
|
|
|
|
|
|
|
|
void php_init_collation(TSRMLS_D);
|
2006-05-05 20:56:21 +00:00
|
|
|
void php_register_unicode_constants(TSRMLS_D);
|
|
|
|
|
|
|
|
PHPAPI zend_class_entry *u_const_ce;
|
2005-08-11 23:36:07 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <zend_unicode.h>
|
|
|
|
|
|
|
|
#endif /* PHP_UNICODE_H */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
* vim600: noet sw=4 ts=4 fdm=marker
|
|
|
|
* vim<600: noet sw=4 ts=4
|
|
|
|
*/
|