Use ENS_ for eSpeak NG error codes, and standardize on a numbering scheme.

This commit is contained in:
Reece H. Dunn
2016-01-02 12:20:25 +00:00
parent f9ea83430e
commit 563e4e3769
7 changed files with 13 additions and 14 deletions
+1 -1
View File
@@ -590,7 +590,7 @@ int main(int argc, char **argv)
espeak_ng_InitializePath(data_path);
espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) {
if (result == ENE_VERSION_MISMATCH)
if (result == ENS_VERSION_MISMATCH)
fprintf(stderr, "Wrong version of espeak-data\n");
else
fprintf(stderr, "Failed to load espeak-data\n");
+6 -7
View File
@@ -31,14 +31,13 @@ extern "C"
#endif
typedef enum {
ENS_OK = 0,
ENS_GROUP_MASK = 0x70000000,
ENS_GROUP_ERRNO = 0x00000000, /* Values 0-255 map to errno error codes. */
ENS_GROUP_ESPEAK_NG = 0x10000000, /* eSpeak NG error codes. */
/* 0 to 255 : errno */
/* Error Codes (< 0) */
ENE_COMPILE_ERRORS = -4,
ENE_VERSION_MISMATCH = -5,
ENS_OK = 0,
ENS_COMPILE_ERROR = 0x100001FF,
ENS_VERSION_MISMATCH = 0x100002FF,
} espeak_ng_STATUS;
typedef enum {
+2 -2
View File
@@ -2740,7 +2740,7 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
fclose(f_errors);
ReadPhondataManifest();
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK;
return error_count > 0 ? ENS_COMPILE_ERROR : ENS_OK;
}
static const char *preset_tune_names[] = {
@@ -3032,7 +3032,7 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
LoadPhData(NULL);
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK;
return error_count > 0 ? ENS_COMPILE_ERROR : ENS_OK;
}
espeak_ng_STATUS espeak_ng_CompilePhonemeData(long rate, FILE *log)
+1 -1
View File
@@ -1593,6 +1593,6 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_CompileDictionary(const char *dsource,
LoadDictionary(translator, dict_name, 0);
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK;
return error_count > 0 ? ENS_COMPILE_ERROR : ENS_OK;
}
#pragma GCC visibility pop
+1 -1
View File
@@ -635,7 +635,7 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length
espeak_ng_InitializePath(path);
espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) {
if (result == ENE_VERSION_MISMATCH)
if (result == ENS_VERSION_MISMATCH)
fprintf(stderr, "Wrong version of espeak-data (expected 0x%x) at %s\n", version_phdata, path_home);
else {
fprintf(stderr, "Failed to load espeak-data\n");
+1 -1
View File
@@ -141,7 +141,7 @@ espeak_ng_STATUS LoadPhData(int *srate)
}
if (version != version_phdata)
return ENE_VERSION_MISMATCH;
return ENS_VERSION_MISMATCH;
// set up phoneme tables
p = phoneme_tab_data;
+1 -1
View File
@@ -577,7 +577,7 @@ int main(int argc, char **argv)
espeak_ng_InitializePath(data_path);
espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) {
if (result == ENE_VERSION_MISMATCH)
if (result == ENS_VERSION_MISMATCH)
fprintf(stderr, "Wrong version of espeak-data (expected 0x%x) at %s\n", version_phdata, path_home);
else
fprintf(stderr, "Failed to load espeak-data\n");