Browse Source

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

master
Reece H. Dunn 9 years ago
parent
commit
563e4e3769

+ 1
- 1
src/espeak-ng.c View File

espeak_ng_InitializePath(data_path); espeak_ng_InitializePath(data_path);
espeak_ng_STATUS result = espeak_ng_Initialize(); espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) { if (result != ENS_OK) {
if (result == ENE_VERSION_MISMATCH)
if (result == ENS_VERSION_MISMATCH)
fprintf(stderr, "Wrong version of espeak-data\n"); fprintf(stderr, "Wrong version of espeak-data\n");
else else
fprintf(stderr, "Failed to load espeak-data\n"); fprintf(stderr, "Failed to load espeak-data\n");

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

#endif #endif


typedef enum { 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; } espeak_ng_STATUS;


typedef enum { typedef enum {

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

fclose(f_errors); fclose(f_errors);


ReadPhondataManifest(); 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[] = { static const char *preset_tune_names[] = {


LoadPhData(NULL); 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) espeak_ng_STATUS espeak_ng_CompilePhonemeData(long rate, FILE *log)

+ 1
- 1
src/libespeak-ng/compiledict.c View File



LoadDictionary(translator, dict_name, 0); 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 #pragma GCC visibility pop

+ 1
- 1
src/libespeak-ng/speak_lib.c View File

espeak_ng_InitializePath(path); espeak_ng_InitializePath(path);
espeak_ng_STATUS result = espeak_ng_Initialize(); espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) { 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); fprintf(stderr, "Wrong version of espeak-data (expected 0x%x) at %s\n", version_phdata, path_home);
else { else {
fprintf(stderr, "Failed to load espeak-data\n"); fprintf(stderr, "Failed to load espeak-data\n");

+ 1
- 1
src/libespeak-ng/synthdata.c View File

} }


if (version != version_phdata) if (version != version_phdata)
return ENE_VERSION_MISMATCH;
return ENS_VERSION_MISMATCH;


// set up phoneme tables // set up phoneme tables
p = phoneme_tab_data; p = phoneme_tab_data;

+ 1
- 1
src/speak-ng.c View File

espeak_ng_InitializePath(data_path); espeak_ng_InitializePath(data_path);
espeak_ng_STATUS result = espeak_ng_Initialize(); espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) { 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); fprintf(stderr, "Wrong version of espeak-data (expected 0x%x) at %s\n", version_phdata, path_home);
else else
fprintf(stderr, "Failed to load espeak-data\n"); fprintf(stderr, "Failed to load espeak-data\n");

Loading…
Cancel
Save