From 21e391b6318e314c0e9e2ae66d63cae54518e9da Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sat, 3 Mar 2018 23:43:14 +0200 Subject: [PATCH] move GetSsmlAttributes() --- src/libespeak-ng/readclause.c | 31 ------------------------------- src/libespeak-ng/ssml.c | 31 +++++++++++++++++++++++++++++++ src/libespeak-ng/ssml.h | 1 + 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/libespeak-ng/readclause.c b/src/libespeak-ng/readclause.c index 366f70a7..56503557 100644 --- a/src/libespeak-ng/readclause.c +++ b/src/libespeak-ng/readclause.c @@ -549,37 +549,6 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output return short_pause; } -wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name) -{ - // Gets the value string for an attribute. - // Returns NULL if the attribute is not present - - int ix; - static wchar_t empty[1] = { 0 }; - - while (*pw != 0) { - if (iswspace(pw[-1])) { - ix = 0; - while (*pw == name[ix]) { - pw++; - ix++; - } - if (name[ix] == 0) { - // found the attribute, now get the value - while (iswspace(*pw)) pw++; - if (*pw == '=') pw++; - while (iswspace(*pw)) pw++; - if ((*pw == '"') || (*pw == '\'')) // allow single-quotes ? - return pw+1; - else - return empty; - } - } - pw++; - } - return NULL; -} - static int AddNameData(const char *name, int wide) { // Add the name to the namedata and return its position diff --git a/src/libespeak-ng/ssml.c b/src/libespeak-ng/ssml.c index a0401d44..58a4eab8 100644 --- a/src/libespeak-ng/ssml.c +++ b/src/libespeak-ng/ssml.c @@ -383,3 +383,34 @@ void PopParamStack(int tag_type, char *outbuf, int *outix, int *n_param_stack, P ProcessParamStack(outbuf, outix, *n_param_stack, param_stack, speech_parameters); } +wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name) +{ + // Gets the value string for an attribute. + // Returns NULL if the attribute is not present + + int ix; + static wchar_t empty[1] = { 0 }; + + while (*pw != 0) { + if (iswspace(pw[-1])) { + ix = 0; + while (*pw == name[ix]) { + pw++; + ix++; + } + if (name[ix] == 0) { + // found the attribute, now get the value + while (iswspace(*pw)) pw++; + if (*pw == '=') pw++; + while (iswspace(*pw)) pw++; + if ((*pw == '"') || (*pw == '\'')) // allow single-quotes ? + return pw+1; + else + return empty; + } + } + pw++; + } + return NULL; +} + diff --git a/src/libespeak-ng/ssml.h b/src/libespeak-ng/ssml.h index 1afcbdc8..0811ec04 100644 --- a/src/libespeak-ng/ssml.h +++ b/src/libespeak-ng/ssml.h @@ -75,6 +75,7 @@ int attrcopy_utf8(char *buf, const wchar_t *pw, int len); int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab); int attrnumber(const wchar_t *pw, int default_value, int type); int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out); +wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name); int GetVoiceAttributes(wchar_t *pw, int tag_type, SSML_STACK *ssml_sp, SSML_STACK *ssml_stack, int n_ssml_stack, char current_voice_id[40], espeak_VOICE *base_voice, char base_voice_variant_name[40]); void ProcessParamStack(char *outbuf, int *outix, int n_param_stack, PARAM_STACK *param_stack, int *speech_parameters); PARAM_STACK *PushParamStack(int tag_type, int *n_param_stack, PARAM_STACK *param_stack);