mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Add stubs for UConverter
Closes GH-5218
This commit is contained in:
parent
3ab75ac019
commit
d70e6bdcde
3 changed files with 169 additions and 108 deletions
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "converter.h"
|
#include "converter.h"
|
||||||
|
#include "converter_arginfo.h"
|
||||||
#include "zend_exceptions.h"
|
#include "zend_exceptions.h"
|
||||||
|
|
||||||
#include <unicode/utypes.h>
|
#include <unicode/utypes.h>
|
||||||
|
@ -105,17 +106,12 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, zend_
|
||||||
/* {{{ proto void UConverter::toUCallback(int $reason,
|
/* {{{ proto void UConverter::toUCallback(int $reason,
|
||||||
string $source, string $codeUnits,
|
string $source, string $codeUnits,
|
||||||
int &$error) */
|
int &$error) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_toUCallback_arginfo, 0, ZEND_RETURN_VALUE, 4)
|
|
||||||
ZEND_ARG_INFO(0, reason)
|
|
||||||
ZEND_ARG_INFO(0, source)
|
|
||||||
ZEND_ARG_INFO(0, codeUnits)
|
|
||||||
ZEND_ARG_INFO(1, error)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, toUCallback) {
|
static PHP_METHOD(UConverter, toUCallback) {
|
||||||
zend_long reason;
|
zend_long reason;
|
||||||
zval *source, *codeUnits, *error;
|
zend_string *source, *codeUnits;
|
||||||
|
zval *error;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lzzz",
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lSSz",
|
||||||
&reason, &source, &codeUnits, &error) == FAILURE) {
|
&reason, &source, &codeUnits, &error) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
@ -125,19 +121,14 @@ static PHP_METHOD(UConverter, toUCallback) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto void UConverter::fromUCallback(int $reason,
|
/* {{{ proto void UConverter::fromUCallback(int $reason,
|
||||||
Array $source, int $codePoint,
|
array $source, int $codePoint,
|
||||||
int &$error) */
|
int &$error) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_fromUCallback_arginfo, 0, ZEND_RETURN_VALUE, 4)
|
|
||||||
ZEND_ARG_INFO(0, reason)
|
|
||||||
ZEND_ARG_INFO(0, source)
|
|
||||||
ZEND_ARG_INFO(0, codePoint)
|
|
||||||
ZEND_ARG_INFO(1, error)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, fromUCallback) {
|
static PHP_METHOD(UConverter, fromUCallback) {
|
||||||
zend_long reason;
|
zend_long reason;
|
||||||
zval *source, *codePoint, *error;
|
zval *source, *error;
|
||||||
|
zend_long codePoint;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lzzz",
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lalz",
|
||||||
&reason, &source, &codePoint, &error) == FAILURE) {
|
&reason, &source, &codePoint, &error) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
@ -413,17 +404,12 @@ static zend_bool php_converter_set_encoding(php_converter_object *objval,
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_converter_do_set_encoding */
|
/* {{{ php_converter_do_set_encoding */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_set_encoding_arginfo, 0, ZEND_RETURN_VALUE, 1)
|
|
||||||
ZEND_ARG_INFO(0, encoding)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static void php_converter_do_set_encoding(UConverter **pcnv, INTERNAL_FUNCTION_PARAMETERS) {
|
static void php_converter_do_set_encoding(UConverter **pcnv, INTERNAL_FUNCTION_PARAMETERS) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
char *enc;
|
char *enc;
|
||||||
size_t enc_len;
|
size_t enc_len;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &enc, &enc_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &enc, &enc_len) == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Bad arguments, "
|
|
||||||
"expected one string argument", 0);
|
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
intl_errors_reset(&objval->error);
|
intl_errors_reset(&objval->error);
|
||||||
|
@ -447,13 +433,10 @@ static PHP_METHOD(UConverter, setDestinationEncoding) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_converter_do_get_encoding */
|
/* {{{ php_converter_do_get_encoding */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_get_encoding_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static void php_converter_do_get_encoding(php_converter_object *objval, UConverter *cnv, INTERNAL_FUNCTION_PARAMETERS) {
|
static void php_converter_do_get_encoding(php_converter_object *objval, UConverter *cnv, INTERNAL_FUNCTION_PARAMETERS) {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Expected no arguments", 0);
|
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,14 +471,11 @@ static PHP_METHOD(UConverter, getDestinationEncoding) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_converter_do_get_type */
|
/* {{{ php_converter_do_get_type */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_get_type_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static void php_converter_do_get_type(php_converter_object *objval, UConverter *cnv, INTERNAL_FUNCTION_PARAMETERS) {
|
static void php_converter_do_get_type(php_converter_object *objval, UConverter *cnv, INTERNAL_FUNCTION_PARAMETERS) {
|
||||||
UConverterType t;
|
UConverterType t;
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Expected no arguments", 0);
|
RETURN_THROWS();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
intl_errors_reset(&objval->error);
|
intl_errors_reset(&objval->error);
|
||||||
|
|
||||||
|
@ -552,11 +532,6 @@ static void php_converter_resolve_callback(zval *zobj,
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto UConverter::__construct([string dest = 'utf-8',[string src = 'utf-8']]) */
|
/* {{{ proto UConverter::__construct([string dest = 'utf-8',[string src = 'utf-8']]) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_ARG_INFO(0, destination_encoding)
|
|
||||||
ZEND_ARG_INFO(0, source_encoding)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
|
|
||||||
static PHP_METHOD(UConverter, __construct) {
|
static PHP_METHOD(UConverter, __construct) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
char *src = "utf-8";
|
char *src = "utf-8";
|
||||||
|
@ -567,7 +542,7 @@ static PHP_METHOD(UConverter, __construct) {
|
||||||
intl_error_reset(NULL);
|
intl_error_reset(NULL);
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!", &dest, &dest_len, &src, &src_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!", &dest, &dest_len, &src, &src_len) == FAILURE) {
|
||||||
return;
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
php_converter_set_encoding(objval, &(objval->src), src, src_len );
|
php_converter_set_encoding(objval, &(objval->src), src, src_len );
|
||||||
|
@ -578,10 +553,6 @@ static PHP_METHOD(UConverter, __construct) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto bool UConverter::setSubstChars(string $chars) */
|
/* {{{ proto bool UConverter::setSubstChars(string $chars) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_setSubstChars_arginfo, 0, ZEND_RETURN_VALUE, 1)
|
|
||||||
ZEND_ARG_INFO(0, chars)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
|
|
||||||
static PHP_METHOD(UConverter, setSubstChars) {
|
static PHP_METHOD(UConverter, setSubstChars) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
char *chars;
|
char *chars;
|
||||||
|
@ -589,7 +560,7 @@ static PHP_METHOD(UConverter, setSubstChars) {
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &chars, &chars_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &chars, &chars_len) == FAILURE) {
|
||||||
return;
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
intl_errors_reset(&objval->error);
|
intl_errors_reset(&objval->error);
|
||||||
|
|
||||||
|
@ -622,9 +593,6 @@ static PHP_METHOD(UConverter, setSubstChars) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto string UConverter::getSubstChars() */
|
/* {{{ proto string UConverter::getSubstChars() */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_getSubstChars_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
|
|
||||||
static PHP_METHOD(UConverter, getSubstChars) {
|
static PHP_METHOD(UConverter, getSubstChars) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
char chars[127];
|
char chars[127];
|
||||||
|
@ -632,9 +600,7 @@ static PHP_METHOD(UConverter, getSubstChars) {
|
||||||
UErrorCode error = U_ZERO_ERROR;
|
UErrorCode error = U_ZERO_ERROR;
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
RETURN_THROWS();
|
||||||
"UConverter::getSubstChars(): expected no arguments", 0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
intl_errors_reset(&objval->error);
|
intl_errors_reset(&objval->error);
|
||||||
|
|
||||||
|
@ -715,14 +681,11 @@ static zend_string* php_converter_do_convert(UConverter *dest_cnv,
|
||||||
|
|
||||||
/* {{{ proto string UConverter::reasonText(int reason) */
|
/* {{{ proto string UConverter::reasonText(int reason) */
|
||||||
#define UCNV_REASON_CASE(v) case (UCNV_ ## v) : RETURN_STRINGL( "REASON_" #v , sizeof( "REASON_" #v ) - 1);
|
#define UCNV_REASON_CASE(v) case (UCNV_ ## v) : RETURN_STRINGL( "REASON_" #v , sizeof( "REASON_" #v ) - 1);
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_reasontext_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_ARG_INFO(0, reason)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, reasonText) {
|
static PHP_METHOD(UConverter, reasonText) {
|
||||||
zend_long reason;
|
zend_long reason;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &reason) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &reason) == FAILURE) {
|
||||||
return;
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
intl_error_reset(NULL);
|
intl_error_reset(NULL);
|
||||||
|
|
||||||
|
@ -741,11 +704,6 @@ static PHP_METHOD(UConverter, reasonText) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto string UConverter::convert(string str[, bool reverse]) */
|
/* {{{ proto string UConverter::convert(string str[, bool reverse]) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_convert_arginfo, 0, ZEND_RETURN_VALUE, 1)
|
|
||||||
ZEND_ARG_INFO(0, str)
|
|
||||||
ZEND_ARG_INFO(0, reverse)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
|
|
||||||
static PHP_METHOD(UConverter, convert) {
|
static PHP_METHOD(UConverter, convert) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -755,7 +713,7 @@ static PHP_METHOD(UConverter, convert) {
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
|
||||||
&str, &str_len, &reverse) == FAILURE) {
|
&str, &str_len, &reverse) == FAILURE) {
|
||||||
return;
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
intl_errors_reset(&objval->error);
|
intl_errors_reset(&objval->error);
|
||||||
|
|
||||||
|
@ -772,13 +730,6 @@ static PHP_METHOD(UConverter, convert) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto string UConverter::transcode(string $str, string $toEncoding, string $fromEncoding[, Array $options = array()]) */
|
/* {{{ proto string UConverter::transcode(string $str, string $toEncoding, string $fromEncoding[, Array $options = array()]) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_transcode_arginfo, 0, ZEND_RETURN_VALUE, 3)
|
|
||||||
ZEND_ARG_INFO(0, str)
|
|
||||||
ZEND_ARG_INFO(0, toEncoding)
|
|
||||||
ZEND_ARG_INFO(0, fromEncoding)
|
|
||||||
ZEND_ARG_ARRAY_INFO(0, options, 1)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
|
|
||||||
static PHP_METHOD(UConverter, transcode) {
|
static PHP_METHOD(UConverter, transcode) {
|
||||||
char *str, *src, *dest;
|
char *str, *src, *dest;
|
||||||
size_t str_len, src_len, dest_len;
|
size_t str_len, src_len, dest_len;
|
||||||
|
@ -787,7 +738,7 @@ static PHP_METHOD(UConverter, transcode) {
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|a!",
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|a!",
|
||||||
&str, &str_len, &dest, &dest_len, &src, &src_len, &options) == FAILURE) {
|
&str, &str_len, &dest, &dest_len, &src, &src_len, &options) == FAILURE) {
|
||||||
return;
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
intl_error_reset(NULL);
|
intl_error_reset(NULL);
|
||||||
|
|
||||||
|
@ -836,15 +787,11 @@ static PHP_METHOD(UConverter, transcode) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto int UConverter::getErrorCode() */
|
/* {{{ proto int UConverter::getErrorCode() */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_geterrorcode_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, getErrorCode) {
|
static PHP_METHOD(UConverter, getErrorCode) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
RETURN_THROWS();
|
||||||
"UConverter::getErrorCode(): expected no arguments", 0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_LONG(intl_error_get_code(&(objval->error)));
|
RETURN_LONG(intl_error_get_code(&(objval->error)));
|
||||||
|
@ -852,16 +799,12 @@ static PHP_METHOD(UConverter, getErrorCode) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto string UConverter::getErrorMessage() */
|
/* {{{ proto string UConverter::getErrorMessage() */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_geterrormsg_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, getErrorMessage) {
|
static PHP_METHOD(UConverter, getErrorMessage) {
|
||||||
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
php_converter_object *objval = CONV_GET(ZEND_THIS);
|
||||||
zend_string *message = intl_error_get_message(&(objval->error));
|
zend_string *message = intl_error_get_message(&(objval->error));
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
RETURN_THROWS();
|
||||||
"UConverter::getErrorMessage(): expected no arguments", 0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message) {
|
if (message) {
|
||||||
|
@ -873,16 +816,12 @@ static PHP_METHOD(UConverter, getErrorMessage) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto array UConverter::getAvailable() */
|
/* {{{ proto array UConverter::getAvailable() */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_getavailable_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, getAvailable) {
|
static PHP_METHOD(UConverter, getAvailable) {
|
||||||
int32_t i,
|
int32_t i,
|
||||||
count = ucnv_countAvailable();
|
count = ucnv_countAvailable();
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
RETURN_THROWS();
|
||||||
"UConverter::getErrorMessage(): expected no arguments", 0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
intl_error_reset(NULL);
|
intl_error_reset(NULL);
|
||||||
|
|
||||||
|
@ -895,9 +834,6 @@ static PHP_METHOD(UConverter, getAvailable) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto array UConverter::getAliases(string name) */
|
/* {{{ proto array UConverter::getAliases(string name) */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_getaliases_arginfo, 0, ZEND_RETURN_VALUE, 1)
|
|
||||||
ZEND_ARG_INFO(0, name)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, getAliases) {
|
static PHP_METHOD(UConverter, getAliases) {
|
||||||
char *name;
|
char *name;
|
||||||
size_t name_len;
|
size_t name_len;
|
||||||
|
@ -905,7 +841,7 @@ static PHP_METHOD(UConverter, getAliases) {
|
||||||
uint16_t i, count;
|
uint16_t i, count;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
|
||||||
return;
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
intl_error_reset(NULL);
|
intl_error_reset(NULL);
|
||||||
|
|
||||||
|
@ -932,15 +868,11 @@ static PHP_METHOD(UConverter, getAliases) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto array UConverter::getStandards() */
|
/* {{{ proto array UConverter::getStandards() */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(php_converter_getstandards_arginfo, 0, ZEND_RETURN_VALUE, 0)
|
|
||||||
ZEND_END_ARG_INFO();
|
|
||||||
static PHP_METHOD(UConverter, getStandards) {
|
static PHP_METHOD(UConverter, getStandards) {
|
||||||
uint16_t i, count;
|
uint16_t i, count;
|
||||||
|
|
||||||
if (zend_parse_parameters_none() == FAILURE) {
|
if (zend_parse_parameters_none() == FAILURE) {
|
||||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
RETURN_THROWS();
|
||||||
"UConverter::getStandards(): expected no arguments", 0);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
intl_error_reset(NULL);
|
intl_error_reset(NULL);
|
||||||
|
|
||||||
|
@ -960,39 +892,39 @@ static PHP_METHOD(UConverter, getStandards) {
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static const zend_function_entry php_converter_methods[] = {
|
static const zend_function_entry php_converter_methods[] = {
|
||||||
PHP_ME(UConverter, __construct, php_converter_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, __construct, arginfo_class_UConverter___construct, ZEND_ACC_PUBLIC)
|
||||||
|
|
||||||
/* Encoding selection */
|
/* Encoding selection */
|
||||||
PHP_ME(UConverter, setSourceEncoding, php_converter_set_encoding_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, setSourceEncoding, arginfo_class_UConverter_setSourceEncoding, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, setDestinationEncoding, php_converter_set_encoding_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, setDestinationEncoding, arginfo_class_UConverter_setDestinationEncoding, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, getSourceEncoding, php_converter_get_encoding_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getSourceEncoding, arginfo_class_UConverter_getSourceEncoding, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, getDestinationEncoding, php_converter_get_encoding_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getDestinationEncoding, arginfo_class_UConverter_getDestinationEncoding, ZEND_ACC_PUBLIC)
|
||||||
|
|
||||||
/* Introspection for algorithmic converters */
|
/* Introspection for algorithmic converters */
|
||||||
PHP_ME(UConverter, getSourceType, php_converter_get_type_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getSourceType, arginfo_class_UConverter_getSourceType, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, getDestinationType, php_converter_get_type_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getDestinationType, arginfo_class_UConverter_getDestinationType, ZEND_ACC_PUBLIC)
|
||||||
|
|
||||||
/* Basic codeunit error handling */
|
/* Basic codeunit error handling */
|
||||||
PHP_ME(UConverter, getSubstChars, php_converter_getSubstChars_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getSubstChars, arginfo_class_UConverter_getSubstChars, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, setSubstChars, php_converter_setSubstChars_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, setSubstChars, arginfo_class_UConverter_setSubstChars, ZEND_ACC_PUBLIC)
|
||||||
|
|
||||||
/* Default callback handlers */
|
/* Default callback handlers */
|
||||||
PHP_ME(UConverter, toUCallback, php_converter_toUCallback_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, toUCallback, arginfo_class_UConverter_toUCallback, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, fromUCallback, php_converter_fromUCallback_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, fromUCallback, arginfo_class_UConverter_fromUCallback, ZEND_ACC_PUBLIC)
|
||||||
|
|
||||||
/* Core conversion workhorses */
|
/* Core conversion workhorses */
|
||||||
PHP_ME(UConverter, convert, php_converter_convert_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, convert, arginfo_class_UConverter_convert, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, transcode, php_converter_transcode_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME(UConverter, transcode, arginfo_class_UConverter_transcode, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
|
|
||||||
/* Error inspection */
|
/* Error inspection */
|
||||||
PHP_ME(UConverter, getErrorCode, php_converter_geterrorcode_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getErrorCode, arginfo_class_UConverter_getErrorCode, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(UConverter, getErrorMessage, php_converter_geterrormsg_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(UConverter, getErrorMessage, arginfo_class_UConverter_getErrorMessage, ZEND_ACC_PUBLIC)
|
||||||
|
|
||||||
/* Ennumeration and lookup */
|
/* Enumeration and lookup */
|
||||||
PHP_ME(UConverter, reasonText, php_converter_reasontext_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME(UConverter, reasonText, arginfo_class_UConverter_reasonText, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_ME(UConverter, getAvailable, php_converter_getavailable_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME(UConverter, getAvailable, arginfo_class_UConverter_getAvailable, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_ME(UConverter, getAliases, php_converter_getaliases_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME(UConverter, getAliases, arginfo_class_UConverter_getAliases, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_ME(UConverter, getStandards, php_converter_getstandards_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME(UConverter, getStandards, arginfo_class_UConverter_getStandards, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_FE_END
|
PHP_FE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
60
ext/intl/converter/converter.stub.php
Normal file
60
ext/intl/converter/converter.stub.php
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class UConverter
|
||||||
|
{
|
||||||
|
public function __construct(?string $destination_encoding = null, ?string $source_encoding = null) {}
|
||||||
|
|
||||||
|
/** @return string|false */
|
||||||
|
public function convert(string $str, bool $reverse = false) {}
|
||||||
|
|
||||||
|
/** @return string|null */
|
||||||
|
public function fromUCallback(int $reason, array $source, int $codePoint, &$error) {}
|
||||||
|
|
||||||
|
/** @return array|false|null */
|
||||||
|
public static function getAliases(string $name) {}
|
||||||
|
|
||||||
|
/** @return array */
|
||||||
|
public static function getAvailable() {}
|
||||||
|
|
||||||
|
/** @return string|false|null */
|
||||||
|
public function getDestinationEncoding() {}
|
||||||
|
|
||||||
|
/** @return int|false|null */
|
||||||
|
public function getDestinationType() {}
|
||||||
|
|
||||||
|
/** @return int */
|
||||||
|
public function getErrorCode() {}
|
||||||
|
|
||||||
|
/** @return string|null */
|
||||||
|
public function getErrorMessage() {}
|
||||||
|
|
||||||
|
/** @return string|false|null */
|
||||||
|
public function getSourceEncoding() {}
|
||||||
|
|
||||||
|
/** @return int|false|null */
|
||||||
|
public function getSourceType() {}
|
||||||
|
|
||||||
|
/** @return array|null */
|
||||||
|
public static function getStandards() {}
|
||||||
|
|
||||||
|
/** @return string|false|null */
|
||||||
|
public function getSubstChars() {}
|
||||||
|
|
||||||
|
/** @return string|false */
|
||||||
|
public static function reasonText(int $reason) {}
|
||||||
|
|
||||||
|
/** @return bool */
|
||||||
|
public function setDestinationEncoding(string $encoding) {}
|
||||||
|
|
||||||
|
/** @return bool */
|
||||||
|
public function setSourceEncoding(string $encoding) {}
|
||||||
|
|
||||||
|
/** @return bool */
|
||||||
|
public function setSubstChars(string $chars) {}
|
||||||
|
|
||||||
|
/** @return string|null */
|
||||||
|
public function toUCallback(int $reason, string $source, string $codeUnits, &$error) {}
|
||||||
|
|
||||||
|
/** @return string|false */
|
||||||
|
public static function transcode(string $str, string $toEncoding, string $fromEncoding, ?array $options = null) {}
|
||||||
|
}
|
69
ext/intl/converter/converter_arginfo.h
Normal file
69
ext/intl/converter/converter_arginfo.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/* This is a generated file, edit the .stub.php file instead. */
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, destination_encoding, IS_STRING, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, source_encoding, IS_STRING, 1)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_convert, 0, 0, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, reverse, _IS_BOOL, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_fromUCallback, 0, 0, 4)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, reason, IS_LONG, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, source, IS_ARRAY, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, codePoint, IS_LONG, 0)
|
||||||
|
ZEND_ARG_INFO(1, error)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_getAliases, 0, 0, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_getAvailable, 0, 0, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getDestinationEncoding arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getDestinationType arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getErrorCode arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getErrorMessage arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getSourceEncoding arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getSourceType arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getStandards arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_getSubstChars arginfo_class_UConverter_getAvailable
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_reasonText, 0, 0, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, reason, IS_LONG, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_setDestinationEncoding, 0, 0, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
#define arginfo_class_UConverter_setSourceEncoding arginfo_class_UConverter_setDestinationEncoding
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_setSubstChars, 0, 0, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, chars, IS_STRING, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_toUCallback, 0, 0, 4)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, reason, IS_LONG, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, codeUnits, IS_STRING, 0)
|
||||||
|
ZEND_ARG_INFO(1, error)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter_transcode, 0, 0, 3)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, toEncoding, IS_STRING, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, fromEncoding, IS_STRING, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 1)
|
||||||
|
ZEND_END_ARG_INFO()
|
Loading…
Add table
Add a link
Reference in a new issue