From 9af96da469b8c38f9da2398413f739b7f211a285 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Tue, 2 May 2017 18:40:16 +0100 Subject: [PATCH] Make the encoding.h API public. --- .../espeak-ng}/encoding.h | 49 +++++++++++++++---- src/include/espeak-ng/espeak_ng.h | 31 ------------ src/libespeak-ng/compiledict.c | 2 +- src/libespeak-ng/dictionary.c | 2 +- src/libespeak-ng/encoding.c | 6 ++- src/libespeak-ng/espeak_api.c | 2 +- src/libespeak-ng/intonation.c | 2 +- src/libespeak-ng/numbers.c | 2 +- src/libespeak-ng/phonemelist.c | 2 +- src/libespeak-ng/readclause.c | 2 +- src/libespeak-ng/setlengths.c | 2 +- src/libespeak-ng/speech.c | 2 +- src/libespeak-ng/synth_mbrola.c | 2 +- src/libespeak-ng/synthdata.c | 2 +- src/libespeak-ng/synthesize.c | 2 +- src/libespeak-ng/tokenizer.c | 2 +- src/libespeak-ng/tr_languages.c | 2 +- src/libespeak-ng/translate.c | 2 +- src/libespeak-ng/voices.c | 2 +- tests/encoding.c | 2 +- tests/tokenizer.c | 2 +- 21 files changed, 62 insertions(+), 60 deletions(-) rename src/{libespeak-ng => include/espeak-ng}/encoding.h (65%) diff --git a/src/libespeak-ng/encoding.h b/src/include/espeak-ng/encoding.h similarity index 65% rename from src/libespeak-ng/encoding.h rename to src/include/espeak-ng/encoding.h index 05791cd4..640782a6 100644 --- a/src/libespeak-ng/encoding.h +++ b/src/include/espeak-ng/encoding.h @@ -22,47 +22,76 @@ extern "C" { #endif +typedef enum +{ + ESPEAKNG_ENCODING_UNKNOWN, + ESPEAKNG_ENCODING_US_ASCII, + ESPEAKNG_ENCODING_ISO_8859_1, + ESPEAKNG_ENCODING_ISO_8859_2, + ESPEAKNG_ENCODING_ISO_8859_3, + ESPEAKNG_ENCODING_ISO_8859_4, + ESPEAKNG_ENCODING_ISO_8859_5, + ESPEAKNG_ENCODING_ISO_8859_6, + ESPEAKNG_ENCODING_ISO_8859_7, + ESPEAKNG_ENCODING_ISO_8859_8, + ESPEAKNG_ENCODING_ISO_8859_9, + ESPEAKNG_ENCODING_ISO_8859_10, + ESPEAKNG_ENCODING_ISO_8859_11, + // ISO-8859-12 is not a valid encoding. + ESPEAKNG_ENCODING_ISO_8859_13, + ESPEAKNG_ENCODING_ISO_8859_14, + ESPEAKNG_ENCODING_ISO_8859_15, + ESPEAKNG_ENCODING_ISO_8859_16, + ESPEAKNG_ENCODING_KOI8_R, + ESPEAKNG_ENCODING_ISCII, + ESPEAKNG_ENCODING_UTF_8, + ESPEAKNG_ENCODING_ISO_10646_UCS_2, +} espeak_ng_ENCODING; + +ESPEAK_NG_API espeak_ng_ENCODING +espeak_ng_EncodingFromName(const char *encoding); + typedef struct espeak_ng_TEXT_DECODER_ espeak_ng_TEXT_DECODER; -espeak_ng_TEXT_DECODER * +ESPEAK_NG_API espeak_ng_TEXT_DECODER * create_text_decoder(void); -void +ESPEAK_NG_API void destroy_text_decoder(espeak_ng_TEXT_DECODER *decoder); -espeak_ng_STATUS +ESPEAK_NG_API espeak_ng_STATUS text_decoder_decode_string(espeak_ng_TEXT_DECODER *decoder, const char *string, int length, espeak_ng_ENCODING encoding); -espeak_ng_STATUS +ESPEAK_NG_API espeak_ng_STATUS text_decoder_decode_string_auto(espeak_ng_TEXT_DECODER *decoder, const char *string, int length, espeak_ng_ENCODING encoding); -espeak_ng_STATUS +ESPEAK_NG_API espeak_ng_STATUS text_decoder_decode_wstring(espeak_ng_TEXT_DECODER *decoder, const wchar_t *string, int length); -espeak_ng_STATUS +ESPEAK_NG_API espeak_ng_STATUS text_decoder_decode_string_multibyte(espeak_ng_TEXT_DECODER *decoder, const void *input, espeak_ng_ENCODING encoding, int flags); -int +ESPEAK_NG_API int text_decoder_eof(espeak_ng_TEXT_DECODER *decoder); -uint32_t +ESPEAK_NG_API uint32_t text_decoder_getc(espeak_ng_TEXT_DECODER *decoder); -uint32_t +ESPEAK_NG_API uint32_t text_decoder_peekc(espeak_ng_TEXT_DECODER *decoder); -const void * +ESPEAK_NG_API const void * text_decoder_get_buffer(espeak_ng_TEXT_DECODER *decoder); #ifdef __cplusplus diff --git a/src/include/espeak-ng/espeak_ng.h b/src/include/espeak-ng/espeak_ng.h index 12491cee..e25fdb35 100644 --- a/src/include/espeak-ng/espeak_ng.h +++ b/src/include/espeak-ng/espeak_ng.h @@ -184,37 +184,6 @@ espeak_ng_CompilePhonemeDataPath(long rate, FILE *log, espeak_ng_ERROR_CONTEXT *context); -/* eSpeak NG 1.49.2 */ - -typedef enum -{ - ESPEAKNG_ENCODING_UNKNOWN, - ESPEAKNG_ENCODING_US_ASCII, - ESPEAKNG_ENCODING_ISO_8859_1, - ESPEAKNG_ENCODING_ISO_8859_2, - ESPEAKNG_ENCODING_ISO_8859_3, - ESPEAKNG_ENCODING_ISO_8859_4, - ESPEAKNG_ENCODING_ISO_8859_5, - ESPEAKNG_ENCODING_ISO_8859_6, - ESPEAKNG_ENCODING_ISO_8859_7, - ESPEAKNG_ENCODING_ISO_8859_8, - ESPEAKNG_ENCODING_ISO_8859_9, - ESPEAKNG_ENCODING_ISO_8859_10, - ESPEAKNG_ENCODING_ISO_8859_11, - // ISO-8859-12 is not a valid encoding. - ESPEAKNG_ENCODING_ISO_8859_13, - ESPEAKNG_ENCODING_ISO_8859_14, - ESPEAKNG_ENCODING_ISO_8859_15, - ESPEAKNG_ENCODING_ISO_8859_16, - ESPEAKNG_ENCODING_KOI8_R, - ESPEAKNG_ENCODING_ISCII, - ESPEAKNG_ENCODING_UTF_8, - ESPEAKNG_ENCODING_ISO_10646_UCS_2, -} espeak_ng_ENCODING; - -ESPEAK_NG_API espeak_ng_ENCODING -espeak_ng_EncodingFromName(const char *encoding); - #ifdef __cplusplus } #endif diff --git a/src/libespeak-ng/compiledict.c b/src/libespeak-ng/compiledict.c index 7ce963b5..6fd74779 100644 --- a/src/libespeak-ng/compiledict.c +++ b/src/libespeak-ng/compiledict.c @@ -30,8 +30,8 @@ #include #include +#include -#include "encoding.h" #include "error.h" #include "speech.h" #include "phoneme.h" diff --git a/src/libespeak-ng/dictionary.c b/src/libespeak-ng/dictionary.c index 3706f658..5dee51cf 100644 --- a/src/libespeak-ng/dictionary.c +++ b/src/libespeak-ng/dictionary.c @@ -29,8 +29,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/encoding.c b/src/libespeak-ng/encoding.c index a9f19d89..122e9099 100644 --- a/src/libespeak-ng/encoding.c +++ b/src/libespeak-ng/encoding.c @@ -23,9 +23,9 @@ #include #include +#include #include "speech.h" -#include "encoding.h" #define LEADING_2_BITS 0xC0 // 0b11000000 #define UTF8_TAIL_BITS 0x80 // 0b10000000 @@ -688,6 +688,8 @@ static const encoding_t string_decoders[] = { { string_decoder_getc_iso_10646_ucs_2, NULL }, }; +#pragma GCC visibility push(default) + espeak_ng_TEXT_DECODER * create_text_decoder(void) { @@ -818,3 +820,5 @@ text_decoder_get_buffer(espeak_ng_TEXT_DECODER *decoder) return NULL; return decoder->current; } + +#pragma GCC visibility pop diff --git a/src/libespeak-ng/espeak_api.c b/src/libespeak-ng/espeak_api.c index 0d625df7..c50f4776 100644 --- a/src/libespeak-ng/espeak_api.c +++ b/src/libespeak-ng/espeak_api.c @@ -25,8 +25,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/intonation.c b/src/libespeak-ng/intonation.c index 52b538d4..946e89f3 100644 --- a/src/libespeak-ng/intonation.c +++ b/src/libespeak-ng/intonation.c @@ -26,8 +26,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/numbers.c b/src/libespeak-ng/numbers.c index b8685461..015cba47 100644 --- a/src/libespeak-ng/numbers.c +++ b/src/libespeak-ng/numbers.c @@ -29,8 +29,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/phonemelist.c b/src/libespeak-ng/phonemelist.c index fa41df19..5339161e 100644 --- a/src/libespeak-ng/phonemelist.c +++ b/src/libespeak-ng/phonemelist.c @@ -26,8 +26,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/readclause.c b/src/libespeak-ng/readclause.c index 483c584e..e14d71a6 100644 --- a/src/libespeak-ng/readclause.c +++ b/src/libespeak-ng/readclause.c @@ -33,9 +33,9 @@ #include #include +#include #include "error.h" -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/setlengths.c b/src/libespeak-ng/setlengths.c index 0e0f7da0..241ab658 100644 --- a/src/libespeak-ng/setlengths.c +++ b/src/libespeak-ng/setlengths.c @@ -26,8 +26,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c index 9f6aa600..368520db 100644 --- a/src/libespeak-ng/speech.c +++ b/src/libespeak-ng/speech.c @@ -46,8 +46,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/synth_mbrola.c b/src/libespeak-ng/synth_mbrola.c index 1f98677c..3e2031dc 100644 --- a/src/libespeak-ng/synth_mbrola.c +++ b/src/libespeak-ng/synth_mbrola.c @@ -29,8 +29,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/synthdata.c b/src/libespeak-ng/synthdata.c index bc56a2ba..4087197e 100644 --- a/src/libespeak-ng/synthdata.c +++ b/src/libespeak-ng/synthdata.c @@ -29,8 +29,8 @@ #include #include +#include -#include "encoding.h" #include "error.h" #include "speech.h" #include "phoneme.h" diff --git a/src/libespeak-ng/synthesize.c b/src/libespeak-ng/synthesize.c index 563191fd..48b14967 100644 --- a/src/libespeak-ng/synthesize.c +++ b/src/libespeak-ng/synthesize.c @@ -29,8 +29,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/tokenizer.c b/src/libespeak-ng/tokenizer.c index 5a8ecbcd..423ccb7b 100644 --- a/src/libespeak-ng/tokenizer.c +++ b/src/libespeak-ng/tokenizer.c @@ -25,9 +25,9 @@ #include #include +#include #include -#include "encoding.h" #include "tokenizer.h" #include "speech.h" #include "phoneme.h" diff --git a/src/libespeak-ng/tr_languages.c b/src/libespeak-ng/tr_languages.c index ecfaf0c1..6d1931ff 100644 --- a/src/libespeak-ng/tr_languages.c +++ b/src/libespeak-ng/tr_languages.c @@ -28,8 +28,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index 390901e3..a1cbf7fc 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -29,8 +29,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index 75fd1330..604f459d 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -36,8 +36,8 @@ #include #include +#include -#include "encoding.h" #include "speech.h" #include "phoneme.h" #include "synthesize.h" diff --git a/tests/encoding.c b/tests/encoding.c index c8810629..36763f2d 100644 --- a/tests/encoding.c +++ b/tests/encoding.c @@ -24,7 +24,7 @@ #include #include -#include "encoding.h" +#include void test_unbound_text_decoder() diff --git a/tests/tokenizer.c b/tests/tokenizer.c index 221eeb35..6275f31d 100644 --- a/tests/tokenizer.c +++ b/tests/tokenizer.c @@ -27,8 +27,8 @@ #include #include +#include -#include "encoding.h" #include "tokenizer.h" #include "speech.h" #include "phoneme.h"