PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/ext/intl/grapheme/grapheme_util.h

http://github.com/infusion/PHP
C Header | 59 lines | 26 code | 16 blank | 17 comment | 2 complexity | 00a03cc3491c503c277580e863ce9924 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause
  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. #ifndef GRAPHEME_GRAPHEME_UTIL_H
  17. #define GRAPHEME_GRAPHEME_UTIL_H
  18. #include "php_intl.h"
  19. #include "intl_convert.h"
  20. /* get_break_interator: get a break iterator from the global structure */
  21. UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
  22. void
  23. grapheme_substr_ascii(char *str, int32_t str_len, int32_t f, int32_t l, int argc, char **sub_str, int *sub_str_len);
  24. int
  25. grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int f_ignore_case TSRMLS_DC);
  26. int
  27. grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int *puchar_pos, int f_ignore_case TSRMLS_DC);
  28. int grapheme_ascii_check(const unsigned char *day, int32_t len);
  29. int grapheme_split_string(const UChar *text, int32_t text_length, int boundary_array[], int boundary_array_len TSRMLS_DC );
  30. inline int32_t
  31. grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len);
  32. inline int32_t
  33. grapheme_memnstr_grapheme(UBreakIterator *bi, UChar *haystack, UChar *needle, int32_t needle_len, UChar *end);
  34. inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n);
  35. UChar *
  36. grapheme_get_haystack_offset(UBreakIterator* bi, UChar *uhaystack, int32_t uhaystack_len, int32_t offset);
  37. int32_t
  38. grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, unsigned char *needle, int32_t needle_len, int32_t offset);
  39. UBreakIterator*
  40. grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
  41. /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */
  42. #define OUTSIDE_STRING(offset, max_len) ( offset < INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
  43. #endif // GRAPHEME_GRAPHEME_UTIL_H