encoding.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (C) 2017 Reece H. Dunn
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, see: <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef ESPEAK_NG_ENCODING_H
  18. #define ESPEAK_NG_ENCODING_H
  19. #include <stdint.h>
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. typedef enum
  25. {
  26. ESPEAKNG_ENCODING_UNKNOWN,
  27. ESPEAKNG_ENCODING_US_ASCII,
  28. ESPEAKNG_ENCODING_ISO_8859_1,
  29. ESPEAKNG_ENCODING_ISO_8859_2,
  30. ESPEAKNG_ENCODING_ISO_8859_3,
  31. ESPEAKNG_ENCODING_ISO_8859_4,
  32. ESPEAKNG_ENCODING_ISO_8859_5,
  33. ESPEAKNG_ENCODING_ISO_8859_6,
  34. ESPEAKNG_ENCODING_ISO_8859_7,
  35. ESPEAKNG_ENCODING_ISO_8859_8,
  36. ESPEAKNG_ENCODING_ISO_8859_9,
  37. ESPEAKNG_ENCODING_ISO_8859_10,
  38. ESPEAKNG_ENCODING_ISO_8859_11,
  39. // ISO-8859-12 is not a valid encoding.
  40. ESPEAKNG_ENCODING_ISO_8859_13,
  41. ESPEAKNG_ENCODING_ISO_8859_14,
  42. ESPEAKNG_ENCODING_ISO_8859_15,
  43. ESPEAKNG_ENCODING_ISO_8859_16,
  44. ESPEAKNG_ENCODING_KOI8_R,
  45. ESPEAKNG_ENCODING_ISCII,
  46. ESPEAKNG_ENCODING_UTF_8,
  47. ESPEAKNG_ENCODING_ISO_10646_UCS_2,
  48. } espeak_ng_ENCODING;
  49. ESPEAK_NG_API espeak_ng_ENCODING
  50. espeak_ng_EncodingFromName(const char *encoding);
  51. typedef struct espeak_ng_TEXT_DECODER_ espeak_ng_TEXT_DECODER;
  52. ESPEAK_NG_API espeak_ng_TEXT_DECODER *
  53. create_text_decoder(void);
  54. ESPEAK_NG_API void
  55. destroy_text_decoder(espeak_ng_TEXT_DECODER *decoder);
  56. ESPEAK_NG_API espeak_ng_STATUS
  57. text_decoder_decode_string(espeak_ng_TEXT_DECODER *decoder,
  58. const char *string,
  59. int length,
  60. espeak_ng_ENCODING encoding);
  61. ESPEAK_NG_API espeak_ng_STATUS
  62. text_decoder_decode_string_auto(espeak_ng_TEXT_DECODER *decoder,
  63. const char *string,
  64. int length,
  65. espeak_ng_ENCODING encoding);
  66. ESPEAK_NG_API espeak_ng_STATUS
  67. text_decoder_decode_wstring(espeak_ng_TEXT_DECODER *decoder,
  68. const wchar_t *string,
  69. int length);
  70. ESPEAK_NG_API espeak_ng_STATUS
  71. text_decoder_decode_string_multibyte(espeak_ng_TEXT_DECODER *decoder,
  72. const void *input,
  73. espeak_ng_ENCODING encoding,
  74. int flags);
  75. ESPEAK_NG_API int
  76. text_decoder_eof(espeak_ng_TEXT_DECODER *decoder);
  77. ESPEAK_NG_API uint32_t
  78. text_decoder_getc(espeak_ng_TEXT_DECODER *decoder);
  79. ESPEAK_NG_API uint32_t
  80. text_decoder_peekc(espeak_ng_TEXT_DECODER *decoder);
  81. ESPEAK_NG_API const void *
  82. text_decoder_get_buffer(espeak_ng_TEXT_DECODER *decoder);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif