Browse Source

cleanup: join two adjacent if (only == false) blocks.

Note: The latter part is untested code.
master
Juho Hiltunen 2 years ago
parent
commit
c5fac3185c
1 changed files with 19 additions and 17 deletions
  1. 19
    17
      src/libespeak-ng/readclause.c

+ 19
- 17
src/libespeak-ng/readclause.c View File

ix = utf8_out(c, &single_letter[2]); ix = utf8_out(c, &single_letter[2]);
single_letter[2+ix] = 0; single_letter[2+ix] = 0;


if (only) {
if (only == true) {
string = &single_letter[2]; string = &single_letter[2];
LookupDictList(tr, &string, phonemes, flags, 0, NULL); LookupDictList(tr, &string, phonemes, flags, 0, NULL);
} else {
}

if (only == false) {
string = &single_letter[1]; string = &single_letter[1];
if (LookupDictList(tr, &string, phonemes, flags, 0, NULL) == 0) { if (LookupDictList(tr, &string, phonemes, flags, 0, NULL) == 0) {
// try _* then * // try _* then *
TranslateRules(tr, &single_letter[2], phonemes, sizeof(phonemes), NULL, 0, NULL); TranslateRules(tr, &single_letter[2], phonemes, sizeof(phonemes), NULL, 0, NULL);
} }
} }
}
if ((only == false) && ((phonemes[0] == 0) || (phonemes[0] == phonSWITCH)) && (tr->translator_name != L('e', 'n'))) {
// not found, try English
SetTranslator2(ESPEAKNG_DEFAULT_VOICE);
string = &single_letter[1];
single_letter[1] = '_';
if (LookupDictList(translator2, &string, phonemes, flags, 0, NULL) == 0) {
string = &single_letter[2];
LookupDictList(translator2, &string, phonemes, flags, 0, NULL);
}
if (phonemes[0])
lang_name = ESPEAKNG_DEFAULT_VOICE;
else
SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table
if (((phonemes[0] == 0) || (phonemes[0] == phonSWITCH)) && (tr->translator_name != L('e', 'n'))) {
// not found, try English
SetTranslator2(ESPEAKNG_DEFAULT_VOICE);
string = &single_letter[1];
single_letter[1] = '_';
if (LookupDictList(translator2, &string, phonemes, flags, 0, NULL) == 0) {
string = &single_letter[2];
LookupDictList(translator2, &string, phonemes, flags, 0, NULL);
}
if (phonemes[0])
lang_name = ESPEAKNG_DEFAULT_VOICE;
else
SelectPhonemeTable(voice->phoneme_tab_ix); // revert to original phoneme table
}
} }


if (phonemes[0]) { if (phonemes[0]) {

Loading…
Cancel
Save