mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Group the LookupMnem API implementations into mnemonics.c.
This commit is contained in:
@@ -151,6 +151,7 @@ src_libespeak_ng_la_SOURCES = \
|
||||
src/libespeak-ng/espeak_api.c \
|
||||
src/libespeak-ng/ieee80.c \
|
||||
src/libespeak-ng/intonation.c \
|
||||
src/libespeak-ng/mnemonics.c \
|
||||
src/libespeak-ng/numbers.c \
|
||||
src/libespeak-ng/readclause.c \
|
||||
src/libespeak-ng/phoneme.c \
|
||||
@@ -212,6 +213,7 @@ noinst_bin_PROGRAMS += tests/encoding.test
|
||||
tests_encoding_test_CFLAGS = -Isrc/libespeak-ng -Isrc/include -D _POSIX_C_SOURCE=200112L ${AM_CFLAGS}
|
||||
tests_encoding_test_SOURCES = \
|
||||
src/libespeak-ng/encoding.c \
|
||||
src/libespeak-ng/mnemonics.c \
|
||||
tests/encoding.c
|
||||
|
||||
##### phoneme data:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
||||
* email: jonsd@users.sourceforge.net
|
||||
* Copyright (C) 2015-2016 Reece H. Dunn
|
||||
* 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
|
||||
@@ -173,17 +173,6 @@ int isspace2(unsigned int c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Lookup a mnemonic string in a table, return its name
|
||||
const char *LookupMnemName(MNEM_TAB *table, const int value)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (table->value == value)
|
||||
return table->mnem;
|
||||
table++;
|
||||
}
|
||||
return ""; // not found
|
||||
}
|
||||
|
||||
void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len)
|
||||
{
|
||||
int stress;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
||||
* email: jonsd@users.sourceforge.net
|
||||
* Copyright (C) 2013-2016 Reece H. Dunn
|
||||
* Copyright (C) 2013-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
|
||||
@@ -104,16 +104,6 @@ int Reverse4Bytes(int word)
|
||||
#endif
|
||||
}
|
||||
|
||||
int LookupMnem(MNEM_TAB *table, const char *string)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (strcmp(string, table->mnem) == 0)
|
||||
return table->value;
|
||||
table++;
|
||||
}
|
||||
return table->value;
|
||||
}
|
||||
|
||||
static void InitGroups(Translator *tr)
|
||||
{
|
||||
// Called after dictionary 1 is loaded, to set up table of entry points for translation rule chains
|
||||
|
||||
@@ -17,24 +17,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <espeak-ng/espeak_ng.h>
|
||||
|
||||
#include "speech.h"
|
||||
|
||||
static int
|
||||
LookupMnemValue(MNEM_TAB *table,
|
||||
const char *string)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (strcmp(string, table->mnem) == 0)
|
||||
return table->value;
|
||||
table++;
|
||||
}
|
||||
return table->value;
|
||||
}
|
||||
|
||||
MNEM_TAB mnem_encoding[] = {
|
||||
{ NULL, ESPEAKNG_ENCODING_UNKNOWN }
|
||||
};
|
||||
@@ -44,7 +30,7 @@ MNEM_TAB mnem_encoding[] = {
|
||||
espeak_ng_ENCODING
|
||||
espeak_ng_EncodingFromName(const char *encoding)
|
||||
{
|
||||
return LookupMnemValue(mnem_encoding, encoding);
|
||||
return LookupMnem(mnem_encoding, encoding);
|
||||
}
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington
|
||||
* email: jonsd@users.sourceforge.net
|
||||
* Copyright (C) 2013-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 <string.h>
|
||||
|
||||
#include <espeak-ng/espeak_ng.h>
|
||||
|
||||
#include "speech.h"
|
||||
|
||||
int LookupMnem(MNEM_TAB *table, const char *string)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (strcmp(string, table->mnem) == 0)
|
||||
return table->value;
|
||||
table++;
|
||||
}
|
||||
return table->value;
|
||||
}
|
||||
|
||||
const char *LookupMnemName(MNEM_TAB *table, const int value)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
if (table->value == value)
|
||||
return table->mnem;
|
||||
table++;
|
||||
}
|
||||
return ""; // not found
|
||||
}
|
||||
@@ -64,6 +64,7 @@ typedef struct {
|
||||
int value;
|
||||
} MNEM_TAB;
|
||||
int LookupMnem(MNEM_TAB *table, const char *string);
|
||||
const char *LookupMnemName(MNEM_TAB *table, const int value);
|
||||
|
||||
void cancel_audio(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user