Commit f4f4839e authored by Brice Videau's avatar Brice Videau

Added introspection capabilities.

parent 11c8aed3
#include <stdlib.h>
#include <excit.h>
#define CASE(val) case val: return #val; break;
const char * excit_type_name(enum excit_type_e type)
{
switch(type) {
CASE(EXCIT_RANGE)
CASE(EXCIT_CONS)
CASE(EXCIT_REPEAT)
CASE(EXCIT_HILBERT2D)
CASE(EXCIT_PRODUCT)
CASE(EXCIT_SLICE)
CASE(EXCIT_USER)
CASE(EXCIT_TYPE_MAX)
default:
return NULL;
}
}
const char * excit_error_name(enum excit_error_e err)
{
switch(err) {
CASE(EXCIT_SUCCESS)
CASE(EXCIT_STOPIT)
CASE(EXCIT_ENOMEM)
CASE(EXCIT_EINVAL)
CASE(EXCIT_EDOM)
CASE(EXCIT_ENOTSUP)
CASE(EXCIT_ERROR_MAX)
default:
return NULL;
}
}
#undef CASE
/*--------------------------------------------------------------------*/
struct slice_it_s {
......
......@@ -12,6 +12,8 @@ enum excit_type_e {
EXCIT_TYPE_MAX
};
const char * excit_type_name(enum excit_type_e type);
enum excit_error_e {
EXCIT_SUCCESS,
EXCIT_STOPIT,
......@@ -22,6 +24,8 @@ enum excit_error_e {
EXCIT_ERROR_MAX
};
const char * excit_error_name(enum excit_error_e err);
struct excit_s {
const struct excit_func_table_s *functions;
ssize_t dimension;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment