From 57c7285ff958bba4deafa9d8a282e3d43e709470 Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sat, 17 Sep 2022 18:20:38 +0300 Subject: [PATCH] code cleanup: move ApplySpecialAttribute2() --- src/libespeak-ng/dictionary.c | 33 +------------------------------- src/libespeak-ng/translate.h | 2 -- src/libespeak-ng/translateword.c | 33 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/libespeak-ng/dictionary.c b/src/libespeak-ng/dictionary.c index 5d519981..8624e350 100644 --- a/src/libespeak-ng/dictionary.c +++ b/src/libespeak-ng/dictionary.c @@ -2214,7 +2214,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c if (letter == 0xe000+'(') { if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED]) pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED]; // a bracket, already spoken by AnnouncePunctuation() - } + } if (IsBracket(letter)) { if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE]) pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE]; @@ -2325,37 +2325,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c return 0; } -void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags) -{ - // apply after the translation is complete - - int ix; - int len; - char *p; - - len = strlen(phonemes); - - if (tr->langopts.param[LOPT_ALT] & 2) { - for (ix = 0; ix < (len-1); ix++) { - if (phonemes[ix] == phonSTRESS_P) { - p = &phonemes[ix+1]; - if ((dict_flags & FLAG_ALT2_TRANS) != 0) { - if (*p == PhonemeCode('E')) - *p = PhonemeCode('e'); - if (*p == PhonemeCode('O')) - *p = PhonemeCode('o'); - } else { - if (*p == PhonemeCode('e')) - *p = PhonemeCode('E'); - if (*p == PhonemeCode('o')) - *p = PhonemeCode('O'); - } - break; - } - } - } -} - int TransposeAlphabet(Translator *tr, char *text) { // transpose cyrillic alphabet (for example) into ascii (single byte) character codes diff --git a/src/libespeak-ng/translate.h b/src/libespeak-ng/translate.h index d8720314..f6b1069d 100644 --- a/src/libespeak-ng/translate.h +++ b/src/libespeak-ng/translate.h @@ -681,8 +681,6 @@ void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts); void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len); -void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags); - int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out); void TranslateClause(Translator *tr, int *tone, char **voice_change); diff --git a/src/libespeak-ng/translateword.c b/src/libespeak-ng/translateword.c index 9a820766..fbf10389 100644 --- a/src/libespeak-ng/translateword.c +++ b/src/libespeak-ng/translateword.c @@ -46,6 +46,7 @@ static void addPluralSuffixes(int flags, Translator *tr, char last_char, char *word_phonemes); +static void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags); static void ChangeWordStress(Translator *tr, char *word, int new_stress); static int CheckDottedAbbrev(char *word1); static int NonAsciiNumber(int letter); @@ -670,6 +671,38 @@ int TranslateWord3(Translator *tr, char *word_start, WORD_TAB *wtab, char *word_ } +void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags) +{ + // apply after the translation is complete + + int ix; + int len; + char *p; + + len = strlen(phonemes); + + if (tr->langopts.param[LOPT_ALT] & 2) { + for (ix = 0; ix < (len-1); ix++) { + if (phonemes[ix] == phonSTRESS_P) { + p = &phonemes[ix+1]; + if ((dict_flags & FLAG_ALT2_TRANS) != 0) { + if (*p == PhonemeCode('E')) + *p = PhonemeCode('e'); + if (*p == PhonemeCode('O')) + *p = PhonemeCode('o'); + } else { + if (*p == PhonemeCode('e')) + *p = PhonemeCode('E'); + if (*p == PhonemeCode('o')) + *p = PhonemeCode('O'); + } + break; + } + } + } +} + + static void ChangeWordStress(Translator *tr, char *word, int new_stress) { int ix;