xref: /php-src/ext/intl/php_intl.h (revision 01b3fc03)
1 /*
2    +----------------------------------------------------------------------+
3    | This source file is subject to version 3.01 of the PHP license,      |
4    | that is bundled with this package in the file LICENSE, and is        |
5    | available through the world-wide-web at the following url:           |
6    | https://www.php.net/license/3_01.txt                                 |
7    | If you did not receive a copy of the PHP license and are unable to   |
8    | obtain it through the world-wide-web, please send a note to          |
9    | license@php.net so we can mail you a copy immediately.               |
10    +----------------------------------------------------------------------+
11    | Authors: Vadim Savchuk <vsavchuk@productengine.com>                  |
12    |          Dmitry Lakhtyuk <dlakhtyuk@productengine.com>               |
13    |          Stanislav Malyshev <stas@zend.com>                          |
14    |          Kirti Velankar <kirtig@yahoo-inc.com>                       |
15    +----------------------------------------------------------------------+
16  */
17 
18 #ifndef PHP_INTL_H
19 #define PHP_INTL_H
20 
21 #include <php.h>
22 
23 /* Even if we're included from C++, don't introduce C++ definitions
24  * because we were included with extern "C". The effect would be that
25  * when the headers defined any method, they would do so with C linkage */
26 #undef U_SHOW_CPLUSPLUS_API
27 #define U_SHOW_CPLUSPLUS_API 0
28 #include "collator/collator_sort.h"
29 #include <unicode/ubrk.h>
30 #include "intl_error.h"
31 #include "Zend/zend_exceptions.h"
32 
33 extern zend_module_entry intl_module_entry;
34 #define phpext_intl_ptr &intl_module_entry
35 
36 #ifdef PHP_WIN32
37 #define PHP_INTL_API __declspec(dllexport)
38 #else
39 #define PHP_INTL_API
40 #endif
41 
42 #ifdef ZTS
43 #include "TSRM.h"
44 #endif
45 
46 ZEND_BEGIN_MODULE_GLOBALS(intl)
47 	struct UCollator *current_collator;
48 	char* default_locale;
49 	collator_compare_func_t compare_func;
50 	UBreakIterator* grapheme_iterator;
51 	intl_error g_error;
52 	zend_long error_level;
53 	bool use_exceptions;
54 ZEND_END_MODULE_GLOBALS(intl)
55 
56 #if defined(ZTS) && defined(COMPILE_DL_INTL)
57 ZEND_TSRMLS_CACHE_EXTERN()
58 #endif
59 
60 ZEND_EXTERN_MODULE_GLOBALS(intl)
61 /* Macro to access request-wide global variables. */
62 #define INTL_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(intl, v)
63 
64 PHP_MINIT_FUNCTION(intl);
65 PHP_MSHUTDOWN_FUNCTION(intl);
66 PHP_RINIT_FUNCTION(intl);
67 PHP_RSHUTDOWN_FUNCTION(intl);
68 PHP_MINFO_FUNCTION(intl);
69 
70 const char *intl_locale_get_default( void );
71 
72 #define PHP_INTL_VERSION PHP_VERSION
73 
74 #endif  /* PHP_INTL_H */
75