Browse Source

Allow out-of-tree intonations compilation

master
Yury Popov 2 years ago
parent
commit
4e5bc19047
No account linked to committer's email address
2 changed files with 22 additions and 3 deletions
  1. 7
    0
      src/include/espeak-ng/espeak_ng.h
  2. 15
    3
      src/libespeak-ng/compiledata.c

+ 7
- 0
src/include/espeak-ng/espeak_ng.h View File

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
src/libespeak-ng/compiledata.c View File

#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;
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);
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;

Loading…
Cancel
Save