Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
#include <config.h>
#endif

extern "C" {
#include "php_intl.h"
#include "intl_error.h"
}

/* {{{ Get code of the last occurred error. */
PHP_FUNCTION( intl_get_error_code )
U_CFUNC PHP_FUNCTION( intl_get_error_code )
{
ZEND_PARSE_PARAMETERS_NONE();

Expand All @@ -30,7 +32,7 @@ PHP_FUNCTION( intl_get_error_code )
/* }}} */

/* {{{ Get text description of the last occurred error. */
PHP_FUNCTION( intl_get_error_message )
U_CFUNC PHP_FUNCTION( intl_get_error_message )
{
ZEND_PARSE_PARAMETERS_NONE();

Expand All @@ -42,29 +44,29 @@ PHP_FUNCTION( intl_get_error_message )
* Returns true if it does, and false if the code
* indicates success or a warning.
*/
PHP_FUNCTION( intl_is_failure )
U_CFUNC PHP_FUNCTION( intl_is_failure )
{
zend_long err_code;

ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(err_code)
ZEND_PARSE_PARAMETERS_END();

RETURN_BOOL( U_FAILURE( err_code ) );
RETURN_BOOL( U_FAILURE( static_cast<UErrorCode>(err_code) ) );
}
/* }}} */

/* {{{ Return a string for a given error code.
* The string will be the same as the name of the error code constant.
*/
PHP_FUNCTION( intl_error_name )
U_CFUNC PHP_FUNCTION( intl_error_name )
{
zend_long err_code;

ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(err_code)
ZEND_PARSE_PARAMETERS_END();

RETURN_STRING( (char*)u_errorName( err_code ) );
RETURN_STRING( (char*)u_errorName( static_cast<UErrorCode>(err_code) ) );
}
/* }}} */
18 changes: 9 additions & 9 deletions ext/intl/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,9 @@ if test "$PHP_INTL" != "no"; then
PHP_SUBST([INTL_SHARED_LIBADD])
INTL_COMMON_FLAGS="$ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
PHP_NEW_EXTENSION([intl], m4_normalize([
common/common_error.c
dateformat/dateformat_class.c
formatter/formatter_class.c
intl_convert.c
intl_error.c
php_intl.c
resourcebundle/resourcebundle_class.c
resourcebundle/resourcebundle_iterator.c
resourcebundle/resourcebundle.c
spoofchecker/spoofchecker_class.c
spoofchecker/spoofchecker_create.c
spoofchecker/spoofchecker_main.c
]),
[$ext_shared],,
[$INTL_COMMON_FLAGS],
Expand All @@ -37,6 +28,8 @@ if test "$PHP_INTL" != "no"; then
collator/collator_sort.cpp \
common/common_enum.cpp \
common/common_date.cpp \
common/common_error.cpp \
dateformat/dateformat_class.cpp \
converter/converter.cpp \
dateformat/dateformat.cpp \
dateformat/dateformat_attr.cpp \
Expand All @@ -49,6 +42,7 @@ if test "$PHP_INTL" != "no"; then
dateformat/dateformat_parse.cpp \
dateformat/datepatterngenerator_class.cpp \
dateformat/datepatterngenerator_methods.cpp \
formatter/formatter_class.cpp \
grapheme/grapheme_string.cpp \
grapheme/grapheme_util.cpp \
msgformat/msgformat_helpers.cpp \
Expand Down Expand Up @@ -84,6 +78,12 @@ if test "$PHP_INTL" != "no"; then
locale/locale_class.cpp \
locale/locale_methods.cpp \
locale/locale.cpp \
resourcebundle/resourcebundle_class.cpp \
resourcebundle/resourcebundle_iterator.cpp \
resourcebundle/resourcebundle.cpp \
spoofchecker/spoofchecker_class.cpp \
spoofchecker/spoofchecker_create.cpp \
spoofchecker/spoofchecker_main.cpp \
uchar/uchar.cpp"

PHP_REQUIRE_CXX()
Expand Down
18 changes: 9 additions & 9 deletions ext/intl/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (PHP_INTL != "no") {
collator_sort.cpp \
", "intl");
ADD_SOURCES(configure_module_dirname + "/common", "\
common_error.c \
common_error.cpp \
common_enum.cpp \
common_date.cpp \
", "intl");
Expand All @@ -33,7 +33,7 @@ if (PHP_INTL != "no") {
", "intl");
ADD_SOURCES(configure_module_dirname + "/formatter", "\
formatter_attr.cpp \
formatter_class.c \
formatter_class.cpp \
formatter_data.cpp \
formatter_format.cpp \
formatter_main.cpp \
Expand Down Expand Up @@ -68,7 +68,7 @@ if (PHP_INTL != "no") {
", "intl");
ADD_SOURCES(configure_module_dirname + "/dateformat", "\
dateformat.cpp \
dateformat_class.c \
dateformat_class.cpp \
dateformat_attr.cpp \
dateformat_format.cpp \
dateformat_format_object.cpp \
Expand All @@ -87,16 +87,16 @@ if (PHP_INTL != "no") {
idn.cpp",
"intl");
ADD_SOURCES(configure_module_dirname + "/resourcebundle", "\
resourcebundle.c \
resourcebundle_class.c \
resourcebundle_iterator.c",
resourcebundle.cpp \
resourcebundle_class.cpp \
resourcebundle_iterator.cpp",
"intl");

if (CHECK_HEADER_ADD_INCLUDE("unicode/uspoof.h", "CFLAGS_INTL")) {
ADD_SOURCES(configure_module_dirname + "/spoofchecker", "\
spoofchecker_class.c \
spoofchecker_create.c \
spoofchecker_main.c",
spoofchecker_class.cpp \
spoofchecker_create.cpp \
spoofchecker_main.cpp",
"intl");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
| Authors: Kirti Velankar <kirtig@yahoo-inc.com> |
+----------------------------------------------------------------------+
*/
#include <unicode/unum.h>
#include <unicode/udat.h>

extern "C" {
#include "dateformat_class.h"
#include "php_intl.h"
#include "dateformat_data.h"
#include "dateformat.h"
#include "dateformat_arginfo.h"
}

#include <zend_exceptions.h>

Expand Down Expand Up @@ -48,7 +50,7 @@ zend_object *IntlDateFormatter_object_create(zend_class_entry *ce)
{
IntlDateFormatter_object* intern;

intern = zend_object_alloc(sizeof(IntlDateFormatter_object), ce);
intern = reinterpret_cast<IntlDateFormatter_object *>(zend_object_alloc(sizeof(IntlDateFormatter_object), ce));
dateformat_data_init( &intern->datef_data );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);
Expand Down
6 changes: 6 additions & 0 deletions ext/intl/dateformat/dateformat_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@

#include <php.h>

#ifdef __cplusplus
extern "C" {
#endif
#include "intl_common.h"
#include "intl_error.h"
#include "intl_data.h"
#ifdef __cplusplus
}
#endif
#include "dateformat_data.h"

typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/dateformat/dateformat_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#endif

#include <unicode/ustring.h>
#include <unicode/ucal.h>
#include <unicode/unum.h>

extern "C" {
#include "../php_intl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
#include <unicode/unum.h>

#include "formatter_class.h"
extern "C" {
#include "php_intl.h"
#include "formatter_data.h"
#include "formatter_format.h"
}

#include <zend_exceptions.h>
#include "Zend/zend_attributes.h"
#include "Zend/zend_interfaces.h"

extern "C" {
#include "formatter_arginfo.h"
}

zend_class_entry *NumberFormatter_ce_ptr = NULL;
static zend_object_handlers NumberFormatter_handlers;
Expand All @@ -33,7 +37,7 @@ static zend_object_handlers NumberFormatter_handlers;
*/

/* {{{ NumberFormatter_objects_free */
void NumberFormatter_object_free( zend_object *object )
U_CFUNC void NumberFormatter_object_free( zend_object *object )
{
NumberFormatter_object* nfo = php_intl_number_format_fetch_object(object);

Expand All @@ -44,11 +48,11 @@ void NumberFormatter_object_free( zend_object *object )
/* }}} */

/* {{{ NumberFormatter_object_create */
zend_object *NumberFormatter_object_create(zend_class_entry *ce)
U_CFUNC zend_object *NumberFormatter_object_create(zend_class_entry *ce)
{
NumberFormatter_object* intern;

intern = zend_object_alloc(sizeof(NumberFormatter_object), ce);
intern = reinterpret_cast<NumberFormatter_object *>(zend_object_alloc(sizeof(NumberFormatter_object), ce));
formatter_data_init( &intern->nf_data );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);
Expand All @@ -58,7 +62,7 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce)
/* }}} */

/* {{{ NumberFormatter_object_clone */
zend_object *NumberFormatter_object_clone(zend_object *object)
U_CFUNC zend_object *NumberFormatter_object_clone(zend_object *object)
{
NumberFormatter_object *nfo = php_intl_number_format_fetch_object(object);
zend_object *new_obj = NumberFormatter_ce_ptr->create_object(object->ce);
Expand Down Expand Up @@ -88,7 +92,7 @@ zend_object *NumberFormatter_object_clone(zend_object *object)
/* {{{ formatter_register_class
* Initialize 'NumberFormatter' class
*/
void formatter_register_class( void )
U_CFUNC void formatter_register_class( void )
{
/* Create and register 'NumberFormatter' class. */
NumberFormatter_ce_ptr = register_class_NumberFormatter();
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/formatter/formatter_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ extern "C" {
#include "intl_common.h"
#include "intl_error.h"
#include "intl_data.h"
#include "formatter_data.h"
#ifdef __cplusplus
}
#endif
#include "formatter_data.h"

typedef struct {
formatter_data nf_data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
#include <zend.h>
#include <zend_API.h>

extern "C" {
#include "intl_convert.h"
#include "intl_data.h"
#include "resourcebundle/resourcebundle_class.h"
}

/* {{{ ResourceBundle_extract_value */
void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *source )
U_CFUNC void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *source )
{
UResType restype;
const UChar* ufield;
Expand Down
6 changes: 6 additions & 0 deletions ext/intl/resourcebundle/resourcebundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

#include "resourcebundle/resourcebundle_class.h"

#ifdef __cplusplus
extern "C" {
#endif
void resourcebundle_extract_value( zval *target, ResourceBundle_object *source);
#ifdef __cplusplus
}
#endif

#endif // #ifndef RESOURCEBUNDLE_CLASS_H
Loading