Commit Graph
73 Commits
Author SHA1 Message Date
Reece H. Dunn eaa08a2bc3 translate: Don't crash translating root words that map to another list entry.
If the list file contains a text replacement to another
entry in the list file, e.g.:

	ripost     riposte $text
	riposte    rI#p0st

calling it from a prefix or suffix rule such as 'riposted'
causes word_out[0] to be NULL, as TranslateWord3 has the
information needed to perform the mapping. In this case,
no phonemes have been written in this loop and the phonemes
have been calculated, so don't override them.
2018-03-11 17:58:15 +00:00
Juho Hiltunen 9012f3f0bf headers: continue with synthdata.h 2018-03-10 13:54:58 +02:00
Juho Hiltunen 231a1d0944 headers: add new file dictionary.h with declarations of functions in dictionary.c 2018-03-10 12:47:02 +02:00
Juho Hiltunen cd991bd2c9 headers: add new file numbers.h with declarations of functions in numbers.c 2018-03-10 09:27:23 +02:00
Juho Hiltunen d395efa481 headers: add new file phonemelist.h with declarations of functions in phonemelist.c 2018-03-10 08:02:24 +02:00
Juho Hiltunen 706df97b20 headers: add new file readclause.h with declarations of functions in readclause.c 2018-03-10 07:18:07 +02:00
Reece H. Dunn c5f88c51dd translate.c: Don't loop to the end of sbuf, as sbuf gets null terminated, so needs a byte for the null character. [msvc /analyze]. 2018-03-07 12:56:26 +00:00
Juho Hiltunen 78749f14f8 readability fix: use boolean instead of 0 and 1 for loop control 2018-02-17 18:17:00 +02:00
Juho Hiltunen 4f56345fb5 Use stdbool instead of int (Issue #8)
See issue #8, https://github.com/espeak-ng/espeak-ng/issues/8

There might still be some ints that could be changed to boolean.

Possible regressions in fifo.c:
int fifo_is_busy() and int fifo_is_command_enabled() used to return an int. Now they return a boolean. This might cause problems on systems where stdbool true/false is something else than 1/0.
2017-12-09 17:34:05 +02:00
Reece H. Dunn 7a33e60234 Reapply the emoji fix from commit 119c200e, only changing the code causing the issue. 2017-11-04 08:31:13 +00:00
Reece H. Dunn 50a2d8e291 Revert "Use strcpy instead of memcpy+strlen."
This reverts commit 119c200e00.
2017-11-04 08:14:59 +00:00
Reece H. Dunn 70d492c8dc Move utf8_out back to translate.c as it is no longer used in tests. 2017-10-24 07:49:24 +01:00
Reece H. Dunn 54e87adbb8 Move isspace2 from compiledict.c to translate.c. 2017-10-24 07:29:58 +01:00
Reece H. Dunn 8d8170ea0d translate.c: Fix -Wmissing-prototypes warnings. 2017-10-11 07:07:49 +01:00
Reece H. Dunn 74f9f5e34b wavegen.c: Fix -Wmissing-prototypes warnings. 2017-10-10 21:37:46 +01:00
Reece H. Dunn d89fa59bed Enable and fix -Wunused-variable warnings. 2017-10-05 07:23:17 +01:00
Reece H. Dunn 119c200e00 Use strcpy instead of memcpy+strlen.
This replaces uses of:

	memcpy(dst, src, strlen(src))

with:

	strcpy(dst, src)

This fixes issues with reading past the end of the copied buffer
(e.g. when processing word-based replacements for emoji characters)
by ensuring that the destination buffer is null terminated.

Reported by Michael Curran <mick@nvaccess.org>
2017-10-01 08:50:56 +01:00
Anthony Cornehl 897fad64c1 Remove definitions for towlower/towupper
The definitions for towlower() and towupper() are defined in /usr/include/wctype.h on FreeBSD platforms. I just removed the define and used  the ucd_ equivilent where towlower/towupper were found.

/bin/sh ./libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I.    -fPIC -fvisibility=hidden -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"/usr/local/share/espeak-
ng-data\" -DLIBESPEAK_NG_EXPORT  -Isrc/include -Isrc/include/compat -I src/ucd-tools/src/include -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -Wno-endif-lab
els    -g -O2 -std=c99 -MT src/libespeak-ng/src_libespeak_ng_la-readclause.lo -MD -MP -MF src/libespeak-ng/.deps/src_libespeak_ng_la-readclause.Tpo -c -o src/libespeak-n
g/src_libespeak_ng_la-readclause.lo `test -f 'src/libespeak-ng/readclause.c' || echo './'`src/libespeak-ng/readclause.c
libtool: compile:  cc -DHAVE_CONFIG_H -I. -fPIC -fvisibility=hidden -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"/usr/local/share/espeak-ng-data\" -DLIBESPEAK_NG_EXPO
RT -Isrc/include -Isrc/include/compat -I src/ucd-tools/src/include -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -Wno-endif-labels -g -O2 -std=c99 -MT src/li
bespeak-ng/src_libespeak_ng_la-readclause.lo -MD -MP -MF src/libespeak-ng/.deps/src_libespeak_ng_la-readclause.Tpo -c src/libespeak-ng/readclause.c  -fPIC -DPIC -o src/l
ibespeak-ng/.libs/src_libespeak_ng_la-readclause.o
In file included from src/libespeak-ng/readclause.c:32:
In file included from src/include/compat/wctype.h:30:
/usr/include/wctype.h:73:8: error: conflicting types for 'ucd_tolower'
wint_t  towlower(wint_t);
        ^
src/include/compat/wchar.h:37:18: note: expanded from macro 'towlower'
                 ^
src/ucd-tools/src/include/ucd/ucd.h:503:13: note: previous declaration is here
codepoint_t ucd_tolower(codepoint_t c);
            ^
In file included from src/libespeak-ng/readclause.c:32:
In file included from src/include/compat/wctype.h:30:
/usr/include/wctype.h:74:8: error: conflicting types for 'ucd_toupper'
wint_t  towupper(wint_t);
        ^
src/include/compat/wchar.h:38:18: note: expanded from macro 'towupper'
                 ^
src/ucd-tools/src/include/ucd/ucd.h:491:13: note: previous declaration is here
codepoint_t ucd_toupper(codepoint_t c);
            ^
src/libespeak-ng/readclause.c:366:19: warning: implicit declaration of function 'mkstemp' is invalid in C99 [-Wimplicit-function-declaration]
                        if ((fd_temp = mkstemp(fname_temp)) >= 0)
                                       ^
1 warning and 2 errors generated.
2017-08-31 17:42:17 -07:00
Reece H. Dunn 416bc66dca Fix pronouncing replacement text that is dependent on start of word rules. 2017-05-29 11:53:33 +01:00
Reece H. Dunn ee07eaa733 Support capitalized words in text-based replacements. This is important in languages like German that differentiate pronunciation on case. Even English does this (e.g. Polish/polish). 2017-05-19 07:13:22 +01:00
Reece H. Dunn fe14c83372 Support multi-word text replacements in dictionary list files. 2017-05-14 11:03:33 +01:00
Reece H. Dunn 85801fc1e3 Remove the now unused dictdialect functionality from the code. 2017-05-07 15:17:47 +01:00
Reece H. Dunn 9af96da469 Make the encoding.h API public. 2017-05-02 18:40:16 +01:00
Reece H. Dunn 7602c9ac18 tokenizer.c: Support linux newlines. 2017-04-26 07:34:57 +01:00
Reece H. Dunn 92f703d98b Use defines instead of hard-coded numbers for more clause logic. 2017-04-18 07:14:45 +01:00
Reece H. Dunn 8749891069 Better specify the CLAUSE_ flags returned by ReadClause. 2017-04-17 22:04:45 +01:00
Reece H. Dunn e4e1e4db0a TranslateWord: remove the unused add_plural_suffix variable. 2017-04-06 19:39:03 +01:00
Reece H. Dunn 62d4aff9a9 Remove the now unused option_multibyte variable. 2017-04-01 15:12:49 +01:00
Reece H. Dunn ec8a7b810f Use the text decoder object at the top-level Synthesize/espeak_TextToPhonemes call, not in TranslateClause. 2017-04-01 15:11:01 +01:00
Reece H. Dunn b3e0fbc8ed encoding.c: Create a text_decoder_decode_string_multibyte helper to work with the espeakCHARS_* flags. 2017-04-01 13:36:18 +01:00
Reece H. Dunn 9dabf64680 encoding.c: Support determining the string length for length < 0. 2017-04-01 13:23:09 +01:00
Reece H. Dunn d167d5649b encoding.c: Implement support for the auto-detected character set (utf-8 + codepoint-encoding). 2017-03-31 22:30:27 +01:00
Reece H. Dunn be480c12de Make TranslateClause return 'const void *' to preserve constness. 2017-03-31 20:23:22 +01:00
Reece H. Dunn 7c16ac543c Use the text decoder API in readclause.c. 2017-03-31 13:17:37 +01:00
Reece H. Dunn 8933185de4 Remove the unused f_in argument to the Read/Translate/SpeakNextClause functions. 2017-03-31 07:13:36 +01:00
Reece H. Dunn 0b0661cef0 Use the encoding.c tables for 8-bit encodings.
1.  Store the encoding enumeration values in the Translation
    object, instead of the charset table.

2.  Use the encoding.c charset table data instead of the ones
    in translate.c.

3.  Remove the charset language file option -- it is only used
    in the Arabic language file, but is used incorrectly there.

4.  Specify ISO 8859-6 for the 8-bit encoding for Arabic instead
    of UTF-8, so that espeakCHARS_8BIT and espeakCHARS_AUTO work
    correctly for Arabic.
2017-03-31 00:01:14 +01:00
Reece H. Dunn 5975f07095 Replace the *2 wchar/wctype APIs with their standard versions. These will be fixed using compatibility headers. 2017-02-13 07:43:23 +00:00
Reece H. Dunn 6a0ea584ea Don't store the unused phoneme equivalence tables in the phoneme data files. 2017-01-27 20:44:06 +00:00
Valdis Vitolins c5355ed94e Fix for issue #69 Speaking '1,,2' in German only says 'eins'. 2017-01-20 19:37:04 +02:00
Valdis Vitolins d9d7006d7a Comments about implementation for utf8_in2() 2017-01-15 22:08:39 +02:00
Ondřej Lysoněk 3817ee1e16 Moved speak_lib.h to espeak-ng directory
Moved include/espeak/speak_lib.h to include/espeak-ng/speak_lib.h and
created a symlink from the original location.
2016-08-28 10:57:10 +01:00
Reece H. Dunn 4cde8b6d13 option_quiet is no longer used (always set to 0), so remove it 2016-02-06 10:45:32 +00:00
Reece H. Dunn 325014da42 Use free instead of Free as free checks for NULL. 2016-01-18 20:23:51 +00:00
Reece H. Dunn 96c43f3eb2 Clean up the include files to make them consistent. 2016-01-16 17:54:39 +00:00
Reece H. Dunn 2a8c4461bd Use snprintf on all platforms (it is C99 conformant in Visual Studio 2015 and can be supported in the compatibility layer for older versions as needed). 2016-01-15 20:16:02 +00:00
Reece H. Dunn 9c7179189b Add a stdint.h compatibility shim. 2016-01-09 13:09:50 +00:00
Reece H. Dunn 6b9eeaa133 Remove if for identical branches in translate.c. [coverity] 2016-01-08 20:08:55 +00:00
Reece H. Dunn b04330ac85 Remove a dead assignment in CheckDottedAbbrev(translate.c) [clang scan-build] 2016-01-06 20:33:36 +00:00
Reece H. Dunn b79635335f Remove a dead assignment in TranslateWord(translate.c) [clang scan-build] 2016-01-06 20:32:15 +00:00
Reece H. Dunn 6251afa556 Remove a dead assignment in TranslateClause(translate.c) [clang scan-build] 2016-01-06 20:30:10 +00:00