Browse Source

maintainability: pass Translator as to towlower2() instead of using a global

master
Juho Hiltunen 7 years ago
parent
commit
b23e8a7269

+ 1
- 1
src/libespeak-ng/compiledict.c View File

if (c2 == 0) if (c2 == 0)
break; break;
if (iswupper(c2)) if (iswupper(c2))
utf8_out(towlower2(c2), p);
utf8_out(towlower2(c2, translator), p);
else else
all_upper_case = false; all_upper_case = false;
p += ix; p += ix;

+ 1
- 1
src/libespeak-ng/numbers.c View File

if (iswupper(letter)) if (iswupper(letter))
Lookup(tr, "_cap", capital); Lookup(tr, "_cap", capital);
} }
letter = towlower2(letter);
letter = towlower2(letter, tr);
LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1); LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1);


if (ph_buf[0] == 0) { if (ph_buf[0] == 0) {

+ 1
- 1
src/libespeak-ng/readclause.c View File

return CLAUSE_NONE; return CLAUSE_NONE;
} }


int towlower2(unsigned int c)
int towlower2(unsigned int c, Translator *translator)
{ {
// check for non-standard upper to lower case conversions // check for non-standard upper to lower case conversions
if (c == 'I' && translator->langopts.dotless_i) if (c == 'I' && translator->langopts.dotless_i)

+ 1
- 1
src/libespeak-ng/readclause.h View File

extern PARAM_STACK param_stack[]; extern PARAM_STACK param_stack[];


int clause_type_from_codepoint(uint32_t c); 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); int Eof(void);
const char *WordToString2(unsigned int word); const char *WordToString2(unsigned int word);
int Read4Bytes(FILE *f); int Read4Bytes(FILE *f);

+ 5
- 5
src/libespeak-ng/translate.c View File

// there is a list of character codes to be substituted with alternative codes // there is a list of character codes to be substituted with alternative codes


if (iswupper(c_lower = c)) { if (iswupper(c_lower = c)) {
c_lower = towlower2(c);
c_lower = towlower2(c, tr);
upper_case = 1; upper_case = 1;
} }


new_c = replace_chars[ix+1]; new_c = replace_chars[ix+1];
break; break;
} }
if ((word >> 16) == (unsigned int)towlower2(next_in)) {
if ((word >> 16) == (unsigned int)towlower2(next_in, tr)) {
new_c = replace_chars[ix+1]; new_c = replace_chars[ix+1];
ignore_next = true; ignore_next = true;
break; break;
if ((option_sayas2 == SAYAS_KEY) && (c != ' ')) { if ((option_sayas2 == SAYAS_KEY) && (c != ' ')) {
if ((prev_in == ' ') && (next_in == ' ')) if ((prev_in == ' ') && (next_in == ' '))
option_sayas2 = SAYAS_SINGLE_CHARS; // single character, speak its name option_sayas2 = SAYAS_SINGLE_CHARS; // single character, speak its name
c = towlower2(c);
c = towlower2(c, tr);
} }




} }


if (iswupper(c)) { if (iswupper(c)) {
c = towlower2(c);
c = towlower2(c, tr);


if ((j = tr->langopts.param[LOPT_CAPS_IN_WORD]) > 0) { if ((j = tr->langopts.param[LOPT_CAPS_IN_WORD]) > 0) {
if ((j == 2) && (syllable_marked == false)) { if ((j == 2) && (syllable_marked == false)) {
// lower case followed by upper case in a word // lower case followed by upper case in a word
if (UpperCaseInWord(tr, &sbuf[ix], c) == 1) { if (UpperCaseInWord(tr, &sbuf[ix], c) == 1) {
// convert to lower case and continue // convert to lower case and continue
c = towlower2(c);
c = towlower2(c, tr);
} else { } else {
c = ' '; // lower case followed by upper case, treat as new word c = ' '; // lower case followed by upper case, treat as new word
space_inserted = true; space_inserted = true;

Loading…
Cancel
Save