Allow out-of-tree intonations compilation

This commit is contained in:
Yury Popov
2022-10-28 12:34:56 +03:00
parent 385105b7cd
commit 4e5bc19047
2 changed files with 22 additions and 3 deletions
+7
View File
@@ -191,6 +191,13 @@ ESPEAK_NG_API espeak_ng_STATUS
espeak_ng_CompileIntonation(FILE *log, espeak_ng_CompileIntonation(FILE *log,
espeak_ng_ERROR_CONTEXT *context); espeak_ng_ERROR_CONTEXT *context);
ESPEAK_NG_API espeak_ng_STATUS
espeak_ng_CompileIntonationPath(const char *source_path,
const char *destination_path,
FILE *log,
espeak_ng_ERROR_CONTEXT *context);
/* eSpeak NG 1.49.1 */ /* eSpeak NG 1.49.1 */
ESPEAK_NG_API espeak_ng_STATUS ESPEAK_NG_API espeak_ng_STATUS
+15 -3
View File
@@ -2697,8 +2697,20 @@ static int LookupEnvelopeName(const char *name)
#pragma GCC visibility push(default) #pragma GCC visibility push(default)
espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log, espeak_ng_ERROR_CONTEXT *context) espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log, espeak_ng_ERROR_CONTEXT *context)
{
return espeak_ng_CompileIntonationPath(NULL, NULL, log, context);
}
espeak_ng_STATUS
espeak_ng_CompileIntonationPath(const char *source_path,
const char *destination_path,
FILE *log,
espeak_ng_ERROR_CONTEXT *context
)
{ {
if (!log) log = stderr; if (!log) log = stderr;
if (!source_path) source_path = path_home;
if (!destination_path) destination_path = path_home;
int ix; int ix;
char *p; char *p;
@@ -2722,9 +2734,9 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log, espeak_ng_ERROR_CONTEXT
error_count = 0; error_count = 0;
f_errors = log; f_errors = log;
sprintf(buf, "%s/../phsource/intonation.txt", path_home); sprintf(buf, "%s/../phsource/intonation.txt", source_path);
if ((f_in = fopen(buf, "r")) == NULL) { if ((f_in = fopen(buf, "r")) == NULL) {
sprintf(buf, "%s/../phsource/intonation", path_home); sprintf(buf, "%s/../phsource/intonation", source_path);
if ((f_in = fopen(buf, "r")) == NULL) { if ((f_in = fopen(buf, "r")) == NULL) {
int error = errno; int error = errno;
fclose(f_errors); fclose(f_errors);
@@ -2777,7 +2789,7 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log, espeak_ng_ERROR_CONTEXT
return ENOMEM; return ENOMEM;
} }
sprintf(buf, "%s/intonations", path_home); sprintf(buf, "%s/intonations", destination_path);
f_out = fopen(buf, "wb"); f_out = fopen(buf, "wb");
if (f_out == NULL) { if (f_out == NULL) {
int error = errno; int error = errno;