mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ext/intl: update from C to C++ step2. (#19294)
This commit is contained in:
parent
c5143c0b22
commit
140fc69b4a
13 changed files with 87 additions and 41 deletions
|
@ -36,14 +36,6 @@ if test "$PHP_INTL" != "no"; then
|
||||||
intl_convert.c
|
intl_convert.c
|
||||||
intl_error.c
|
intl_error.c
|
||||||
listformatter/listformatter_class.c
|
listformatter/listformatter_class.c
|
||||||
msgformat/msgformat_attr.c
|
|
||||||
msgformat/msgformat_class.c
|
|
||||||
msgformat/msgformat_data.c
|
|
||||||
msgformat/msgformat_format.c
|
|
||||||
msgformat/msgformat_parse.c
|
|
||||||
msgformat/msgformat.c
|
|
||||||
normalizer/normalizer_class.c
|
|
||||||
normalizer/normalizer_normalize.c
|
|
||||||
php_intl.c
|
php_intl.c
|
||||||
resourcebundle/resourcebundle_class.c
|
resourcebundle/resourcebundle_class.c
|
||||||
resourcebundle/resourcebundle_iterator.c
|
resourcebundle/resourcebundle_iterator.c
|
||||||
|
@ -73,6 +65,14 @@ if test "$PHP_INTL" != "no"; then
|
||||||
calendar/calendar_class.cpp \
|
calendar/calendar_class.cpp \
|
||||||
calendar/calendar_methods.cpp \
|
calendar/calendar_methods.cpp \
|
||||||
calendar/gregoriancalendar_methods.cpp \
|
calendar/gregoriancalendar_methods.cpp \
|
||||||
|
msgformat/msgformat_attr.cpp \
|
||||||
|
msgformat/msgformat_class.cpp \
|
||||||
|
msgformat/msgformat_data.cpp \
|
||||||
|
msgformat/msgformat_format.cpp \
|
||||||
|
msgformat/msgformat_parse.cpp \
|
||||||
|
msgformat/msgformat.cpp \
|
||||||
|
normalizer/normalizer_class.cpp \
|
||||||
|
normalizer/normalizer_normalize.cpp \
|
||||||
breakiterator/breakiterator_class.cpp \
|
breakiterator/breakiterator_class.cpp \
|
||||||
breakiterator/breakiterator_iterators.cpp \
|
breakiterator/breakiterator_iterators.cpp \
|
||||||
breakiterator/breakiterator_methods.cpp \
|
breakiterator/breakiterator_methods.cpp \
|
||||||
|
|
|
@ -48,20 +48,20 @@ if (PHP_INTL != "no") {
|
||||||
locale_methods.cpp \
|
locale_methods.cpp \
|
||||||
", "intl");
|
", "intl");
|
||||||
ADD_SOURCES(configure_module_dirname + "/msgformat", "\
|
ADD_SOURCES(configure_module_dirname + "/msgformat", "\
|
||||||
msgformat.c \
|
msgformat.cpp \
|
||||||
msgformat_attr.c \
|
msgformat_attr.cpp \
|
||||||
msgformat_class.c \
|
msgformat_class.cpp \
|
||||||
msgformat_data.c \
|
msgformat_data.cpp \
|
||||||
msgformat_format.c \
|
msgformat_format.cpp \
|
||||||
msgformat_helpers.cpp \
|
msgformat_helpers.cpp \
|
||||||
msgformat_parse.c \
|
msgformat_parse.cpp \
|
||||||
", "intl");
|
", "intl");
|
||||||
ADD_SOURCES(configure_module_dirname + "/grapheme", "\
|
ADD_SOURCES(configure_module_dirname + "/grapheme", "\
|
||||||
grapheme_string.c grapheme_util.c \
|
grapheme_string.c grapheme_util.c \
|
||||||
", "intl");
|
", "intl");
|
||||||
ADD_SOURCES(configure_module_dirname + "/normalizer", "\
|
ADD_SOURCES(configure_module_dirname + "/normalizer", "\
|
||||||
normalizer_class.c \
|
normalizer_class.cpp \
|
||||||
normalizer_normalize.c \
|
normalizer_normalize.cpp \
|
||||||
", "intl");
|
", "intl");
|
||||||
ADD_SOURCES(configure_module_dirname + "/dateformat", "\
|
ADD_SOURCES(configure_module_dirname + "/dateformat", "\
|
||||||
dateformat.c \
|
dateformat.c \
|
||||||
|
|
|
@ -936,7 +936,7 @@ static int handleAppendResult( int result, smart_str* loc_name)
|
||||||
* }}} */
|
* }}} */
|
||||||
U_CFUNC PHP_FUNCTION(locale_compose)
|
U_CFUNC PHP_FUNCTION(locale_compose)
|
||||||
{
|
{
|
||||||
smart_str loc_name_s = {0};
|
smart_str loc_name_s = {NULL, 0};
|
||||||
smart_str *loc_name = &loc_name_s;
|
smart_str *loc_name = &loc_name_s;
|
||||||
zval* arr = NULL;
|
zval* arr = NULL;
|
||||||
HashTable* hash_arr = NULL;
|
HashTable* hash_arr = NULL;
|
||||||
|
|
|
@ -19,10 +19,12 @@
|
||||||
#include <unicode/ustring.h>
|
#include <unicode/ustring.h>
|
||||||
#include <unicode/umsg.h>
|
#include <unicode/umsg.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
#include "msgformat_class.h"
|
#include "msgformat_class.h"
|
||||||
#include "msgformat_data.h"
|
#include "msgformat_data.h"
|
||||||
#include "intl_convert.h"
|
#include "intl_convert.h"
|
||||||
|
}
|
||||||
|
|
||||||
/* {{{ */
|
/* {{{ */
|
||||||
static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||||
|
@ -99,7 +101,7 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Create formatter. */
|
/* {{{ Create formatter. */
|
||||||
PHP_FUNCTION( msgfmt_create )
|
U_CFUNC PHP_FUNCTION( msgfmt_create )
|
||||||
{
|
{
|
||||||
object_init_ex( return_value, MessageFormatter_ce_ptr );
|
object_init_ex( return_value, MessageFormatter_ce_ptr );
|
||||||
if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
|
if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
|
||||||
|
@ -110,7 +112,7 @@ PHP_FUNCTION( msgfmt_create )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ MessageFormatter object constructor. */
|
/* {{{ MessageFormatter object constructor. */
|
||||||
PHP_METHOD( MessageFormatter, __construct )
|
U_CFUNC PHP_METHOD( MessageFormatter, __construct )
|
||||||
{
|
{
|
||||||
const bool old_use_exception = INTL_G(use_exceptions);
|
const bool old_use_exception = INTL_G(use_exceptions);
|
||||||
const zend_long old_error_level = INTL_G(error_level);
|
const zend_long old_error_level = INTL_G(error_level);
|
||||||
|
@ -127,7 +129,7 @@ PHP_METHOD( MessageFormatter, __construct )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Get formatter's last error code. */
|
/* {{{ Get formatter's last error code. */
|
||||||
PHP_FUNCTION( msgfmt_get_error_code )
|
U_CFUNC PHP_FUNCTION( msgfmt_get_error_code )
|
||||||
{
|
{
|
||||||
zval* object = NULL;
|
zval* object = NULL;
|
||||||
MessageFormatter_object* mfo = NULL;
|
MessageFormatter_object* mfo = NULL;
|
||||||
|
@ -147,7 +149,7 @@ PHP_FUNCTION( msgfmt_get_error_code )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Get text description for formatter's last error code. */
|
/* {{{ Get text description for formatter's last error code. */
|
||||||
PHP_FUNCTION( msgfmt_get_error_message )
|
U_CFUNC PHP_FUNCTION( msgfmt_get_error_message )
|
||||||
{
|
{
|
||||||
zend_string* message = NULL;
|
zend_string* message = NULL;
|
||||||
zval* object = NULL;
|
zval* object = NULL;
|
|
@ -16,15 +16,17 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
#include "msgformat_class.h"
|
#include "msgformat_class.h"
|
||||||
#include "msgformat_data.h"
|
#include "msgformat_data.h"
|
||||||
#include "intl_convert.h"
|
#include "intl_convert.h"
|
||||||
|
}
|
||||||
|
|
||||||
#include <unicode/ustring.h>
|
#include <unicode/ustring.h>
|
||||||
|
|
||||||
/* {{{ Get formatter pattern. */
|
/* {{{ Get formatter pattern. */
|
||||||
PHP_FUNCTION( msgfmt_get_pattern )
|
U_CFUNC PHP_FUNCTION( msgfmt_get_pattern )
|
||||||
{
|
{
|
||||||
MSG_FORMAT_METHOD_INIT_VARS;
|
MSG_FORMAT_METHOD_INIT_VARS;
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ PHP_FUNCTION( msgfmt_get_pattern )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Set formatter pattern. */
|
/* {{{ Set formatter pattern. */
|
||||||
PHP_FUNCTION( msgfmt_set_pattern )
|
U_CFUNC PHP_FUNCTION( msgfmt_set_pattern )
|
||||||
{
|
{
|
||||||
char* value = NULL;
|
char* value = NULL;
|
||||||
size_t value_len = 0;
|
size_t value_len = 0;
|
||||||
|
@ -105,7 +107,7 @@ PHP_FUNCTION( msgfmt_set_pattern )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Get formatter locale. */
|
/* {{{ Get formatter locale. */
|
||||||
PHP_FUNCTION( msgfmt_get_locale )
|
U_CFUNC PHP_FUNCTION( msgfmt_get_locale )
|
||||||
{
|
{
|
||||||
char *loc;
|
char *loc;
|
||||||
MSG_FORMAT_METHOD_INIT_VARS;
|
MSG_FORMAT_METHOD_INIT_VARS;
|
|
@ -14,10 +14,12 @@
|
||||||
|
|
||||||
#include <unicode/unum.h>
|
#include <unicode/unum.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "msgformat_class.h"
|
#include "msgformat_class.h"
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
#include "msgformat_data.h"
|
#include "msgformat_data.h"
|
||||||
#include "msgformat_arginfo.h"
|
#include "msgformat_arginfo.h"
|
||||||
|
}
|
||||||
|
|
||||||
#include <zend_exceptions.h>
|
#include <zend_exceptions.h>
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ static zend_object_handlers MessageFormatter_handlers;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* {{{ MessageFormatter_objects_free */
|
/* {{{ MessageFormatter_objects_free */
|
||||||
void MessageFormatter_object_free( zend_object *object )
|
U_CFUNC void MessageFormatter_object_free( zend_object *object )
|
||||||
{
|
{
|
||||||
MessageFormatter_object* mfo = php_intl_messageformatter_fetch_object(object);
|
MessageFormatter_object* mfo = php_intl_messageformatter_fetch_object(object);
|
||||||
|
|
||||||
|
@ -40,11 +42,11 @@ void MessageFormatter_object_free( zend_object *object )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ MessageFormatter_object_create */
|
/* {{{ MessageFormatter_object_create */
|
||||||
zend_object *MessageFormatter_object_create(zend_class_entry *ce)
|
U_CFUNC zend_object *MessageFormatter_object_create(zend_class_entry *ce)
|
||||||
{
|
{
|
||||||
MessageFormatter_object* intern;
|
MessageFormatter_object* intern;
|
||||||
|
|
||||||
intern = zend_object_alloc(sizeof(MessageFormatter_object), ce);
|
intern = reinterpret_cast<MessageFormatter_object *>(zend_object_alloc(sizeof(MessageFormatter_object), ce));
|
||||||
msgformat_data_init( &intern->mf_data );
|
msgformat_data_init( &intern->mf_data );
|
||||||
zend_object_std_init( &intern->zo, ce );
|
zend_object_std_init( &intern->zo, ce );
|
||||||
object_properties_init(&intern->zo, ce);
|
object_properties_init(&intern->zo, ce);
|
||||||
|
@ -54,7 +56,7 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce)
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ MessageFormatter_object_clone */
|
/* {{{ MessageFormatter_object_clone */
|
||||||
zend_object *MessageFormatter_object_clone(zend_object *object)
|
U_CFUNC zend_object *MessageFormatter_object_clone(zend_object *object)
|
||||||
{
|
{
|
||||||
MessageFormatter_object *mfo = php_intl_messageformatter_fetch_object(object);
|
MessageFormatter_object *mfo = php_intl_messageformatter_fetch_object(object);
|
||||||
zend_object *new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
|
zend_object *new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
|
||||||
|
@ -66,7 +68,7 @@ zend_object *MessageFormatter_object_clone(zend_object *object)
|
||||||
/* clone formatter object */
|
/* clone formatter object */
|
||||||
if (MSG_FORMAT_OBJECT(mfo) != NULL) {
|
if (MSG_FORMAT_OBJECT(mfo) != NULL) {
|
||||||
UErrorCode error = U_ZERO_ERROR;
|
UErrorCode error = U_ZERO_ERROR;
|
||||||
MSG_FORMAT_OBJECT(new_mfo) = umsg_clone(MSG_FORMAT_OBJECT(mfo), &error);
|
MSG_FORMAT_OBJECT(new_mfo) = reinterpret_cast<UMessageFormat *>(umsg_clone(MSG_FORMAT_OBJECT(mfo), &error));
|
||||||
|
|
||||||
if (U_FAILURE(error)) {
|
if (U_FAILURE(error)) {
|
||||||
zend_throw_error(NULL, "Failed to clone MessageFormatter");
|
zend_throw_error(NULL, "Failed to clone MessageFormatter");
|
|
@ -24,7 +24,7 @@
|
||||||
/* {{{ void msgformat_data_init( msgformat_data* mf_data )
|
/* {{{ void msgformat_data_init( msgformat_data* mf_data )
|
||||||
* Initialize internals of msgformat_data.
|
* Initialize internals of msgformat_data.
|
||||||
*/
|
*/
|
||||||
void msgformat_data_init( msgformat_data* mf_data )
|
U_CFUNC void msgformat_data_init( msgformat_data* mf_data )
|
||||||
{
|
{
|
||||||
if( !mf_data )
|
if( !mf_data )
|
||||||
return;
|
return;
|
||||||
|
@ -40,7 +40,7 @@ void msgformat_data_init( msgformat_data* mf_data )
|
||||||
/* {{{ void msgformat_data_free( msgformat_data* mf_data )
|
/* {{{ void msgformat_data_free( msgformat_data* mf_data )
|
||||||
* Clean up memory allocated for msgformat_data
|
* Clean up memory allocated for msgformat_data
|
||||||
*/
|
*/
|
||||||
void msgformat_data_free(msgformat_data* mf_data)
|
U_CFUNC void msgformat_data_free(msgformat_data* mf_data)
|
||||||
{
|
{
|
||||||
if (!mf_data)
|
if (!mf_data)
|
||||||
return;
|
return;
|
||||||
|
@ -69,7 +69,7 @@ void msgformat_data_free(msgformat_data* mf_data)
|
||||||
*/
|
*/
|
||||||
msgformat_data* msgformat_data_create( void )
|
msgformat_data* msgformat_data_create( void )
|
||||||
{
|
{
|
||||||
msgformat_data* mf_data = ecalloc( 1, sizeof(msgformat_data) );
|
msgformat_data* mf_data = reinterpret_cast<msgformat_data *>(ecalloc( 1, sizeof(msgformat_data) ));
|
||||||
|
|
||||||
msgformat_data_init( mf_data );
|
msgformat_data_init( mf_data );
|
||||||
|
|
|
@ -17,7 +17,13 @@
|
||||||
|
|
||||||
#include <php.h>
|
#include <php.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
#include "../intl_error.h"
|
#include "../intl_error.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unicode/umsg.h>
|
#include <unicode/umsg.h>
|
||||||
|
|
||||||
|
@ -26,16 +32,22 @@ typedef struct {
|
||||||
intl_error error;
|
intl_error error;
|
||||||
|
|
||||||
// formatter handling
|
// formatter handling
|
||||||
UMessageFormat* umsgf;
|
UMessageFormat *umsgf;
|
||||||
char* orig_format;
|
char* orig_format;
|
||||||
zend_ulong orig_format_len;
|
zend_ulong orig_format_len;
|
||||||
HashTable* arg_types;
|
HashTable* arg_types;
|
||||||
int tz_set; /* if we've already the time zone in sub-formats */
|
int tz_set; /* if we've already the time zone in sub-formats */
|
||||||
} msgformat_data;
|
} msgformat_data;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
msgformat_data* msgformat_data_create( void );
|
msgformat_data* msgformat_data_create( void );
|
||||||
void msgformat_data_init( msgformat_data* mf_data );
|
void msgformat_data_init( msgformat_data* mf_data );
|
||||||
void msgformat_data_free( msgformat_data* mf_data );
|
void msgformat_data_free( msgformat_data* mf_data );
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MSG_FORMAT_QUOTE_APOS
|
#ifdef MSG_FORMAT_QUOTE_APOS
|
||||||
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec);
|
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec);
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
|
|
||||||
#include <unicode/ustring.h>
|
#include <unicode/ustring.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
#include "msgformat_class.h"
|
#include "msgformat_class.h"
|
||||||
#include "msgformat_data.h"
|
#include "msgformat_data.h"
|
||||||
#include "msgformat_helpers.h"
|
#include "msgformat_helpers.h"
|
||||||
#include "intl_convert.h"
|
#include "intl_convert.h"
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef Z_ADDREF_P
|
#ifndef Z_ADDREF_P
|
||||||
#define Z_ADDREF_P(z) ((z)->refcount++)
|
#define Z_ADDREF_P(z) ((z)->refcount++)
|
||||||
|
@ -48,7 +50,7 @@ static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *ret
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Format a message. */
|
/* {{{ Format a message. */
|
||||||
PHP_FUNCTION( msgfmt_format )
|
U_CFUNC PHP_FUNCTION( msgfmt_format )
|
||||||
{
|
{
|
||||||
zval *args;
|
zval *args;
|
||||||
MSG_FORMAT_METHOD_INIT_VARS;
|
MSG_FORMAT_METHOD_INIT_VARS;
|
||||||
|
@ -69,7 +71,7 @@ PHP_FUNCTION( msgfmt_format )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Format a message. */
|
/* {{{ Format a message. */
|
||||||
PHP_FUNCTION( msgfmt_format_message )
|
U_CFUNC PHP_FUNCTION( msgfmt_format_message )
|
||||||
{
|
{
|
||||||
zval *args;
|
zval *args;
|
||||||
UChar *spattern = NULL;
|
UChar *spattern = NULL;
|
|
@ -18,11 +18,13 @@
|
||||||
|
|
||||||
#include <unicode/ustring.h>
|
#include <unicode/ustring.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
#include "msgformat_class.h"
|
#include "msgformat_class.h"
|
||||||
#include "msgformat_data.h"
|
#include "msgformat_data.h"
|
||||||
#include "msgformat_helpers.h"
|
#include "msgformat_helpers.h"
|
||||||
#include "intl_convert.h"
|
#include "intl_convert.h"
|
||||||
|
}
|
||||||
|
|
||||||
/* {{{ */
|
/* {{{ */
|
||||||
static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value)
|
static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value)
|
||||||
|
@ -52,7 +54,7 @@ static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t s
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Parse a message */
|
/* {{{ Parse a message */
|
||||||
PHP_FUNCTION( msgfmt_parse )
|
U_CFUNC PHP_FUNCTION( msgfmt_parse )
|
||||||
{
|
{
|
||||||
char *source;
|
char *source;
|
||||||
size_t source_len;
|
size_t source_len;
|
||||||
|
@ -74,7 +76,7 @@ PHP_FUNCTION( msgfmt_parse )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Parse a message. */
|
/* {{{ Parse a message. */
|
||||||
PHP_FUNCTION( msgfmt_parse_message )
|
U_CFUNC PHP_FUNCTION( msgfmt_parse_message )
|
||||||
{
|
{
|
||||||
UChar *spattern = NULL;
|
UChar *spattern = NULL;
|
||||||
int spattern_len = 0;
|
int spattern_len = 0;
|
|
@ -12,11 +12,22 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
#include <string_view>
|
||||||
|
#endif
|
||||||
|
#include <unicode/unistr.h>
|
||||||
|
|
||||||
#include "normalizer.h"
|
#include "normalizer.h"
|
||||||
#include "normalizer_class.h"
|
#include "normalizer_class.h"
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
#include "normalizer_arginfo.h"
|
#include "normalizer_arginfo.h"
|
||||||
#include "intl_error.h"
|
#include "intl_error.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unicode/unorm.h>
|
#include <unicode/unorm.h>
|
||||||
|
|
||||||
|
@ -29,7 +40,7 @@ zend_class_entry *Normalizer_ce_ptr = NULL;
|
||||||
/* {{{ normalizer_register_Normalizer_class
|
/* {{{ normalizer_register_Normalizer_class
|
||||||
* Initialize 'Normalizer' class
|
* Initialize 'Normalizer' class
|
||||||
*/
|
*/
|
||||||
void normalizer_register_Normalizer_class( void )
|
U_CFUNC void normalizer_register_Normalizer_class( void )
|
||||||
{
|
{
|
||||||
/* Create and register 'Normalizer' class. */
|
/* Create and register 'Normalizer' class. */
|
||||||
Normalizer_ce_ptr = register_class_Normalizer();
|
Normalizer_ce_ptr = register_class_Normalizer();
|
|
@ -36,6 +36,12 @@ typedef struct {
|
||||||
#define NORMALIZER_ERROR_CODE(co) INTL_ERROR_CODE(NORMALIZER_ERROR(co))
|
#define NORMALIZER_ERROR_CODE(co) INTL_ERROR_CODE(NORMALIZER_ERROR(co))
|
||||||
#define NORMALIZER_ERROR_CODE_P(co) &(INTL_ERROR_CODE(NORMALIZER_ERROR(co)))
|
#define NORMALIZER_ERROR_CODE_P(co) &(INTL_ERROR_CODE(NORMALIZER_ERROR(co)))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
void normalizer_register_Normalizer_class( void );
|
void normalizer_register_Normalizer_class( void );
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
extern zend_class_entry *Normalizer_ce_ptr;
|
extern zend_class_entry *Normalizer_ce_ptr;
|
||||||
#endif // #ifndef NORMALIZER_CLASS_H
|
#endif // #ifndef NORMALIZER_CLASS_H
|
||||||
|
|
|
@ -16,11 +16,18 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
#include <string_view>
|
||||||
|
#include <unicode/unistr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "php_intl.h"
|
#include "php_intl.h"
|
||||||
#include <unicode/unorm2.h>
|
#include <unicode/unorm2.h>
|
||||||
#include "normalizer.h"
|
#include "normalizer.h"
|
||||||
#include "normalizer_class.h"
|
#include "normalizer_class.h"
|
||||||
#include "intl_convert.h"
|
#include "intl_convert.h"
|
||||||
|
}
|
||||||
#include <unicode/utf8.h>
|
#include <unicode/utf8.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +78,7 @@ static UBool intl_is_normalized(zend_long form, const UChar *uinput, int32_t uin
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
/* {{{ Normalize a string. */
|
/* {{{ Normalize a string. */
|
||||||
PHP_FUNCTION( normalizer_normalize )
|
U_CFUNC PHP_FUNCTION( normalizer_normalize )
|
||||||
{
|
{
|
||||||
char* input = NULL;
|
char* input = NULL;
|
||||||
/* form is optional, defaults to FORM_C */
|
/* form is optional, defaults to FORM_C */
|
||||||
|
@ -200,7 +207,7 @@ PHP_FUNCTION( normalizer_normalize )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Test if a string is in a given normalization form. */
|
/* {{{ Test if a string is in a given normalization form. */
|
||||||
PHP_FUNCTION( normalizer_is_normalized )
|
U_CFUNC PHP_FUNCTION( normalizer_is_normalized )
|
||||||
{
|
{
|
||||||
char* input = NULL;
|
char* input = NULL;
|
||||||
/* form is optional, defaults to FORM_C */
|
/* form is optional, defaults to FORM_C */
|
||||||
|
@ -276,7 +283,7 @@ PHP_FUNCTION( normalizer_is_normalized )
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Returns the Decomposition_Mapping property for the given UTF-8 encoded code point. */
|
/* {{{ Returns the Decomposition_Mapping property for the given UTF-8 encoded code point. */
|
||||||
PHP_FUNCTION( normalizer_get_raw_decomposition )
|
U_CFUNC PHP_FUNCTION( normalizer_get_raw_decomposition )
|
||||||
{
|
{
|
||||||
char* input = NULL;
|
char* input = NULL;
|
||||||
size_t input_length = 0;
|
size_t input_length = 0;
|
Loading…
Add table
Add a link
Reference in a new issue