Updates to Github #github

espeak-ng@groups.io Integration <espeak-ng@...>

[espeak-ng:master] New Comment on Issue #674 Build fails on MacOS Catalina
By rhdunn:

http://man7.org/linux/man-pages/man3/ungetc.3p.html doesn't say that the ungot character has to be the same as the character previously read.

The following simple ungetc replacement does not currently work:

diff --git a/src/libespeak-ng/compiledata.c b/src/libespeak-ng/compiledata.c
index acd62221..e55545ab 100644
--- a/src/libespeak-ng/compiledata.c
+++ b/src/libespeak-ng/compiledata.c
@@ -403,6 +403,7 @@ static FILE *f_report;
 static FILE *f_in;
 static int f_in_linenum;
 static int f_in_displ;
+static unsigned int f_in_ungetc = EOF;
 static int linenum;
 static int count_references = 0;
@@ -715,7 +716,11 @@ static int LookupPhoneme(const char *string, int control)
 static unsigned int get_char()
        unsigned int c;
-       c = fgetc(f_in);
+       if (f_in_ungetc != EOF) {
+               c = f_in_ungetc;
+               f_in_ungetc = EOF;
+       } else
+               c = fgetc(f_in);
        if (c == '\n')
        return c;
@@ -723,7 +728,7 @@ static unsigned int get_char()
 static void unget_char(unsigned int c)
-       ungetc(c, f_in);
+       f_in_ungetc = c;
        if (c == '\n')

I'm getting a lot of errors, starting with:

phonemes(124): The phoneme feature is not recognised: 'gowelout'.
phonemes(359): The phoneme feature is not recognised: 'fowelout'.

That looks suspiciously similar to what you are seeing (esp. re: the line numbers), so maybe that is what the Mac implementation is doing internally.

[espeak-ng:master] New Comment on Issue #674 Build fails on MacOS Catalina
By rhdunn:

Can you check what ungetc is returning, and if it is returning EOF then what is the errno value and associated message?

Join espeak-ng@groups.io to automatically receive all group messages.