From 64f12fec87d79325a37d9783c5b59f99704fec2c Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sat, 17 Sep 2022 17:22:01 +0300 Subject: [PATCH] code cleanup: move towlower2() --- src/libespeak-ng/common.c | 14 ++++++++++++-- src/libespeak-ng/common.h | 3 +++ src/libespeak-ng/compiledict.c | 1 - src/libespeak-ng/numbers.c | 2 +- src/libespeak-ng/readclause.c | 9 --------- src/libespeak-ng/readclause.h | 1 - 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/libespeak-ng/common.c b/src/libespeak-ng/common.c index 5698f284..f810ebbe 100644 --- a/src/libespeak-ng/common.c +++ b/src/libespeak-ng/common.c @@ -32,9 +32,10 @@ #include #include #include - +#include #include "common.h" +#include "translate.h" #pragma GCC visibility push(default) @@ -164,4 +165,13 @@ int utf8_in2(int *c, const char *buf, int backwards) } *c = c1; return n_bytes+1; -} \ No newline at end of file +} + +int towlower2(unsigned int c, Translator *translator) +{ + // check for non-standard upper to lower case conversions + if (c == 'I' && translator->langopts.dotless_i) + return 0x131; // I -> ı + + return ucd_tolower(c); +} diff --git a/src/libespeak-ng/common.h b/src/libespeak-ng/common.h index 7265a5eb..bb33e183 100644 --- a/src/libespeak-ng/common.h +++ b/src/libespeak-ng/common.h @@ -21,10 +21,13 @@ #define ESPEAK_NG_COMMON_H #include "espeak-ng/espeak_ng.h" +#include "translate.h" extern ESPEAK_NG_API int GetFileLength(const char *filename); extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); +int towlower2(unsigned int c, Translator *translator); // Supports Turkish I + ESPEAK_NG_API int utf8_in(int *c, const char *buf); int utf8_in2(int *c, const char *buf, int backwards); int utf8_out(unsigned int c, char *buf); diff --git a/src/libespeak-ng/compiledict.c b/src/libespeak-ng/compiledict.c index e830859f..14e027fc 100644 --- a/src/libespeak-ng/compiledict.c +++ b/src/libespeak-ng/compiledict.c @@ -39,7 +39,6 @@ #include "error.h" // for create_file_error_context #include "mnemonics.h" // for LookupMnemName, MNEM_TAB #include "phoneme.h" // for PHONEME_TAB_LIST, phonSWITCH, phone... -#include "readclause.h" // for towlower2 #include "speech.h" // for path_home #include "synthesize.h" // for Write4Bytes #include "translate.h" // for isspace2, IsDigit09, utf8_in, utf8_out diff --git a/src/libespeak-ng/numbers.c b/src/libespeak-ng/numbers.c index e0884393..dab57e75 100644 --- a/src/libespeak-ng/numbers.c +++ b/src/libespeak-ng/numbers.c @@ -35,7 +35,7 @@ #include "common.h" #include "dictionary.h" // for Lookup, TranslateRules, EncodePhonemes, Look... #include "phoneme.h" // for phonSWITCH, PHONEME_TAB, phonEND_WORD, phonP... -#include "readclause.h" // for WordToString2, towlower2 +#include "readclause.h" // for WordToString2 #include "synthdata.h" // for SelectPhonemeTable #include "synthesize.h" // for phoneme_tab #include "translate.h" // for Translator, LANGUAGE_OPTIONS, IsDigit09, WOR... diff --git a/src/libespeak-ng/readclause.c b/src/libespeak-ng/readclause.c index b6147033..03ce76a7 100644 --- a/src/libespeak-ng/readclause.c +++ b/src/libespeak-ng/readclause.c @@ -139,15 +139,6 @@ int is_str_totally_null(const char* str, int size) { return (*str == 0 && memcmp(str, str+1, size-1) == 0); } -int towlower2(unsigned int c, Translator *translator) -{ - // check for non-standard upper to lower case conversions - if (c == 'I' && translator->langopts.dotless_i) - return 0x131; // I -> ı - - return ucd_tolower(c); -} - static int IsRomanU(unsigned int c) { if ((c == 'I') || (c == 'V') || (c == 'X') || (c == 'L')) diff --git a/src/libespeak-ng/readclause.h b/src/libespeak-ng/readclause.h index bdcf15f9..c2d2ea3b 100644 --- a/src/libespeak-ng/readclause.h +++ b/src/libespeak-ng/readclause.h @@ -38,7 +38,6 @@ extern PARAM_STACK param_stack[]; int is_str_totally_null(const char* str, int size); int clause_type_from_codepoint(uint32_t c); -int towlower2(unsigned int c, Translator *translator); // Supports Turkish I int Eof(void); const char *WordToString2(unsigned int word); int Read4Bytes(FILE *f);