| 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"); |
| #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 { |
| 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) |
| 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 |
| 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"); |
| } | } | ||||
| 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; |
| 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"); |