xref: /PHP-5.3/ext/intl/normalizer/normalizer.c (revision 9762609c)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5                                                        |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | http://www.php.net/license/3_01.txt                                  |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Ed Batutis <ed@batutis.com>                                 |
14    +----------------------------------------------------------------------+
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include "normalizer_class.h"
22 #include "normalizer.h"
23 
24 #include <unicode/utypes.h>
25 #include <unicode/unorm.h>
26 #include <unicode/ustring.h>
27 
28 /* {{{ normalizer_register_constants
29  * Register constants common for the both (OO and procedural)
30  * APIs.
31  */
normalizer_register_constants(INIT_FUNC_ARGS)32 void normalizer_register_constants( INIT_FUNC_ARGS )
33 {
34 	if( !Normalizer_ce_ptr )
35 	{
36 		zend_error( E_ERROR, "Normalizer class not defined" );
37 		return;
38 	}
39 
40 	#define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)
41 	#define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC );
42 	#define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
43 
44 	/* Normalization form constants */
45 	NORMALIZER_EXPOSE_CLASS_CONST( NONE );
46 	NORMALIZER_EXPOSE_CLASS_CONST( FORM_D );
47 	NORMALIZER_EXPOSE_CLASS_CONST( NFD );
48 	NORMALIZER_EXPOSE_CLASS_CONST( FORM_KD );
49 	NORMALIZER_EXPOSE_CLASS_CONST( NFKD );
50 	NORMALIZER_EXPOSE_CLASS_CONST( FORM_C );
51 	NORMALIZER_EXPOSE_CLASS_CONST( NFC );
52 	NORMALIZER_EXPOSE_CLASS_CONST( FORM_KC );
53 	NORMALIZER_EXPOSE_CLASS_CONST( NFKC );
54 
55 	#undef NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST
56 	#undef NORMALIZER_EXPOSE_CLASS_CONST
57 	#undef NORMALIZER_EXPOSE_CONST
58 }
59 /* }}} */
60 
61 /*
62  * Local variables:
63  * tab-width: 4
64  * c-basic-offset: 4
65  * End:
66  * vim600: noet sw=4 ts=4 fdm=marker
67  * vim<600: noet sw=4 ts=4
68  */
69