Browse Source

move GetSsmlAttributes()

master
Juho Hiltunen 7 years ago
parent
commit
21e391b631
3 changed files with 32 additions and 31 deletions
  1. 0
    31
      src/libespeak-ng/readclause.c
  2. 31
    0
      src/libespeak-ng/ssml.c
  3. 1
    0
      src/libespeak-ng/ssml.h

+ 0
- 31
src/libespeak-ng/readclause.c View File

@@ -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

+ 31
- 0
src/libespeak-ng/ssml.c View File

@@ -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;
}


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

@@ -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);

Loading…
Cancel
Save