intl_common.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. +----------------------------------------------------------------------+
  15. */
  16. #ifndef INTL_COMMON_H
  17. #define INTL_COMMON_H
  18. /* Auxiliary macros */
  19. BEGIN_EXTERN_C()
  20. #include <php.h>
  21. END_EXTERN_C()
  22. #include <unicode/utypes.h>
  23. #ifndef UBYTES
  24. # define UBYTES(len) ((len) * sizeof(UChar))
  25. #endif
  26. #ifndef eumalloc
  27. # define eumalloc(size) (UChar*)safe_emalloc(size, sizeof(UChar), 0)
  28. #endif
  29. #ifndef eurealloc
  30. # define eurealloc(ptr, size) (UChar*)erealloc((ptr), size * sizeof(UChar))
  31. #endif
  32. #define USIZE(data) sizeof((data))/sizeof(UChar)
  33. #define UCHARS(len) ((len) / sizeof(UChar))
  34. #define INTL_ZSTR_VAL(str) (UChar*) ZSTR_VAL(str)
  35. #define INTL_ZSTR_LEN(str) UCHARS(ZSTR_LEN(str))
  36. BEGIN_EXTERN_C()
  37. extern zend_class_entry *IntlException_ce_ptr;
  38. END_EXTERN_C()
  39. #endif /* INTL_COMMON_H */