Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ext/intl/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ if test "$PHP_INTL" != "no"; then
intl_convert.c
intl_error.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
resourcebundle/resourcebundle_class.c
resourcebundle/resourcebundle_iterator.c
Expand Down Expand Up @@ -73,6 +65,14 @@ if test "$PHP_INTL" != "no"; then
calendar/calendar_class.cpp \
calendar/calendar_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_iterators.cpp \
breakiterator/breakiterator_methods.cpp \
Expand Down
16 changes: 8 additions & 8 deletions ext/intl/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ if (PHP_INTL != "no") {
locale_methods.cpp \
", "intl");
ADD_SOURCES(configure_module_dirname + "/msgformat", "\
msgformat.c \
msgformat_attr.c \
msgformat_class.c \
msgformat_data.c \
msgformat_format.c \
msgformat.cpp \
msgformat_attr.cpp \
msgformat_class.cpp \
msgformat_data.cpp \
msgformat_format.cpp \
msgformat_helpers.cpp \
msgformat_parse.c \
msgformat_parse.cpp \
", "intl");
ADD_SOURCES(configure_module_dirname + "/grapheme", "\
grapheme_string.c grapheme_util.c \
", "intl");
ADD_SOURCES(configure_module_dirname + "/normalizer", "\
normalizer_class.c \
normalizer_normalize.c \
normalizer_class.cpp \
normalizer_normalize.cpp \
", "intl");
ADD_SOURCES(configure_module_dirname + "/dateformat", "\
dateformat.c \
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/locale/locale_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ static int handleAppendResult( int result, smart_str* loc_name)
* }}} */
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;
zval* arr = NULL;
HashTable* hash_arr = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
#include <unicode/ustring.h>
#include <unicode/umsg.h>

extern "C" {
#include "php_intl.h"
#include "msgformat_class.h"
#include "msgformat_data.h"
#include "intl_convert.h"
}

/* {{{ */
static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
Expand Down Expand Up @@ -99,7 +101,7 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
/* }}} */

/* {{{ Create formatter. */
PHP_FUNCTION( msgfmt_create )
U_CFUNC PHP_FUNCTION( msgfmt_create )
{
object_init_ex( return_value, MessageFormatter_ce_ptr );
if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
Expand All @@ -110,7 +112,7 @@ PHP_FUNCTION( msgfmt_create )
/* }}} */

/* {{{ MessageFormatter object constructor. */
PHP_METHOD( MessageFormatter, __construct )
U_CFUNC PHP_METHOD( MessageFormatter, __construct )
{
const bool old_use_exception = INTL_G(use_exceptions);
const zend_long old_error_level = INTL_G(error_level);
Expand All @@ -127,7 +129,7 @@ PHP_METHOD( MessageFormatter, __construct )
/* }}} */

/* {{{ Get formatter's last error code. */
PHP_FUNCTION( msgfmt_get_error_code )
U_CFUNC PHP_FUNCTION( msgfmt_get_error_code )
{
zval* object = NULL;
MessageFormatter_object* mfo = NULL;
Expand All @@ -147,7 +149,7 @@ PHP_FUNCTION( msgfmt_get_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;
zval* object = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
#include <config.h>
#endif

extern "C" {
#include "php_intl.h"
#include "msgformat_class.h"
#include "msgformat_data.h"
#include "intl_convert.h"
}

#include <unicode/ustring.h>

/* {{{ Get formatter pattern. */
PHP_FUNCTION( msgfmt_get_pattern )
U_CFUNC PHP_FUNCTION( msgfmt_get_pattern )
{
MSG_FORMAT_METHOD_INIT_VARS;

Expand All @@ -46,7 +48,7 @@ PHP_FUNCTION( msgfmt_get_pattern )
/* }}} */

/* {{{ Set formatter pattern. */
PHP_FUNCTION( msgfmt_set_pattern )
U_CFUNC PHP_FUNCTION( msgfmt_set_pattern )
{
char* value = NULL;
size_t value_len = 0;
Expand Down Expand Up @@ -105,7 +107,7 @@ PHP_FUNCTION( msgfmt_set_pattern )
/* }}} */

/* {{{ Get formatter locale. */
PHP_FUNCTION( msgfmt_get_locale )
U_CFUNC PHP_FUNCTION( msgfmt_get_locale )
{
char *loc;
MSG_FORMAT_METHOD_INIT_VARS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

#include <unicode/unum.h>

extern "C" {
#include "msgformat_class.h"
#include "php_intl.h"
#include "msgformat_data.h"
#include "msgformat_arginfo.h"
}

#include <zend_exceptions.h>

Expand All @@ -29,7 +31,7 @@ static zend_object_handlers MessageFormatter_handlers;
*/

/* {{{ 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);

Expand All @@ -40,11 +42,11 @@ void MessageFormatter_object_free( zend_object *object )
/* }}} */

/* {{{ 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;

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 );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);
Expand All @@ -54,7 +56,7 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce)
/* }}} */

/* {{{ 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);
zend_object *new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
Expand All @@ -66,7 +68,7 @@ zend_object *MessageFormatter_object_clone(zend_object *object)
/* clone formatter object */
if (MSG_FORMAT_OBJECT(mfo) != NULL) {
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)) {
zend_throw_error(NULL, "Failed to clone MessageFormatter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/* {{{ void msgformat_data_init( msgformat_data* mf_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 )
return;
Expand All @@ -40,7 +40,7 @@ void msgformat_data_init( msgformat_data* mf_data )
/* {{{ void msgformat_data_free( msgformat_data* mf_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)
return;
Expand Down Expand Up @@ -69,7 +69,7 @@ void msgformat_data_free(msgformat_data* mf_data)
*/
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 );

Expand Down
14 changes: 13 additions & 1 deletion ext/intl/msgformat/msgformat_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@

#include <php.h>

#ifdef __cplusplus
extern "C" {
#endif
#include "../intl_error.h"
#ifdef __cplusplus
}
#endif

#include <unicode/umsg.h>

Expand All @@ -26,16 +32,22 @@ typedef struct {
intl_error error;

// formatter handling
UMessageFormat* umsgf;
UMessageFormat *umsgf;
char* orig_format;
zend_ulong orig_format_len;
HashTable* arg_types;
int tz_set; /* if we've already the time zone in sub-formats */
} msgformat_data;

#ifdef __cplusplus
extern "C" {
#endif
msgformat_data* msgformat_data_create( void );
void msgformat_data_init( msgformat_data* mf_data );
void msgformat_data_free( msgformat_data* mf_data );
#ifdef __cplusplus
}
#endif

#ifdef MSG_FORMAT_QUOTE_APOS
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

#include <unicode/ustring.h>

extern "C" {
#include "php_intl.h"
#include "msgformat_class.h"
#include "msgformat_data.h"
#include "msgformat_helpers.h"
#include "intl_convert.h"
}

#ifndef Z_ADDREF_P
#define Z_ADDREF_P(z) ((z)->refcount++)
Expand All @@ -48,7 +50,7 @@ static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *ret
/* }}} */

/* {{{ Format a message. */
PHP_FUNCTION( msgfmt_format )
U_CFUNC PHP_FUNCTION( msgfmt_format )
{
zval *args;
MSG_FORMAT_METHOD_INIT_VARS;
Expand All @@ -69,7 +71,7 @@ PHP_FUNCTION( msgfmt_format )
/* }}} */

/* {{{ Format a message. */
PHP_FUNCTION( msgfmt_format_message )
U_CFUNC PHP_FUNCTION( msgfmt_format_message )
{
zval *args;
UChar *spattern = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

#include <unicode/ustring.h>

extern "C" {
#include "php_intl.h"
#include "msgformat_class.h"
#include "msgformat_data.h"
#include "msgformat_helpers.h"
#include "intl_convert.h"
}

/* {{{ */
static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value)
Expand Down Expand Up @@ -52,7 +54,7 @@ static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t s
/* }}} */

/* {{{ Parse a message */
PHP_FUNCTION( msgfmt_parse )
U_CFUNC PHP_FUNCTION( msgfmt_parse )
{
char *source;
size_t source_len;
Expand All @@ -74,7 +76,7 @@ PHP_FUNCTION( msgfmt_parse )
/* }}} */

/* {{{ Parse a message. */
PHP_FUNCTION( msgfmt_parse_message )
U_CFUNC PHP_FUNCTION( msgfmt_parse_message )
{
UChar *spattern = NULL;
int spattern_len = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@
+----------------------------------------------------------------------+
*/

#if __cplusplus >= 201703L
#include <string_view>
#endif
#include <unicode/unistr.h>

#include "normalizer.h"
#include "normalizer_class.h"
#include "php_intl.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "normalizer_arginfo.h"
#include "intl_error.h"
#ifdef __cplusplus
}
#endif

#include <unicode/unorm.h>

Expand All @@ -29,7 +40,7 @@ zend_class_entry *Normalizer_ce_ptr = NULL;
/* {{{ normalizer_register_Normalizer_class
* Initialize 'Normalizer' class
*/
void normalizer_register_Normalizer_class( void )
U_CFUNC void normalizer_register_Normalizer_class( void )
{
/* Create and register 'Normalizer' class. */
Normalizer_ce_ptr = register_class_Normalizer();
Expand Down
6 changes: 6 additions & 0 deletions ext/intl/normalizer/normalizer_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ typedef struct {
#define NORMALIZER_ERROR_CODE(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 );
#ifdef __cplusplus
}
#endif
extern zend_class_entry *Normalizer_ce_ptr;
#endif // #ifndef NORMALIZER_CLASS_H
Loading