/* Error Codes (< 0) */ | /* Error Codes (< 0) */ | ||||
ENE_READ_ERROR = -1, | |||||
ENE_WRITE_ERROR = -2, | |||||
ENE_COMPILE_ERRORS = -4, | ENE_COMPILE_ERRORS = -4, | ||||
ENE_VERSION_MISMATCH = -5, | ENE_VERSION_MISMATCH = -5, | ||||
} espeak_ng_STATUS; | } espeak_ng_STATUS; |
/* | /* | ||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington | * Copyright (C) 2005 to 2014 by Jonathan Duddington | ||||
* email: [email protected] | * email: [email protected] | ||||
* Copyright (C) 2013-2015 Reece H. Dunn | |||||
* Copyright (C) 2013-2016 Reece H. Dunn | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
if (!access(fname, 755)) { | if (!access(fname, 755)) { | ||||
fprintf(log, "Can't find phoneme source directory: %s\n", fname); | fprintf(log, "Can't find phoneme source directory: %s\n", fname); | ||||
return ENE_READ_ERROR; | |||||
return errno; | |||||
} | } | ||||
strncpy0(current_fname, source, sizeof(current_fname)); | strncpy0(current_fname, source, sizeof(current_fname)); | ||||
f_in = fopen_log(f_errors, fname, "rb"); | f_in = fopen_log(f_errors, fname, "rb"); | ||||
if (f_in == NULL) { | if (f_in == NULL) { | ||||
fprintf(log, "Can't read master phonemes file: %s\n", fname); | fprintf(log, "Can't read master phonemes file: %s\n", fname); | ||||
return ENE_READ_ERROR; | |||||
return errno; | |||||
} | } | ||||
sprintf(fname, "%s/../phsource/%s", path_home, "compile_report"); | sprintf(fname, "%s/../phsource/%s", path_home, "compile_report"); | ||||
f_phtab = fopen_log(f_errors, fname, "wb"); | f_phtab = fopen_log(f_errors, fname, "wb"); | ||||
if (f_phdata == NULL || f_phindex == NULL || f_phtab == NULL) | if (f_phdata == NULL || f_phindex == NULL || f_phtab == NULL) | ||||
return ENE_WRITE_ERROR; | |||||
return errno; | |||||
sprintf(fname, "%s/../phsource/compile_prog_log", path_home); | sprintf(fname, "%s/../phsource/compile_prog_log", path_home); | ||||
f_prog_log = fopen_log(f_errors, fname, "wb"); | f_prog_log = fopen_log(f_errors, fname, "wb"); | ||||
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", path_home); | ||||
if ((f_in = fopen_log(f_errors, buf, "r")) == NULL) { | if ((f_in = fopen_log(f_errors, buf, "r")) == NULL) { | ||||
int error = errno; | |||||
fprintf(log, "Can't read file: %s\n", buf); | fprintf(log, "Can't read file: %s\n", buf); | ||||
fclose(f_errors); | fclose(f_errors); | ||||
return ENE_READ_ERROR; | |||||
return error; | |||||
} | } | ||||
} | } | ||||
sprintf(buf, "%s/intonations", path_home); | sprintf(buf, "%s/intonations", path_home); | ||||
f_out = fopen_log(f_errors, buf, "wb"); | f_out = fopen_log(f_errors, buf, "wb"); | ||||
if (f_out == NULL) { | if (f_out == NULL) { | ||||
int error = errno; | |||||
fclose(f_in); | fclose(f_in); | ||||
fclose(f_errors); | fclose(f_errors); | ||||
free(tune_data); | free(tune_data); | ||||
return ENE_WRITE_ERROR; | |||||
return error; | |||||
} | } | ||||
while (!feof(f_in)) { | while (!feof(f_in)) { |
/* | /* | ||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington | * Copyright (C) 2005 to 2014 by Jonathan Duddington | ||||
* email: [email protected] | * email: [email protected] | ||||
* Copyright (C) 2015 Reece H. Dunn | |||||
* Copyright (C) 2015-2016 Reece H. Dunn | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
#include "config.h" | #include "config.h" | ||||
#include <errno.h> | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <ctype.h> | #include <ctype.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
if ((f_in = fopen(fname_in, "r")) == NULL) { | if ((f_in = fopen(fname_in, "r")) == NULL) { | ||||
sprintf(fname_in, "%srules", path); | sprintf(fname_in, "%srules", path); | ||||
if ((f_in = fopen_log(fname_in, "r")) == NULL) | if ((f_in = fopen_log(fname_in, "r")) == NULL) | ||||
return ENE_READ_ERROR; | |||||
return errno; | |||||
} | } | ||||
sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name); | sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name); | ||||
if ((f_out = fopen_log(fname_out, "wb+")) == NULL) { | if ((f_out = fopen_log(fname_out, "wb+")) == NULL) { | ||||
int error = errno; | |||||
fclose(f_in); | fclose(f_in); | ||||
return ENE_WRITE_ERROR; | |||||
return error; | |||||
} | } | ||||
sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP); | sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP); | ||||
/* | /* | ||||
* Copyright (C) 2005 to 2014 by Jonathan Duddington | * Copyright (C) 2005 to 2014 by Jonathan Duddington | ||||
* email: [email protected] | * email: [email protected] | ||||
* Copyright (C) 2013-2015 Reece H. Dunn | |||||
* Copyright (C) 2013-2016 Reece H. Dunn | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
#include "config.h" | #include "config.h" | ||||
#include <errno.h> | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
strcpy(buf, filepath); | strcpy(buf, filepath); | ||||
if ((f_in = fopen(buf, "r")) == NULL) { | if ((f_in = fopen(buf, "r")) == NULL) { | ||||
fprintf(log, "Can't read: %s\n", filepath); | fprintf(log, "Can't read: %s\n", filepath); | ||||
return ENE_READ_ERROR; | |||||
return errno; | |||||
} | } | ||||
while (fgets(buf, sizeof(phoneme), f_in) != NULL) { | while (fgets(buf, sizeof(phoneme), f_in) != NULL) { | ||||
sprintf(buf, "%s/mbrola_ph/%s_phtrans", path_home, mbrola_voice); | sprintf(buf, "%s/mbrola_ph/%s_phtrans", path_home, mbrola_voice); | ||||
if ((f_out = fopen(buf, "wb")) == NULL) { | if ((f_out = fopen(buf, "wb")) == NULL) { | ||||
fprintf(log, "Can't write to: %s\n", buf); | fprintf(log, "Can't write to: %s\n", buf); | ||||
return ENE_WRITE_ERROR; | |||||
return errno; | |||||
} | } | ||||
data[count].name = 0; // list terminator | data[count].name = 0; // list terminator |