| 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 |
|
| 20 |
#include <stdint.h> |
| 21 |
|
| 22 |
#ifdef __cplusplus |
| 23 |
extern "C" |
| 24 |
{ |
| 25 |
#endif |
| 26 |
|
| 27 |
typedef enum |
| 28 |
{ |
| 29 |
ESPEAKNG_ENCODING_UNKNOWN, |
| 30 |
ESPEAKNG_ENCODING_US_ASCII, |
| 31 |
ESPEAKNG_ENCODING_ISO_8859_1, |
| 32 |
ESPEAKNG_ENCODING_ISO_8859_2, |
| 33 |
ESPEAKNG_ENCODING_ISO_8859_3, |
| 34 |
ESPEAKNG_ENCODING_ISO_8859_4, |
| 35 |
ESPEAKNG_ENCODING_ISO_8859_5, |
| 36 |
ESPEAKNG_ENCODING_ISO_8859_6, |
| 37 |
ESPEAKNG_ENCODING_ISO_8859_7, |
| 38 |
ESPEAKNG_ENCODING_ISO_8859_8, |
| 39 |
ESPEAKNG_ENCODING_ISO_8859_9, |
| 40 |
ESPEAKNG_ENCODING_ISO_8859_10, |
| 41 |
ESPEAKNG_ENCODING_ISO_8859_11, |
| 42 |
// ISO-8859-12 is not a valid encoding. |
| 43 |
ESPEAKNG_ENCODING_ISO_8859_13, |
| 44 |
ESPEAKNG_ENCODING_ISO_8859_14, |
| 45 |
ESPEAKNG_ENCODING_ISO_8859_15, |
| 46 |
ESPEAKNG_ENCODING_ISO_8859_16, |
| 47 |
ESPEAKNG_ENCODING_KOI8_R, |
| 48 |
ESPEAKNG_ENCODING_ISCII, |
| 49 |
ESPEAKNG_ENCODING_UTF_8, |
| 50 |
ESPEAKNG_ENCODING_ISO_10646_UCS_2, |
| 51 |
} espeak_ng_ENCODING; |
| 52 |
|
| 53 |
ESPEAK_NG_API espeak_ng_ENCODING |
| 54 |
espeak_ng_EncodingFromName(const char *encoding); |
| 55 |
|
| 56 |
typedef struct espeak_ng_TEXT_DECODER_ espeak_ng_TEXT_DECODER; |
| 57 |
|
| 58 |
ESPEAK_NG_API espeak_ng_TEXT_DECODER * |
| 59 |
create_text_decoder(void); |
| 60 |
|
| 61 |
ESPEAK_NG_API void |
| 62 |
destroy_text_decoder(espeak_ng_TEXT_DECODER *decoder); |
| 63 |
|
| 64 |
ESPEAK_NG_API espeak_ng_STATUS |
| 65 |
text_decoder_decode_string(espeak_ng_TEXT_DECODER *decoder, |
| 66 |
const char *string, |
| 67 |
int length, |
| 68 |
espeak_ng_ENCODING encoding); |
| 69 |
|
| 70 |
ESPEAK_NG_API espeak_ng_STATUS |
| 71 |
text_decoder_decode_string_auto(espeak_ng_TEXT_DECODER *decoder, |
| 72 |
const char *string, |
| 73 |
int length, |
| 74 |
espeak_ng_ENCODING encoding); |
| 75 |
|
| 76 |
ESPEAK_NG_API espeak_ng_STATUS |
| 77 |
text_decoder_decode_wstring(espeak_ng_TEXT_DECODER *decoder, |
| 78 |
const wchar_t *string, |
| 79 |
int length); |
| 80 |
|
| 81 |
ESPEAK_NG_API espeak_ng_STATUS |
| 82 |
text_decoder_decode_string_multibyte(espeak_ng_TEXT_DECODER *decoder, |
| 83 |
const void *input, |
| 84 |
espeak_ng_ENCODING encoding, |
| 85 |
int flags); |
| 86 |
|
| 87 |
ESPEAK_NG_API int |
| 88 |
text_decoder_eof(espeak_ng_TEXT_DECODER *decoder); |
| 89 |
|
| 90 |
ESPEAK_NG_API uint32_t |
| 91 |
text_decoder_getc(espeak_ng_TEXT_DECODER *decoder); |
| 92 |
|
| 93 |
ESPEAK_NG_API uint32_t |
| 94 |
text_decoder_peekc(espeak_ng_TEXT_DECODER *decoder); |
| 95 |
|
| 96 |
ESPEAK_NG_API const void * |
| 97 |
text_decoder_get_buffer(espeak_ng_TEXT_DECODER *decoder); |
| 98 |
|
| 99 |
#ifdef __cplusplus |
| 100 |
} |
| 101 |
#endif |
| 102 |
|
| 103 |
#endif |