Browse Source

code cleanup: move CheckTranslator() to langopts.c

master
Juho Hiltunen 2 years ago
parent
commit
3182dee147
3 changed files with 14 additions and 15 deletions
  1. 14
    2
      src/libespeak-ng/langopts.c
  2. 0
    1
      src/libespeak-ng/voice.h
  3. 0
    12
      src/libespeak-ng/voices.c

+ 14
- 2
src/libespeak-ng/langopts.c View File

#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>


static int LookupTune(const char *name);

#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>
#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>
#include "voice.h" // for CheckTranslator() #include "voice.h" // for CheckTranslator()
#include "synthdata.h" // for n_tunes, tunes #include "synthdata.h" // for n_tunes, tunes


static int CheckTranslator(Translator *tr, const MNEM_TAB *keyword_tab, int key);
static int LookupTune(const char *name);

enum { enum {
V_NAME = 1, V_NAME = 1,
V_LANGUAGE, V_LANGUAGE,
return -1; return -1;
} }


int CheckTranslator(Translator *tr, const MNEM_TAB *keyword_tab, int key)
{
// Return 0 if translator is set.
// Return 1 and print an error message for specified key if not
// used for parsing language options
if (tr)
return 0;

fprintf(stderr, "Cannot set %s: language not set, or is invalid.\n", LookupMnemName(keyword_tab, key));
return 1;
}

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

extern voice_t *voice; extern voice_t *voice;
extern int tone_points[12]; extern int tone_points[12];


int CheckTranslator(Translator *tr, const MNEM_TAB *keyword_tab, int key);
const char *SelectVoice(espeak_VOICE *voice_select, int *found); const char *SelectVoice(espeak_VOICE *voice_select, int *found);
espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name); espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name);
voice_t *LoadVoice(const char *voice_name, int control); voice_t *LoadVoice(const char *voice_name, int control);

+ 0
- 12
src/libespeak-ng/voices.c View File

} }
} }


int CheckTranslator(Translator *tr, const MNEM_TAB *keyword_tab, int key)
{
// Return 0 if translator is set.
// Return 1 and print an error message for specified key if not
// used for parsing language options
if (tr)
return 0;

fprintf(stderr, "Cannot set %s: language not set, or is invalid.\n", LookupMnemName(keyword_tab, key));
return 1;
}

voice_t *LoadVoice(const char *vname, int control) voice_t *LoadVoice(const char *vname, int control)
{ {
// control, bit 0 1= no_default // control, bit 0 1= no_default

Loading…
Cancel
Save