rewrite pic_type_repr

This commit is contained in:
Yuichi Nishiwaki 2013-12-02 13:39:11 +09:00
parent a43e3248e8
commit 704b2d148b
1 changed files with 42 additions and 21 deletions

View File

@ -35,27 +35,48 @@ pic_type(pic_value v)
const char * const char *
pic_type_repr(enum pic_tt tt) pic_type_repr(enum pic_tt tt)
{ {
static const char *reprs[17] = { switch (tt) {
"nil", case PIC_TT_NIL:
"boolean", return "nil";
"float", case PIC_TT_BOOL:
"int", return "boolean";
"symbol", case PIC_TT_FLOAT:
"char", return "float";
"eof", case PIC_TT_INT:
"undef", return "int";
"pair", case PIC_TT_SYMBOL:
"string", return "symbol";
"vector", case PIC_TT_CHAR:
"blob", return "char";
"proc", case PIC_TT_EOF:
"port", return "eof";
"error", case PIC_TT_UNDEF:
"env", return "undef";
"cont" case PIC_TT_PAIR:
}; return "pair";
case PIC_TT_STRING:
return reprs[tt]; return "string";
case PIC_TT_VECTOR:
return "vector";
case PIC_TT_BLOB:
return "blob";
case PIC_TT_PORT:
return "port";
case PIC_TT_ERROR:
return "error";
case PIC_TT_ENV:
return "env";
case PIC_TT_CONT:
return "cont";
case PIC_TT_PROC:
return "proc";
case PIC_TT_SC:
return "sc";
case PIC_TT_SENV:
return "senv";
case PIC_TT_SYNTAX:
return "syntax";
}
} }
pic_value pic_value