Esempio n. 1
0
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;
}
Esempio n. 2
0
/* {{{ Miscellaneous constants */
static void php_register_misc_constants(TSRMLS_D)
{
	zend_declare_class_constant_double(u_const_ce, "NO_NUMERIC_VALUE",
									   sizeof("NO_NUMERIC_VALUE")-1, U_NO_NUMERIC_VALUE TSRMLS_CC);

	/* Min and max codepoint values */
	REGISTER_U_CONST(UCHAR_MIN_VALUE);
	REGISTER_U_CONST(UCHAR_MAX_VALUE);

	/* Property name constants */
	REGISTER_U_CONST(U_SHORT_PROPERTY_NAME);
	REGISTER_U_CONST(U_LONG_PROPERTY_NAME);

	/* Case folding constants */
	REGISTER_U_CONST(U_FOLD_CASE_DEFAULT);
	REGISTER_U_CONST(U_FOLD_CASE_EXCLUDE_SPECIAL_I);
}