Browse Source

code cleanup: move check for SSML comments and declarations to

ProcessSsmlTag()

Note the line in readclause.c:
if ((c2 == '/') || iswalpha(c2) || c2 == '!' || c2 == '?') {

It might be enough to pass everything to ProcessSsmlTag. What are the
cases that are skipped because of this?
master
Juho Hiltunen 4 years ago
parent
commit
34657e7ea4
2 changed files with 6 additions and 6 deletions
  1. 1
    6
      src/libespeak-ng/readclause.c
  2. 5
    0
      src/libespeak-ng/ssml.c

+ 1
- 6
src/libespeak-ng/readclause.c View File

@@ -753,12 +753,7 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_
if ((c1 <= 0x20) && ((sayas_mode == SAYAS_SINGLE_CHARS) || (sayas_mode == SAYAS_KEY)))
c1 += 0xe000; // move into unicode private usage area
} else if ((c1 == '<') && (ssml_ignore_l_angle != '<')) {
if ((c2 == '!') || (c2 == '?')) {
// a comment, ignore until closing '<' (or <?xml tag )
while (!Eof() && (c1 != '>'))
c1 = GetC();
c2 = ' ';
} else if ((c2 == '/') || iswalpha(c2)) {
if ((c2 == '/') || iswalpha(c2) || c2 == '!' || c2 == '?') {
// check for space in the output buffer for embedded commands produced by the SSML tag
if (ix > (n_buf - 20)) {
// Perhaps not enough room, end the clause before the SSML tag

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

@@ -574,6 +574,11 @@ int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, con
PARAM_STACK *sp;
SSML_STACK *ssml_sp;

// don't process comments and xml declarations
if (wcsncmp(xml_buf, (wchar_t *) "!--", 3) == 0 || wcsncmp(xml_buf, (wchar_t *) "?xml", 4) == 0) {
return 0;
}

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


Loading…
Cancel
Save