int php_uchar_minit(INIT_FUNC_ARGS) { zend_class_entry tmp, *ce; INIT_CLASS_ENTRY(tmp, "IntlChar", intlchar_methods); ce = zend_register_internal_class(&tmp); #define IC_CONSTL(name, val) \ zend_declare_class_constant_long(ce, name, strlen(name), val); zend_declare_class_constant_string(ce, "UNICODE_VERSION", sizeof("UNICODE_VERISON")-1, U_UNICODE_VERSION); IC_CONSTL("CODEPOINT_MIN", UCHAR_MIN_VALUE) IC_CONSTL("CODEPOINT_MAX", UCHAR_MAX_VALUE) IC_CONSTL("FOLD_CASE_DEFAULT", U_FOLD_CASE_DEFAULT) IC_CONSTL("FOLD_CASE_EXCLUDE_SPECIAL_I", U_FOLD_CASE_EXCLUDE_SPECIAL_I) zend_declare_class_constant_double(ce, "NO_NUMERIC_VALUE", sizeof("NO_NUMERIC_VALUE")-1, U_NO_NUMERIC_VALUE); /* All enums used by the uchar APIs. There are a LOT of them, * so they're separated out into include files, * leaving this source file for actual implementation. */ #define UPROPERTY(name) IC_CONSTL("PROPERTY_" #name, UCHAR_##name) #include "uproperty-enum.h" #undef UPROPERTY #define UCHARCATEGORY(name) IC_CONSTL("CHAR_CATEGORY_" #name, U_##name) #include "ucharcategory-enum.h" #undef UCHARCATEGORY #define UCHARDIRECTION(name) IC_CONSTL("CHAR_DIRECTION_" #name, U_##name) #include "uchardirection-enum.h" #undef UCHARDIRECTION #define UBLOCKCODE(name) IC_CONSTL("BLOCK_CODE_" #name, UBLOCK_##name) #include "ublockcode-enum.h" #undef UBLOCKCODE /* Smaller, self-destribing enums */ #define UOTHER(name) IC_CONSTL(#name, U_##name) #include "uother-enum.h" #undef UOTHER #undef IC_CONSTL #undef IC_CONSTS return SUCCESS; }
void IntlExtension::initUChar() { Native::registerClassConstant<KindOfStaticString> (s_IntlChar.get(), s_UNICODE_VERSION.get(), s_UNICODE_VERSION_value.get()); #define IC_CONSTL(name, val) Native::registerClassConstant<KindOfInt64> \ (s_IntlChar.get(), makeStaticString(name), val); IC_CONSTL("CODEPOINT_MIN", UCHAR_MIN_VALUE) IC_CONSTL("CODEPOINT_MAX", UCHAR_MAX_VALUE) /* All enums used by the uchar APIs. There are a LOT of them, * so they're separated out into include files, * leaving this source file for actual implementation. * * Note that these includes are shared between PHP and HHVM */ #define UPROPERTY(name) IC_CONSTL("PROPERTY_" #name, UCHAR_##name) #include "hphp/runtime/ext/icu/uproperty-enum.h" #undef UPROPERTY #define UCHARCATEGORY(name) IC_CONSTL("CHAR_CATEGORY_" #name, U_##name) #include "hphp/runtime/ext/icu/ucharcategory-enum.h" #undef UCHARCATEGORY #define UCHARDIRECTION(name) IC_CONSTL("CHAR_DIRECTION_" #name, U_##name) #include "hphp/runtime/ext/icu/uchardirection-enum.h" #undef UCHARDIRECTION #define UBLOCKCODE(name) IC_CONSTL("BLOCK_CODE_" #name, UBLOCK_##name) #include "hphp/runtime/ext/icu/ublockcode-enum.h" #undef UBLOCKCODE /* Smaller, self-destribing enums */ #define UOTHER(name) IC_CONSTL(#name, U_##name) #include "hphp/runtime/ext/icu/uother-enum.h" #undef UOTHER #undef IC_CONSTL // Methods returning bool/UChar32 and taking a single UChar32 argument #define UCHAR_ME(name) \ HHVM_NAMED_STATIC_ME(IntlChar, name, uchar_method<u_##name>) UCHAR_ME(isUAlphabetic); UCHAR_ME(isULowercase); UCHAR_ME(isUUppercase); UCHAR_ME(isUWhiteSpace); UCHAR_ME(islower); UCHAR_ME(isupper); UCHAR_ME(istitle); UCHAR_ME(isdigit); UCHAR_ME(isalpha); UCHAR_ME(isalnum); UCHAR_ME(isxdigit); UCHAR_ME(ispunct); UCHAR_ME(isgraph); UCHAR_ME(isblank); UCHAR_ME(isdefined); UCHAR_ME(isspace); UCHAR_ME(isJavaSpaceChar); UCHAR_ME(isWhitespace); UCHAR_ME(iscntrl); UCHAR_ME(isISOControl); UCHAR_ME(isprint); UCHAR_ME(isbase); UCHAR_ME(isMirrored); UCHAR_ME(isIDStart); UCHAR_ME(isIDPart); UCHAR_ME(isIDIgnorable); UCHAR_ME(isJavaIDStart); UCHAR_ME(isJavaIDPart); UCHAR_ME(charMirror); UCHAR_ME(tolower); UCHAR_ME(toupper); UCHAR_ME(totitle); #if U_ICU_VERSION_MAJOR_NUM >= 52 UCHAR_ME(getBidiPairedBracket); #endif /* ICU >= 52 */ #undef UCHAR_ME // Methods with unique signatures #define ICS_ME(name) HHVM_STATIC_ME(IntlChar, name) ICS_ME(chr); ICS_ME(ord); ICS_ME(hasBinaryProperty); ICS_ME(getIntPropertyValue); ICS_ME(getIntPropertyMinValue); ICS_ME(getIntPropertyMaxValue); ICS_ME(getNumericValue); ICS_ME(enumCharTypes); ICS_ME(getBlockCode); ICS_ME(getBlockCode); ICS_ME(charName); ICS_ME(charFromName); ICS_ME(enumCharNames); ICS_ME(getPropertyName); ICS_ME(getPropertyEnum); ICS_ME(getPropertyValueName); ICS_ME(getPropertyValueEnum); ICS_ME(foldCase); ICS_ME(digit); ICS_ME(forDigit); ICS_ME(charAge); ICS_ME(getUnicodeVersion); ICS_ME(getFC_NFKC_Closure); ICS_ME(charDirection); ICS_ME(charType); ICS_ME(getCombiningClass); ICS_ME(charDigitValue); #undef ICS_ME loadSystemlib("icu_uchar"); }