locale.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. | Author: Kirti Velankar <kirtig@yahoo-inc.com> |
  14. +----------------------------------------------------------------------+
  15. */
  16. /* $Id$ */
  17. #ifdef HAVE_CONFIG_H
  18. #include "config.h"
  19. #endif
  20. #include "locale_class.h"
  21. #include "locale.h"
  22. #include <unicode/utypes.h>
  23. #include <unicode/uloc.h>
  24. #include <unicode/ustring.h>
  25. /* {{{ locale_register_constants
  26. * Register constants common for the both (OO and procedural)
  27. * APIs.
  28. */
  29. void locale_register_constants( INIT_FUNC_ARGS )
  30. {
  31. if( !Locale_ce_ptr )
  32. {
  33. zend_error( E_ERROR, "Locale class not defined" );
  34. return;
  35. }
  36. #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)
  37. #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC );
  38. #define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
  39. LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE );
  40. LOCALE_EXPOSE_CLASS_CONST( VALID_LOCALE );
  41. zend_declare_class_constant_null(Locale_ce_ptr, ZEND_STRS("DEFAULT_LOCALE") - 1 TSRMLS_CC);
  42. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "LANG_TAG", LOC_LANG_TAG);
  43. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "EXTLANG_TAG", LOC_EXTLANG_TAG);
  44. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "SCRIPT_TAG", LOC_SCRIPT_TAG);
  45. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "REGION_TAG", LOC_REGION_TAG);
  46. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "VARIANT_TAG",LOC_VARIANT_TAG);
  47. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "GRANDFATHERED_LANG_TAG",LOC_GRANDFATHERED_LANG_TAG);
  48. LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR( "PRIVATE_TAG",LOC_PRIVATE_TAG);
  49. #undef LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR
  50. #undef LOCALE_EXPOSE_CLASS_CONST
  51. #undef LOCALE_EXPOSE_CONST
  52. }
  53. /* }}} */
  54. /*
  55. * Local variables:
  56. * tab-width: 4
  57. * c-basic-offset: 4
  58. * End:
  59. * vim600: noet sw=4 ts=4 fdm=marker
  60. * vim<600: noet sw=4 ts=4
  61. */