mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-02 14:04:27 +00:00
Remove parentheses around return statements.
This commit is contained in:
+9
-9
@@ -204,7 +204,7 @@ int OpenWavFile(char *path, int rate)
|
||||
};
|
||||
|
||||
if (path == NULL)
|
||||
return (2);
|
||||
return 2;
|
||||
|
||||
while (isspace(*path)) path++;
|
||||
|
||||
@@ -218,7 +218,7 @@ int OpenWavFile(char *path, int rate)
|
||||
|
||||
if (f_wavfile == NULL) {
|
||||
fprintf(stderr, "Can't write to: '%s'\n", path);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ int OpenWavFile(char *path, int rate)
|
||||
Write4Bytes(f_wavfile, rate);
|
||||
Write4Bytes(f_wavfile, rate * 2);
|
||||
fwrite(&wave_hdr[32], 1, 12, f_wavfile);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -257,11 +257,11 @@ static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events)
|
||||
{
|
||||
char fname[210];
|
||||
|
||||
if (quiet) return (0); // -q quiet mode
|
||||
if (quiet) return 0; // -q quiet mode
|
||||
|
||||
if (wav == NULL) {
|
||||
CloseWavFile();
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (events->type != 0) {
|
||||
@@ -283,10 +283,10 @@ static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events)
|
||||
if (samples_split > 0) {
|
||||
sprintf(fname, "%s_%.2d%s", wavefile, wavefile_count+1, filetype);
|
||||
if (OpenWavFile(fname, samplerate) != 0)
|
||||
return (1);
|
||||
return 1;
|
||||
} else {
|
||||
if (OpenWavFile(wavefile, samplerate) != 0)
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events)
|
||||
samples_total += numsamples;
|
||||
fwrite(wav, numsamples*2, 1, f_wavfile);
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -768,5 +768,5 @@ int main(int argc, char **argv)
|
||||
|
||||
if (f_phonemes_out != stdout)
|
||||
fclose(f_phonemes_out); // needed for WinCE
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -439,11 +439,11 @@ static const char *KeyToMnem(keywtab_t *ktab, int type, int value)
|
||||
while (ktab->mnem != NULL) {
|
||||
if (ktab->data == value) {
|
||||
if ((type == -1) || (type == ktab->type))
|
||||
return (ktab->mnem);
|
||||
return ktab->mnem;
|
||||
}
|
||||
ktab++;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void DecompilePhoneme(FILE *f_out, PHONEME_TAB *ph, int compile_phoneme)
|
||||
@@ -745,7 +745,7 @@ static int ref_sorter(char **a, char **b)
|
||||
if (ix != 0)
|
||||
return ix;
|
||||
|
||||
return (p1->ph_mnemonic - p2->ph_mnemonic);
|
||||
return p1->ph_mnemonic - p2->ph_mnemonic;
|
||||
}
|
||||
|
||||
|
||||
@@ -855,7 +855,7 @@ static FILE *fopen_log(FILE *f_log, const char *fname, const char *access)
|
||||
if (f_log != NULL)
|
||||
fprintf(f_log, "Can't access (%s) file '%s'\n", access, fname);
|
||||
}
|
||||
return (f);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -867,7 +867,7 @@ static unsigned int StringToWord(const char *string)
|
||||
unsigned int word;
|
||||
|
||||
if (string == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
word = 0;
|
||||
for (ix = 0; ix < 4; ix++) {
|
||||
@@ -875,7 +875,7 @@ static unsigned int StringToWord(const char *string)
|
||||
c = string[ix];
|
||||
word |= (c << (ix*8));
|
||||
}
|
||||
return (word);
|
||||
return word;
|
||||
}
|
||||
|
||||
|
||||
@@ -948,7 +948,7 @@ static int LookupPhoneme(const char *string, int control)
|
||||
unsigned int word;
|
||||
|
||||
if (strcmp(string, "NULL") == 0)
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
ix = strlen(string);
|
||||
if ((ix == 0) || (ix > 4)) {
|
||||
@@ -966,7 +966,7 @@ static int LookupPhoneme(const char *string, int control)
|
||||
use = 0;
|
||||
for (ix = start; ix < n_phcodes; ix++) {
|
||||
if (phoneme_tab2[ix].mnemonic == word)
|
||||
return (ix);
|
||||
return ix;
|
||||
|
||||
if ((use == 0) && (phoneme_tab2[ix].mnemonic == 0)) {
|
||||
use = ix;
|
||||
@@ -975,9 +975,9 @@ static int LookupPhoneme(const char *string, int control)
|
||||
|
||||
if (use == 0) {
|
||||
if (control == 0)
|
||||
return (-1);
|
||||
return -1;
|
||||
if (n_phcodes >= N_PHONEME_TAB-1)
|
||||
return (-1); // phoneme table is full
|
||||
return -1; // phoneme table is full
|
||||
use = n_phcodes++;
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ static int LookupPhoneme(const char *string, int control)
|
||||
phoneme_tab2[use].mnemonic = word;
|
||||
phoneme_tab2[use].type = phINVALID;
|
||||
phoneme_tab2[use].program = linenum; // for error report if the phoneme remains undeclared
|
||||
return (use);
|
||||
return use;
|
||||
}
|
||||
|
||||
|
||||
@@ -996,7 +996,7 @@ static unsigned int get_char()
|
||||
c = fgetc(f_in);
|
||||
if (c == '\n')
|
||||
linenum++;
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
|
||||
static void unget_char(unsigned int c)
|
||||
@@ -1012,7 +1012,7 @@ int CheckNextChar()
|
||||
int c;
|
||||
while (((c = get_char()) == ' ') || (c == '\t')) ;
|
||||
unget_char(c);
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,12 +1046,12 @@ static int NextItem(int type)
|
||||
}
|
||||
}
|
||||
if (feof(f_in))
|
||||
return (-2);
|
||||
return -2;
|
||||
|
||||
if (c == '(') {
|
||||
if (type == tOPENBRACKET)
|
||||
return (1);
|
||||
return (-1);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ix = 0;
|
||||
@@ -1082,7 +1082,7 @@ static int NextItem(int type)
|
||||
unget_char(c);
|
||||
|
||||
if (type == tSTRING) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((type == tNUMBER) || (type == tSIGNEDNUMBER)) {
|
||||
@@ -1105,7 +1105,7 @@ static int NextItem(int type)
|
||||
acc += (*p - '0');
|
||||
p++;
|
||||
}
|
||||
return (acc * sign);
|
||||
return acc * sign;
|
||||
}
|
||||
|
||||
|
||||
@@ -1114,17 +1114,17 @@ static int NextItem(int type)
|
||||
while (pk->mnem != NULL) {
|
||||
if (strcmp(item_string, pk->mnem) == 0) {
|
||||
item_type = pk->type;
|
||||
return (pk->data);
|
||||
return pk->data;
|
||||
}
|
||||
pk++;
|
||||
}
|
||||
item_type = -1;
|
||||
return (-1); // keyword not found
|
||||
return -1; // keyword not found
|
||||
}
|
||||
if (type == tPHONEMEMNEM) {
|
||||
return (LookupPhoneme(item_string, 2));
|
||||
return LookupPhoneme(item_string, 2);
|
||||
}
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1141,7 +1141,7 @@ static int NextItemMax(int max)
|
||||
error(msg, NULL);
|
||||
value = max;
|
||||
}
|
||||
return (value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,12 +1162,12 @@ static int NextItemBrackets(int type, int control)
|
||||
|
||||
value = NextItem(type);
|
||||
if ((control & 2) && (item_terminator == ','))
|
||||
return (value);
|
||||
return value;
|
||||
|
||||
if (item_terminator != ')') {
|
||||
error("Expected ')'", NULL);
|
||||
}
|
||||
return (value);
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,7 @@ static int Range(int value, int divide, int min, int max)
|
||||
value = max;
|
||||
if (value < min)
|
||||
value = min;
|
||||
return (value - min);
|
||||
return value - min;
|
||||
}
|
||||
|
||||
|
||||
@@ -1300,7 +1300,7 @@ int CompileVowelTransition(int which)
|
||||
prog_out[3] = word2;
|
||||
prog_out += 4;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1331,7 +1331,7 @@ int LoadSpect(const char *path, int control)
|
||||
spectseq = SpectSeqCreate();
|
||||
if (spectseq == NULL) {
|
||||
Error("Failed to create SpectSeq");
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/../phsource/%s", path_home, path);
|
||||
@@ -1340,7 +1340,7 @@ int LoadSpect(const char *path, int control)
|
||||
if (spectseq->frames == NULL) {
|
||||
error("Bad vowel file, no frames: '%s'", path);
|
||||
SpectSeqDestroy(spectseq);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// do we need additional klatt data ?
|
||||
@@ -1481,7 +1481,7 @@ int LoadSpect(const char *path, int control)
|
||||
}
|
||||
|
||||
SpectSeqDestroy(spectseq);
|
||||
return (displ);
|
||||
return displ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1552,13 +1552,13 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
error("WAV file is not mono: %s", fname);
|
||||
}
|
||||
remove(fname_temp);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f = fopen(fname_temp, "rb");
|
||||
if (f == NULL) {
|
||||
error("Can't read temp file: %s", fname_temp);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
if (f_report != NULL)
|
||||
fprintf(f_report, "resampled %s\n", fname);
|
||||
@@ -1634,7 +1634,7 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
fclose(f);
|
||||
remove(fname_temp);
|
||||
}
|
||||
return (displ | 0x800000); // set bit 23 to indicate a wave file rather than a spectrum
|
||||
return displ | 0x800000; // set bit 23 to indicate a wave file rather than a spectrum
|
||||
}
|
||||
|
||||
|
||||
@@ -1658,7 +1658,7 @@ static int LoadEnvelope(FILE *f, const char *fname)
|
||||
n_envelopes++;
|
||||
}
|
||||
|
||||
return (displ);
|
||||
return displ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1677,7 +1677,7 @@ static int Hash8(const char *string)
|
||||
chars++;
|
||||
}
|
||||
|
||||
return ((hash+chars) & 0xff);
|
||||
return (hash+chars) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
@@ -1742,7 +1742,7 @@ static int LoadEnvelope2(FILE *f, const char *fname)
|
||||
displ = ftell(f_phdata);
|
||||
fwrite(env, 1, 128, f_phdata);
|
||||
|
||||
return (displ);
|
||||
return displ;
|
||||
}
|
||||
|
||||
static int LoadDataFile(const char *path, int control)
|
||||
@@ -1759,9 +1759,9 @@ static int LoadDataFile(const char *path, int control)
|
||||
char buf[sizeof(path_home)+150];
|
||||
|
||||
if (strcmp(path, "NULL") == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
if (strcmp(path, "DFT") == 0)
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
count_references++;
|
||||
|
||||
@@ -1783,7 +1783,7 @@ static int LoadDataFile(const char *path, int control)
|
||||
sprintf(buf, "%s/../phsource/%s.wav", path_home, path);
|
||||
if ((f = fopen(buf, "rb")) == NULL) {
|
||||
error("Can't read file: %s", path);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1825,7 +1825,7 @@ static int LoadDataFile(const char *path, int control)
|
||||
ref_hash_tab[hash] = p2;
|
||||
}
|
||||
|
||||
return (addr);
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1866,7 +1866,7 @@ static int CompileToneSpec(void)
|
||||
*prog_out++ = amp_env;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1904,7 +1904,7 @@ int CompileSound(int keyword, int isvowel)
|
||||
|
||||
*prog_out++ = sound_instns[keyword-kFMT] + ((value & 0xff) << 4) + ((addr >> 16) & 0xf);
|
||||
*prog_out++ = addr & 0xffff;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1941,7 +1941,7 @@ int CompileIf(int elif)
|
||||
word2 = 0;
|
||||
if (prog_out >= prog_out_max) {
|
||||
error("Phoneme program too large", NULL);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((key = NextItem(tCONDITION)) < 0)
|
||||
@@ -1989,7 +1989,7 @@ int CompileIf(int elif)
|
||||
error("Unexpected keyword '%s'", item_string);
|
||||
|
||||
if ((strcmp(item_string, "phoneme") == 0) || (strcmp(item_string, "endphoneme") == 0))
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// output the word
|
||||
@@ -2031,7 +2031,7 @@ int CompileIf(int elif)
|
||||
if_stack[if_level].p_then = prog_out;
|
||||
*prog_out++ = i_JUMP_FALSE;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2072,7 +2072,7 @@ int CompileElse(void)
|
||||
|
||||
if (if_level < 1) {
|
||||
error("ELSE not expected", NULL);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (if_stack[if_level].returned == 0) {
|
||||
@@ -2091,7 +2091,7 @@ int CompileElse(void)
|
||||
if_stack[if_level].p_else = ref;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2099,12 +2099,12 @@ int CompileElif(void)
|
||||
{
|
||||
if (if_level < 1) {
|
||||
error("ELIF not expected", NULL);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CompileElse();
|
||||
CompileIf(1);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2116,7 +2116,7 @@ int CompileEndif(void)
|
||||
|
||||
if (if_level < 1) {
|
||||
error("ENDIF not expected", NULL);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FillThen(0);
|
||||
@@ -2136,7 +2136,7 @@ int CompileEndif(void)
|
||||
}
|
||||
|
||||
if_level--;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2148,14 +2148,14 @@ static int CompileSwitch(int type)
|
||||
|
||||
if (type == 0) {
|
||||
// check the instructions in the Switch
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (type == 1)
|
||||
*prog_out++ = i_SWITCH_PREVVOWEL+6;
|
||||
if (type == 2)
|
||||
*prog_out++ = i_SWITCH_NEXTVOWEL+6;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2166,11 +2166,11 @@ static PHONEME_TAB_LIST *FindPhonemeTable(const char *string)
|
||||
|
||||
for (ix = 0; ix < n_phoneme_tabs; ix++) {
|
||||
if (strcmp(phoneme_tab_list2[ix].name, string) == 0) {
|
||||
return (&phoneme_tab_list2[ix]);
|
||||
return &phoneme_tab_list2[ix];
|
||||
}
|
||||
}
|
||||
error("Unknown phoneme table: '%s'", string);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -2185,7 +2185,7 @@ static PHONEME_TAB *FindPhoneme(const char *string)
|
||||
|
||||
// is this the name of a phoneme which is in scope
|
||||
if ((strlen(string) <= 4) && ((ix = LookupPhoneme(string, 0)) != -1)) {
|
||||
return (&phoneme_tab2[ix]);
|
||||
return &phoneme_tab2[ix];
|
||||
}
|
||||
|
||||
// no, treat the name as phonemetable/phoneme
|
||||
@@ -2196,18 +2196,18 @@ static PHONEME_TAB *FindPhoneme(const char *string)
|
||||
|
||||
phtab = FindPhonemeTable(buf);
|
||||
if (phtab == NULL) {
|
||||
return (NULL); // phoneme table not found
|
||||
return NULL; // phoneme table not found
|
||||
}
|
||||
|
||||
mnem = StringToWord(phname);
|
||||
for (ix = 1; ix < 256; ix++) {
|
||||
if (mnem == phtab->phoneme_tab_ptr[ix].mnemonic) {
|
||||
return (&phtab->phoneme_tab_ptr[ix]);
|
||||
return &phtab->phoneme_tab_ptr[ix];
|
||||
}
|
||||
}
|
||||
|
||||
error("Phoneme reference not found: '%s'", string);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -2316,13 +2316,13 @@ int CompilePhoneme(int compile_phoneme)
|
||||
NextItem(tSTRING);
|
||||
if (compile_phoneme) {
|
||||
phcode = LookupPhoneme(item_string, 1); // declare phoneme if not already there
|
||||
if (phcode == -1) return (0);
|
||||
if (phcode == -1) return 0;
|
||||
phoneme_out = &phoneme_tab2[phcode];
|
||||
} else {
|
||||
// declare a procedure
|
||||
if (n_procs >= N_PROCS) {
|
||||
error("Too many procedures", NULL);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
strcpy(proc_names[n_procs], item_string);
|
||||
phoneme_out = &phoneme_out2;
|
||||
@@ -2666,7 +2666,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
fwrite(prog_buf, sizeof(USHORT), prog_out - prog_buf, f_phindex);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3158,7 +3158,7 @@ MNEM_TAB envelope_names[] = {
|
||||
|
||||
int LookupEnvelopeName(const char *name)
|
||||
{
|
||||
return (LookupMnem(envelope_names, name));
|
||||
return LookupMnem(envelope_names, name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -168,8 +168,8 @@ int isspace2(unsigned int c)
|
||||
int c2;
|
||||
|
||||
if (((c2 = (c & 0xff)) == 0) || (c > ' '))
|
||||
return (0);
|
||||
return (1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ static FILE *fopen_log(const char *fname, const char *access)
|
||||
if (f_log != NULL)
|
||||
fprintf(f_log, "Can't access (%s) file '%s'\n", access, fname);
|
||||
}
|
||||
return (f);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,10 +192,10 @@ const char *LookupMnemName(MNEM_TAB *table, const int value)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (table->value == value)
|
||||
return (table->mnem);
|
||||
return table->mnem;
|
||||
table++;
|
||||
}
|
||||
return (""); /* not found */
|
||||
return ""; /* not found */
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ char *DecodeRule(const char *group_chars, int group_length, char *rule, int cont
|
||||
while (ix < 8)
|
||||
output[ix++] = ' ';
|
||||
output[ix] = 0;
|
||||
return (output);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
}
|
||||
|
||||
if (word[0] == 0) {
|
||||
return (0); /* blank line */
|
||||
return 0; /* blank line */
|
||||
}
|
||||
|
||||
if (text_mode)
|
||||
@@ -674,7 +674,7 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
dict_line[0] = length;
|
||||
|
||||
|
||||
return (length);
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
@@ -750,7 +750,7 @@ static int compile_dictlist_file(const char *path, const char *filename)
|
||||
if ((f_in = fopen(fname, "r")) == NULL) {
|
||||
sprintf(fname, "%s%s", path, filename);
|
||||
if ((f_in = fopen(fname, "r")) == NULL)
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (f_log != NULL)
|
||||
@@ -784,7 +784,7 @@ static int compile_dictlist_file(const char *path, const char *filename)
|
||||
if (f_log != NULL)
|
||||
fprintf(f_log, "\t%d entries\n", count);
|
||||
fclose(f_in);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -804,12 +804,12 @@ static int group3_ix;
|
||||
int isHexDigit(int c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9'))
|
||||
return (c - '0');
|
||||
return c - '0';
|
||||
if ((c >= 'a') && (c <= 'f'))
|
||||
return (c - 'a' + 10);
|
||||
return c - 'a' + 10;
|
||||
if ((c >= 'A') && (c <= 'F'))
|
||||
return (c - 'A' + 10);
|
||||
return (-1);
|
||||
return c - 'A' + 10;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1143,7 +1143,7 @@ static char *compile_rule(char *input)
|
||||
fprintf(f_log, "%5d: Syntax error\n", linenum);
|
||||
error_count++;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EncodePhonemes(rule_phonemes, buf, &bad_phoneme);
|
||||
@@ -1216,7 +1216,7 @@ static char *compile_rule(char *input)
|
||||
output[len++] = 0;
|
||||
prule = (char *)malloc(len);
|
||||
memcpy(prule, output, len);
|
||||
return (prule);
|
||||
return prule;
|
||||
}
|
||||
|
||||
|
||||
@@ -1226,10 +1226,10 @@ int __cdecl string_sorter(char **a, char **b)
|
||||
int ix;
|
||||
|
||||
if ((ix = strcmp(pa = *a, pb = *b)) != 0)
|
||||
return (ix);
|
||||
return ix;
|
||||
pa += (strlen(pa)+1);
|
||||
pb += (strlen(pb)+1);
|
||||
return (strcmp(pa, pb));
|
||||
return strcmp(pa, pb);
|
||||
}
|
||||
|
||||
|
||||
@@ -1238,10 +1238,10 @@ static int __cdecl rgroup_sorter(RGROUP *a, RGROUP *b)
|
||||
// Sort long names before short names
|
||||
int ix;
|
||||
ix = strlen(b->name) - strlen(a->name);
|
||||
if (ix != 0) return (ix);
|
||||
if (ix != 0) return ix;
|
||||
ix = strcmp(a->name, b->name);
|
||||
if (ix != 0) return (ix);
|
||||
return (a->start-b->start);
|
||||
if (ix != 0) return ix;
|
||||
return a->start-b->start;
|
||||
}
|
||||
|
||||
|
||||
@@ -1425,14 +1425,14 @@ static int compile_lettergroup(char *input, FILE *f_out)
|
||||
if (!IsDigit09(p[0]) || !IsDigit09(p[1])) {
|
||||
fprintf(f_log, "%5d: Expected 2 digits after '.L'\n", linenum);
|
||||
error_count++;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
group = atoi(&p[0]);
|
||||
if (group >= N_LETTER_GROUPS) {
|
||||
fprintf(f_log, "%5d: lettergroup out of range (01-%.2d)\n", linenum, N_LETTER_GROUPS-1);
|
||||
error_count++;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (!isspace2(*p)) p++;
|
||||
@@ -1476,7 +1476,7 @@ static int compile_lettergroup(char *input, FILE *f_out)
|
||||
|
||||
fputc(RULE_GROUP_END, f_out);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1508,7 +1508,7 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
group_name[0] = 0;
|
||||
|
||||
if ((f_temp = fopen_log(fname_temp, "wb")) == NULL)
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
for (;;) {
|
||||
linenum++;
|
||||
@@ -1655,7 +1655,7 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
qsort((void *)rgroup, n_rgroups, sizeof(rgroup[0]), (int(__cdecl *)(const void *, const void *))rgroup_sorter);
|
||||
|
||||
if ((f_temp = fopen(fname_temp, "rb")) == NULL)
|
||||
return (2);
|
||||
return 2;
|
||||
|
||||
prev_rgroup_name = "\n";
|
||||
|
||||
@@ -1693,7 +1693,7 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
remove(fname_temp);
|
||||
|
||||
fprintf(f_log, "\t%d rules, %d groups (%d)\n\n", count, n_rgroups, n_groups3);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1733,7 +1733,7 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
|
||||
if ((f_in = fopen_log(fname_in, "r")) == NULL) {
|
||||
if (fname_err)
|
||||
strcpy(fname_err, fname_in);
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1742,7 +1742,7 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
|
||||
if (fname_err)
|
||||
strcpy(fname_err, fname_out);
|
||||
fclose(f_in);
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP);
|
||||
|
||||
@@ -1778,5 +1778,5 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
|
||||
|
||||
LoadDictionary(translator, dict_name, 0);
|
||||
|
||||
return (error_count);
|
||||
return error_count;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ static unsigned int StringToWord(const char *string)
|
||||
unsigned int word;
|
||||
|
||||
if (string == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
word = 0;
|
||||
for (ix = 0; ix < 4; ix++) {
|
||||
@@ -57,7 +57,7 @@ static unsigned int StringToWord(const char *string)
|
||||
c = string[ix];
|
||||
word |= (c << (ix*8));
|
||||
}
|
||||
return (word);
|
||||
return word;
|
||||
}
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
|
||||
@@ -105,9 +105,9 @@ int Reverse4Bytes(int word)
|
||||
word2 = word2 << 8;
|
||||
word2 |= (word >> ix) & 0xff;
|
||||
}
|
||||
return (word2);
|
||||
return word2;
|
||||
#else
|
||||
return (word);
|
||||
return word;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -116,10 +116,10 @@ int LookupMnem(MNEM_TAB *table, const char *string)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (strcmp(string, table->mnem) == 0)
|
||||
return (table->value);
|
||||
return table->value;
|
||||
table++;
|
||||
}
|
||||
return (table->value);
|
||||
return table->value;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
}
|
||||
if (f != NULL)
|
||||
fclose(f);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tr->data_dictlist = Alloc(size);
|
||||
@@ -258,13 +258,13 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
|
||||
if (size <= (N_HASH_DICT + sizeof(int)*2)) {
|
||||
fprintf(stderr, "Empty _dict file: '%s\n", fname);
|
||||
return (2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ((Reverse4Bytes(pw[0]) != N_HASH_DICT) ||
|
||||
(length <= 0) || (length > 0x8000000)) {
|
||||
fprintf(stderr, "Bad data: '%s' (%x length=%x)\n", fname, Reverse4Bytes(pw[0]), length);
|
||||
return (2);
|
||||
return 2;
|
||||
}
|
||||
tr->data_dictrules = &(tr->data_dictlist[length]);
|
||||
|
||||
@@ -286,7 +286,7 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
fprintf(stderr, "Full dictionary is not installed for '%s'\n", name);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ int HashDictionary(const char *string)
|
||||
chars++;
|
||||
}
|
||||
|
||||
return ((hash+chars) & 0x3ff); // a 10 bit hash code
|
||||
return (hash+chars) & 0x3ff; // a 10 bit hash code
|
||||
}
|
||||
|
||||
|
||||
@@ -383,7 +383,7 @@ const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme)
|
||||
utf8_in(bad_phoneme, p);
|
||||
}
|
||||
*outptr++ = 0;
|
||||
return (p+1);
|
||||
return p+1;
|
||||
}
|
||||
|
||||
if (max <= 0)
|
||||
@@ -402,7 +402,7 @@ const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme)
|
||||
if (c == 0) {
|
||||
if (strcmp(p_lang, "en") == 0) {
|
||||
*p_lang = 0; // don't need "en", it's assumed by default
|
||||
return (p);
|
||||
return p;
|
||||
}
|
||||
} else {
|
||||
*outptr++ = '|'; // more phonemes follow, terminate language string with separator
|
||||
@@ -413,7 +413,7 @@ const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme)
|
||||
}
|
||||
/* terminate the encoded string */
|
||||
*outptr = 0;
|
||||
return (p);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -483,14 +483,14 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
if (ph->code == phonEND_WORD) {
|
||||
// ignore
|
||||
phon_out[0] = 0;
|
||||
return (phon_out);
|
||||
return phon_out;
|
||||
}
|
||||
|
||||
if (ph->code == phonSWITCH) {
|
||||
// the tone_ph field contains a phoneme table number
|
||||
p = phoneme_tab_list[plist->tone_ph].name;
|
||||
sprintf(phon_out, "(%s)", p);
|
||||
return (phon_out + strlen(phon_out));
|
||||
return phon_out + strlen(phon_out);
|
||||
}
|
||||
|
||||
if (use_ipa) {
|
||||
@@ -507,7 +507,7 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
if (*p == 0x20) {
|
||||
// indicates no name for this phoneme
|
||||
*phon_out = 0;
|
||||
return (phon_out);
|
||||
return phon_out;
|
||||
}
|
||||
if ((*p != 0) && ((*p & 0xff) < 0x20)) {
|
||||
// name starts with a flags byte
|
||||
@@ -521,7 +521,7 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
strcpy(phon_out, p);
|
||||
phon_out += len;
|
||||
*phon_out = 0;
|
||||
return (phon_out);
|
||||
return phon_out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
|
||||
phon_out = &phon_out[ix];
|
||||
*phon_out = 0;
|
||||
return (phon_out);
|
||||
return phon_out;
|
||||
}
|
||||
|
||||
|
||||
@@ -593,7 +593,7 @@ const char *GetTranslatedPhonemeString(int phoneme_mode)
|
||||
phon_out_size = N_PHON_OUT;
|
||||
if ((phon_out_buf = (char *)realloc(phon_out_buf, phon_out_size)) == NULL) {
|
||||
phon_out_size = 0;
|
||||
return ("");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ const char *GetTranslatedPhonemeString(int phoneme_mode)
|
||||
phon_out_size = phon_out_ix + len + N_PHON_OUT;
|
||||
if ((phon_out_buf = (char *)realloc(phon_out_buf, phon_out_size)) == NULL) {
|
||||
phon_out_size = 0;
|
||||
return ("");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,11 +687,11 @@ const char *GetTranslatedPhonemeString(int phoneme_mode)
|
||||
}
|
||||
|
||||
if (!phon_out_buf)
|
||||
return ("");
|
||||
return "";
|
||||
|
||||
phon_out_buf[phon_out_ix] = 0;
|
||||
|
||||
return (phon_out_buf);
|
||||
return phon_out_buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ static int IsLetterGroup(Translator *tr, char *word, int group, int pre)
|
||||
|
||||
p = tr->letterGroups[group];
|
||||
if (p == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
while (*p != RULE_GROUP_END) {
|
||||
if (pre) {
|
||||
@@ -720,13 +720,13 @@ static int IsLetterGroup(Translator *tr, char *word, int group, int pre)
|
||||
}
|
||||
if (*p == 0) {
|
||||
if (pre)
|
||||
return (len);
|
||||
return (w-word); // matched a complete string
|
||||
return len;
|
||||
return w-word; // matched a complete string
|
||||
}
|
||||
|
||||
while (*p++ != 0) ; // skip to end of string
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -736,33 +736,33 @@ static int IsLetter(Translator *tr, int letter, int group)
|
||||
|
||||
if (tr->letter_groups[group] != NULL) {
|
||||
if (wcschr(tr->letter_groups[group], letter))
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (group > 7)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (tr->letter_bits_offset > 0) {
|
||||
if (((letter2 = (letter - tr->letter_bits_offset)) > 0) && (letter2 < 0x100))
|
||||
letter = letter2;
|
||||
else
|
||||
return (0);
|
||||
return 0;
|
||||
} else {
|
||||
if ((letter >= 0xc0) && (letter < N_REMOVE_ACCENT))
|
||||
return (tr->letter_bits[remove_accent[letter-0xc0]] & (1L << group));
|
||||
return tr->letter_bits[remove_accent[letter-0xc0]] & (1L << group);
|
||||
}
|
||||
|
||||
if ((letter >= 0) && (letter < 0x100))
|
||||
return (tr->letter_bits[letter] & (1L << group));
|
||||
return tr->letter_bits[letter] & (1L << group);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int IsVowel(Translator *tr, int letter)
|
||||
{
|
||||
return (IsLetter(tr, letter, LETTERGP_VOWEL2));
|
||||
return IsLetter(tr, letter, LETTERGP_VOWEL2);
|
||||
}
|
||||
|
||||
|
||||
@@ -780,8 +780,8 @@ static int Unpronouncable2(Translator *tr, char *word)
|
||||
end_flags = TranslateRules(tr, word, ph_buf, sizeof(ph_buf), NULL, FLAG_UNPRON_TEST, NULL);
|
||||
word[-1] = c;
|
||||
if ((end_flags == 0) || (end_flags & SUFX_UNPRON))
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -803,19 +803,19 @@ int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
utf8_in(&c, word);
|
||||
if ((tr->letter_bits_offset > 0) && (c < 0x241)) {
|
||||
// Latin characters for a language with a non-latin alphabet
|
||||
return (0); // so we can re-translate the word as English
|
||||
return 0; // so we can re-translate the word as English
|
||||
}
|
||||
|
||||
if (((alphabet = AlphabetFromChar(c)) != NULL) && (alphabet->offset != tr->letter_bits_offset)) {
|
||||
// Character is not in our alphabet
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tr->langopts.param[LOPT_UNPRONOUNCABLE] == 1)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (((c = *word) == ' ') || (c == 0) || (c == '\''))
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
index = 0;
|
||||
count = 0;
|
||||
@@ -841,21 +841,21 @@ int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
}
|
||||
|
||||
if ((c != '\'') && !iswalpha2(c))
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((vowel_posn > 2) && (tr->langopts.param[LOPT_UNPRONOUNCABLE] == 2)) {
|
||||
// Lookup unpronounable rules in *_rules
|
||||
return (Unpronouncable2(tr, word));
|
||||
return Unpronouncable2(tr, word);
|
||||
}
|
||||
|
||||
if (c1 == tr->langopts.param[LOPT_UNPRONOUNCABLE])
|
||||
vowel_posn--; // disregard this as the initial letter when counting
|
||||
|
||||
if (vowel_posn > (tr->langopts.max_initial_consonants+1))
|
||||
return (1); // no vowel, or no vowel in first few letters
|
||||
return 1; // no vowel, or no vowel in first few letters
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, signed char *
|
||||
|
||||
*stressed_syllable = primary_posn;
|
||||
*vowel_count = count;
|
||||
return (max_stress);
|
||||
return max_stress;
|
||||
}
|
||||
|
||||
|
||||
@@ -2258,7 +2258,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
static const char str_pause[2] = { phonPAUSE_NOLINK, 0 };
|
||||
|
||||
if (tr->data_dictrules == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (dict_flags != NULL)
|
||||
dict_flags0 = dict_flags[0];
|
||||
@@ -2367,7 +2367,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
// not a Latin alphabet, switch to the default Latin alphabet language
|
||||
if ((letter <= 0x241) && iswalpha2(letter)) {
|
||||
sprintf(phonemes, "%c%s", phonSWITCH, tr->langopts.ascii_language);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2408,12 +2408,12 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
if (((alphabet = AlphabetFromChar(letter)) != NULL) && (alphabet->offset != tr->letter_bits_offset)) {
|
||||
if (tr->langopts.alt_alphabet == alphabet->offset) {
|
||||
sprintf(phonemes, "%c%s", phonSWITCH, WordToString2(tr->langopts.alt_alphabet_lang));
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
if (alphabet->flags & AL_WORDS) {
|
||||
// switch to the nominated language for this alphabet
|
||||
sprintf(phonemes, "%c%s", phonSWITCH, WordToString2(alphabet->language));
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2449,12 +2449,12 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
|
||||
if (match1.points > 0) {
|
||||
if (word_flags & FLAG_UNPRON_TEST)
|
||||
return (match1.end_type | 1);
|
||||
return match1.end_type | 1;
|
||||
|
||||
if ((match1.phonemes[0] == phonSWITCH) && ((word_flags & FLAG_DONT_SWITCH_TRANSLATOR) == 0)) {
|
||||
// an instruction to switch language, return immediately so we can re-translate
|
||||
strcpy(phonemes, match1.phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((option_phonemes & espeakPHONEMES_TRACE) && ((word_flags & FLAG_NO_TRACE) == 0)) {
|
||||
@@ -2474,7 +2474,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
}
|
||||
strcpy(end_phonemes, match1.phonemes);
|
||||
memcpy(p_start, word_copy, strlen(word_copy));
|
||||
return (match1.end_type);
|
||||
return match1.end_type;
|
||||
}
|
||||
}
|
||||
if (match1.del_fwd != NULL)
|
||||
@@ -2485,7 +2485,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
|
||||
memcpy(p_start, word_copy, strlen(word_copy));
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2607,9 +2607,9 @@ int TransposeAlphabet(Translator *tr, char *text)
|
||||
*p2 = 0;
|
||||
ix = p2 - buf;
|
||||
memcpy(text, buf, ix);
|
||||
return (ix | 0x40); // bit 6 indicates compressed characters
|
||||
return ix | 0x40; // bit 6 indicates compressed characters
|
||||
} else {
|
||||
return (strlen(text));
|
||||
return strlen(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2670,7 +2670,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
if (p == NULL) {
|
||||
if (flags != NULL)
|
||||
*flags = 0;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Find the first entry in the list for this hash value which matches.
|
||||
@@ -2867,7 +2867,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
print_dictionary_flags(flags, dict_flags_buf, sizeof(dict_flags_buf));
|
||||
fprintf(f_trans, "Flags: %s %s\n", word1, dict_flags_buf);
|
||||
}
|
||||
return (0); // no phoneme translation found here, only flags. So use rules
|
||||
return 0; // no phoneme translation found here, only flags. So use rules
|
||||
}
|
||||
|
||||
if (flags != NULL)
|
||||
@@ -2904,10 +2904,10 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
if ((word[ix] == 0) && !IsAlpha(c)) {
|
||||
flags[0] |= FLAG_MAX3;
|
||||
}
|
||||
return (word_end);
|
||||
return word_end;
|
||||
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2953,7 +2953,7 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
// set the skip words flag
|
||||
flags[0] |= FLAG_SKIPWORDS;
|
||||
dictionary_skipwords = length;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3037,14 +3037,14 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
}
|
||||
|
||||
ph_out[0] = 0;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ph_out[0] = 0;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3075,7 +3075,7 @@ int Lookup(Translator *tr, const char *word, char *ph_out)
|
||||
strcpy(ph_out, word_phonemes);
|
||||
option_sayas = say_as;
|
||||
}
|
||||
return (flags0);
|
||||
return flags0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3088,7 +3088,7 @@ int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out)
|
||||
flags[0] = flags[1] = 0;
|
||||
LookupDictList(tr, &word1, buf, flags, 0, NULL);
|
||||
*flags_out = flags;
|
||||
return (flags[0]);
|
||||
return flags[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -3214,5 +3214,5 @@ int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy)
|
||||
if (ending[0] == '\'')
|
||||
end_flags &= ~FLAG_SUFX; // don't consider 's as an added suffix
|
||||
|
||||
return (end_flags);
|
||||
return end_flags;
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ static void *say_thread(void *p)
|
||||
int fifo_is_command_enabled()
|
||||
{
|
||||
SHOW("ENTER fifo_is_command_enabled=%d\n", (int)(0 == my_stop_is_required));
|
||||
return (0 == my_stop_is_required);
|
||||
return 0 == my_stop_is_required;
|
||||
}
|
||||
|
||||
typedef struct t_node {
|
||||
|
||||
@@ -410,7 +410,7 @@ static int count_increments(int ix, int end_ix, int min_stress)
|
||||
if (stress >= min_stress)
|
||||
count++;
|
||||
}
|
||||
return (count);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -452,7 +452,7 @@ static int CountUnstressed(int start, int end, int limit)
|
||||
if (syllable_tab[ix].stress >= limit)
|
||||
break;
|
||||
}
|
||||
return (ix - start);
|
||||
return ix - start;
|
||||
}
|
||||
|
||||
static int SetHeadIntonation(TUNE *tune, int syl_ix, int end_ix, int control)
|
||||
@@ -569,7 +569,7 @@ static int SetHeadIntonation(TUNE *tune, int syl_ix, int end_ix, int control)
|
||||
|
||||
syl_ix++;
|
||||
}
|
||||
return (syl_ix);
|
||||
return syl_ix;
|
||||
|
||||
}
|
||||
|
||||
@@ -668,7 +668,7 @@ static int calc_pitch_segment(int ix, int end_ix, TONE_HEAD *th, TONE_NUCLEUS *t
|
||||
|
||||
ix++;
|
||||
}
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
@@ -746,7 +746,7 @@ static int calc_pitches2(int start, int end, int tune_number)
|
||||
ix = SetHeadIntonation(tune, ix, tone_posn, 0);
|
||||
|
||||
if (no_tonic)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
/* tonic syllable */
|
||||
/******************/
|
||||
@@ -770,7 +770,7 @@ static int calc_pitches2(int start, int end, int tune_number)
|
||||
|
||||
SetPitchGradient(ix, end, tune->tail_start, tune->tail_end);
|
||||
|
||||
return (tone_pitch_env);
|
||||
return tone_pitch_env;
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ static int calc_pitches(int control, int start, int end, int tune_number)
|
||||
int continuing = 0;
|
||||
|
||||
if (control == 0) {
|
||||
return (calc_pitches2(start, end, tune_number));
|
||||
return calc_pitches2(start, end, tune_number);
|
||||
}
|
||||
|
||||
if (start > 0)
|
||||
@@ -810,7 +810,7 @@ static int calc_pitches(int control, int start, int end, int tune_number)
|
||||
ix = calc_pitch_segment(ix, tone_posn, th, tn, PRIMARY, continuing);
|
||||
|
||||
if (no_tonic)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
/* tonic syllable */
|
||||
/******************/
|
||||
@@ -838,7 +838,7 @@ static int calc_pitches(int control, int start, int end, int tune_number)
|
||||
|
||||
SetPitchGradient(ix, end, tn->tail_start, tn->tail_end);
|
||||
|
||||
return (tone_pitch_env);
|
||||
return tone_pitch_env;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-13
@@ -243,7 +243,7 @@ static double sampled_source(int source_num)
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -461,10 +461,10 @@ static int parwave(klatt_frame_ptr frame)
|
||||
|
||||
sample_count++;
|
||||
if (out_ptr >= out_end) {
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -599,7 +599,7 @@ static double impulsive_source()
|
||||
vwave = 0.0;
|
||||
}
|
||||
|
||||
return (resonator(&(kt_globals.rsn[RGL]), vwave));
|
||||
return resonator(&(kt_globals.rsn[RGL]), vwave);
|
||||
}
|
||||
|
||||
|
||||
@@ -621,10 +621,10 @@ static double natural_source()
|
||||
vwave += kt_globals.pulse_shape_a;
|
||||
lgtemp = vwave * 0.028;
|
||||
|
||||
return (lgtemp);
|
||||
return lgtemp;
|
||||
} else {
|
||||
vwave = 0.0;
|
||||
return (0.0);
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,7 +876,7 @@ static double gen_noise(double noise)
|
||||
noise = kt_globals.nrand + (0.75 * nlast);
|
||||
nlast = noise;
|
||||
|
||||
return (noise);
|
||||
return noise;
|
||||
}
|
||||
|
||||
|
||||
@@ -914,10 +914,10 @@ static double DBtoLIN(long dB)
|
||||
};
|
||||
|
||||
if ((dB < 0) || (dB > 87)) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((double)(amptable[dB]) * 0.001);
|
||||
return (double)(amptable[dB]) * 0.001;
|
||||
}
|
||||
|
||||
|
||||
@@ -1009,7 +1009,7 @@ int Wavegen_Klatt(int resume)
|
||||
frame_init(&kt_frame); /* get parameters for next frame of speech */
|
||||
|
||||
if (parwave(&kt_frame) == 1) {
|
||||
return (1); // output buffer is full
|
||||
return 1; // output buffer is full
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,11 +1022,11 @@ int Wavegen_Klatt(int resume)
|
||||
sample_count -= fade;
|
||||
kt_globals.nspfr = fade;
|
||||
if (parwave(&kt_frame) == 1) {
|
||||
return (1); // output buffer is full
|
||||
return 1; // output buffer is full
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1153,7 +1153,7 @@ int Wavegen_Klatt2(int length, int modulation, int resume, frame_t *fr1, frame_t
|
||||
if (resume == 0)
|
||||
SetSynth_Klatt(length, modulation, fr1, fr2, wvoice, 1);
|
||||
|
||||
return (Wavegen_Klatt(resume));
|
||||
return Wavegen_Klatt(resume);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ static int mbrola_is_idle(void)
|
||||
p = (char *)memchr(buffer, ')', sizeof(buffer));
|
||||
if (!p || (unsigned)(p - buffer) >= sizeof(buffer) - 2)
|
||||
return 0;
|
||||
return (p[1] == ' ' && p[2] == 'S');
|
||||
return p[1] == ' ' && p[2] == 'S';
|
||||
}
|
||||
|
||||
static ssize_t receive_from_mbrola(void *buffer, size_t bufsize)
|
||||
|
||||
+46
-46
@@ -413,7 +413,7 @@ static int LookupLetter2(Translator *tr, unsigned int letter, char *ph_buf)
|
||||
TranslateRules(tr, &single_letter[2], ph_buf, 20, NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
return (ph_buf[0]);
|
||||
return ph_buf[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -582,9 +582,9 @@ int NonAsciiNumber(int letter)
|
||||
if (letter < base)
|
||||
break; // not found
|
||||
if (letter < (base+10))
|
||||
return (letter-base+'0');
|
||||
return letter-base+'0';
|
||||
}
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define L_SUB 0x4000 // subscript
|
||||
@@ -673,9 +673,9 @@ int IsSuperscript(int letter)
|
||||
if (c > letter)
|
||||
break;
|
||||
if (c == letter)
|
||||
return (derived_letters[ix+1]);
|
||||
return derived_letters[ix+1];
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -756,7 +756,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
|
||||
if (ph_buf[0] == phonSWITCH) {
|
||||
strcpy(phonemes, ph_buf);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -925,7 +925,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
if ((len + strlen(ph_buf2)) < N_WORD_PHONEMES) {
|
||||
strcpy(&phonemes[len], ph_buf2);
|
||||
}
|
||||
return (n_bytes);
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1036,7 +1036,7 @@ static int CheckDotOrdinal(Translator *tr, char *word, char *word_end, WORD_TAB
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ordinal);
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,14 +1046,14 @@ static int hu_number_e(const char *word, int thousandplex, int value)
|
||||
|
||||
if ((word[0] == 'a') || (word[0] == 'e')) {
|
||||
if ((word[1] == ' ') || (word[1] == 'z') || ((word[1] == 't') && (word[2] == 't')))
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (((thousandplex == 1) || ((value % 1000) == 0)) && (word[1] == 'l'))
|
||||
return (0); // 1000-el
|
||||
return 0; // 1000-el
|
||||
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1086,39 +1086,39 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
flags[1] = 0;
|
||||
|
||||
if (((tr->langopts.numbers & NUM_ROMAN_CAPITALS) && !(wtab[0].flags & FLAG_ALL_UPPER)) || IsDigit09(word[-2]))
|
||||
return (0); // not '2xx'
|
||||
return 0; // not '2xx'
|
||||
|
||||
if (word[1] == ' ') {
|
||||
if ((tr->langopts.numbers & (NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL | NUM_ORDINAL_DOT)) && (wtab[0].flags & FLAG_HAS_DOT)) {
|
||||
// allow single letter Roman ordinal followed by dot.
|
||||
} else
|
||||
return (0); // only one letter, don't speak as a Roman Number
|
||||
return 0; // only one letter, don't speak as a Roman Number
|
||||
}
|
||||
|
||||
word_start = word;
|
||||
while ((c = *word++) != ' ') {
|
||||
if ((p2 = strchr(roman_numbers, c)) == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
value = roman_values[p2 - roman_numbers];
|
||||
if (value == prev) {
|
||||
repeat++;
|
||||
if (repeat >= 3)
|
||||
return (0);
|
||||
return 0;
|
||||
} else
|
||||
repeat = 0;
|
||||
|
||||
if ((prev > 1) && (prev != 10) && (prev != 100)) {
|
||||
if (value >= prev)
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
if ((prev != 0) && (prev < value)) {
|
||||
if (((acc % 10) != 0) || ((prev*10) < value))
|
||||
return (0);
|
||||
return 0;
|
||||
subtract = prev;
|
||||
value -= subtract;
|
||||
} else if (value >= subtract)
|
||||
return (0);
|
||||
return 0;
|
||||
else
|
||||
acc += prev;
|
||||
prev = value;
|
||||
@@ -1126,14 +1126,14 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
}
|
||||
|
||||
if (IsDigit09(word[0]))
|
||||
return (0); // eg. 'xx2'
|
||||
return 0; // eg. 'xx2'
|
||||
|
||||
acc += prev;
|
||||
if (acc < tr->langopts.min_roman)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (acc > tr->langopts.max_roman)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
|
||||
Lookup(tr, "_roman", ph_roman); // precede by "roman" if _rom is defined in *_list
|
||||
@@ -1148,7 +1148,7 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
|
||||
if (word[0] == '.') {
|
||||
// dot has not been removed. This implies that there was no space after it
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (CheckDotOrdinal(tr, word_start, word, wtab, 1))
|
||||
@@ -1161,7 +1161,7 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
// should use the 'e' form of the number
|
||||
num_control |= 1;
|
||||
} else
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
wtab[0].flags |= FLAG_ORDINAL;
|
||||
@@ -1175,7 +1175,7 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
if (tr->langopts.numbers & NUM_ROMAN_AFTER)
|
||||
strcat(ph_out, ph_roman);
|
||||
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1192,36 +1192,36 @@ static const char *M_Variant(int value)
|
||||
{
|
||||
case 1: // lang=ru use singular for xx1 except for x11
|
||||
if ((teens == 0) && ((value % 10) == 1))
|
||||
return ("1M");
|
||||
return "1M";
|
||||
break;
|
||||
|
||||
case 2: // lang=cs,sk
|
||||
if ((value >= 2) && (value <= 4))
|
||||
return ("0MA");
|
||||
return "0MA";
|
||||
break;
|
||||
|
||||
case 3: // lang=pl
|
||||
if ((teens == 0) && (((value % 10) >= 2) && ((value % 10) <= 4)))
|
||||
return ("0MA");
|
||||
return "0MA";
|
||||
break;
|
||||
|
||||
case 4: // lang=lt
|
||||
if ((teens == 1) || ((value % 10) == 0))
|
||||
return ("0MB");
|
||||
return "0MB";
|
||||
if ((value % 10) == 1)
|
||||
return ("0MA");
|
||||
return "0MA";
|
||||
break;
|
||||
|
||||
case 5: // lang=bs,hr,sr
|
||||
if (teens == 0) {
|
||||
if ((value % 10) == 1)
|
||||
return ("1M");
|
||||
return "1M";
|
||||
if (((value % 10) >= 2) && ((value % 10) <= 4))
|
||||
return ("0MA");
|
||||
return "0MA";
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ("0M");
|
||||
return "0M";
|
||||
}
|
||||
|
||||
|
||||
@@ -1310,9 +1310,9 @@ static int LookupThousands(Translator *tr, int value, int thousandplex, int thou
|
||||
sprintf(ph_out, "%s%s", ph_of, ph_thousands);
|
||||
|
||||
if ((value == 1) && (thousandplex == 1) && (tr->langopts.numbers & NUM_OMIT_1_THOUSAND))
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
return (found_value);
|
||||
return found_value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1561,7 +1561,7 @@ static int LookupNum2(Translator *tr, int value, int thousandplex, const int con
|
||||
}
|
||||
}
|
||||
}
|
||||
return (used_and);
|
||||
return used_and;
|
||||
}
|
||||
|
||||
|
||||
@@ -1773,7 +1773,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
|
||||
|
||||
sprintf(ph_out, "%s%s%c%s", buf1, ph_hundred_and, phonEND_WORD, buf2);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1783,13 +1783,13 @@ bool CheckThousandsGroup(char *word, int group_len)
|
||||
int ix;
|
||||
|
||||
if (IsDigit09(word[group_len]) || IsDigit09(-1))
|
||||
return (false);
|
||||
return false;
|
||||
|
||||
for (ix = 0; ix < group_len; ix++) {
|
||||
if (!IsDigit09(word[ix]))
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1915,7 +1915,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
} else {
|
||||
if (n_digits > 3) {
|
||||
flags[0] &= ~FLAG_SKIPWORDS;
|
||||
return (0); // long number string with leading zero, speak as individual digits
|
||||
return 0; // long number string with leading zero, speak as individual digits
|
||||
}
|
||||
|
||||
// speak leading zeros
|
||||
@@ -2017,7 +2017,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
// Look for special pronunciation for this number in isolation (LANG=kl)
|
||||
sprintf(string, "_%dn", value);
|
||||
if (Lookup(tr, string, ph_out)) {
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2147,7 +2147,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
|
||||
if (skipwords)
|
||||
dictionary_skipwords = skipwords;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2155,10 +2155,10 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control)
|
||||
{
|
||||
if ((option_sayas == SAYAS_DIGITS1) || (wtab[0].flags & FLAG_INDIVIDUAL_DIGITS))
|
||||
return (0); // speak digits individually
|
||||
return 0; // speak digits individually
|
||||
|
||||
if (tr->langopts.numbers != 0) {
|
||||
return (TranslateNumber_1(tr, word1, ph_out, flags, wtab, control));
|
||||
return TranslateNumber_1(tr, word1, ph_out, flags, wtab, control);
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static int SubstitutePhonemes(Translator *tr, PHONEME_LIST *plist_out)
|
||||
plist_out[n_plist_out].type = plist_out[n_plist_out].ph->type;
|
||||
n_plist_out++;
|
||||
}
|
||||
return (n_plist_out);
|
||||
return n_plist_out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+153
-153
@@ -291,26 +291,26 @@ static const short wchar_toupper[] = {
|
||||
int iswalpha(int c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
return (isalpha(c));
|
||||
return isalpha(c);
|
||||
if ((c > 0x3040) && (c <= 0xa700))
|
||||
return (1); // japanese, chinese characters
|
||||
return 1; // japanese, chinese characters
|
||||
if (c > MAX_WALPHA)
|
||||
return (0);
|
||||
return (walpha_tab[c-0x80]);
|
||||
return 0;
|
||||
return walpha_tab[c-0x80];
|
||||
}
|
||||
|
||||
int iswdigit(int c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
return (isdigit(c));
|
||||
return (0);
|
||||
return isdigit(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iswalnum(int c)
|
||||
{
|
||||
if (iswdigit(c))
|
||||
return (1);
|
||||
return (iswalpha(c));
|
||||
return 1;
|
||||
return iswalpha(c);
|
||||
}
|
||||
|
||||
int towlower(int c)
|
||||
@@ -319,19 +319,19 @@ int towlower(int c)
|
||||
int ix;
|
||||
|
||||
if (c < 0x80)
|
||||
return (tolower(c));
|
||||
return tolower(c);
|
||||
|
||||
if ((c > MAX_WALPHA) || ((x = walpha_tab[c-0x80]) >= 0xfe))
|
||||
return (c);
|
||||
return c;
|
||||
|
||||
if (x == 0xfd) {
|
||||
// special cases, lookup translation table
|
||||
for (ix = 0; wchar_tolower[ix] != 0; ix += 2) {
|
||||
if (wchar_tolower[ix] == c)
|
||||
return (wchar_tolower[ix+1]);
|
||||
return wchar_tolower[ix+1];
|
||||
}
|
||||
}
|
||||
return (c + x); // convert to lower case
|
||||
return c + x; // convert to lower case
|
||||
}
|
||||
|
||||
int towupper(int c)
|
||||
@@ -339,59 +339,59 @@ int towupper(int c)
|
||||
int ix;
|
||||
// check whether a previous character code is the upper-case equivalent of this character
|
||||
if (towlower(c-32) == c)
|
||||
return (c-32); // yes, use it
|
||||
return c-32; // yes, use it
|
||||
if (towlower(c-1) == c)
|
||||
return (c-1);
|
||||
return c-1;
|
||||
for (ix = 0; wchar_toupper[ix] != 0; ix += 2) {
|
||||
if (wchar_toupper[ix] == c)
|
||||
return (wchar_toupper[ix+1]);
|
||||
return wchar_toupper[ix+1];
|
||||
}
|
||||
return (c); // no
|
||||
return c; // no
|
||||
}
|
||||
|
||||
int iswupper(int c)
|
||||
{
|
||||
int x;
|
||||
if (c < 0x80)
|
||||
return (isupper(c));
|
||||
return isupper(c);
|
||||
if (((c > MAX_WALPHA) || (x = walpha_tab[c-0x80]) == 0) || (x == 0xff))
|
||||
return (0);
|
||||
return (1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int iswlower(int c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
return (islower(c));
|
||||
return islower(c);
|
||||
if ((c > MAX_WALPHA) || (walpha_tab[c-0x80] != 0xff))
|
||||
return (0);
|
||||
return (1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int iswspace(int c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
return (isspace(c));
|
||||
return isspace(c);
|
||||
if (c == 0xa0)
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iswpunct(int c)
|
||||
{
|
||||
if (c < 0x100)
|
||||
return (ispunct(c));
|
||||
return (0);
|
||||
return ispunct(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const wchar_t *wcschr(const wchar_t *str, int c)
|
||||
{
|
||||
while (*str != 0) {
|
||||
if (*str == c)
|
||||
return (str);
|
||||
return str;
|
||||
str++;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
@@ -403,7 +403,7 @@ const int wcslen(const wchar_t *str)
|
||||
while (*str != 0) {
|
||||
ix++;
|
||||
}
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -418,7 +418,7 @@ float wcstod(const wchar_t *str, wchar_t **tailptr)
|
||||
break;
|
||||
}
|
||||
*tailptr = (wchar_t *)&str[ix];
|
||||
return (atof(buf));
|
||||
return atof(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -428,35 +428,35 @@ float wcstod(const wchar_t *str, wchar_t **tailptr)
|
||||
int iswalpha2(int c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
return (isalpha(c));
|
||||
return isalpha(c);
|
||||
if ((c > 0x3040) && (c <= 0xa700))
|
||||
return (1); // japanese, chinese characters
|
||||
return 1; // japanese, chinese characters
|
||||
if (c > MAX_WALPHA)
|
||||
return (iswalpha(c));
|
||||
return (walpha_tab[c-0x80]);
|
||||
return iswalpha(c);
|
||||
return walpha_tab[c-0x80];
|
||||
}
|
||||
|
||||
int iswlower2(int c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
return (islower(c));
|
||||
return islower(c);
|
||||
if (c > MAX_WALPHA)
|
||||
return (iswlower(c));
|
||||
return iswlower(c);
|
||||
if (walpha_tab[c-0x80] == 0xff)
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iswupper2(int c)
|
||||
{
|
||||
int x;
|
||||
if (c < 0x80)
|
||||
return (isupper(c));
|
||||
return isupper(c);
|
||||
if (c > MAX_WALPHA)
|
||||
return (iswupper(c));
|
||||
return iswupper(c);
|
||||
if (((x = walpha_tab[c-0x80]) > 0) && (x < 0xfe))
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int towlower2(unsigned int c)
|
||||
@@ -472,47 +472,47 @@ int towlower2(unsigned int c)
|
||||
}
|
||||
|
||||
if (c < 0x80)
|
||||
return (tolower(c));
|
||||
return tolower(c);
|
||||
|
||||
if (c > MAX_WALPHA)
|
||||
return (towlower(c));
|
||||
return towlower(c);
|
||||
|
||||
if ((x = walpha_tab[c-0x80]) >= 0xfe)
|
||||
return (c); // this is not an upper case letter
|
||||
return c; // this is not an upper case letter
|
||||
|
||||
if (x == 0xfd) {
|
||||
// special cases, lookup translation table
|
||||
for (ix = 0; wchar_tolower[ix] != 0; ix += 2) {
|
||||
if (wchar_tolower[ix] == (int)c)
|
||||
return (wchar_tolower[ix+1]);
|
||||
return wchar_tolower[ix+1];
|
||||
}
|
||||
}
|
||||
return (c + x); // convert to lower case
|
||||
return c + x; // convert to lower case
|
||||
}
|
||||
|
||||
int towupper2(unsigned int c)
|
||||
{
|
||||
int ix;
|
||||
if (c > MAX_WALPHA)
|
||||
return (towupper(c));
|
||||
return towupper(c);
|
||||
|
||||
// check whether a previous character code is the upper-case equivalent of this character
|
||||
if (towlower2(c-32) == (int)c)
|
||||
return (c-32); // yes, use it
|
||||
return c-32; // yes, use it
|
||||
if (towlower2(c-1) == (int)c)
|
||||
return (c-1);
|
||||
return c-1;
|
||||
for (ix = 0; wchar_toupper[ix] != 0; ix += 2) {
|
||||
if (wchar_toupper[ix] == (int)c)
|
||||
return (wchar_toupper[ix+1]);
|
||||
return wchar_toupper[ix+1];
|
||||
}
|
||||
return (c); // no
|
||||
return c; // no
|
||||
}
|
||||
|
||||
static int IsRomanU(unsigned int c)
|
||||
{
|
||||
if ((c == 'I') || (c == 'V') || (c == 'X') || (c == 'L'))
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -531,12 +531,12 @@ static void GetC_unget(int c)
|
||||
int Eof(void)
|
||||
{
|
||||
if (ungot_char != 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (f_input != 0)
|
||||
return (feof(f_input));
|
||||
return feof(f_input);
|
||||
|
||||
return (end_of_input);
|
||||
return end_of_input;
|
||||
}
|
||||
|
||||
|
||||
@@ -554,33 +554,33 @@ static int GetC_get(void)
|
||||
if (feof(f_input)) c2 = 0;
|
||||
c = c + (c2 << 8);
|
||||
}
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
|
||||
if (option_multibyte == espeakCHARS_WCHAR) {
|
||||
if (*p_wchar_input == 0) {
|
||||
end_of_input = 1;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!end_of_input)
|
||||
return (*p_wchar_input++);
|
||||
return *p_wchar_input++;
|
||||
} else {
|
||||
if (*p_textinput == 0) {
|
||||
end_of_input = 1;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!end_of_input) {
|
||||
if (option_multibyte == espeakCHARS_16BIT) {
|
||||
c = p_textinput[0] + (p_textinput[1] << 8);
|
||||
p_textinput += 2;
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
return (*p_textinput++ & 0xff);
|
||||
return *p_textinput++ & 0xff;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ static int GetC(void)
|
||||
|
||||
if ((c1 = ungot_char) != 0) {
|
||||
ungot_char = 0;
|
||||
return (c1);
|
||||
return c1;
|
||||
}
|
||||
|
||||
if (ungot2 != 0) {
|
||||
@@ -612,7 +612,7 @@ static int GetC(void)
|
||||
|
||||
if ((option_multibyte == espeakCHARS_WCHAR) || (option_multibyte == espeakCHARS_16BIT)) {
|
||||
count_characters++;
|
||||
return (c1); // wchar_t text
|
||||
return c1; // wchar_t text
|
||||
}
|
||||
|
||||
if ((option_multibyte < 2) && (c1 & 0x80)) {
|
||||
@@ -648,7 +648,7 @@ static int GetC(void)
|
||||
}
|
||||
if (ix == 0) {
|
||||
count_characters++;
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
// top-bit-set character is not utf8, drop through to 8bit charset case
|
||||
@@ -659,8 +659,8 @@ static int GetC(void)
|
||||
// 8 bit character set, convert to unicode if
|
||||
count_characters++;
|
||||
if (c1 >= 0xa0)
|
||||
return (translator->charset_a0[c1-0xa0]);
|
||||
return (c1);
|
||||
return translator->charset_a0[c1-0xa0];
|
||||
return c1;
|
||||
}
|
||||
|
||||
|
||||
@@ -683,7 +683,7 @@ const char *WordToString2(unsigned int word)
|
||||
p++;
|
||||
}
|
||||
*p = 0;
|
||||
return (buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -699,9 +699,9 @@ static const char *LookupSpecial(Translator *tr, const char *string, char *text_
|
||||
SetWordStress(tr, phonemes, flags, -1, 0);
|
||||
DecodePhonemes(phonemes, phonemes2);
|
||||
sprintf(text_out, "[\002%s]]", phonemes2);
|
||||
return (text_out);
|
||||
return text_out;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -774,7 +774,7 @@ static const char *LookupCharName(Translator *tr, int c, int only)
|
||||
strcpy(buf, "[\002(X1)(X1)(X1)]]");
|
||||
}
|
||||
|
||||
return (buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
int Read4Bytes(FILE *f)
|
||||
@@ -788,7 +788,7 @@ int Read4Bytes(FILE *f)
|
||||
c = fgetc(f) & 0xff;
|
||||
acc += (c << (ix*8));
|
||||
}
|
||||
return (acc);
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
@@ -807,7 +807,7 @@ static int LoadSoundFile(const char *fname, int index)
|
||||
}
|
||||
|
||||
if (fname == NULL)
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
if (fname[0] != '/') {
|
||||
// a relative path, look in espeak-data/soundicons
|
||||
@@ -848,7 +848,7 @@ static int LoadSoundFile(const char *fname, int index)
|
||||
f = fopen(fname, "rb");
|
||||
if (f == NULL) {
|
||||
fprintf(stderr, "Can't read temp file: %s\n", fname);
|
||||
return (3);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ static int LoadSoundFile(const char *fname, int index)
|
||||
fseek(f, 0, SEEK_SET);
|
||||
if ((p = (char *)realloc(soundicon_tab[index].data, length)) == NULL) {
|
||||
fclose(f);
|
||||
return (4);
|
||||
return 4;
|
||||
}
|
||||
length = fread(p, 1, length, f);
|
||||
fclose(f);
|
||||
@@ -865,7 +865,7 @@ static int LoadSoundFile(const char *fname, int index)
|
||||
ip = (int *)(&p[40]);
|
||||
soundicon_tab[index].length = (*ip) / 2; // length in samples
|
||||
soundicon_tab[index].data = p;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -878,12 +878,12 @@ static int LookupSoundicon(int c)
|
||||
if (soundicon_tab[ix].name == c) {
|
||||
if (soundicon_tab[ix].length == 0) {
|
||||
if (LoadSoundFile(NULL, ix) != 0)
|
||||
return (-1); // sound file is not available
|
||||
return -1; // sound file is not available
|
||||
}
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -897,7 +897,7 @@ static int LoadSoundFile2(const char *fname)
|
||||
|
||||
for (ix = 0; ix < n_soundicon_tab; ix++) {
|
||||
if (((soundicon_tab[ix].filename != NULL) && strcmp(fname, soundicon_tab[ix].filename) == 0))
|
||||
return (ix); // already loaded
|
||||
return ix; // already loaded
|
||||
}
|
||||
|
||||
// load the file into the next slot
|
||||
@@ -906,11 +906,11 @@ static int LoadSoundFile2(const char *fname)
|
||||
slot = 0;
|
||||
|
||||
if (LoadSoundFile(fname, slot) != 0)
|
||||
return (-1);
|
||||
return -1;
|
||||
|
||||
soundicon_tab[slot].filename = (char *)realloc(soundicon_tab[ix].filename, strlen(fname)+1);
|
||||
strcpy(soundicon_tab[slot].filename, fname);
|
||||
return (slot);
|
||||
return slot;
|
||||
}
|
||||
|
||||
|
||||
@@ -951,7 +951,7 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output
|
||||
}
|
||||
|
||||
if (punctname == NULL)
|
||||
return (-1);
|
||||
return -1;
|
||||
|
||||
if ((*bufix == 0) || (end_clause == 0) || (tr->langopts.param[LOPT_ANNOUNCE_PUNCT] & 2)) {
|
||||
punct_count = 1;
|
||||
@@ -1003,10 +1003,10 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output
|
||||
*bufix += len;
|
||||
|
||||
if (end_clause == 0)
|
||||
return (-1);
|
||||
return -1;
|
||||
|
||||
if (c1 == '-')
|
||||
return (CLAUSE_NONE); // no pause
|
||||
return CLAUSE_NONE; // no pause
|
||||
|
||||
attributes = punct_attributes[lookupwchar(punct_chars, c1)];
|
||||
|
||||
@@ -1016,14 +1016,14 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output
|
||||
|
||||
if ((bufix1 > 0) && !(tr->langopts.param[LOPT_ANNOUNCE_PUNCT] & 2)) {
|
||||
if ((attributes & ~0x8000) == CLAUSE_SEMICOLON)
|
||||
return (CLAUSE_SHORTFALL);
|
||||
return (short_pause);
|
||||
return CLAUSE_SHORTFALL;
|
||||
return short_pause;
|
||||
}
|
||||
|
||||
if (attributes & CLAUSE_BIT_SENTENCE)
|
||||
return (attributes);
|
||||
return attributes;
|
||||
|
||||
return (short_pause);
|
||||
return short_pause;
|
||||
}
|
||||
|
||||
#define SSML_SPEAK 1
|
||||
@@ -1153,15 +1153,15 @@ static const char *VoiceFromStack()
|
||||
voice_select.languages = language;
|
||||
v_id = SelectVoice(&voice_select, &voice_found);
|
||||
if (v_id == NULL)
|
||||
return ("default");
|
||||
return "default";
|
||||
|
||||
if ((strchr(v_id, '+') == NULL) && ((voice_select.gender == 0) || (voice_select.gender == base_voice.gender)) && (base_voice_variant_name[0] != 0)) {
|
||||
// a voice variant has not been selected, use the original voice variant
|
||||
sprintf(buf, "%s+%s", v_id, base_voice_variant_name);
|
||||
strncpy0(voice_name, buf, sizeof(voice_name));
|
||||
return (voice_name);
|
||||
return voice_name;
|
||||
}
|
||||
return (v_id);
|
||||
return v_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1231,7 +1231,7 @@ static PARAM_STACK *PushParamStack(int tag_type)
|
||||
for (ix = 0; ix < N_SPEECH_PARAM; ix++) {
|
||||
sp->parameter[ix] = -1;
|
||||
}
|
||||
return (sp);
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
@@ -1277,14 +1277,14 @@ static wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
|
||||
if (*pw == '=') pw++;
|
||||
while (iswspace(*pw)) pw++;
|
||||
if ((*pw == '"') || (*pw == '\'')) // allow single-quotes ?
|
||||
return (pw+1);
|
||||
return pw+1;
|
||||
else
|
||||
return (empty);
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
pw++;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1293,13 +1293,13 @@ static int attrcmp(const wchar_t *string1, const char *string2)
|
||||
int ix;
|
||||
|
||||
if (string1 == NULL)
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
for (ix = 0; (string1[ix] == string2[ix]) && (string1[ix] != 0); ix++) {
|
||||
}
|
||||
if (((string1[ix] == '"') || (string1[ix] == '\'')) && (string2[ix] == 0))
|
||||
return (0);
|
||||
return (1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1309,9 +1309,9 @@ static int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab)
|
||||
|
||||
for (ix = 0; mtab[ix].mnem != NULL; ix++) {
|
||||
if (attrcmp(string1, mtab[ix].mnem) == 0)
|
||||
return (mtab[ix].value);
|
||||
return mtab[ix].value;
|
||||
}
|
||||
return (mtab[ix].value);
|
||||
return mtab[ix].value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1320,7 +1320,7 @@ static int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
int value = 0;
|
||||
|
||||
if ((pw == NULL) || !IsDigit09(*pw))
|
||||
return (default_value);
|
||||
return default_value;
|
||||
|
||||
while (IsDigit09(*pw)) {
|
||||
value = value*10 + *pw++ - '0';
|
||||
@@ -1329,7 +1329,7 @@ static int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
// time: seconds rather than ms
|
||||
value *= 1000;
|
||||
}
|
||||
return (value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1352,7 +1352,7 @@ static int attrcopy_utf8(char *buf, const wchar_t *pw, int len)
|
||||
}
|
||||
}
|
||||
buf[ix] = 0;
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
@@ -1376,14 +1376,14 @@ static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out)
|
||||
if (tail == pw) {
|
||||
// failed to find a number, return 100%
|
||||
*value_out = 100;
|
||||
return (2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (*tail == '%') {
|
||||
if (sign != 0)
|
||||
value = 100 + (sign * value);
|
||||
*value_out = (int)value;
|
||||
return (2); // percentage
|
||||
return 2; // percentage
|
||||
}
|
||||
|
||||
if ((tail[0] == 's') && (tail[1] == 't')) {
|
||||
@@ -1395,7 +1395,7 @@ static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out)
|
||||
x = pow((double)2.0, (double)((value*sign)/12)) * 100;
|
||||
*value_out = (int)x;
|
||||
#endif
|
||||
return (2); // percentage
|
||||
return 2; // percentage
|
||||
}
|
||||
|
||||
if (param_type == espeakRATE) {
|
||||
@@ -1403,11 +1403,11 @@ static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out)
|
||||
*value_out = (int)(value * 100);
|
||||
else
|
||||
*value_out = 100 + (int)(sign * value * 100);
|
||||
return (2); // percentage
|
||||
return 2; // percentage
|
||||
}
|
||||
|
||||
*value_out = (int)value;
|
||||
return (sign); // -1, 0, or 1
|
||||
return sign; // -1, 0, or 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1429,7 +1429,7 @@ int AddNameData(const char *name, int wide)
|
||||
if (namedata_ix+len >= n_namedata) {
|
||||
// allocate more space for marker names
|
||||
if ((vp = realloc(namedata, namedata_ix+len + 1000)) == NULL)
|
||||
return (-1); // failed to allocate, original data is unchanged but ignore this new name
|
||||
return -1; // failed to allocate, original data is unchanged but ignore this new name
|
||||
// !!! Bug?? If the allocated data shifts position, then pointers given to user application will be invalid
|
||||
|
||||
namedata = (char *)vp;
|
||||
@@ -1437,7 +1437,7 @@ int AddNameData(const char *name, int wide)
|
||||
}
|
||||
memcpy(&namedata[ix = namedata_ix], name, len);
|
||||
namedata_ix += len;
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
@@ -1512,7 +1512,7 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type)
|
||||
}
|
||||
|
||||
if ((tag_type != SSML_VOICE) && (lang == NULL))
|
||||
return (0); // <s> or <p> without language spec, nothing to do
|
||||
return 0; // <s> or <p> without language spec, nothing to do
|
||||
|
||||
ssml_sp = &ssml_stack[n_ssml_stack++];
|
||||
|
||||
@@ -1530,10 +1530,10 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type)
|
||||
if (strcmp(new_voice_id, current_voice_id) != 0) {
|
||||
// add an embedded command to change the voice
|
||||
strcpy(current_voice_id, new_voice_id);
|
||||
return (CLAUSE_BIT_VOICE); // change of voice
|
||||
return CLAUSE_BIT_VOICE; // change of voice
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1627,9 +1627,9 @@ static int ReplaceKeyName(char *outbuf, int index, int *outix)
|
||||
if ((letter = LookupMnem(keynames, p)) != 0) {
|
||||
ix = utf8_out(letter, p);
|
||||
*outix = index + ix;
|
||||
return (letter);
|
||||
return letter;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1737,7 +1737,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
|
||||
if (self_closing && ignore_if_self_closing[tag_type])
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1879,7 +1879,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
// This is the marker we are waiting for before starting to speak
|
||||
clear_skipping_text = 1;
|
||||
skip_marker[0] = 0;
|
||||
return (CLAUSE_NONE);
|
||||
return CLAUSE_NONE;
|
||||
}
|
||||
|
||||
if ((index = AddNameData(buf, 0)) >= 0) {
|
||||
@@ -1928,12 +1928,12 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
PopParamStack(tag_type, outbuf, outix);
|
||||
else
|
||||
audio_text = 1;
|
||||
return (CLAUSE_NONE);
|
||||
return CLAUSE_NONE;
|
||||
|
||||
case SSML_AUDIO + SSML_CLOSE:
|
||||
PopParamStack(tag_type, outbuf, outix);
|
||||
audio_text = 0;
|
||||
return (CLAUSE_NONE);
|
||||
return CLAUSE_NONE;
|
||||
|
||||
case SSML_BREAK:
|
||||
value = 21;
|
||||
@@ -1970,7 +1970,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
value = 0xfff;
|
||||
terminator |= CLAUSE_PAUSE_LONG;
|
||||
}
|
||||
return (terminator + value);
|
||||
return terminator + value;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1982,20 +1982,20 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
}
|
||||
if (GetVoiceAttributes(px, tag_type) == 0)
|
||||
return (0); // no voice change
|
||||
return (CLAUSE_VOICE);
|
||||
return 0; // no voice change
|
||||
return CLAUSE_VOICE;
|
||||
|
||||
case SSML_VOICE:
|
||||
if (GetVoiceAttributes(px, tag_type) == 0)
|
||||
return (0); // no voice change
|
||||
return (CLAUSE_VOICE);
|
||||
return 0; // no voice change
|
||||
return CLAUSE_VOICE;
|
||||
|
||||
case SSML_SPEAK + SSML_CLOSE:
|
||||
// unwind stack until the previous <voice> or <speak> tag
|
||||
while ((n_ssml_stack > 1) && (ssml_stack[n_ssml_stack-1].tag_type != SSML_SPEAK)) {
|
||||
n_ssml_stack--;
|
||||
}
|
||||
return (CLAUSE_PERIOD + GetVoiceAttributes(px, tag_type));
|
||||
return CLAUSE_PERIOD + GetVoiceAttributes(px, tag_type);
|
||||
|
||||
case SSML_VOICE + SSML_CLOSE:
|
||||
// unwind stack until the previous <voice> or <speak> tag
|
||||
@@ -2004,11 +2004,11 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
|
||||
terminator = 0; // ?? Sentence intonation, but no pause ??
|
||||
return (terminator + GetVoiceAttributes(px, tag_type));
|
||||
return terminator + GetVoiceAttributes(px, tag_type);
|
||||
|
||||
case HTML_BREAK:
|
||||
case HTML_BREAK + SSML_CLOSE:
|
||||
return (CLAUSE_COLON);
|
||||
return CLAUSE_COLON;
|
||||
|
||||
case SSML_SENTENCE:
|
||||
if (ssml_sp->tag_type == SSML_SENTENCE) {
|
||||
@@ -2016,7 +2016,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
voice_change_flag = GetVoiceAttributes(px, SSML_SENTENCE+SSML_CLOSE);
|
||||
}
|
||||
voice_change_flag |= GetVoiceAttributes(px, tag_type);
|
||||
return (CLAUSE_PARAGRAPH + voice_change_flag);
|
||||
return CLAUSE_PARAGRAPH + voice_change_flag;
|
||||
|
||||
|
||||
case SSML_PARAGRAPH:
|
||||
@@ -2029,7 +2029,7 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
voice_change_flag |= GetVoiceAttributes(px, SSML_PARAGRAPH+SSML_CLOSE);
|
||||
}
|
||||
voice_change_flag |= GetVoiceAttributes(px, tag_type);
|
||||
return (CLAUSE_PARAGRAPH + voice_change_flag);
|
||||
return CLAUSE_PARAGRAPH + voice_change_flag;
|
||||
|
||||
|
||||
case SSML_SENTENCE + SSML_CLOSE:
|
||||
@@ -2037,18 +2037,18 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
// end of a sentence which specified a language
|
||||
voice_change_flag = GetVoiceAttributes(px, tag_type);
|
||||
}
|
||||
return (CLAUSE_PERIOD + voice_change_flag);
|
||||
return CLAUSE_PERIOD + voice_change_flag;
|
||||
|
||||
|
||||
case SSML_PARAGRAPH + SSML_CLOSE:
|
||||
if ((ssml_sp->tag_type == SSML_SENTENCE) || (ssml_sp->tag_type == SSML_PARAGRAPH)) {
|
||||
// End of a paragraph which specified a language.
|
||||
// (End-of-paragraph also implies end-of-sentence)
|
||||
return (GetVoiceAttributes(px, tag_type) + CLAUSE_PARAGRAPH);
|
||||
return GetVoiceAttributes(px, tag_type) + CLAUSE_PARAGRAPH;
|
||||
}
|
||||
return (CLAUSE_PARAGRAPH);
|
||||
return CLAUSE_PARAGRAPH;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2145,7 +2145,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
if (!iswalnum(c1)) {
|
||||
if ((end_character_position > 0) && (count_characters > end_character_position)) {
|
||||
end_of_input = 1;
|
||||
return (CLAUSE_EOF);
|
||||
return CLAUSE_EOF;
|
||||
}
|
||||
|
||||
if ((skip_characters > 0) && (count_characters >= skip_characters)) {
|
||||
@@ -2154,7 +2154,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
clear_skipping_text = 1;
|
||||
skip_characters = 0;
|
||||
UngetC(c2);
|
||||
return (CLAUSE_NONE);
|
||||
return CLAUSE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2235,7 +2235,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
ungot_char2 = c1;
|
||||
buf[ix] = ' ';
|
||||
buf[ix+1] = 0;
|
||||
return (CLAUSE_NONE);
|
||||
return CLAUSE_NONE;
|
||||
}
|
||||
|
||||
// SSML Tag
|
||||
@@ -2267,7 +2267,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
if (terminator & CLAUSE_BIT_VOICE) {
|
||||
strcpy(voice_change, current_voice_id);
|
||||
}
|
||||
return (terminator);
|
||||
return terminator;
|
||||
}
|
||||
c1 = ' ';
|
||||
c2 = GetC();
|
||||
@@ -2292,7 +2292,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
}
|
||||
buf[ix] = ' ';
|
||||
buf[ix+1] = 0;
|
||||
return (terminator);
|
||||
return terminator;
|
||||
}
|
||||
|
||||
if ((c1 == CTRL_EMBEDDED) || (c1 == ctrl_embedded)) {
|
||||
@@ -2302,7 +2302,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
while (!iswspace(c1 = GetC()) && !Eof() && (ix < (n_buf-1)))
|
||||
buf[ix++] = c1; // add voice name to end of buffer, after the text
|
||||
buf[ix++] = 0;
|
||||
return (CLAUSE_VOICE);
|
||||
return CLAUSE_VOICE;
|
||||
} else if (c2 == 'B') {
|
||||
// set the punctuation option from an embedded command
|
||||
// B0 B1 B<punct list><space>
|
||||
@@ -2368,7 +2368,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
ungot_word = "i ";
|
||||
UngetC(c2);
|
||||
p_word[0] = 0;
|
||||
return (CLAUSE_PERIOD);
|
||||
return CLAUSE_PERIOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2429,7 +2429,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
if (parag > 3)
|
||||
parag = 3;
|
||||
if (option_ssml) parag = 1;
|
||||
return ((CLAUSE_PARAGRAPH-30) + 30*parag); // several blank lines, longer pause
|
||||
return (CLAUSE_PARAGRAPH-30) + 30*parag; // several blank lines, longer pause
|
||||
}
|
||||
|
||||
if (linelength <= option_linelength) {
|
||||
@@ -2437,7 +2437,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
UngetC(c2);
|
||||
buf[ix] = ' ';
|
||||
buf[ix+1] = 0;
|
||||
return (CLAUSE_COLON);
|
||||
return CLAUSE_COLON;
|
||||
}
|
||||
|
||||
linelength = 0;
|
||||
@@ -2459,7 +2459,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
ungot_char2 = c1;
|
||||
buf[end_clause_index] = ' '; // delete the end-clause punctuation
|
||||
buf[end_clause_index+1] = 0;
|
||||
return (end_clause_after_tag);
|
||||
return end_clause_after_tag;
|
||||
}
|
||||
end_clause_after_tag = 0;
|
||||
}
|
||||
@@ -2502,7 +2502,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
if ((option_punctuation == 1) || (wcschr(option_punctlist, c1) != NULL)) {
|
||||
tr->phonemes_repeat_count = 0;
|
||||
if ((terminator = AnnouncePunctuation(tr, c1, &c2, buf, &ix, is_end_clause)) >= 0)
|
||||
return (terminator);
|
||||
return terminator;
|
||||
announced_punctuation = c1;
|
||||
}
|
||||
}
|
||||
@@ -2591,10 +2591,10 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
}
|
||||
if (nl_count > 1) {
|
||||
if ((punct_data == CLAUSE_QUESTION) || (punct_data == CLAUSE_EXCLAMATION))
|
||||
return (punct_data + 35); // with a longer pause
|
||||
return (CLAUSE_PARAGRAPH);
|
||||
return punct_data + 35; // with a longer pause
|
||||
return CLAUSE_PARAGRAPH;
|
||||
}
|
||||
return (punct_data); // only recognise punctuation if followed by a blank or bracket/quote
|
||||
return punct_data; // only recognise punctuation if followed by a blank or bracket/quote
|
||||
} else {
|
||||
if (!Eof()) {
|
||||
if (iswspace(c2))
|
||||
@@ -2636,7 +2636,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
buf[ix] = ' ';
|
||||
buf[ix+1] = 0;
|
||||
UngetC(c2);
|
||||
return (CLAUSE_NONE);
|
||||
return CLAUSE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2648,7 +2648,7 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
}
|
||||
buf[ix] = ' ';
|
||||
buf[ix+1] = 0;
|
||||
return (CLAUSE_EOF); // end of file
|
||||
return CLAUSE_EOF; // end of file
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event)
|
||||
out_samplerate = voice_samplerate;
|
||||
if (!wave_init(voice_samplerate)) {
|
||||
err = EE_INTERNAL_ERROR;
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
wave_set_callback_is_output_enabled(fifo_is_command_enabled);
|
||||
my_audio = wave_open("alsa");
|
||||
@@ -172,7 +172,7 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event)
|
||||
|
||||
SHOW_TIME("LEAVE dispatch_audio\n");
|
||||
|
||||
return (a_wave_can_be_played == 0); // 1 = stop synthesis, -1 = error
|
||||
return a_wave_can_be_played == 0; // 1 = stop synthesis, -1 = error
|
||||
}
|
||||
|
||||
|
||||
@@ -283,12 +283,12 @@ int GetFileLength(const char *filename)
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat(filename, &statbuf) != 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (S_ISDIR(statbuf.st_mode))
|
||||
return (-2); // a directory
|
||||
return -2; // a directory
|
||||
|
||||
return (statbuf.st_size);
|
||||
return statbuf.st_size;
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
@@ -298,7 +298,7 @@ char *Alloc(int size)
|
||||
char *p;
|
||||
if ((p = (char *)malloc(size)) == NULL)
|
||||
fprintf(stderr, "Can't allocate memory\n"); // I was told that size+1 fixes a crash on 64-bit systems
|
||||
return (p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void Free(void *ptr)
|
||||
@@ -387,7 +387,7 @@ static int initialise(int control)
|
||||
for (param = 0; param < N_SPEECH_PARAM; param++)
|
||||
param_stack[0].parameter[param] = param_defaults[param];
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text,
|
||||
#endif
|
||||
|
||||
if ((outbuf == NULL) || (event_list == NULL))
|
||||
return (EE_INTERNAL_ERROR); // espeak_Initialize() has not been called
|
||||
return EE_INTERNAL_ERROR; // espeak_Initialize() has not been called
|
||||
|
||||
option_multibyte = flags & 7;
|
||||
option_ssml = flags & espeakSSML;
|
||||
@@ -448,7 +448,7 @@ static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text,
|
||||
if (SynthOnTimer() != 0)
|
||||
break;
|
||||
}
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@@ -507,7 +507,7 @@ static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text,
|
||||
}
|
||||
}
|
||||
}
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
@@ -642,7 +642,7 @@ espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *
|
||||
aStatus = Synthesize(unique_identifier, text, flags | espeakSSML);
|
||||
SHOW_TIME("LEAVE sync_espeak_Synth_Mark");
|
||||
|
||||
return (aStatus);
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
|
||||
@@ -755,13 +755,13 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length
|
||||
outbuf_size = (buf_length * samplerate)/500;
|
||||
outbuf = (unsigned char *)realloc(outbuf, outbuf_size);
|
||||
if ((out_start = outbuf) == NULL)
|
||||
return (EE_INTERNAL_ERROR);
|
||||
return EE_INTERNAL_ERROR;
|
||||
|
||||
// allocate space for event list. Allow 200 events per second.
|
||||
// Add a constant to allow for very small buf_length
|
||||
n_event_list = (buf_length*200)/1000 + 20;
|
||||
if ((event_list = (espeak_EVENT *)realloc(event_list, sizeof(espeak_EVENT) * n_event_list)) == NULL)
|
||||
return (EE_INTERNAL_ERROR);
|
||||
return EE_INTERNAL_ERROR;
|
||||
|
||||
option_phonemes = 0;
|
||||
option_phoneme_events = (options & (espeakINITIALIZE_PHONEME_EVENTS | espeakINITIALIZE_PHONEME_IPA));
|
||||
@@ -781,7 +781,7 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length
|
||||
fifo_init();
|
||||
#endif
|
||||
|
||||
return (samplerate);
|
||||
return samplerate;
|
||||
}
|
||||
|
||||
|
||||
@@ -811,7 +811,7 @@ ESPEAK_API espeak_ERROR espeak_Synth(const void *text, size_t size,
|
||||
*unique_identifier = 0;
|
||||
|
||||
if (synchronous_mode) {
|
||||
return (sync_espeak_Synth(0, text, size, position, position_type, end_position, flags, user_data));
|
||||
return sync_espeak_Synth(0, text, size, position, position_type, end_position, flags, user_data);
|
||||
}
|
||||
|
||||
#ifdef USE_ASYNC
|
||||
@@ -869,7 +869,7 @@ ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text, size_t size,
|
||||
*unique_identifier = 0;
|
||||
|
||||
if (synchronous_mode) {
|
||||
return (sync_espeak_Synth_Mark(0, text, size, index_mark, end_position, flags, user_data));
|
||||
return sync_espeak_Synth_Mark(0, text, size, index_mark, end_position, flags, user_data);
|
||||
}
|
||||
|
||||
#ifdef USE_ASYNC
|
||||
@@ -915,7 +915,7 @@ ESPEAK_API espeak_ERROR espeak_Key(const char *key)
|
||||
|
||||
if (synchronous_mode) {
|
||||
sync_espeak_Key(key);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
#ifdef USE_ASYNC
|
||||
@@ -944,7 +944,7 @@ ESPEAK_API espeak_ERROR espeak_Char(wchar_t character)
|
||||
|
||||
if (synchronous_mode) {
|
||||
sync_espeak_Char(character);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
t_espeak_command *c = create_espeak_char(character, NULL);
|
||||
@@ -955,7 +955,7 @@ ESPEAK_API espeak_ERROR espeak_Char(wchar_t character)
|
||||
return a_error;
|
||||
#else
|
||||
sync_espeak_Char(character);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
{
|
||||
ENTER("espeak_SetVoiceByName");
|
||||
|
||||
return (SetVoiceByName(name));
|
||||
return SetVoiceByName(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -973,7 +973,7 @@ ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_selector
|
||||
{
|
||||
ENTER("espeak_SetVoiceByProperties");
|
||||
|
||||
return (SetVoiceByProperties(voice_selector));
|
||||
return SetVoiceByProperties(voice_selector);
|
||||
}
|
||||
|
||||
|
||||
@@ -982,9 +982,9 @@ ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current)
|
||||
ENTER("espeak_GetParameter");
|
||||
// current: 0=default value, 1=current value
|
||||
if (current) {
|
||||
return (param_stack[0].parameter[parameter]);
|
||||
return param_stack[0].parameter[parameter];
|
||||
} else {
|
||||
return (param_defaults[parameter]);
|
||||
return param_defaults[parameter];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1001,7 +1001,7 @@ ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int valu
|
||||
|
||||
if (synchronous_mode) {
|
||||
SetParameter(parameter, value, relative);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
t_espeak_command *c = create_espeak_parameter(parameter, value, relative);
|
||||
@@ -1013,7 +1013,7 @@ ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int valu
|
||||
return a_error;
|
||||
#else
|
||||
SetParameter(parameter, value, relative);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1028,7 +1028,7 @@ ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
|
||||
if (synchronous_mode) {
|
||||
sync_espeak_SetPunctuationList(punctlist);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
t_espeak_command *c = create_espeak_punctuation_list(punctlist);
|
||||
@@ -1039,7 +1039,7 @@ ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
return a_error;
|
||||
#else
|
||||
sync_espeak_SetPunctuationList(punctlist);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1077,7 +1077,7 @@ ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode,
|
||||
|
||||
option_multibyte = textmode & 7;
|
||||
*textptr = TranslateClause(translator, NULL, *textptr, NULL, NULL);
|
||||
return (GetTranslatedPhonemeString(phonememode));
|
||||
return GetTranslatedPhonemeString(phonememode);
|
||||
}
|
||||
|
||||
|
||||
@@ -1113,11 +1113,11 @@ ESPEAK_API int espeak_IsPlaying(void)
|
||||
{
|
||||
#ifdef USE_ASYNC
|
||||
if ((my_mode == AUDIO_OUTPUT_PLAYBACK) && wave_is_busy(my_audio))
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
return (fifo_is_busy());
|
||||
return fifo_is_busy();
|
||||
#else
|
||||
return (0);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1175,7 +1175,7 @@ ESPEAK_API const char *espeak_Info(const char **ptr)
|
||||
if (ptr != NULL) {
|
||||
*ptr = path_home;
|
||||
}
|
||||
return (version_string);
|
||||
return version_string;
|
||||
}
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
+11
-11
@@ -86,7 +86,7 @@ float polint(float xa[], float ya[], int n, float x)
|
||||
hp = xa[i+m]-x;
|
||||
w = c[i+1]-d[i];
|
||||
if ((den = ho-hp) == 0.0) {
|
||||
return (ya[2]); // two input xa are identical
|
||||
return ya[2]; // two input xa are identical
|
||||
}
|
||||
den = w/den;
|
||||
d[i] = hp*den;
|
||||
@@ -94,7 +94,7 @@ float polint(float xa[], float ya[], int n, float x)
|
||||
}
|
||||
y += ((2*ns < (n-m) ? c[ns+1] : d[ns--]));
|
||||
}
|
||||
return (y);
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ int LoadFrame(SpectFrame *frame, FILE *stream, int file_format_type)
|
||||
|
||||
if (spect_data == NULL) {
|
||||
fprintf(stderr, "Failed to allocate memory\n");
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
frame->max_y = 0;
|
||||
@@ -198,7 +198,7 @@ int LoadFrame(SpectFrame *frame, FILE *stream, int file_format_type)
|
||||
}
|
||||
frame->spect = spect_data;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ double GetFrameRms(SpectFrame *frame, int seq_amplitude)
|
||||
total += ((htab[h] * htab[h]) >> 10);
|
||||
}
|
||||
frame->rms = sqrt(total) / 7.25;
|
||||
return (frame->rms);
|
||||
return frame->rms;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,13 +272,13 @@ static float GetFrameLength(SpectSeq *spect, int frame)
|
||||
int ix;
|
||||
float adjust = 0;
|
||||
|
||||
if (frame >= spect->numframes-1) return (0);
|
||||
if (frame >= spect->numframes-1) return 0;
|
||||
|
||||
for (ix = frame+1; ix < spect->numframes-1; ix++) {
|
||||
if (spect->frames[ix]->keyframe) break; // reached next keyframe
|
||||
adjust += spect->frames[ix]->length_adjust;
|
||||
}
|
||||
return ((spect->frames[ix]->time - spect->frames[frame]->time) * 1000.0 + adjust);
|
||||
return (spect->frames[ix]->time - spect->frames[frame]->time) * 1000.0 + adjust;
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
FILE *stream = fopen(filename, "rb");
|
||||
if (stream == NULL) {
|
||||
fprintf(stderr, "Failed to open: '%s'", filename);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fread(&id1, sizeof(uint32_t), 1, stream);
|
||||
@@ -309,7 +309,7 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported spectral file format.\n");
|
||||
fclose(stream);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fread(&name_len, sizeof(uint32_t), 1, stream);
|
||||
@@ -326,7 +326,7 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
|
||||
if (n == 0) {
|
||||
fclose(stream);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (spect->frames != NULL) {
|
||||
@@ -383,5 +383,5 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
spect->frames[ix]->length_adjust = spect->frames[ix]->length - GetFrameLength(spect, ix);
|
||||
}
|
||||
fclose(stream);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
if (mbrola_voice == NULL) {
|
||||
samplerate = samplerate_native;
|
||||
SetParameter(espeakVOICETYPE, 0, 0);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
sprintf(path, "%s/mbrola/%s", path_home, mbrola_voice);
|
||||
@@ -150,12 +150,12 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
if (load_MBR() == FALSE) { // load mbrola.dll
|
||||
fprintf(stderr, "Can't load mbrola.dll\n");
|
||||
return (EE_INTERNAL_ERROR);
|
||||
return EE_INTERNAL_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (init_MBR(path) != 0) // initialise the required mbrola voice
|
||||
return (EE_NOT_FOUND);
|
||||
return EE_NOT_FOUND;
|
||||
|
||||
setNoError_MBR(1); // don't stop on phoneme errors
|
||||
|
||||
@@ -164,13 +164,13 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
size = GetFileLength(path);
|
||||
if ((f_in = fopen(path, "rb")) == NULL) {
|
||||
close_MBR();
|
||||
return (EE_NOT_FOUND);
|
||||
return EE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if ((mbrola_tab = (MBROLA_TAB *)realloc(mbrola_tab, size)) == NULL) {
|
||||
fclose(f_in);
|
||||
close_MBR();
|
||||
return (EE_INTERNAL_ERROR);
|
||||
return EE_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
mbrola_control = Read4Bytes(f_in);
|
||||
@@ -189,7 +189,7 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
SetParameter(espeakVOICETYPE, 1, 0);
|
||||
strcpy(mbrola_name, mbrola_voice);
|
||||
mbrola_delay = 1000; // improve synchronization of events
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev
|
||||
|
||||
if (pr->control & 0x10) {
|
||||
mbr_name_prefix = pr->mbr_name;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
mnem = pr->mbr_name;
|
||||
break;
|
||||
@@ -268,7 +268,7 @@ static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev
|
||||
mnem = (mnem << 8) | (mbr_name_prefix & 0xff);
|
||||
}
|
||||
mbr_name_prefix = 0;
|
||||
return (mnem);
|
||||
return mnem;
|
||||
}
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
|
||||
|
||||
if (final)
|
||||
sprintf(output, "\t100 %d\n", p_end);
|
||||
return (output);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
FILE *f_mbrola = NULL;
|
||||
|
||||
if (*n_ph == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (option_phonemes & espeakPHONEMES_MBROLA) {
|
||||
// send mbrola data to a file, not to the mbrola library
|
||||
@@ -650,17 +650,17 @@ void MbrolaReset(void)
|
||||
|
||||
espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int *srate)
|
||||
{
|
||||
return (EE_INTERNAL_ERROR);
|
||||
return EE_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MbrolaFill(int length, int resume, int amplitude)
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MbrolaReset(void)
|
||||
|
||||
@@ -86,7 +86,7 @@ static char *ReadPhFile(void *ptr, const char *fname, int *size)
|
||||
|
||||
if ((f_in = fopen(buf, "rb")) == NULL) {
|
||||
fprintf(stderr, "Can't read data file: '%s'\n", buf);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ptr != NULL)
|
||||
@@ -94,18 +94,18 @@ static char *ReadPhFile(void *ptr, const char *fname, int *size)
|
||||
|
||||
if ((p = Alloc(length)) == NULL) {
|
||||
fclose(f_in);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
if (fread(p, 1, length, f_in) != length) {
|
||||
fclose(f_in);
|
||||
Free(p);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fclose(f_in);
|
||||
if (size != NULL)
|
||||
*size = length;
|
||||
return (p);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,13 +121,13 @@ int LoadPhData(int *srate)
|
||||
int *pw;
|
||||
|
||||
if ((phoneme_tab_data = (unsigned char *)ReadPhFile((void *)(phoneme_tab_data), "phontab", NULL)) == NULL)
|
||||
return (-1);
|
||||
return -1;
|
||||
if ((phoneme_index = (USHORT *)ReadPhFile((void *)(phoneme_index), "phonindex", NULL)) == NULL)
|
||||
return (-1);
|
||||
return -1;
|
||||
if ((phondata_ptr = ReadPhFile((void *)(phondata_ptr), "phondata", NULL)) == NULL)
|
||||
return (-1);
|
||||
return -1;
|
||||
if ((tunes = (TUNE *)ReadPhFile((void *)(tunes), "intonations", &length)) == NULL)
|
||||
return (-1);
|
||||
return -1;
|
||||
wavefile_data = (unsigned char *)phondata_ptr;
|
||||
n_tunes = length / sizeof(TUNE);
|
||||
|
||||
@@ -166,7 +166,7 @@ int LoadPhData(int *srate)
|
||||
|
||||
if (srate != NULL)
|
||||
*srate = rate;
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,9 +191,9 @@ int PhonemeCode(unsigned int mnem)
|
||||
if (phoneme_tab[ix] == NULL)
|
||||
continue;
|
||||
if (phoneme_tab[ix]->mnemonic == mnem)
|
||||
return (phoneme_tab[ix]->code);
|
||||
return phoneme_tab[ix]->code;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ int LookupPhonemeString(const char *string)
|
||||
mnem |= (c << (ix*8));
|
||||
}
|
||||
|
||||
return (PhonemeCode(mnem));
|
||||
return PhonemeCode(mnem);
|
||||
}
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params,
|
||||
}
|
||||
|
||||
*n_frames = nf;
|
||||
return (frames);
|
||||
return frames;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,9 +353,9 @@ unsigned char *GetEnvelope(int index)
|
||||
{
|
||||
if (index == 0) {
|
||||
fprintf(stderr, "espeak: No envelope\n");
|
||||
return (envelope_data[0]); // not found, use a default envelope
|
||||
return envelope_data[0]; // not found, use a default envelope
|
||||
}
|
||||
return ((unsigned char *)&phondata_ptr[index]);
|
||||
return (unsigned char *)&phondata_ptr[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -409,9 +409,9 @@ int LookupPhonemeTable(const char *name)
|
||||
}
|
||||
}
|
||||
if (ix == n_phoneme_tables)
|
||||
return (-1);
|
||||
return -1;
|
||||
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
@@ -422,10 +422,10 @@ int SelectPhonemeTableName(const char *name)
|
||||
int ix;
|
||||
|
||||
if ((ix = LookupPhonemeTable(name)) == -1)
|
||||
return (-1);
|
||||
return -1;
|
||||
|
||||
SelectPhonemeTable(ix);
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition,
|
||||
if (phoneme_tab[plist[1].phcode]->type == phVOWEL) {
|
||||
pl = &plist[1];
|
||||
} else
|
||||
return (false); // no stress elevel for this consonant
|
||||
return false; // no stress elevel for this consonant
|
||||
}
|
||||
|
||||
stress_level = pl->stresslevel & 0xf;
|
||||
@@ -516,7 +516,7 @@ static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition,
|
||||
if (tr != NULL) {
|
||||
if ((control & 1) && (plist->synthflags & SFLAG_DICTIONARY) && ((tr->langopts.param[LOPT_REDUCE] & 1) == 0)) {
|
||||
// change phoneme. Don't change phonemes which are given for the word in the dictionary.
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((tr->langopts.param[LOPT_REDUCE] & 0x2) && (stress_level >= pl->wordstress)) {
|
||||
@@ -526,18 +526,18 @@ static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition,
|
||||
}
|
||||
|
||||
if (condition == 4) {
|
||||
return (stress_level >= pl->wordstress);
|
||||
return stress_level >= pl->wordstress;
|
||||
}
|
||||
|
||||
if (condition == 3) {
|
||||
// if stressed
|
||||
if (stress_level > 3)
|
||||
return (true);
|
||||
return true;
|
||||
} else {
|
||||
if (stress_level < condition_level[condition])
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
return (false);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ static int CountVowelPosition(PHONEME_LIST *plist)
|
||||
break;
|
||||
plist--;
|
||||
}
|
||||
return (count);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -594,17 +594,17 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
if (which == 4) {
|
||||
// nextPhW not word boundary
|
||||
if (plist[1].sourceix)
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
if (which == 5) {
|
||||
// prevPhW, not word boundary
|
||||
if (plist[0].sourceix)
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
if (which == 6) {
|
||||
// next2PhW, not word boundary
|
||||
if (plist[1].sourceix || plist[2].sourceix)
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,7 +633,7 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
// nextVowel, not word boundary
|
||||
for (which = 1;; which++) {
|
||||
if (plist[which].sourceix)
|
||||
return (false);
|
||||
return false;
|
||||
if (phoneme_tab[plist[which].phcode]->type == phVOWEL) {
|
||||
plist = &plist[which];
|
||||
break;
|
||||
@@ -643,7 +643,7 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
|
||||
case 8: // prevVowel in this word
|
||||
if ((worddata == NULL) || (worddata->prev_vowel.ph == NULL))
|
||||
return (false); // no previous vowel
|
||||
return false; // no previous vowel
|
||||
plist = &(worddata->prev_vowel);
|
||||
check_endtype = 1;
|
||||
break;
|
||||
@@ -651,14 +651,14 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
case 9: // next3PhW
|
||||
for (ix = 1; ix <= 3; ix++) {
|
||||
if (plist[ix].sourceix)
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
plist = &plist[3];
|
||||
break;
|
||||
|
||||
case 10: // prev2PhW
|
||||
if ((plist[0].sourceix) || (plist[-1].sourceix))
|
||||
return (false);
|
||||
return false;
|
||||
plist -= 2;
|
||||
check_endtype = 1;
|
||||
break;
|
||||
@@ -680,12 +680,12 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
if (instn2 < 7) {
|
||||
// 'data' is a phoneme number
|
||||
if ((phoneme_tab[data]->mnemonic == ph->mnemonic) == true)
|
||||
return (true);
|
||||
return true;
|
||||
|
||||
// not an exact match, check for a vowel type (eg. #i )
|
||||
if ((check_endtype) && (ph->type == phVOWEL))
|
||||
return (data == ph->end_type); // prevPh() match on end_type
|
||||
return (data == ph->start_type); // thisPh() or nextPh(), match on start_type
|
||||
return data == ph->end_type; // prevPh() match on end_type
|
||||
return data == ph->start_type; // thisPh() or nextPh(), match on start_type
|
||||
}
|
||||
|
||||
data = instn & 0x1f;
|
||||
@@ -694,17 +694,17 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
{
|
||||
case 0x00:
|
||||
// phoneme type, vowel, nasal, fricative, etc
|
||||
return (ph->type == data);
|
||||
return ph->type == data;
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
// place of articulation
|
||||
return (((ph->phflags >> 16) & 0xf) == data);
|
||||
return ((ph->phflags >> 16) & 0xf) == data;
|
||||
break;
|
||||
|
||||
case 0x40:
|
||||
// is a bit set in phoneme flags
|
||||
return ((ph->phflags & (1 << data)) != 0);
|
||||
return (ph->phflags & (1 << data)) != 0;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
@@ -715,59 +715,59 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
return (StressCondition(tr, plist, data, 0));
|
||||
return StressCondition(tr, plist, data, 0);
|
||||
|
||||
case 5: // isBreak, Either pause phoneme, or (stop/vstop/vfric not followed by vowel or (liquid in same word))
|
||||
return ((ph->type == phPAUSE) || (plist_this->synthflags & SFLAG_NEXT_PAUSE));
|
||||
return (ph->type == phPAUSE) || (plist_this->synthflags & SFLAG_NEXT_PAUSE);
|
||||
|
||||
case 6: // isWordStart
|
||||
return (plist->sourceix != 0);
|
||||
return plist->sourceix != 0;
|
||||
|
||||
case 7: // notWordStart
|
||||
return (plist->sourceix == 0);
|
||||
return plist->sourceix == 0;
|
||||
|
||||
case 8: // isWordEnd
|
||||
return (plist[1].sourceix || (plist[1].ph->type == phPAUSE));
|
||||
return plist[1].sourceix || (plist[1].ph->type == phPAUSE);
|
||||
break;
|
||||
|
||||
case 9: // isAfterStress
|
||||
if (plist->sourceix != 0)
|
||||
return (false);
|
||||
return false;
|
||||
do {
|
||||
plist--;
|
||||
if ((plist->stresslevel & 0xf) >= 4)
|
||||
return (true);
|
||||
return true;
|
||||
|
||||
} while (plist->sourceix == 0);
|
||||
break;
|
||||
|
||||
case 10: // isNotVowel
|
||||
return (ph->type != phVOWEL);
|
||||
return ph->type != phVOWEL;
|
||||
|
||||
case 11: // isFinalVowel
|
||||
for (;;) {
|
||||
plist++;
|
||||
// plist->ph = phoneme_tab[plist->phcode]; // Why was this line here?? It corrupts plist if we have language switching if phoneme_tab is wrong language
|
||||
if (plist->sourceix != 0)
|
||||
return (true); // start of next word, without finding another vowel
|
||||
return true; // start of next word, without finding another vowel
|
||||
if (plist->ph->type == phVOWEL)
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: // isVoiced
|
||||
return ((ph->type == phVOWEL) || (ph->type == phLIQUID) || (ph->phflags & phVOICED));
|
||||
return (ph->type == phVOWEL) || (ph->type == phLIQUID) || (ph->phflags & phVOICED);
|
||||
|
||||
case 13: // isFirstVowel
|
||||
return (CountVowelPosition(plist) == 1);
|
||||
return CountVowelPosition(plist) == 1;
|
||||
|
||||
case 14: // isSecondVowel
|
||||
return (CountVowelPosition(plist) == 2);
|
||||
return CountVowelPosition(plist) == 2;
|
||||
|
||||
case 15: // isSeqFlag1
|
||||
// is this preceded by a sequence if 1 or more vowels which have 'flag1' ? (lang=hi)
|
||||
if (plist->sourceix != 0)
|
||||
return (false); // this is the first phoneme in the word, so no.
|
||||
return false; // this is the first phoneme in the word, so no.
|
||||
|
||||
count = 0;
|
||||
for (;;) {
|
||||
@@ -781,28 +781,28 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
if (plist->sourceix != 0)
|
||||
break;
|
||||
}
|
||||
return (count > 0);
|
||||
return count > 0;
|
||||
|
||||
case 0x10: // isTranslationGiven
|
||||
return ((plist->synthflags & SFLAG_DICTIONARY) != 0);
|
||||
return (plist->synthflags & SFLAG_DICTIONARY) != 0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return (false);
|
||||
return false;
|
||||
} else if (instn2 == 0xf) {
|
||||
// Other conditions
|
||||
switch (data)
|
||||
{
|
||||
case 1: // PreVoicing
|
||||
return (control & 1);
|
||||
return control & 1;
|
||||
case 2: // KlattSynth
|
||||
return (voice->klattv[0] != 0);
|
||||
return voice->klattv[0] != 0;
|
||||
case 3: // MbrolaSynth
|
||||
return (mbrola_name[0] != 0);
|
||||
return mbrola_name[0] != 0;
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -843,41 +843,41 @@ int NumInstnWords(USHORT *prog)
|
||||
instn = *prog;
|
||||
instn_type = instn >> 12;
|
||||
if ((n = n_words[instn_type]) > 0)
|
||||
return (n);
|
||||
return n;
|
||||
|
||||
switch (instn_type)
|
||||
{
|
||||
case 0:
|
||||
if (((instn & 0xf00) >> 8) == i_IPA_NAME) {
|
||||
n = ((instn & 0xff) + 1) / 2;
|
||||
return (n+1);
|
||||
return n+1;
|
||||
}
|
||||
return (1);;
|
||||
return 1;
|
||||
|
||||
case 6:
|
||||
type2 = (instn & 0xf00) >> 9;
|
||||
if ((type2 == 5) || (type2 == 6))
|
||||
return (12); // switch on vowel type
|
||||
return (1);
|
||||
return 12; // switch on vowel type
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
// a condition, check for a 2-word instruction
|
||||
if (((n = instn & 0x0f00) == 0x600) || (n == 0x0d00))
|
||||
return (2);
|
||||
return (1);
|
||||
return 2;
|
||||
return 1;
|
||||
|
||||
default:
|
||||
// instn_type 11 to 15, 2 words
|
||||
instn2 = prog[2];
|
||||
if ((instn2 >> 12) == 0xf) {
|
||||
// This instruction is followed by addWav(), 2 more words
|
||||
return (4);
|
||||
return 4;
|
||||
}
|
||||
if (instn2 == i_CONTINUE) {
|
||||
return (3);
|
||||
return 3;
|
||||
}
|
||||
return (2);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ const char *WordToString(unsigned int word)
|
||||
for (ix = 0; ix < 4; ix++)
|
||||
buf[ix] = word >> (ix*8);
|
||||
buf[4] = 0;
|
||||
return (buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ int PauseLength(int pause, int control)
|
||||
if (len < speed.min_pause) {
|
||||
len = speed.min_pause; // mS, limit the amount to which pauses can be shortened
|
||||
}
|
||||
return (len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
wav_length += p[0]; // length in bytes
|
||||
|
||||
if (wav_length == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
min_length = speed.min_sample_len;
|
||||
|
||||
@@ -304,7 +304,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
}
|
||||
|
||||
if (amp < 0)
|
||||
return (length);
|
||||
return length;
|
||||
|
||||
len4 = wav_length / 4;
|
||||
|
||||
@@ -319,7 +319,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q[2] = (intptr_t)(&wavefile_data[index]);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
return (length);
|
||||
return length;
|
||||
}
|
||||
|
||||
if (length > wav_length) {
|
||||
@@ -368,7 +368,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
return (length);
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp)
|
||||
len = DoSample2(phdata->sound_addr[pd_WAV], 2, phdata->pd_param[pd_LENGTHMOD]*2, phdata->pd_control, length_mod, amp2);
|
||||
}
|
||||
last_frame = NULL;
|
||||
return (len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ static frame_t *AllocFrame()
|
||||
ix++;
|
||||
if (ix >= N_FRAME_POOL)
|
||||
ix = 0;
|
||||
return (&frame_pool[ix]);
|
||||
return &frame_pool[ix];
|
||||
}
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ static frame_t *CopyFrame(frame_t *frame1, int copy)
|
||||
|
||||
if ((copy == 0) && (frame1->frflags & FRFLAG_COPIED)) {
|
||||
// this frame has already been copied in temporary rw memory
|
||||
return (frame1);
|
||||
return frame1;
|
||||
}
|
||||
|
||||
frame2 = AllocFrame();
|
||||
@@ -498,7 +498,7 @@ static frame_t *CopyFrame(frame_t *frame1, int copy)
|
||||
frame2->length = 0;
|
||||
frame2->frflags |= FRFLAG_COPIED;
|
||||
}
|
||||
return (frame2);
|
||||
return frame2;
|
||||
}
|
||||
|
||||
|
||||
@@ -562,12 +562,12 @@ static int VowelCloseness(frame_t *fr)
|
||||
int f1;
|
||||
|
||||
if ((f1 = fr->ffreq[1]) < 300)
|
||||
return (3);
|
||||
return 3;
|
||||
if (f1 < 400)
|
||||
return (2);
|
||||
return 2;
|
||||
if (f1 < 500)
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,7 @@ int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsig
|
||||
frame_t *fr = NULL;
|
||||
|
||||
if (*n_frames < 2)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
len = (data1 & 0x3f) * 2;
|
||||
rms = (data1 >> 6) & 0x3f;
|
||||
@@ -699,8 +699,8 @@ int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsig
|
||||
DoPause(20, 0); // add a short pause after the consonant
|
||||
|
||||
if (flags & 16)
|
||||
return (len);
|
||||
return (0);
|
||||
return len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -914,7 +914,7 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
int frame_lengths[N_SEQ_FRAMES];
|
||||
|
||||
if (fmt_params->fmt_addr == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
length_mod = plist->length;
|
||||
if (length_mod == 0) length_mod = 256;
|
||||
@@ -937,7 +937,7 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
modn_flags = 0;
|
||||
frames = LookupSpect(this_ph, which, fmt_params, &n_frames, plist);
|
||||
if (frames == NULL)
|
||||
return (0); // not found
|
||||
return 0; // not found
|
||||
|
||||
if (fmt_params->fmt_amp != fmt_amplitude) {
|
||||
// an amplitude adjustment is specified for this sequence
|
||||
@@ -1073,7 +1073,7 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
}
|
||||
|
||||
|
||||
return (total_len);
|
||||
return total_len;
|
||||
}
|
||||
|
||||
|
||||
@@ -1223,13 +1223,13 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
static WORD_PH_DATA worddata;
|
||||
|
||||
if (option_quiet)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (option_phoneme_events & espeakINITIALIZE_PHONEME_IPA)
|
||||
use_ipa = 1;
|
||||
|
||||
if (mbrola_name[0] != 0)
|
||||
return (MbrolaGenerate(phoneme_list, n_ph, resume));
|
||||
return MbrolaGenerate(phoneme_list, n_ph, resume);
|
||||
|
||||
if (resume == 0) {
|
||||
ix = 1;
|
||||
@@ -1259,7 +1259,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
free_min = MIN_WCMDQ; // 25
|
||||
|
||||
if (WcmdqFree() <= free_min)
|
||||
return (1); // wait
|
||||
return 1; // wait
|
||||
|
||||
prev = &phoneme_list[ix-1];
|
||||
next = &phoneme_list[ix+1];
|
||||
@@ -1614,7 +1614,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
*n_ph = 0;
|
||||
}
|
||||
|
||||
return (0); // finished the phoneme list
|
||||
return 0; // finished the phoneme list
|
||||
}
|
||||
|
||||
|
||||
@@ -1626,7 +1626,7 @@ static int paused = 0;
|
||||
int SynthOnTimer()
|
||||
{
|
||||
if (!timer_on) {
|
||||
return (WavegenCloseSound());
|
||||
return WavegenCloseSound();
|
||||
}
|
||||
|
||||
do {
|
||||
@@ -1638,13 +1638,13 @@ int SynthOnTimer()
|
||||
}
|
||||
} while (skipping_text);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SynthStatus()
|
||||
{
|
||||
return (timer_on | paused);
|
||||
return timer_on | paused;
|
||||
}
|
||||
|
||||
|
||||
@@ -1670,9 +1670,9 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
|
||||
if (control == 4) {
|
||||
if ((f_text == NULL) && (p_text == NULL))
|
||||
return (0);
|
||||
return 0;
|
||||
else
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (control == 2) {
|
||||
@@ -1686,7 +1686,7 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
n_phoneme_list = 0;
|
||||
WcmdqStop();
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (control == 3) {
|
||||
@@ -1700,14 +1700,14 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
paused = 0;
|
||||
Generate(phoneme_list, &n_phoneme_list, 0); // re-start from beginning of clause
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (control == 5) {
|
||||
// stop speaking, but continue looking for text
|
||||
n_phoneme_list = 0;
|
||||
WcmdqStop();
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((f_in != NULL) || (text_in != NULL)) {
|
||||
@@ -1720,14 +1720,14 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
if ((f_text == NULL) && (p_text == NULL)) {
|
||||
skipping_text = 0;
|
||||
timer_on = 0;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((f_text != NULL) && feof(f_text)) {
|
||||
timer_on = 0;
|
||||
fclose(f_text);
|
||||
f_text = NULL;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (current_phoneme_table != voice->phoneme_tab_ix) {
|
||||
@@ -1754,7 +1754,7 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
|
||||
if (skipping_text) {
|
||||
n_phoneme_list = 0;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Generate(phoneme_list, &n_phoneme_list, 0);
|
||||
@@ -1772,5 +1772,5 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
new_voice = NULL;
|
||||
}
|
||||
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ ALPHABET *AlphabetFromName(const char *name)
|
||||
|
||||
for (alphabet = alphabets; alphabet->name != NULL; alphabet++) {
|
||||
if (strcmp(name, &alphabet->name[1]) == 0)
|
||||
return (alphabet);
|
||||
return alphabet;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,13 +129,13 @@ ALPHABET *AlphabetFromChar(int c)
|
||||
while (alphabet->name != NULL) {
|
||||
if (c <= alphabet->range_max) {
|
||||
if (c >= alphabet->range_min)
|
||||
return (alphabet);
|
||||
return alphabet;
|
||||
else
|
||||
break;
|
||||
}
|
||||
alphabet++;
|
||||
}
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ static Translator *NewTranslator(void)
|
||||
|
||||
tr = (Translator *)Alloc(sizeof(Translator));
|
||||
if (tr == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
tr->charset_a0 = charsets[1]; // ISO-8859-1, this is for when the input is not utf8
|
||||
dictionary_name[0] = 0;
|
||||
@@ -314,7 +314,7 @@ static Translator *NewTranslator(void)
|
||||
|
||||
memcpy(tr->langopts.tunes, default_tunes, sizeof(tr->langopts.tunes));
|
||||
|
||||
return (tr);
|
||||
return tr;
|
||||
}
|
||||
|
||||
// common letter pairs, encode these as a single byte
|
||||
@@ -1629,7 +1629,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->translator_name = name2;
|
||||
|
||||
ProcessLanguageOptions(&tr->langopts);
|
||||
return (tr);
|
||||
return tr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -382,80 +382,80 @@ int IsAlpha(unsigned int c)
|
||||
};
|
||||
|
||||
if (iswalpha2(c))
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
if (c < 0x300)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if ((c >= 0x901) && (c <= 0xdf7)) {
|
||||
// Indic scripts: Devanagari, Tamil, etc
|
||||
if ((c & 0x7f) < 0x64)
|
||||
return (1);
|
||||
return 1;
|
||||
if (lookupwchar(extra_indic_alphas, c) != 0)
|
||||
return (1);
|
||||
return 1;
|
||||
if ((c >= 0xd7a) && (c <= 0xd7f))
|
||||
return (1); // malaytalam chillu characters
|
||||
return 1; // malaytalam chillu characters
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((c >= 0x5b0) && (c <= 0x5c2))
|
||||
return (1); // Hebrew vowel marks
|
||||
return 1; // Hebrew vowel marks
|
||||
|
||||
if (c == 0x0605)
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
if ((c == 0x670) || ((c >= 0x64b) && (c <= 0x65e)))
|
||||
return (1); // arabic vowel marks
|
||||
return 1; // arabic vowel marks
|
||||
|
||||
if ((c >= 0x300) && (c <= 0x36f))
|
||||
return (1); // combining accents
|
||||
return 1; // combining accents
|
||||
|
||||
if ((c >= 0x780) && (c <= 0x7b1))
|
||||
return (1); // taani/divehi (maldives)
|
||||
return 1; // taani/divehi (maldives)
|
||||
|
||||
if ((c >= 0xf40) && (c <= 0xfbc))
|
||||
return (1); // tibetan
|
||||
return 1; // tibetan
|
||||
|
||||
if ((c >= 0x1100) && (c <= 0x11ff))
|
||||
return (1); // Korean jamo
|
||||
return 1; // Korean jamo
|
||||
|
||||
if ((c >= 0x2800) && (c <= 0x28ff))
|
||||
return (1); // braille
|
||||
return 1; // braille
|
||||
|
||||
if ((c > 0x3040) && (c <= 0xa700))
|
||||
return (1); // Chinese/Japanese. Should never get here, but Mac OS 10.4's iswalpha seems to be broken, so just make sure
|
||||
return 1; // Chinese/Japanese. Should never get here, but Mac OS 10.4's iswalpha seems to be broken, so just make sure
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IsDigit09(unsigned int c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9'))
|
||||
return (1);
|
||||
return (0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IsDigit(unsigned int c)
|
||||
{
|
||||
if (iswdigit(c))
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
if ((c >= 0x966) && (c <= 0x96f))
|
||||
return (1);
|
||||
return 1;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IsSpace(unsigned int c)
|
||||
{
|
||||
if (c == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
if ((c >= 0x2500) && (c < 0x25a0))
|
||||
return (1); // box drawing characters
|
||||
return 1; // box drawing characters
|
||||
if ((c >= 0xfff9) && (c <= 0xffff))
|
||||
return (1); // unicode specials
|
||||
return (iswspace(c));
|
||||
return 1; // unicode specials
|
||||
return iswspace(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -474,9 +474,9 @@ int lookupwchar(const unsigned short *list, int c)
|
||||
|
||||
for (ix = 0; list[ix] != 0; ix++) {
|
||||
if (list[ix] == c)
|
||||
return (ix+1);
|
||||
return ix+1;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,17 +488,17 @@ int lookupwchar2(const unsigned short *list, int c)
|
||||
|
||||
for (ix = 0; list[ix] != 0; ix += 2) {
|
||||
if (list[ix] == c)
|
||||
return (list[ix+1]);
|
||||
return list[ix+1];
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int IsBracket(int c)
|
||||
{
|
||||
if ((c >= 0x2014) && (c <= 0x201f))
|
||||
return (1);
|
||||
return (lookupwchar(brackets, c));
|
||||
return 1;
|
||||
return lookupwchar(brackets, c);
|
||||
}
|
||||
|
||||
|
||||
@@ -513,11 +513,11 @@ int utf8_out(unsigned int c, char *buf)
|
||||
|
||||
if (c < 0x80) {
|
||||
buf[0] = c;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
if (c >= 0x110000) {
|
||||
buf[0] = ' '; // out of range character code
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
if (c < 0x0800)
|
||||
n_bytes = 1;
|
||||
@@ -532,7 +532,7 @@ int utf8_out(unsigned int c, char *buf)
|
||||
shift -= 6;
|
||||
buf[j+1] = 0x80 + ((c >> shift) & 0x3f);
|
||||
}
|
||||
return (n_bytes+1);
|
||||
return n_bytes+1;
|
||||
}
|
||||
|
||||
|
||||
@@ -541,12 +541,12 @@ int utf8_nbytes(const char *buf)
|
||||
// Returns the number of bytes for the first UTF-8 character in buf
|
||||
unsigned char c = (unsigned char)buf[0];
|
||||
if (c < 0x80)
|
||||
return (1);
|
||||
return 1;
|
||||
if (c < 0xe0)
|
||||
return (2);
|
||||
return 2;
|
||||
if (c < 0xf0)
|
||||
return (3);
|
||||
return (4);
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ int utf8_in2(int *c, const char *buf, int backwards)
|
||||
}
|
||||
}
|
||||
*c = c1;
|
||||
return (n_bytes+1);
|
||||
return n_bytes+1;
|
||||
}
|
||||
|
||||
|
||||
@@ -594,7 +594,7 @@ int utf8_in(int *c, const char *buf)
|
||||
{
|
||||
// Read a unicode characater from a UTF8 string
|
||||
// Returns the number of UTF8 bytes used.
|
||||
return (utf8_in2(c, buf, 0));
|
||||
return utf8_in2(c, buf, 0);
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
@@ -603,8 +603,8 @@ char *strchr_w(const char *s, int c)
|
||||
{
|
||||
// return NULL for any non-ascii character
|
||||
if (c >= 0x80)
|
||||
return (NULL);
|
||||
return (strchr((char *)s, c)); // (char *) is needed for Borland compiler
|
||||
return NULL;
|
||||
return strchr((char *)s, c); // (char *) is needed for Borland compiler
|
||||
}
|
||||
|
||||
|
||||
@@ -614,9 +614,9 @@ int IsAllUpper(const char *word)
|
||||
while ((*word != 0) && !isspace2(*word)) {
|
||||
word += utf8_in(&c, word);
|
||||
if (!iswupper2(c))
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -638,11 +638,11 @@ static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes,
|
||||
if (phonemes[0] == phonSWITCH) {
|
||||
// change to another language in order to translate this word
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
SetSpellingStress(tr, phonemes, spell_word, posn);
|
||||
return (word);
|
||||
return word;
|
||||
}
|
||||
|
||||
|
||||
@@ -700,7 +700,7 @@ static int CheckDottedAbbrev(char *word1, WORD_TAB *wtab)
|
||||
word1[ix++] = ' ';
|
||||
dictionary_skipwords = (count - 1)*2;
|
||||
}
|
||||
return (count);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -725,13 +725,13 @@ int ChangeEquivalentPhonemes(Translator *tr, int lang2, char *phonemes)
|
||||
|
||||
// has a phoneme equivalence table been specified for thus language pair?
|
||||
if ((ix = phoneme_tab_list[tr->phoneme_tab_ix].equivalence_tables) == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
pb = (unsigned char *)&phondata_ptr[ix];
|
||||
|
||||
for (;;) {
|
||||
if (pb[0] == 0)
|
||||
return (0); // table not found
|
||||
return 0; // table not found
|
||||
|
||||
if (pb[0] == lang2)
|
||||
break;
|
||||
@@ -783,7 +783,7 @@ int ChangeEquivalentPhonemes(Translator *tr, int lang2, char *phonemes)
|
||||
DecodePhonemes(phonemes, phonbuf);
|
||||
fprintf(f_trans, "%s\n\n", phonbuf);
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -862,7 +862,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
if (tr->data_dictlist == NULL) {
|
||||
// dictionary is not loaded
|
||||
word_phonemes[0] = 0;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// count the length of the word
|
||||
@@ -961,7 +961,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
if (phonemes[0] == phonSWITCH) {
|
||||
// change to another language in order to translate this word
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((wmark > 0) && (wmark < 8)) {
|
||||
@@ -977,12 +977,12 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
if (!found && iswdigit(first_char)) {
|
||||
Lookup(tr, "_0lang", word_phonemes);
|
||||
if (word_phonemes[0] == phonSWITCH)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if ((tr->langopts.numbers2 & NUM2_ENGLISH_NUMERALS) && !(wtab->flags & FLAG_CHAR_REPLACED)) {
|
||||
// for this language, speak English numerals (0-9) with the English voice
|
||||
sprintf(word_phonemes, "%c", phonSWITCH);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
found = TranslateNumber(tr, word1, phonemes, dictionary_flags, wtab, 0);
|
||||
@@ -1019,13 +1019,13 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
|
||||
if (SpeakIndividualLetters(tr, word1, phonemes, spell_word) == NULL) {
|
||||
if (word_length > 1)
|
||||
return (FLAG_SPELLWORD); // a mixture of languages, retranslate as individual letters, separated by spaces
|
||||
return (0);
|
||||
return FLAG_SPELLWORD; // a mixture of languages, retranslate as individual letters, separated by spaces
|
||||
return 0;
|
||||
}
|
||||
strcpy(word_phonemes, phonemes);
|
||||
if (wflags & FLAG_TRANSLATOR2)
|
||||
return (0);
|
||||
return (dictionary_flags[0] & FLAG_SKIPWORDS); // for "b.c.d"
|
||||
return 0;
|
||||
return dictionary_flags[0] & FLAG_SKIPWORDS; // for "b.c.d"
|
||||
} else if (found == 0) {
|
||||
int posn;
|
||||
int non_initial;
|
||||
@@ -1056,8 +1056,8 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
// change to another language in order to translate this word
|
||||
strcpy(word_phonemes, unpron_phonemes);
|
||||
if (strcmp(&unpron_phonemes[1], "en") == 0)
|
||||
return (FLAG_SPELLWORD); // _^_en must have been set in TranslateLetter(), not *_rules which uses only _^_
|
||||
return (0);
|
||||
return FLAG_SPELLWORD; // _^_en must have been set in TranslateLetter(), not *_rules which uses only _^_
|
||||
return 0;
|
||||
}
|
||||
|
||||
length = 0;
|
||||
@@ -1078,7 +1078,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
if (phonemes[0] == phonSWITCH) {
|
||||
// change to another language in order to translate this word
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((phonemes[0] == 0) && (end_phonemes[0] == 0)) {
|
||||
@@ -1088,10 +1088,10 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
utf8_in(&wc, wordx);
|
||||
if ((word_length == 1) && (IsAlpha(wc) || IsSuperscript(wc))) {
|
||||
if ((wordx = SpeakIndividualLetters(tr, wordx, phonemes, spell_word)) == NULL) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
// change to another language in order to translate this word
|
||||
wordx[-1] = c_temp;
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1228,7 +1228,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
// change to another language in order to translate this word
|
||||
memcpy(wordx, word_copy, strlen(word_copy));
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
if (dictionary_flags[0] == 0) {
|
||||
dictionary_flags[0] = dictionary_flags2[0];
|
||||
@@ -1246,7 +1246,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
// change to another language in order to translate this word
|
||||
memcpy(wordx, word_copy, strlen(word_copy));
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dictionary_flags2[0] & FLAG_ABBREV) {
|
||||
@@ -1290,7 +1290,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
strcpy(word_phonemes, phonemes);
|
||||
memcpy(wordx, word_copy, strlen(word_copy));
|
||||
wordx[-1] = c_temp;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1473,7 +1473,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
|
||||
dictionary_flags[0] |= was_unpronouncable;
|
||||
memcpy(word_start, word_copy2, word_copy_length);
|
||||
return (dictionary_flags[0]);
|
||||
return dictionary_flags[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -1496,7 +1496,7 @@ static int CountSyllables(unsigned char *phonemes)
|
||||
if (phoneme_tab[phon]->type == phVOWEL)
|
||||
count++;
|
||||
}
|
||||
return (count);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -1582,7 +1582,7 @@ int SetTranslator2(const char *new_language)
|
||||
}
|
||||
if (translator2 != NULL)
|
||||
translator2->phonemes_repeat[0] = 0;
|
||||
return (new_phoneme_tab);
|
||||
return new_phoneme_tab;
|
||||
}
|
||||
|
||||
|
||||
@@ -1651,7 +1651,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
embedded_flag = 0;
|
||||
}
|
||||
word_phonemes[0] = 0;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// after a $pause word attribute, ignore a $pause attribute on the next two words
|
||||
@@ -1716,7 +1716,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
if (flags & FLAG_SPELLWORD) {
|
||||
// re-translate the word as individual letters, separated by spaces
|
||||
memcpy(word, word_copy, word_copy_len);
|
||||
return (flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
if ((flags & FLAG_COMBINE) && !(wtab[1].flags & FLAG_PHONEMES)) {
|
||||
@@ -1811,7 +1811,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
// strcpy((char *)p,translator2->word_phonemes);
|
||||
|
||||
if (p[0] == phonSWITCH)
|
||||
return (FLAG_SPELLWORD);
|
||||
return FLAG_SPELLWORD;
|
||||
|
||||
if (switch_phonemes < 0) {
|
||||
// language code is not recognised or 2nd translator won't translate it
|
||||
@@ -2044,7 +2044,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
}
|
||||
|
||||
tr->prev_dict_flags[0] = flags;
|
||||
return (flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -2080,10 +2080,10 @@ static int EmbeddedCommand(unsigned int *source_index_out)
|
||||
|
||||
c = source[source_index++];
|
||||
if (embedded_ix >= (N_EMBEDDED_LIST - 2))
|
||||
return (0); // list is full
|
||||
return 0; // list is full
|
||||
|
||||
if ((p = strchr_w(commands, c)) == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
cmd = (p - commands)+1;
|
||||
if (value == -1) {
|
||||
value = embedded_default[cmd];
|
||||
@@ -2103,7 +2103,7 @@ static int EmbeddedCommand(unsigned int *source_index_out)
|
||||
|
||||
embedded_list[embedded_ix++] = cmd + sign + (value << 8);
|
||||
*source_index_out = source_index;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2119,12 +2119,12 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
|
||||
|
||||
if (ignore_next) {
|
||||
ignore_next = 0;
|
||||
return (8);
|
||||
return 8;
|
||||
}
|
||||
if (c == 0) return (0);
|
||||
if (c == 0) return 0;
|
||||
|
||||
if ((replace_chars = tr->langopts.replace_chars) == NULL)
|
||||
return (c);
|
||||
return c;
|
||||
|
||||
// there is a list of character codes to be substituted with alternative codes
|
||||
|
||||
@@ -2149,7 +2149,7 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
|
||||
}
|
||||
|
||||
if (new_c == 0)
|
||||
return (c); // no substitution
|
||||
return c; // no substitution
|
||||
|
||||
if (new_c & 0xffe00000) {
|
||||
// there is a second character to be inserted
|
||||
@@ -2165,7 +2165,7 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
|
||||
new_c = towupper2(new_c);
|
||||
|
||||
*wordflags |= FLAG_CHAR_REPLACED;
|
||||
return (new_c);
|
||||
return new_c;
|
||||
|
||||
}
|
||||
|
||||
@@ -2207,10 +2207,10 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c,
|
||||
c = initial + 0x1100;
|
||||
*insert = (11*28*21) + (medial*28) + final + 0xac00;
|
||||
}
|
||||
return (c);
|
||||
return c;
|
||||
} else if (((code = c - 0x3130) >= 0) && (code < 0x34)) {
|
||||
// Hangul compatibility jamo
|
||||
return (hangul_compatibility[code] + 0x1100);
|
||||
return hangul_compatibility[code] + 0x1100;
|
||||
}
|
||||
|
||||
switch (tr->translator_name)
|
||||
@@ -2227,17 +2227,17 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c,
|
||||
if ((next_in == 'n') && (tr->translator_name == L('a', 'f'))) {
|
||||
// n preceded by either apostrophe or U2019 "right single quotation mark"
|
||||
ptr[0] = ' '; // delete the n
|
||||
return (0x0259); // replace ' by unicode schwa character
|
||||
return 0x0259; // replace ' by unicode schwa character
|
||||
}
|
||||
if ((next_in == 'n') || (next_in == 't')) {
|
||||
// Dutch, [@n] and [@t]
|
||||
return (0x0259); // replace ' by unicode schwa character
|
||||
return 0x0259; // replace ' by unicode schwa character
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (SubstituteChar(tr, c, next_in, insert, wordflags));
|
||||
return SubstituteChar(tr, c, next_in, insert, wordflags);
|
||||
}
|
||||
|
||||
|
||||
@@ -2258,11 +2258,11 @@ int UpperCaseInWord(Translator *tr, char *word, int c)
|
||||
len = strlen(p);
|
||||
if ((word[-len] == ' ') && (memcmp(&word[-len+1], p, len-1) == 0)) {
|
||||
if ((c == p[len-1]) || ((p[len-1] == 'A') && IsVowel(tr, c)))
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2315,7 +2315,7 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
int tone2;
|
||||
|
||||
if (tr == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p_textinput = (unsigned char *)vp_input;
|
||||
@@ -3049,12 +3049,12 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
}
|
||||
|
||||
if (Eof() || (vp_input == NULL))
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
if (option_multibyte == espeakCHARS_WCHAR)
|
||||
return ((void *)p_wchar_input);
|
||||
return (void *)p_wchar_input;
|
||||
else
|
||||
return ((void *)p_textinput);
|
||||
return (void *)p_textinput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+44
-44
@@ -201,11 +201,11 @@ static char *fgets_strip(char *buf, int size, FILE *f_in)
|
||||
char *p;
|
||||
|
||||
if (fgets(buf, size, f_in) == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
if (buf[0] == '#') {
|
||||
buf[0] = 0;
|
||||
return (buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
len = strlen(buf);
|
||||
@@ -215,7 +215,7 @@ static char *fgets_strip(char *buf, int size, FILE *f_in)
|
||||
if ((p = strstr(buf, "//")) != NULL)
|
||||
*p = 0;
|
||||
|
||||
return (buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,9 +225,9 @@ static int LookupTune(const char *name)
|
||||
|
||||
for (ix = 0; ix < n_tunes; ix++) {
|
||||
if (strcmp(name, tunes[ix].name) == 0)
|
||||
return (ix);
|
||||
return ix;
|
||||
}
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *le
|
||||
sprintf(fname_buf, "%s/mbrola/%s", path_home, vname);
|
||||
|
||||
if (GetFileLength(fname_buf) <= 0)
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -353,7 +353,7 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *le
|
||||
gender = LookupMnem(genders, vgender);
|
||||
|
||||
if (n_languages == 0) {
|
||||
return (NULL); // no language lines in the voice file
|
||||
return NULL; // no language lines in the voice file
|
||||
}
|
||||
|
||||
p = (char *)calloc(sizeof(espeak_VOICE) + langix + strlen(fname) + strlen(vname) + 3, 1);
|
||||
@@ -377,7 +377,7 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *le
|
||||
voice_data->gender = gender;
|
||||
voice_data->variant = 0;
|
||||
voice_data->xx1 = n_variants;
|
||||
return (voice_data);
|
||||
return voice_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -509,8 +509,8 @@ static int Read8Numbers(char *data_in, int *data)
|
||||
{
|
||||
// Read 8 integer numbers
|
||||
memset(data, 0, 8+sizeof(int));
|
||||
return (sscanf(data_in, "%d %d %d %d %d %d %d %d",
|
||||
&data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7]));
|
||||
return sscanf(data_in, "%d %d %d %d %d %d %d %d",
|
||||
&data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7]);
|
||||
}
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ static unsigned int StringToWord2(const char *string)
|
||||
for (ix = 0; (ix < 4) && ((c = string[ix]) != 0); ix++) {
|
||||
value = (value << 8) | (c & 0xff);
|
||||
}
|
||||
return (value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
if (control & 0x10) {
|
||||
strcpy(buf, vname);
|
||||
if (GetFileLength(buf) <= 0)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
} else {
|
||||
if (voicename[0] == 0)
|
||||
strcpy(voicename, "default");
|
||||
@@ -627,7 +627,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
language_type = "en"; // default
|
||||
if (f_voice == NULL) {
|
||||
if (control & 3)
|
||||
return (NULL); // can't open file
|
||||
return NULL; // can't open file
|
||||
|
||||
if (SelectPhonemeTableName(voicename) >= 0)
|
||||
language_type = voicename;
|
||||
@@ -1023,7 +1023,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
LoadDictionary(new_translator, new_dictionary, control & 4);
|
||||
if (dictionary_name[0] == 0) {
|
||||
DeleteTranslator(new_translator);
|
||||
return (NULL); // no dictionary loaded
|
||||
return NULL; // no dictionary loaded
|
||||
}
|
||||
|
||||
new_translator->dict_condition = conditional_rules;
|
||||
@@ -1057,7 +1057,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
translator->stress_amps_r[ix] = stress_amps[ix] -1;
|
||||
}
|
||||
|
||||
return (voice);
|
||||
return voice;
|
||||
}
|
||||
|
||||
|
||||
@@ -1096,7 +1096,7 @@ static char *ExtractVoiceVariantName(char *vname, int variant_num, int add_dir)
|
||||
sprintf(variant_name, "%sf%d", variant_prefix, variant_num-10); // female
|
||||
}
|
||||
|
||||
return (variant_name);
|
||||
return variant_name;
|
||||
}
|
||||
|
||||
|
||||
@@ -1114,12 +1114,12 @@ voice_t *LoadVoiceVariant(const char *vname, int variant_num)
|
||||
variant_name = ExtractVoiceVariantName(buf, variant_num, 1);
|
||||
|
||||
if ((v = LoadVoice(buf, 0)) == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
if (variant_name[0] != 0) {
|
||||
v = LoadVoice(variant_name, 2);
|
||||
}
|
||||
return (v);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -1132,10 +1132,10 @@ static int __cdecl VoiceNameSorter(const void *p1, const void *p2)
|
||||
|
||||
|
||||
if ((ix = strcmp(&v1->languages[1], &v2->languages[1])) != 0) // primary language name
|
||||
return (ix);
|
||||
return ix;
|
||||
if ((ix = v1->languages[0] - v2->languages[0]) != 0) // priority number
|
||||
return (ix);
|
||||
return (strcmp(v1->name, v2->name));
|
||||
return ix;
|
||||
return strcmp(v1->name, v2->name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1146,8 +1146,8 @@ static int __cdecl VoiceScoreSorter(const void *p1, const void *p2)
|
||||
espeak_VOICE *v2 = *(espeak_VOICE **)p2;
|
||||
|
||||
if ((ix = v2->score - v1->score) != 0)
|
||||
return (ix);
|
||||
return (strcmp(v1->name, v2->name));
|
||||
return ix;
|
||||
return strcmp(v1->name, v2->name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1171,8 +1171,8 @@ static int ScoreVoice(espeak_VOICE *voice_spec, const char *spec_language, int s
|
||||
if (spec_n_parts < 0) {
|
||||
// match on the subdirectory
|
||||
if (memcmp(voice->identifier, spec_language, spec_lang_len) == 0)
|
||||
return (100);
|
||||
return (0);
|
||||
return 100;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (spec_n_parts == 0) {
|
||||
@@ -1231,7 +1231,7 @@ static int ScoreVoice(espeak_VOICE *voice_spec, const char *spec_language, int s
|
||||
}
|
||||
}
|
||||
if (score == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (voice_spec->name != NULL) {
|
||||
if (strcmp(voice_spec->name, voice->name) == 0) {
|
||||
@@ -1274,7 +1274,7 @@ static int ScoreVoice(espeak_VOICE *voice_spec, const char *spec_language, int s
|
||||
}
|
||||
if (score < 1)
|
||||
score = 1;
|
||||
return (score);
|
||||
return score;
|
||||
}
|
||||
|
||||
|
||||
@@ -1332,12 +1332,12 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int
|
||||
voices[nv] = NULL; // list terminator
|
||||
|
||||
if (nv == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
// sort the selected voices by their score
|
||||
qsort(voices, nv, sizeof(espeak_VOICE *), (int(__cdecl *)(const void *, const void *))VoiceScoreSorter);
|
||||
|
||||
return (nv);
|
||||
return nv;
|
||||
}
|
||||
|
||||
|
||||
@@ -1391,9 +1391,9 @@ espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name2)
|
||||
}
|
||||
|
||||
if (match_name < 0)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
return (voices[match_name]);
|
||||
return voices[match_name];
|
||||
}
|
||||
|
||||
|
||||
@@ -1446,10 +1446,10 @@ char const *SelectVoice(espeak_VOICE *voice_select, int *found)
|
||||
if ((voice_select2.gender == 0) && (voice_select2.age == 0) && (voice_select2.variant == 0)) {
|
||||
if (variant_name[0] != 0) {
|
||||
sprintf(voice_id, "%s+%s", vp->identifier, variant_name);
|
||||
return (voice_id);
|
||||
return voice_id;
|
||||
}
|
||||
|
||||
return (vp->identifier);
|
||||
return vp->identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1520,16 +1520,16 @@ char const *SelectVoice(espeak_VOICE *voice_select, int *found)
|
||||
|
||||
// index the sorted list by the required variant number
|
||||
if (ix2 == 0)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
vp = voices2[voice_select2.variant % ix2];
|
||||
|
||||
if (vp->variant != 0) {
|
||||
variant_name = ExtractVoiceVariantName(NULL, vp->variant, 0);
|
||||
sprintf(voice_id, "%s+%s", vp->identifier, variant_name);
|
||||
return (voice_id);
|
||||
return voice_id;
|
||||
}
|
||||
|
||||
return (vp->identifier);
|
||||
return vp->identifier;
|
||||
}
|
||||
|
||||
|
||||
@@ -1697,7 +1697,7 @@ espeak_ERROR SetVoiceByName(const char *name)
|
||||
DoVoiceChange(voice);
|
||||
voice_selector.languages = voice->language_name;
|
||||
SetVoiceStack(&voice_selector, variant_name);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
if (n_voices_list == 0)
|
||||
@@ -1711,10 +1711,10 @@ espeak_ERROR SetVoiceByName(const char *name)
|
||||
DoVoiceChange(voice);
|
||||
voice_selector.languages = voice->language_name;
|
||||
SetVoiceStack(&voice_selector, variant_name);
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
}
|
||||
return (EE_INTERNAL_ERROR); // voice name not found
|
||||
return EE_INTERNAL_ERROR; // voice name not found
|
||||
}
|
||||
|
||||
|
||||
@@ -1727,13 +1727,13 @@ espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
voice_id = SelectVoice(voice_selector, &voice_found);
|
||||
|
||||
if (voice_found == 0)
|
||||
return (EE_NOT_FOUND);
|
||||
return EE_NOT_FOUND;
|
||||
|
||||
LoadVoiceVariant(voice_id, 0);
|
||||
DoVoiceChange(voice);
|
||||
SetVoiceStack(voice_selector, "");
|
||||
|
||||
return (EE_OK);
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1765,7 +1765,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
GetVoices(path_voices);
|
||||
voices_list[n_voices_list] = NULL; // voices list terminator
|
||||
}
|
||||
return ((const espeak_VOICE **)voices_list);
|
||||
return (const espeak_VOICE **)voices_list;
|
||||
|
||||
#else
|
||||
int ix;
|
||||
@@ -1802,7 +1802,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
}
|
||||
voices[j] = NULL;
|
||||
}
|
||||
return ((const espeak_VOICE **)voices);
|
||||
return (const espeak_VOICE **)voices;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1810,7 +1810,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
|
||||
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void)
|
||||
{
|
||||
return (¤t_voice_selected);
|
||||
return ¤t_voice_selected;
|
||||
}
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
@@ -392,7 +392,7 @@ static int pa_callback(const void *inputBuffer, void *outputBuffer,
|
||||
}
|
||||
#endif
|
||||
|
||||
return (aResult);
|
||||
return aResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ static int wave_open_sound()
|
||||
|
||||
if (active == 1) {
|
||||
SHOW_TIME("wave_open_sound > already active");
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
if (active < 0) {
|
||||
out_channels = 1;
|
||||
@@ -519,7 +519,7 @@ static int wave_open_sound()
|
||||
|
||||
SHOW("wave_open_sound > %s\n", "LEAVE");
|
||||
|
||||
return (err != paNoError);
|
||||
return err != paNoError;
|
||||
}
|
||||
|
||||
#if (USE_PORTAUDIO == 19)
|
||||
@@ -656,7 +656,7 @@ void *wave_open(const char *the_api)
|
||||
select_device("alsa");
|
||||
once = 1;
|
||||
}
|
||||
return ((void *)1);
|
||||
return (void *)1;
|
||||
}
|
||||
|
||||
static size_t copyBuffer(char *dest, char *src, const size_t theSizeInBytes)
|
||||
@@ -906,7 +906,7 @@ int wave_is_busy(void *theHandler)
|
||||
SHOW("wave_is_busy: %d\n", active);
|
||||
|
||||
|
||||
return (active == 1);
|
||||
return active == 1;
|
||||
}
|
||||
|
||||
void wave_terminate()
|
||||
@@ -996,7 +996,7 @@ extern void *wave_test_get_write_buffer() {
|
||||
|
||||
int wave_get_remaining_time(uint32_t sample, uint32_t *time)
|
||||
{
|
||||
if (!time) return (-1);
|
||||
if (!time) return -1;
|
||||
*time = (uint32_t)0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ int wave_init(int srate)
|
||||
void *wave_open(const char *the_api)
|
||||
{
|
||||
ENTER("wave_open");
|
||||
return ((void *)1);
|
||||
return (void *)1;
|
||||
}
|
||||
|
||||
size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize)
|
||||
@@ -786,7 +786,7 @@ extern void *wave_test_get_write_buffer() {
|
||||
|
||||
int wave_get_remaining_time(uint32_t sample, uint32_t *time)
|
||||
{
|
||||
if (!time) return (-1);
|
||||
if (!time) return -1;
|
||||
*time = (uint32_t)0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ int wave_init(int srate) {
|
||||
SHOW("wave_init() sun_audio_fd: %d\n", sun_audio_fd);
|
||||
|
||||
if (sun_audio_fd < 0) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ioctl(sun_audio_fd, AUDIO_GETINFO, &ainfo);
|
||||
@@ -113,9 +113,9 @@ int wave_init(int srate) {
|
||||
if (ioctl(sun_audio_fd, AUDIO_SETINFO, &ainfo) == -1) {
|
||||
SHOW("wave_init() failed to set audio params: %s\n", strerror(errno));
|
||||
close(sun_audio_fd);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// wave_open
|
||||
@@ -143,7 +143,7 @@ int wave_init(int srate) {
|
||||
void *wave_open(const char *the_api)
|
||||
{
|
||||
ENTER("wave_open");
|
||||
return ((void *)sun_audio_fd);
|
||||
return (void *)sun_audio_fd;
|
||||
}
|
||||
|
||||
// wave_write
|
||||
@@ -471,7 +471,7 @@ int wave_get_remaining_time(uint32_t sample, uint32_t *time)
|
||||
audio_info_t ainfo;
|
||||
ENTER("wave_get_remaining_time");
|
||||
if (!time) {
|
||||
return (-1);
|
||||
return -1;
|
||||
SHOW_TIME("wave_get_remaining_time > LEAVE");
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ extern void *wave_test_get_write_buffer() {
|
||||
|
||||
int wave_get_remaining_time(uint32_t sample, uint32_t *time)
|
||||
{
|
||||
if (!time) return (-1);
|
||||
if (!time) return -1;
|
||||
*time = (uint32_t)0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+40
-40
@@ -292,12 +292,12 @@ int WcmdqFree()
|
||||
int i;
|
||||
i = wcmdq_head - wcmdq_tail;
|
||||
if (i <= 0) i += N_WCMDQ;
|
||||
return (i);
|
||||
return i;
|
||||
}
|
||||
|
||||
int WcmdqUsed()
|
||||
{
|
||||
return (N_WCMDQ - WcmdqFree());
|
||||
return N_WCMDQ - WcmdqFree();
|
||||
}
|
||||
|
||||
|
||||
@@ -470,7 +470,7 @@ static int WaveCallback(const void *inputBuffer, void *outputBuffer,
|
||||
|
||||
#if USE_PORTAUDIO == 18
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
return (result);
|
||||
return result;
|
||||
#endif
|
||||
if (result != 0) {
|
||||
static int end_timer = 0;
|
||||
@@ -479,12 +479,12 @@ static int WaveCallback(const void *inputBuffer, void *outputBuffer,
|
||||
if (end_timer > 0) {
|
||||
end_timer--;
|
||||
if (end_timer == 0)
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
#else
|
||||
return (result);
|
||||
return result;
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -528,7 +528,7 @@ static PaError Pa_OpenDefaultStream2(PaStream **stream,
|
||||
result = Pa_OpenStream(
|
||||
stream, NULL, &hostApiOutputParameters, sampleRate, framesPerBuffer, paNoFlag, streamCallback, userData);
|
||||
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -540,7 +540,7 @@ int WavegenOpenSound()
|
||||
|
||||
if (option_waveout || option_quiet) {
|
||||
// writing to WAV file, not to portaudio
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if USE_PORTAUDIO == 18
|
||||
@@ -550,7 +550,7 @@ int WavegenOpenSound()
|
||||
#endif
|
||||
|
||||
if (active == 1)
|
||||
return (0);
|
||||
return 0;
|
||||
if (active < 0) {
|
||||
out_channels = 1;
|
||||
|
||||
@@ -587,7 +587,7 @@ int WavegenOpenSound()
|
||||
exit(2);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -607,13 +607,13 @@ int WavegenCloseSound()
|
||||
if (active == 0) {
|
||||
Pa_CloseStream(pa_stream);
|
||||
pa_stream = NULL;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
WavegenOpenSound(); // still items in the queue, shouldn't be closed
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -622,29 +622,29 @@ int WavegenInitSound()
|
||||
PaError err;
|
||||
|
||||
if (option_quiet)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
// PortAudio sound output library
|
||||
err = Pa_Initialize();
|
||||
pa_init_err = err;
|
||||
if (err != paNoError) {
|
||||
fprintf(stderr, "Failed to initialise the PortAudio sound\n");
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int WavegenOpenSound()
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
int WavegenCloseSound()
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
int WavegenInitSound()
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -706,7 +706,7 @@ int GetAmplitude(void)
|
||||
|
||||
amp = (embedded_value[EMBED_A])*55/100;
|
||||
general_amplitude = amp * amp_emphasis[embedded_value[EMBED_F]] / 16;
|
||||
return (general_amplitude);
|
||||
return general_amplitude;
|
||||
}
|
||||
|
||||
|
||||
@@ -775,12 +775,12 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control)
|
||||
|
||||
#ifdef SPECT_EDITOR
|
||||
if (harm_sqrt_n > 0)
|
||||
return (HarmToHarmspect(pitch, htab));
|
||||
return HarmToHarmspect(pitch, htab);
|
||||
#endif
|
||||
|
||||
// initialise as much of *out as we will need
|
||||
if (wvoice == NULL)
|
||||
return (1);
|
||||
return 1;
|
||||
hmax = (peaks[wvoice->n_harmonic_peaks].freq + peaks[wvoice->n_harmonic_peaks].right)/pitch;
|
||||
if (hmax >= MAX_HARMONIC)
|
||||
hmax = MAX_HARMONIC-1;
|
||||
@@ -866,7 +866,7 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control)
|
||||
}
|
||||
}
|
||||
|
||||
return (hmax); // highest harmonic number
|
||||
return hmax; // highest harmonic number
|
||||
}
|
||||
|
||||
|
||||
@@ -1029,7 +1029,7 @@ static int ApplyBreath(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1060,7 +1060,7 @@ int Wavegen()
|
||||
|
||||
for (;;) {
|
||||
if ((end_wave == 0) && (samplecount == nsamples))
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if ((samplecount & 0x3f) == 0) {
|
||||
// every 64 samples, adjust the parameters
|
||||
@@ -1105,7 +1105,7 @@ int Wavegen()
|
||||
// sign has changed, reached a quiet point in the waveform
|
||||
cbytes = wavemult_offset - (cycle_samples)/2;
|
||||
if (samplecount > nsamples)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
cycle_count++;
|
||||
|
||||
@@ -1257,9 +1257,9 @@ int Wavegen()
|
||||
echo_head = 0;
|
||||
|
||||
if (out_ptr >= out_end)
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1273,7 +1273,7 @@ static int PlaySilence(int length, int resume)
|
||||
wavephase = 0x7fffffff;
|
||||
|
||||
if (length == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (resume == 0)
|
||||
n_samples = length;
|
||||
@@ -1292,9 +1292,9 @@ static int PlaySilence(int length, int resume)
|
||||
echo_head = 0;
|
||||
|
||||
if (out_ptr >= out_end)
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1347,19 +1347,19 @@ static int PlayWave(int length, int resume, unsigned char *data, int scale, int
|
||||
echo_head = 0;
|
||||
|
||||
if (out_ptr >= out_end)
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int SetWithRange0(int value, int max)
|
||||
{
|
||||
if (value < 0)
|
||||
return (0);
|
||||
return 0;
|
||||
if (value > max)
|
||||
return (max);
|
||||
return (value);
|
||||
return max;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1615,7 +1615,7 @@ static int Wavegen2(int length, int modulation, int resume, frame_t *fr1, frame_
|
||||
if (resume == 0)
|
||||
SetSynth(length, modulation, fr1, fr2, wvoice);
|
||||
|
||||
return (Wavegen());
|
||||
return Wavegen();
|
||||
}
|
||||
|
||||
void Write4Bytes(FILE *f, int value)
|
||||
@@ -1650,14 +1650,14 @@ int WavegenFill2(int fill_zeros)
|
||||
// continue to play silence until echo is completed
|
||||
resume = PlaySilence(echo_complete, resume);
|
||||
if (resume == 1)
|
||||
return (0); // not yet finished
|
||||
return 0; // not yet finished
|
||||
}
|
||||
|
||||
if (fill_zeros) {
|
||||
while (out_ptr < out_end)
|
||||
*out_ptr++ = 0;
|
||||
}
|
||||
return (1); // queue empty, close sound channel
|
||||
return 1; // queue empty, close sound channel
|
||||
}
|
||||
|
||||
result = 0;
|
||||
@@ -1767,7 +1767,7 @@ int WavegenFill2(int fill_zeros)
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1787,7 +1787,7 @@ static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text
|
||||
}
|
||||
|
||||
if (sonicSpeedupStream == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (end_of_text) {
|
||||
sonicFlushStream(sonicSpeedupStream);
|
||||
|
||||
+9
-9
@@ -204,7 +204,7 @@ static int OpenWaveFile(const char *path, int rate)
|
||||
};
|
||||
|
||||
if (path == NULL)
|
||||
return (2);
|
||||
return 2;
|
||||
|
||||
while (isspace(*path)) path++;
|
||||
|
||||
@@ -225,9 +225,9 @@ static int OpenWaveFile(const char *path, int rate)
|
||||
Write4Bytes(f_wave, rate);
|
||||
Write4Bytes(f_wave, rate * 2);
|
||||
fwrite(&wave_hdr[32], 1, 12, f_wave);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,12 +270,12 @@ static int WavegenFile(void)
|
||||
finished = WavegenFill(0);
|
||||
|
||||
if (quiet)
|
||||
return (finished);
|
||||
return finished;
|
||||
|
||||
if (f_wave == NULL) {
|
||||
sprintf(fname, "%s_%.2d%s", wavefile, ++wavefile_count, filetype);
|
||||
if (OpenWaveFile(fname, samplerate) != 0)
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (end_of_sentence) {
|
||||
@@ -290,7 +290,7 @@ static int WavegenFile(void)
|
||||
samples_total += (out_ptr - wav_outbuf)/2;
|
||||
fwrite(wav_outbuf, 1, out_ptr - wav_outbuf, f_wave);
|
||||
}
|
||||
return (finished);
|
||||
return finished;
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ static int initialise(void)
|
||||
for (param = 0; param < N_SPEECH_PARAM; param++)
|
||||
param_stack[0].parameter[param] = param_defaults[param];
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (option_quiet) {
|
||||
while (SpeakNextClause(NULL, NULL, 1) != 0) ;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
speaking = 1;
|
||||
@@ -843,5 +843,5 @@ int main(int argc, char **argv)
|
||||
|
||||
if ((f_trans != stdout) && (f_trans != stderr))
|
||||
fclose(f_trans); // needed for WinCe
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user