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 */
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 */
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);
* @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;
* @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;
* @ingroup Embryo_Error_Group
*/
EAPI const char *
-embryo_error_string_get(int error)
+embryo_error_string_get(Embryo_Error error)
{
const char *messages[] =
{
/* 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];
}