diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index 958b0971..d51616a9 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -1790,80 +1790,6 @@ static int EmbeddedCommand(unsigned int *source_index_out) return 1; } -// handle .replace rule in xx_rules file -static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in, int *insert, int *wordflags) -{ - int ix; - unsigned int word; - unsigned int new_c, c2 = ' ', c_lower; - int upper_case = 0; - static bool ignore_next = false; - const unsigned int *replace_chars; - - if (ignore_next) { - ignore_next = false; - return 8; - } - if (c == 0) return 0; - - if ((replace_chars = tr->langopts.replace_chars) == NULL) - return c; - - // there is a list of character codes to be substituted with alternative codes - - if (iswupper(c_lower = c)) { - c_lower = towlower2(c, tr); - upper_case = 1; - } - - new_c = 0; - for (ix = 0; (word = replace_chars[ix]) != 0; ix += 2) { - if (c_lower == (word & 0xffff)) { - if ((word >> 16) == 0) { - new_c = replace_chars[ix+1]; - break; - } - if ((word >> 16) == (unsigned int)towlower2(next_in, tr)) { - new_c = replace_chars[ix+1]; - ignore_next = true; - break; - } - } - } - - if (new_c == 0) - return c; // no substitution - - if (new_c & 0xffe00000) { - // there is a second character to be inserted - // don't convert the case of the second character unless the next letter is also upper case - c2 = new_c >> 16; - if (upper_case && iswupper(next_in)) - c2 = ucd_toupper(c2); - *insert = c2; - new_c &= 0xffff; - } - - if (upper_case) - new_c = ucd_toupper(new_c); - - *wordflags |= FLAG_CHAR_REPLACED; - if (option_phonemes & espeakPHONEMES_TRACE) { - char msg[21] = {'R','e','p','l','a','c','e',':',' '}; - char *index = msg; - index += 9; - index += utf8_out(c, index); - *index++ = ' '; - *index++ = '>'; - *index++ = ' '; - index += utf8_out(new_c, index); - index += utf8_out(c2, index); - *index = 0; - fprintf(f_trans, "%s\n", msg); - } - return new_c; -} - static bool GetNextTranslateChars(const int **from, const int **to, bool next_step) { // Set pointers to next 'from' and 'to' part for replacement