| @@ -90,6 +90,8 @@ src/espeak-ng | |||
| src/espeakedit | |||
| src/speak-ng | |||
| tests/*.test | |||
| espeak-ng.pc | |||
| espeak-ng-*.tar.gz | |||
| @@ -23,6 +23,9 @@ bin_PROGRAMS = | |||
| lib_LTLIBRARIES = | |||
| man1_MANS = | |||
| noinst_bin_PROGRAMS = | |||
| noinst_bindir = | |||
| ##### ChangeLog: | |||
| ChangeLog: | |||
| @@ -109,7 +112,8 @@ docs: docs/index.html \ | |||
| src/speak-ng.1.html \ | |||
| README.html | |||
| check: apk-check | |||
| check: tests/encoding.test | |||
| tests/encoding.test | |||
| ##### build targets: | |||
| @@ -142,6 +146,7 @@ src_libespeak_ng_la_SOURCES = \ | |||
| src/libespeak-ng/compiledict.c \ | |||
| src/libespeak-ng/compilembrola.c \ | |||
| src/libespeak-ng/dictionary.c \ | |||
| src/libespeak-ng/encoding.c \ | |||
| src/libespeak-ng/error.c \ | |||
| src/libespeak-ng/espeak_api.c \ | |||
| src/libespeak-ng/ieee80.c \ | |||
| @@ -200,6 +205,15 @@ src_espeak_ng_LDADD = src/libespeak-ng.la ${PCAUDIOLIB_LIBS} | |||
| src_espeak_ng_CFLAGS = -Isrc/include ${AM_CFLAGS} | |||
| src_espeak_ng_SOURCES = src/espeak-ng.c | |||
| ##### tests: | |||
| 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 \ | |||
| tests/encoding.c | |||
| ##### phoneme data: | |||
| espeak-ng-data/phondata: phsource/phonemes.stamp | |||
| @@ -183,6 +183,16 @@ espeak_ng_CompilePhonemeDataPath(long rate, | |||
| FILE *log, | |||
| espeak_ng_ERROR_CONTEXT *context); | |||
| /* eSpeak NG 1.49.2 */ | |||
| typedef enum | |||
| { | |||
| ESPEAKNG_ENCODING_UNKNOWN, | |||
| } espeak_ng_ENCODING; | |||
| ESPEAK_NG_API espeak_ng_ENCODING | |||
| espeak_ng_EncodingFromName(const char *encoding); | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -0,0 +1,50 @@ | |||
| /* | |||
| * Copyright (C) 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" | |||
| 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 } | |||
| }; | |||
| #pragma GCC visibility push(default) | |||
| espeak_ng_ENCODING | |||
| espeak_ng_EncodingFromName(const char *encoding) | |||
| { | |||
| return LookupMnemValue(mnem_encoding, encoding); | |||
| } | |||
| #pragma GCC visibility pop | |||
| @@ -0,0 +1,43 @@ | |||
| /* | |||
| * Copyright (C) 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, write see: | |||
| * <http://www.gnu.org/licenses/>. | |||
| */ | |||
| #include "config.h" | |||
| #include <assert.h> | |||
| #include <stdlib.h> | |||
| #include <stdio.h> | |||
| #include <espeak-ng/espeak_ng.h> | |||
| void | |||
| test_unknown_encoding() | |||
| { | |||
| printf("testing unknown encoding\n"); | |||
| assert(espeak_ng_EncodingFromName("") == ESPEAKNG_ENCODING_UNKNOWN); | |||
| assert(espeak_ng_EncodingFromName("abcxyz") == ESPEAKNG_ENCODING_UNKNOWN); | |||
| } | |||
| int | |||
| main(int argc, char **argv) | |||
| { | |||
| test_unknown_encoding(); | |||
| printf("done\n"); | |||
| return EXIT_SUCCESS; | |||
| } | |||