From 151780ba2c3201e06b72454daffb36bc1e59fe8a Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 22 Sep 2010 14:13:03 +0000 Subject: [PATCH] int->enum. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/embryo@52591 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Embryo.h | 10 +++++----- src/lib/embryo_amx.c | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib/Embryo.h b/src/lib/Embryo.h index a3adffc..c9f97ce 100644 --- a/src/lib/Embryo.h +++ b/src/lib/Embryo.h @@ -45,7 +45,7 @@ extern "C" { EAPI extern Embryo_Version *embryo_version; /* potentioal error values */ - enum + typedef enum _Embryo_Error { EMBRYO_ERROR_NONE, /* reserve the first 15 error codes for exit codes of the abstract machine */ @@ -73,7 +73,7 @@ extern "C" { EMBRYO_ERROR_INIT_JIT, /** Cannot initialize the JIT */ EMBRYO_ERROR_PARAMS, /** Parameter error */ EMBRYO_ERROR_DOMAIN, /** Domain error, expression result does not fit in range */ - }; + } Embryo_Error; /* possible function type values that are enumerated */ #define EMBRYO_FUNCTION_NONE 0x7fffffff /* An invalid/non existent function */ @@ -128,11 +128,11 @@ extern "C" { EAPI Embryo_Cell embryo_program_variable_find(Embryo_Program *ep, const char *name); EAPI int embryo_program_variable_count_get(Embryo_Program *ep); EAPI Embryo_Cell embryo_program_variable_get(Embryo_Program *ep, int num); - EAPI void embryo_program_error_set(Embryo_Program *ep, int error); - EAPI int embryo_program_error_get(Embryo_Program *ep); + EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error error); + EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep); EAPI void embryo_program_data_set(Embryo_Program *ep, void *data); EAPI void *embryo_program_data_get(Embryo_Program *ep); - EAPI const char *embryo_error_string_get(int error); + EAPI const char *embryo_error_string_get(Embryo_Error error); EAPI int embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell); EAPI void embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst); EAPI void embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cell); diff --git a/src/lib/embryo_amx.c b/src/lib/embryo_amx.c index 1dc5c86..b4dd3c7 100644 --- a/src/lib/embryo_amx.c +++ b/src/lib/embryo_amx.c @@ -709,7 +709,7 @@ embryo_program_variable_get(Embryo_Program *ep, int num) * @ingroup Embryo_Error_Group */ EAPI void -embryo_program_error_set(Embryo_Program *ep, int error) +embryo_program_error_set(Embryo_Program *ep, Embryo_Error error) { if (!ep) return; ep->error = error; @@ -721,7 +721,7 @@ embryo_program_error_set(Embryo_Program *ep, int error) * @return The current error code. * @ingroup Embryo_Error_Group */ -EAPI int +EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep) { if (!ep) return EMBRYO_ERROR_NONE; @@ -768,7 +768,7 @@ embryo_program_data_get(Embryo_Program *ep) * @ingroup Embryo_Error_Group */ EAPI const char * -embryo_error_string_get(int error) +embryo_error_string_get(Embryo_Error error) { const char *messages[] = { @@ -799,7 +799,8 @@ embryo_error_string_get(int error) /* EMBRYO_ERROR_INIT_JIT */ "Cannot initialize the JIT", /* EMBRYO_ERROR_PARAMS */ "Parameter error", }; - if ((error < 0) || (error >= (int)(sizeof(messages) / sizeof(messages[0])))) + if (((int)error < 0) || + ((int)error >= (int)(sizeof(messages) / sizeof(messages[0])))) return (const char *)"(unknown)"; return messages[error]; } -- 2.7.4