Browse Source

start moving SSML related parsing to ssml.c

move: attrcmp() and attrlookup()
new file ssml.c added to Makefile.am
master
Juho Hiltunen 7 years ago
parent
commit
a8239c4502
3 changed files with 77 additions and 25 deletions
  1. 1
    0
      Makefile.am
  2. 0
    25
      src/libespeak-ng/readclause.c
  3. 76
    0
      src/libespeak-ng/ssml.c

+ 1
- 0
Makefile.am View File

@@ -167,6 +167,7 @@ src_libespeak_ng_la_SOURCES = \
src/libespeak-ng/setlengths.c \
src/libespeak-ng/spect.c \
src/libespeak-ng/speech.c \
src/libespeak-ng/ssml.c \
src/libespeak-ng/synthdata.c \
src/libespeak-ng/synthesize.c \
src/libespeak-ng/synth_mbrola.c \

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

@@ -807,31 +807,6 @@ static wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
return NULL;
}

static int attrcmp(const wchar_t *string1, const char *string2)
{
int ix;

if (string1 == NULL)
return 1;

for (ix = 0; (string1[ix] == string2[ix]) && (string1[ix] != 0); ix++)
;
if (((string1[ix] == '"') || (string1[ix] == '\'')) && (string2[ix] == 0))
return 0;
return 1;
}

static int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab)
{
int ix;

for (ix = 0; mtab[ix].mnem != NULL; ix++) {
if (attrcmp(string1, mtab[ix].mnem) == 0)
return mtab[ix].value;
}
return mtab[ix].value;
}

static int attrnumber(const wchar_t *pw, int default_value, int type)
{
int value = 0;

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

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2005 to 2015 by Jonathan Duddington
* email: [email protected]
* Copyright (C) 2015-2017 Reece H. Dunn
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see: <http://www.gnu.org/licenses/>.
*/


#include "config.h"

#include <ctype.h>
#include <errno.h>
#include <locale.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wchar.h>
#include <wctype.h>


#include <espeak-ng/espeak_ng.h>
#include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h>
#include <ucd/ucd.h>

#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"

int attrcmp(const wchar_t *string1, const char *string2);
int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab);

int attrcmp(const wchar_t *string1, const char *string2)
{
int ix;

if (string1 == NULL)
return 1;

for (ix = 0; (string1[ix] == string2[ix]) && (string1[ix] != 0); ix++)
;
if (((string1[ix] == '"') || (string1[ix] == '\'')) && (string2[ix] == 0))
return 0;
return 1;
}


int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab)
{
int ix;

for (ix = 0; mtab[ix].mnem != NULL; ix++) {
if (attrcmp(string1, mtab[ix].mnem) == 0)
return mtab[ix].value;
}
return mtab[ix].value;
}


Loading…
Cancel
Save