This is a bit slower since we don't pass n_xml_buf as an argument but rather get it with a call to wcslen. It is much cleaner though, since the name ProcessSsmlTag() implies that all processing should be done there.master
@@ -643,7 +643,6 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_ | |||
int terminator; | |||
int found; | |||
bool any_alnum = false; | |||
bool self_closing; | |||
int punct_data = 0; | |||
bool is_end_clause; | |||
int announced_punctuation = 0; | |||
@@ -780,14 +779,7 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_ | |||
xml_buf[n_xml_buf] = 0; | |||
c2 = ' '; | |||
self_closing = false; | |||
if (xml_buf[n_xml_buf-1] == '/') { | |||
// a self-closing tag | |||
xml_buf[n_xml_buf-1] = ' '; | |||
self_closing = true; | |||
} | |||
terminator = ProcessSsmlTag(xml_buf, buf, &ix, n_buf, self_closing, xmlbase, &audio_text, current_voice_id, &base_voice, base_voice_variant_name, &ignore_text, &clear_skipping_text, &sayas_mode, &sayas_start, ssml_stack, &n_ssml_stack, &n_param_stack, (int *)speech_parameters); | |||
terminator = ProcessSsmlTag(xml_buf, buf, &ix, n_buf, xmlbase, &audio_text, current_voice_id, &base_voice, base_voice_variant_name, &ignore_text, &clear_skipping_text, &sayas_mode, &sayas_start, ssml_stack, &n_ssml_stack, &n_param_stack, (int *)speech_parameters); | |||
if (terminator != 0) { | |||
buf[ix] = ' '; |
@@ -549,7 +549,7 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp, | |||
} | |||
} | |||
int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, bool self_closing, const char *xmlbase, bool *audio_text, char *current_voice_id, espeak_VOICE *base_voice, char *base_voice_variant_name, bool *ignore_text, bool *clear_skipping_text, int *sayas_mode, int *sayas_start, SSML_STACK *ssml_stack, int *n_ssml_stack, int *n_param_stack, int *speech_parameters) | |||
int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, const char *xmlbase, bool *audio_text, char *current_voice_id, espeak_VOICE *base_voice, char *base_voice_variant_name, bool *ignore_text, bool *clear_skipping_text, int *sayas_mode, int *sayas_start, SSML_STACK *ssml_stack, int *n_ssml_stack, int *n_param_stack, int *speech_parameters) | |||
{ | |||
// xml_buf is the tag and attributes with a zero terminator in place of the original '>' | |||
// returns a clause terminator value. | |||
@@ -577,6 +577,15 @@ int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, boo | |||
// these tags have no effect if they are self-closing, eg. <voice /> | |||
static char ignore_if_self_closing[] = { 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0 }; | |||
bool self_closing = false; | |||
int len; | |||
len = wcslen(xml_buf); | |||
if (xml_buf[len - 1] == '/') { | |||
// a self-closing tag | |||
xml_buf[len - 1] = ' '; | |||
self_closing = true; | |||
} | |||
static const MNEM_TAB mnem_phoneme_alphabet[] = { | |||
{ "espeak", 1 }, | |||
{ NULL, -1 } |
@@ -66,7 +66,6 @@ int ProcessSsmlTag(wchar_t *xml_buf, | |||
char *outbuf, | |||
int *outix, | |||
int n_outbuf, | |||
bool self_closing, | |||
const char *xmlbase, | |||
bool *audio_text, | |||
char *current_voice_id, |