Browse Source

Output phoneme compilation errors to stderr.

master
Reece H. Dunn 9 years ago
parent
commit
17c61b25d7
1 changed files with 2 additions and 16 deletions
  1. 2
    16
      src/libespeak-ng/compiledata.c

+ 2
- 16
src/libespeak-ng/compiledata.c View File

{ {
if (string == NULL) if (string == NULL)
string = ""; string = "";
fprintf(f_errors, "%4d: ", linenum-1);
fprintf(f_errors, "%s(%d): ", current_fname, linenum-1);
fprintf(f_errors, format, string); fprintf(f_errors, format, string);
fprintf(f_errors, "\n"); fprintf(f_errors, "\n");
error_count++; error_count++;
if (n_phoneme_tabs == 0) if (n_phoneme_tabs == 0)
return; return;


fprintf(f_errors, "\n");

// check that all referenced phonemes have been declared // check that all referenced phonemes have been declared
for (ix = 0; ix < n_phcodes; ix++) { for (ix = 0; ix < n_phcodes; ix++) {
if (phoneme_tab2[ix].type == phINVALID) { if (phoneme_tab2[ix].type == phINVALID) {
int j; int j;
PHONEME_TAB *p; PHONEME_TAB *p;


fprintf(f_errors, "______________________________\nPhoneme Table: '%s'\n", name);

if (n_phoneme_tabs >= N_PHONEME_TABS-1) { if (n_phoneme_tabs >= N_PHONEME_TABS-1) {
Error("Too many phonemetables"); Error("Too many phonemetables");
return; return;
f_in = stack[--stack_ix].file; f_in = stack[--stack_ix].file;
strcpy(current_fname, stack[stack_ix].fname); strcpy(current_fname, stack[stack_ix].fname);
linenum = stack[stack_ix].linenum; linenum = stack[stack_ix].linenum;
fprintf(f_errors, "\n\n");
} }


item = NextItem(tKEYWORD); item = NextItem(tKEYWORD);
sprintf(buf, "%s/../phsource/%s", path_home, item_string); sprintf(buf, "%s/../phsource/%s", path_home, item_string);


if ((stack_ix < N_STACK) && (f = fopen_log(f_errors, buf, "rb")) != NULL) { if ((stack_ix < N_STACK) && (f = fopen_log(f_errors, buf, "rb")) != NULL) {
fprintf(f_errors, "include %s\n", item_string);
stack[stack_ix].linenum = linenum; stack[stack_ix].linenum = linenum;
strcpy(stack[stack_ix].fname, current_fname); strcpy(stack[stack_ix].fname, current_fname);
stack[stack_ix++].file = f_in; stack[stack_ix++].file = f_in;
return ENE_READ_ERROR; return ENE_READ_ERROR;
} }


sprintf(fname, "%s/../phsource/%s", path_home, "error_log");
if ((f_errors = fopen_log(f_errors, fname, "w")) == NULL)
f_errors = stderr;

sprintf(fname, "%s/../phsource/%s", path_home, "compile_report"); sprintf(fname, "%s/../phsource/%s", path_home, "compile_report");
f_report = fopen_log(f_errors, fname, "w"); f_report = fopen_log(f_errors, fname, "w");


"# Address Data file\n" "# Address Data file\n"
"# ------- ---------\n"); "# ------- ---------\n");


fprintf(f_errors, "Source data path = '%s/../phsource'\n", path_home);
fprintf(f_errors, "Master phonemes file = '%s/../phsource/phonemes'\n", path_home);
fprintf(f_errors, "Output to '%s/'\n\n", path_home);

sprintf(fname, "%s/%s", path_home, "phondata"); sprintf(fname, "%s/%s", path_home, "phondata");
f_phdata = fopen_log(f_errors, fname, "wb"); f_phdata = fopen_log(f_errors, fname, "wb");


} else } else
fprintf(log, "Compiled phonemes: %d errors.\n", error_count); fprintf(log, "Compiled phonemes: %d errors.\n", error_count);


if (f_errors != stderr)
if (f_errors != stderr && f_errors != stdout)
fclose(f_errors); fclose(f_errors);


ReadPhondataManifest(); ReadPhondataManifest();

Loading…
Cancel
Save