mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-04 06:32:20 +00:00
maintainability: pass Translator as to towlower2() instead of using a global
This commit is contained in:
@@ -591,7 +591,7 @@ static int compile_line(char *linebuf, char *dict_line, int n_dict_line, int *ha
|
||||
if (c2 == 0)
|
||||
break;
|
||||
if (iswupper(c2))
|
||||
utf8_out(towlower2(c2), p);
|
||||
utf8_out(towlower2(c2, translator), p);
|
||||
else
|
||||
all_upper_case = false;
|
||||
p += ix;
|
||||
|
||||
@@ -709,7 +709,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALP
|
||||
if (iswupper(letter))
|
||||
Lookup(tr, "_cap", capital);
|
||||
}
|
||||
letter = towlower2(letter);
|
||||
letter = towlower2(letter, tr);
|
||||
LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1);
|
||||
|
||||
if (ph_buf[0] == 0) {
|
||||
|
||||
@@ -132,7 +132,7 @@ int clause_type_from_codepoint(uint32_t c)
|
||||
return CLAUSE_NONE;
|
||||
}
|
||||
|
||||
int towlower2(unsigned int c)
|
||||
int towlower2(unsigned int c, Translator *translator)
|
||||
{
|
||||
// check for non-standard upper to lower case conversions
|
||||
if (c == 'I' && translator->langopts.dotless_i)
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct {
|
||||
extern PARAM_STACK param_stack[];
|
||||
|
||||
int clause_type_from_codepoint(uint32_t c);
|
||||
int towlower2(unsigned int c); // Supports Turkish I
|
||||
int towlower2(unsigned int c, Translator *translator); // Supports Turkish I
|
||||
int Eof(void);
|
||||
const char *WordToString2(unsigned int word);
|
||||
int Read4Bytes(FILE *f);
|
||||
|
||||
@@ -1816,7 +1816,7 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
|
||||
// there is a list of character codes to be substituted with alternative codes
|
||||
|
||||
if (iswupper(c_lower = c)) {
|
||||
c_lower = towlower2(c);
|
||||
c_lower = towlower2(c, tr);
|
||||
upper_case = 1;
|
||||
}
|
||||
|
||||
@@ -1827,7 +1827,7 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
|
||||
new_c = replace_chars[ix+1];
|
||||
break;
|
||||
}
|
||||
if ((word >> 16) == (unsigned int)towlower2(next_in)) {
|
||||
if ((word >> 16) == (unsigned int)towlower2(next_in, tr)) {
|
||||
new_c = replace_chars[ix+1];
|
||||
ignore_next = true;
|
||||
break;
|
||||
@@ -2146,7 +2146,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
if ((option_sayas2 == SAYAS_KEY) && (c != ' ')) {
|
||||
if ((prev_in == ' ') && (next_in == ' '))
|
||||
option_sayas2 = SAYAS_SINGLE_CHARS; // single character, speak its name
|
||||
c = towlower2(c);
|
||||
c = towlower2(c, tr);
|
||||
}
|
||||
|
||||
|
||||
@@ -2284,7 +2284,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
}
|
||||
|
||||
if (iswupper(c)) {
|
||||
c = towlower2(c);
|
||||
c = towlower2(c, tr);
|
||||
|
||||
if ((j = tr->langopts.param[LOPT_CAPS_IN_WORD]) > 0) {
|
||||
if ((j == 2) && (syllable_marked == false)) {
|
||||
@@ -2297,7 +2297,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
// lower case followed by upper case in a word
|
||||
if (UpperCaseInWord(tr, &sbuf[ix], c) == 1) {
|
||||
// convert to lower case and continue
|
||||
c = towlower2(c);
|
||||
c = towlower2(c, tr);
|
||||
} else {
|
||||
c = ' '; // lower case followed by upper case, treat as new word
|
||||
space_inserted = true;
|
||||
|
||||
Reference in New Issue
Block a user