Browse Source

maintainability: pass current_alphabet as argument to TranslateLetter() instead of using global

master
Juho Hiltunen 7 years ago
parent
commit
f73ebfd126

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

return 0; 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 // get pronunciation for an isolated letter
// return number of bytes used by the letter // return number of bytes used by the letter

+ 3
- 1
src/libespeak-ng/numbers.h View File

#ifndef ESPEAK_NG_NUMBERS_H #ifndef ESPEAK_NG_NUMBERS_H
#define ESPEAK_NG_NUMBERS_H #define ESPEAK_NG_NUMBERS_H


#include "translate.h"

#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars); void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars);
int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab); 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 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 #ifdef __cplusplus

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

capitals |= 4; // speak charater code for unknown letters capitals |= 4; // speak charater code for unknown letters


while ((*word != ' ') && (*word != 0)) { while ((*word != ' ') && (*word != 0)) {
word += TranslateLetter(tr, word, phonemes, capitals | non_initial);
word += TranslateLetter(tr, word, phonemes, capitals | non_initial, current_alphabet);
posn++; posn++;
non_initial = true; non_initial = true;
if (phonemes[0] == phonSWITCH) { if (phonemes[0] == phonSWITCH) {
if (posn > 0) if (posn > 0)
non_initial = true; non_initial = true;


wordx += TranslateLetter(tr, wordx, unpron_phonemes, non_initial);
wordx += TranslateLetter(tr, wordx, unpron_phonemes, non_initial, current_alphabet);
posn++; posn++;
if (unpron_phonemes[0] == phonSWITCH) { if (unpron_phonemes[0] == phonSWITCH) {
// change to another language in order to translate this word // change to another language in order to translate this word

+ 0
- 1
src/libespeak-ng/translate.h View File

int flags; int flags;
} ALPHABET; } ALPHABET;


extern ALPHABET *current_alphabet;
// alphabet flags // alphabet flags
#define AL_DONT_NAME 0x01 // don't speak the alphabet name #define AL_DONT_NAME 0x01 // don't speak the alphabet name
#define AL_NOT_LETTERS 0x02 // don't use the language for speaking letters #define AL_NOT_LETTERS 0x02 // don't use the language for speaking letters

Loading…
Cancel
Save