mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
maintainability: pass current_alphabet as argument to TranslateLetter() instead of using global
This commit is contained in:
@@ -664,7 +664,7 @@ int IsSuperscript(int letter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALPHABET *current_alphabet)
|
||||
{
|
||||
// get pronunciation for an isolated letter
|
||||
// return number of bytes used by the letter
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef ESPEAK_NG_NUMBERS_H
|
||||
#define ESPEAK_NG_NUMBERS_H
|
||||
|
||||
#include "translate.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
@@ -32,7 +34,7 @@ int IsSuperscript(int letter);
|
||||
void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars);
|
||||
int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab);
|
||||
int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control);
|
||||
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control);
|
||||
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALPHABET *current_alphabet);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -459,7 +459,7 @@ static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes,
|
||||
capitals |= 4; // speak charater code for unknown letters
|
||||
|
||||
while ((*word != ' ') && (*word != 0)) {
|
||||
word += TranslateLetter(tr, word, phonemes, capitals | non_initial);
|
||||
word += TranslateLetter(tr, word, phonemes, capitals | non_initial, current_alphabet);
|
||||
posn++;
|
||||
non_initial = true;
|
||||
if (phonemes[0] == phonSWITCH) {
|
||||
@@ -770,7 +770,7 @@ static int TranslateWord3(Translator *tr, char *word_start, WORD_TAB *wtab, char
|
||||
if (posn > 0)
|
||||
non_initial = true;
|
||||
|
||||
wordx += TranslateLetter(tr, wordx, unpron_phonemes, non_initial);
|
||||
wordx += TranslateLetter(tr, wordx, unpron_phonemes, non_initial, current_alphabet);
|
||||
posn++;
|
||||
if (unpron_phonemes[0] == phonSWITCH) {
|
||||
// change to another language in order to translate this word
|
||||
|
||||
@@ -281,7 +281,6 @@ typedef struct {
|
||||
int flags;
|
||||
} ALPHABET;
|
||||
|
||||
extern ALPHABET *current_alphabet;
|
||||
// alphabet flags
|
||||
#define AL_DONT_NAME 0x01 // don't speak the alphabet name
|
||||
#define AL_NOT_LETTERS 0x02 // don't use the language for speaking letters
|
||||
|
||||
Reference in New Issue
Block a user