move ReplaceKeyName()

This commit is contained in:
Juho Hiltunen
2018-03-03 23:43:48 +02:00
parent 21e391b631
commit 6c4d22b6d2
3 changed files with 26 additions and 25 deletions
-25
View File
@@ -669,31 +669,6 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
}
}
static int ReplaceKeyName(char *outbuf, int index, int *outix)
{
// Replace some key-names by single characters, so they can be pronounced in different languages
static MNEM_TAB keynames[] = {
{ "space ", 0xe020 },
{ "tab ", 0xe009 },
{ "underscore ", 0xe05f },
{ "double-quote ", '"' },
{ NULL, 0 }
};
int ix;
int letter;
char *p;
p = &outbuf[index];
if ((letter = LookupMnem(keynames, p)) != 0) {
ix = utf8_out(letter, p);
*outix = index + ix;
return letter;
}
return 0;
}
static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, bool self_closing)
{
// xml_buf is the tag and attributes with a zero terminator in place of the original '>'
+25
View File
@@ -414,3 +414,28 @@ wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
return NULL;
}
int ReplaceKeyName(char *outbuf, int index, int *outix)
{
// Replace some key-names by single characters, so they can be pronounced in different languages
static MNEM_TAB keynames[] = {
{ "space ", 0xe020 },
{ "tab ", 0xe009 },
{ "underscore ", 0xe05f },
{ "double-quote ", '"' },
{ NULL, 0 }
};
int ix;
int letter;
char *p;
p = &outbuf[index];
if ((letter = LookupMnem(keynames, p)) != 0) {
ix = utf8_out(letter, p);
*outix = index + ix;
return letter;
}
return 0;
}
+1
View File
@@ -81,3 +81,4 @@ void ProcessParamStack(char *outbuf, int *outix, int n_param_stack, PARAM_STACK
PARAM_STACK *PushParamStack(int tag_type, int *n_param_stack, PARAM_STACK *param_stack);
const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espeak_VOICE *base_voice, char base_voice_variant_name[40]);
void PopParamStack(int tag_type, char *outbuf, int *outix, int *n_param_stack, PARAM_STACK *param_stack, int *speech_parameters);
int ReplaceKeyName(char *outbuf, int index, int *outix);