mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-26 21:14:27 +00:00
start moving SSML related parsing to ssml.c
move: attrcmp() and attrlookup() new file ssml.c added to Makefile.am
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington
|
||||
* email: jonsd@users.sourceforge.net
|
||||
* 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user