From: Sara Golemon Date: Wed, 20 Sep 2006 23:44:23 +0000 (+0000) Subject: Backfill protos for ext/unicode functions X-Git-Tag: RELEASE_1_0_0RC1~1604 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67af7e225cd8b670be22b53a2b25e81972ee1d90;p=php Backfill protos for ext/unicode functions --- diff --git a/ext/unicode/collator.c b/ext/unicode/collator.c index a4a808c947..b6e2a85861 100644 --- a/ext/unicode/collator.c +++ b/ext/unicode/collator.c @@ -163,11 +163,16 @@ static zval* collator_set_wrapper(zval *object, zend_collator *zcoll TSRMLS_DC) return object; } +/* {{{ proto Collator collator_create(string collator_name) U +Create a new collator object */ PHP_METHOD(collator, __construct) { zif_collator_create(INTERNAL_FUNCTION_PARAM_PASSTHRU); } +/* }}} */ +/* {{{ proto Collator collator_create(string collator_name) U +Create a new collator object */ PHP_FUNCTION(collator_create) { UErrorCode status = U_ZERO_ERROR; @@ -191,7 +196,10 @@ PHP_FUNCTION(collator_create) } collator_set_wrapper(object, zend_collator_create(ucoll) TSRMLS_CC); } +/* }}} */ +/* {{{ proto int collator_compare(Collator coll, string elementA, string elementB) U +Use a collator object to compare two elements */ PHP_FUNCTION(collator_compare) { zval *object; @@ -205,7 +213,10 @@ PHP_FUNCTION(collator_compare) collatorobj = (php_collator_obj *) zend_object_store_get_object(object TSRMLS_CC); RETURN_LONG(ucol_strcoll(collatorobj->zcoll->coll, string1, string1_len, string2, string2_len)); } +/* }}} */ +/* {{{ proto array collator_sort(Collator coll, array initialarray) U +Sort an array using a collator */ PHP_FUNCTION(collator_sort) { zval *object; @@ -230,7 +241,10 @@ PHP_FUNCTION(collator_sort) } UG(default_collator) = orig_collator; } +/* }}} */ +/* {{{ proto void collator_set_strength(Collator coll, int strength) U +Set the strength on a collator object */ PHP_FUNCTION(collator_set_strength) { zval *object; @@ -243,7 +257,10 @@ PHP_FUNCTION(collator_set_strength) collatorobj = (php_collator_obj *) zend_object_store_get_object(object TSRMLS_CC); ucol_setStrength(collatorobj->zcoll->coll, strength); } +/* }}} */ +/* {{{ proto int collator_get_strength(Collator coll) U +Returns the current collator strength */ PHP_FUNCTION(collator_get_strength) { zval *object; @@ -255,7 +272,10 @@ PHP_FUNCTION(collator_get_strength) collatorobj = (php_collator_obj *) zend_object_store_get_object(object TSRMLS_CC); RETURN_LONG(ucol_getStrength(collatorobj->zcoll->coll)); } +/* }}} */ +/* {{{ proto bool collator_set_attribute(Collator coll, int attribute, int value) U +Set a collator attribute */ PHP_FUNCTION(collator_set_attribute) { zval *object; @@ -271,7 +291,11 @@ PHP_FUNCTION(collator_set_attribute) ucol_setAttribute(collatorobj->zcoll->coll, attribute, value, &error); RETURN_BOOL(error == U_ZERO_ERROR ? 1 : 0); } +/* }}} */ + +/* {{{ proto int collator_get_attribute(Collator coll, int attribute) U +Read an attribute from a collator */ PHP_FUNCTION(collator_get_attribute) { zval *object; @@ -290,6 +314,7 @@ PHP_FUNCTION(collator_get_attribute) } RETURN_LONG(value); } +/* }}} */ /* {{{ proto Collator collator_get_default(void) U Returns default collator */ diff --git a/ext/unicode/property.c b/ext/unicode/property.c index bd4fc36ccb..3b48d9dc31 100644 --- a/ext/unicode/property.c +++ b/ext/unicode/property.c @@ -53,135 +53,208 @@ static void check_property_impl(INTERNAL_FUNCTION_PARAMETERS, prop_check_func_t /* {{{ C/POSIX migration functions */ +/* {{{ proto bool char_is_lower(string text) U +Determines if text is lowercase */ PHP_FUNCTION(char_is_lower) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_islower); } +/* }}} */ +/* {{{ proto bool char_is_upper(string text) U +Determines if text is uppercase */ PHP_FUNCTION(char_is_upper) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isupper); } +/* }}} */ +/* {{{ proto bool char_is_digit(string text) U +Determines if text is all digits */ PHP_FUNCTION(char_is_digit) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isdigit); } +/* }}} */ +/* {{{ proto bool char_is_alpha(string text) U +Determines if text is alpha */ PHP_FUNCTION(char_is_alpha) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isalpha); } +/* }}} */ +/* {{{ proto bool char_is_alnum(string text) U +Determines if text is alpha/numeric */ PHP_FUNCTION(char_is_alnum) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isalnum); } +/* }}} */ +/* {{{ proto bool char_is_xdigit(string text) U +Determines if text is hexits */ PHP_FUNCTION(char_is_xdigit) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isxdigit); } +/* }}} */ +/* {{{ proto bool char_is_punct(string text) U +Determines if text is punctuation */ PHP_FUNCTION(char_is_punct) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_ispunct); } +/* }}} */ +/* {{{ proto bool char_is_graph(string text) U +Determines if text is graphemes */ PHP_FUNCTION(char_is_graph) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isgraph); } +/* }}} */ +/* {{{ proto bool char_is_blank(string text) U +Determines if text is blank */ PHP_FUNCTION(char_is_blank) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isblank); } +/* }}} */ +/* {{{ proto bool char_is_space(string text) U +Determines if text is space(s) */ PHP_FUNCTION(char_is_space) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isspace); } +/* }}} */ +/* {{{ proto bool char_is_cntrl(string text) U +Determines if text is control characters */ PHP_FUNCTION(char_is_cntrl) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_iscntrl); } +/* }}} */ +/* {{{ proto bool char_is_print(string text) U +Determines if text is printable */ PHP_FUNCTION(char_is_print) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isprint); } +/* }}} */ /* }}} */ /* {{{ Additional binary property functions */ +/* {{{ proto bool char_is_defined(string text) U +Determines if text is defined (valid unicode points) */ PHP_FUNCTION(char_is_defined) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isdefined); } +/* }}} */ +/* {{{ proto bool char_is_id_start(string text) U +Determines if the specified character is permissible as the first character in an identifier according to Unicode */ PHP_FUNCTION(char_is_id_start) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isIDStart); } +/* }}} */ +/* {{{ proto bool char_is_id_part(string text) U +etermines if the specified characters are permissible in an identifier according to Java */ PHP_FUNCTION(char_is_id_part) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isIDPart); } +/* }}} */ +/* {{{ proto bool char_is_id_ignorable(string text) U +Determines if the specified characters should be regarded as an ignorable character in an identifier, according to Java */ PHP_FUNCTION(char_is_id_ignorable) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isIDIgnorable); } +/* }}} */ +/* {{{ proto bool char_is_iso_control(string text) U +Determines whether the specified code points are ISO control codes */ PHP_FUNCTION(char_is_iso_control) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isISOControl); } +/* }}} */ +/* {{{ proto bool char_is_mirrored(string text) U +Determines whether the code points have the Bidi_Mirrored property */ PHP_FUNCTION(char_is_mirrored) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isMirrored); } +/* }}} */ +/* {{{ proto bool char_is_base(string text) U +Determines if text consists of base characters */ PHP_FUNCTION(char_is_base) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isbase); } +/* }}} */ +/* {{{ proto bool char_is_whitespace(string text) U +Determines if text is whitespace */ PHP_FUNCTION(char_is_whitespace) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isUWhiteSpace); } +/* }}} */ +/* {{{ proto bool char_is_alphabetic(string text) U +Determines if text is alphabetic */ PHP_FUNCTION(char_is_alphabetic) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isUAlphabetic); } +/* }}} */ +/* {{{ proto bool char_is_uppercase(string text) U +Determines if text is uppercase */ PHP_FUNCTION(char_is_uppercase) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isUUppercase); } +/* }}} */ +/* {{{ proto bool char_is_lowercase (string text) U +Determines if text is lowercase */ PHP_FUNCTION(char_is_lowercase) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_isULowercase); } +/* }}} */ +/* {{{ proto bool char_is_titlecase(string text) U +Determines whether the specified code points are titlecase letters */ PHP_FUNCTION(char_is_titlecase) { check_property_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, u_istitle); } - +/* }}} */ /* }}} */ /* {{{ Single character properties */ +/* {{{ poto float char_get_numeric_value(char text) U +Get the numeric value for a Unicode code point as defined in the Unicode Character Database */ PHP_FUNCTION(char_get_numeric_value) { UChar *str; @@ -200,7 +273,10 @@ PHP_FUNCTION(char_get_numeric_value) RETURN_DOUBLE(u_getNumericValue(ch)); } +/* }}} */ +/* {{{ proto int char_get_combining_class(char text) U +Returns the combining class of the first code point in text */ PHP_FUNCTION(char_get_combining_class) { UChar *str; @@ -219,7 +295,10 @@ PHP_FUNCTION(char_get_combining_class) RETURN_LONG((long)u_getCombiningClass(ch)); } +/* }}} */ +/* {{{ proto int char_get_digit_value(char text[, int radix]) U +Returns the decimal digit value of a decimal digit character (optionally in a specific radix). */ PHP_FUNCTION(char_get_digit_value) { UChar *str; @@ -247,7 +326,10 @@ PHP_FUNCTION(char_get_digit_value) RETURN_LONG(u_charDigitValue(ch)); } } +/* }}} */ +/* {{{ proto char char_get_mirrored(char c) U +Maps the specified character to a "mirror-image" character */ PHP_FUNCTION(char_get_mirrored) { UChar *str; @@ -266,7 +348,10 @@ PHP_FUNCTION(char_get_mirrored) RETURN_UCHAR32(u_charMirror(ch)); } +/* }}} */ +/* {{{ proto int char_get_direction(char c) U +Returns the bidirectional category value for the code point, which is used in the Unicode bidirectional algorithm (UAX #9 http://www.unicode.org/reports/tr9/) */ PHP_FUNCTION(char_get_direction) { UChar *str; @@ -285,7 +370,10 @@ PHP_FUNCTION(char_get_direction) RETURN_LONG((long)u_charDirection(ch)); } +/* }}} */ +/* {{{ proto string char_get_age(char c) U +Get the "age" of the code point */ PHP_FUNCTION(char_get_age) { UChar *str; @@ -309,7 +397,10 @@ PHP_FUNCTION(char_get_age) RETURN_ASCII_STRING(buf, ZSTR_DUPLICATE); } +/* }}} */ +/* {{{ proto int char_get_type(char c) U +Returns the general category value for the code point */ PHP_FUNCTION(char_get_type) { UChar *str; @@ -328,7 +419,10 @@ PHP_FUNCTION(char_get_type) RETURN_LONG(u_charType(ch)); } +/* }}} */ +/* {{{ proto bool char_is_valid(char c) U +Determines if c is a valid Unicode point */ PHP_FUNCTION(char_is_valid) { UChar *str; @@ -347,7 +441,10 @@ PHP_FUNCTION(char_is_valid) RETURN_BOOL(U_IS_UNICODE_CHAR(ch)); } +/* }}} */ +/* {{{ proto char char_from_digit(int digit[, int radix = 10]) U +Get the character associated with a digit */ PHP_FUNCTION(char_from_digit) { int digit; @@ -372,7 +469,10 @@ PHP_FUNCTION(char_from_digit) RETURN_UCHAR32(ch); } +/* }}} */ +/* {{{ proto char char_from_name(string charname[, bool extended = false]) U +Translate a human readable character name into a codepoint */ PHP_FUNCTION(char_from_name) { void *name; @@ -414,7 +514,10 @@ PHP_FUNCTION(char_from_name) RETURN_FALSE; } } +/* }}} */ +/* {{{ proto string char_get_name(char c[, bool extended = false]) U +Get the human readable name associated with a character */ PHP_FUNCTION(char_get_name) { UChar *str; @@ -454,11 +557,14 @@ PHP_FUNCTION(char_get_name) RETURN_ASCII_STRINGL(buf, buf_len, ZSTR_AUTOFREE); } +/* }}} */ /* }}} */ /* {{{ Other property functions */ +/* {{{ proto bool char_has_binary_property(string text, int property) U +Determines if the characters in text all have the binary property specified */ PHP_FUNCTION(char_has_binary_property) { UChar *str = NULL; @@ -486,7 +592,10 @@ PHP_FUNCTION(char_has_binary_property) RETURN_BOOL(result); } +/* }}} */ +/* {{{ proto int char_get_property_value(char c, int property) U +Get the value of a property associated with a character */ PHP_FUNCTION(char_get_property_value) { UChar *str; @@ -511,7 +620,10 @@ PHP_FUNCTION(char_get_property_value) RETURN_LONG(u_getIntPropertyValue(ch, (UProperty)prop)); } } +/* }}} */ +/* {{{ proto int char_get_property_min_value(int property) U +Get the minimum value associated with a property */ PHP_FUNCTION(char_get_property_min_value) { long prop; @@ -522,7 +634,10 @@ PHP_FUNCTION(char_get_property_min_value) RETURN_LONG(u_getIntPropertyMinValue((UProperty)prop)); } +/* }}} */ +/* {{{ proto int char_get_property_max_value(int property) U +Get the maximum value associated with a property */ PHP_FUNCTION(char_get_property_max_value) { long prop; @@ -533,7 +648,10 @@ PHP_FUNCTION(char_get_property_max_value) RETURN_LONG(u_getIntPropertyMaxValue((UProperty)prop)); } +/* }}} */ +/* {{{ proto string char_get_property_name(int property) U +Get the name associated with a property */ PHP_FUNCTION(char_get_property_name) { long prop; @@ -555,7 +673,10 @@ PHP_FUNCTION(char_get_property_name) RETURN_FALSE; } } +/* }}} */ +/* {{{ proto int char_get_property_min_value(string property_name) U +Get ID of a given property name */ PHP_FUNCTION(char_get_property_from_name) { void *name; @@ -585,7 +706,10 @@ PHP_FUNCTION(char_get_property_from_name) RETURN_LONG(prop); } +/* }}} */ +/* {{{ proto string char_get_property_value_name(int property, int value[, int name_choice]) U +Get the name of a property value */ PHP_FUNCTION(char_get_property_value_name) { long prop; @@ -608,7 +732,10 @@ PHP_FUNCTION(char_get_property_value_name) RETURN_FALSE; } } +/* }}} */ +/* {{{ proto int char_get_property_value_from_name(int property, string value_name) U +Get the value ID associated with a property's value name */ PHP_FUNCTION(char_get_property_value_from_name) { long prop; @@ -639,6 +766,7 @@ PHP_FUNCTION(char_get_property_value_from_name) RETURN_LONG(value); } +/* }}} */ /* }}} */ @@ -724,6 +852,9 @@ static UBool php_enum_char_type_range(const void *context, return result; } +/* {{{ proto bool char_enum_names(callback Callback, int start, int limit[, int extended = false]) U +Enumerate all assigned Unicode characters between the start and limit code points (start inclusive, limit exclusive) +and call a function for each, passing the code point value and the character name. */ PHP_FUNCTION(char_enum_names) { zval *callback; @@ -783,7 +914,10 @@ PHP_FUNCTION(char_enum_names) RETURN_FALSE; } } +/* }}} */ +/* {{{ proto bool char_enum_types(callback Callback) U +Enumerate the character types calling Callback for each type range */ PHP_FUNCTION(char_enum_types) { zval *callback; @@ -829,6 +963,8 @@ PHP_FUNCTION(char_enum_types) RETURN_TRUE; } +/* }}} */ + /* }}} */ diff --git a/ext/unicode/transform.c b/ext/unicode/transform.c index 4f9f5cd68c..cbda48b255 100644 --- a/ext/unicode/transform.c +++ b/ext/unicode/transform.c @@ -18,6 +18,8 @@ #include "php_unicode.h" +/* {{{ proto string str_transliterate(string str, string from, string to[, string variant]) U +Transliterate a string using the alphabet provided */ PHP_FUNCTION(str_transliterate) { UChar *str, *from, *to, *variant = NULL; @@ -81,6 +83,7 @@ PHP_FUNCTION(str_transliterate) RETURN_UNICODEL(result, result_len, 0); } +/* }}} */ /* * Local variables: diff --git a/ext/unicode/unicode.c b/ext/unicode/unicode.c index 9e67e121e4..65ca1083ce 100644 --- a/ext/unicode/unicode.c +++ b/ext/unicode/unicode.c @@ -232,6 +232,8 @@ PHP_FUNCTION(unicode_get_subst_char) } /* }}} */ +/* {{{ proto callback unicode_set_error_handler(callback new_callback) U +Set (or clear) the unicode conversion error handler */ PHP_FUNCTION(unicode_set_error_handler) { zval *error_handler; @@ -274,7 +276,11 @@ PHP_FUNCTION(unicode_set_error_handler) RETURN_NULL(); } } +/* }}} */ +/* {{{ proto bool unicode_restore_error_handler(void) U +Restores the active error handler to the one which was previously active +(Before the last unicode_set_error_handler() call) */ PHP_FUNCTION(unicode_restore_error_handler) { if (UG(conv_error_handler)) { @@ -291,6 +297,7 @@ PHP_FUNCTION(unicode_restore_error_handler) } RETURN_TRUE; } +/* }}} */ /* {{{ unicode_functions[] */ zend_function_entry unicode_functions[] = {