Back to index

php5  5.3.10
locale.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | This source file is subject to version 3.01 of the PHP license,      |
00006    | that is bundled with this package in the file LICENSE, and is        |
00007    | available through the world-wide-web at the following url:           |
00008    | http://www.php.net/license/3_01.txt                                  |
00009    | If you did not receive a copy of the PHP license and are unable to   |
00010    | obtain it through the world-wide-web, please send a note to          |
00011    | license@php.net so we can mail you a copy immediately.               |
00012    +----------------------------------------------------------------------+
00013    | Author: Kirti Velankar <kirtig@yahoo-inc.com>                        |
00014    +----------------------------------------------------------------------+
00015 */
00016 
00017 /* $Id: locale.c 264111 2008-08-03 11:33:45Z jani $ */
00018 
00019 #ifdef HAVE_CONFIG_H
00020 #include "config.h"
00021 #endif
00022 
00023 #include "locale_class.h"
00024 #include "locale.h"
00025 
00026 #include <unicode/utypes.h>
00027 #include <unicode/uloc.h>
00028 #include <unicode/ustring.h>
00029 
00030 /* {{{ locale_register_constants
00031  * Register constants common for the both (OO and procedural)
00032  * APIs.
00033  */
00034 void locale_register_constants( INIT_FUNC_ARGS )
00035 {
00036        if( !Locale_ce_ptr )
00037        {
00038               zend_error( E_ERROR, "Locale class not defined" );
00039               return;
00040        }
00041 
00042        #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)
00043        #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC );
00044        #define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
00045 
00046        LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE );
00047        LOCALE_EXPOSE_CLASS_CONST( VALID_LOCALE );
00048 
00049        zend_declare_class_constant_null(Locale_ce_ptr, ZEND_STRS("DEFAULT_LOCALE") - 1 TSRMLS_CC);
00050 
00051        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "LANG_TAG", LOC_LANG_TAG);
00052        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "EXTLANG_TAG", LOC_EXTLANG_TAG);
00053        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "SCRIPT_TAG", LOC_SCRIPT_TAG);
00054        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "REGION_TAG", LOC_REGION_TAG);
00055        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "VARIANT_TAG",LOC_VARIANT_TAG);
00056        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "GRANDFATHERED_LANG_TAG",LOC_GRANDFATHERED_LANG_TAG);
00057        LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "PRIVATE_TAG",LOC_PRIVATE_TAG);
00058 
00059        #undef LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR
00060        #undef LOCALE_EXPOSE_CLASS_CONST
00061        #undef LOCALE_EXPOSE_CONST
00062 }
00063 /* }}} */
00064 
00065 /*
00066  * Local variables:
00067  * tab-width: 4
00068  * c-basic-offset: 4
00069  * End:
00070  * vim600: noet sw=4 ts=4 fdm=marker
00071  * vim<600: noet sw=4 ts=4
00072  */