37 lines
990 B
C
37 lines
990 B
C
#include <blue/core/status.h>
|
|
#include <ivy/status.h>
|
|
|
|
#define ENUM_STR(x) \
|
|
case x: \
|
|
return #x
|
|
|
|
const char *ivy_status_to_string(enum ivy_status status)
|
|
{
|
|
switch (status) {
|
|
ENUM_STR(IVY_OK);
|
|
ENUM_STR(IVY_ERR_EOF);
|
|
ENUM_STR(IVY_ERR_IO_FAILURE);
|
|
ENUM_STR(IVY_ERR_BAD_SYNTAX);
|
|
ENUM_STR(IVY_ERR_NO_MEMORY);
|
|
ENUM_STR(IVY_ERR_NOT_SUPPORTED);
|
|
ENUM_STR(IVY_ERR_INTERNAL_FAILURE);
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
|
|
#define ENUM_CONVERT(from, to) \
|
|
case (from): \
|
|
return (to)
|
|
|
|
enum ivy_status ivy_status_from_b_status(enum b_status status)
|
|
{
|
|
switch (status) {
|
|
ENUM_CONVERT(B_SUCCESS, IVY_OK);
|
|
ENUM_CONVERT(B_ERR_NAME_EXISTS, IVY_ERR_NAME_EXISTS);
|
|
ENUM_CONVERT(B_ERR_NO_MEMORY, IVY_ERR_NO_MEMORY);
|
|
default:
|
|
return IVY_ERR_INTERNAL_FAILURE;
|
|
}
|
|
}
|