add pic_type_repr

This commit is contained in:
Yuichi Nishiwaki 2013-10-30 15:37:33 +09:00
parent d4001a70ae
commit 1e4ff3276a
2 changed files with 23 additions and 0 deletions

View File

@ -77,6 +77,7 @@ struct pic_port;
#define pic_vec_ptr(o) ((struct pic_vector *)(o).u.data) #define pic_vec_ptr(o) ((struct pic_vector *)(o).u.data)
enum pic_tt pic_type(pic_value); enum pic_tt pic_type(pic_value);
const char *pic_type_repr(enum pic_tt);
pic_value pic_nil_value(); pic_value pic_nil_value();
pic_value pic_true_value(); pic_value pic_true_value();

View File

@ -30,6 +30,28 @@ pic_type(pic_value v)
abort(); abort();
} }
const char *
pic_type_repr(enum pic_tt tt)
{
static const char *reprs[13] = {
"nil",
"boolean",
"float",
"int",
"symbol",
"eof",
"undef",
"pair",
"string",
"vector",
"proc",
"port",
"env"
};
return reprs[tt];
}
pic_value pic_value
pic_nil_value() pic_nil_value()
{ {