normalizer.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifdef HAVE_CONFIG_H
  17. #include "config.h"
  18. #endif
  19. #include "normalizer_class.h"
  20. #include "normalizer.h"
  21. #include <unicode/utypes.h>
  22. #include <unicode/unorm.h>
  23. #include <unicode/ustring.h>
  24. /* {{{ normalizer_register_constants
  25. * Register constants common for the both (OO and procedural)
  26. * APIs.
  27. */
  28. void normalizer_register_constants( INIT_FUNC_ARGS )
  29. {
  30. if( !Normalizer_ce_ptr )
  31. {
  32. zend_error( E_ERROR, "Normalizer class not defined" );
  33. return;
  34. }
  35. #define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)
  36. #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC );
  37. #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
  38. /* Normalization form constants */
  39. NORMALIZER_EXPOSE_CLASS_CONST( NONE );
  40. NORMALIZER_EXPOSE_CLASS_CONST( FORM_D );
  41. NORMALIZER_EXPOSE_CLASS_CONST( NFD );
  42. NORMALIZER_EXPOSE_CLASS_CONST( FORM_KD );
  43. NORMALIZER_EXPOSE_CLASS_CONST( NFKD );
  44. NORMALIZER_EXPOSE_CLASS_CONST( FORM_C );
  45. NORMALIZER_EXPOSE_CLASS_CONST( NFC );
  46. NORMALIZER_EXPOSE_CLASS_CONST( FORM_KC );
  47. NORMALIZER_EXPOSE_CLASS_CONST( NFKC );
  48. #undef NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST
  49. #undef NORMALIZER_EXPOSE_CLASS_CONST
  50. #undef NORMALIZER_EXPOSE_CONST
  51. }
  52. /* }}} */
  53. /*
  54. * Local variables:
  55. * tab-width: 4
  56. * c-basic-offset: 4
  57. * End:
  58. * vim600: noet sw=4 ts=4 fdm=marker
  59. * vim<600: noet sw=4 ts=4
  60. */