diff --git a/include/picrin/port.h b/include/picrin/port.h index c421bb11..a2c7e472 100644 --- a/include/picrin/port.h +++ b/include/picrin/port.h @@ -23,6 +23,9 @@ struct pic_port { }; #define pic_port_p(v) (pic_type(v) == PIC_TT_PORT) +#define pic_env_p(v) (pic_type(v) == PIC_TT_ENV) + #define pic_port_ptr(v) ((struct pic_port *)(v).u.data) +#define pic_env_ptr(v) ((struct pic_env *)(v).u.data) #endif diff --git a/src/port.c b/src/port.c index fbe75c67..0dfc6c50 100644 --- a/src/port.c +++ b/src/port.c @@ -65,7 +65,8 @@ write(pic_state *pic, pic_value obj) printf(")"); break; case PIC_TT_ENV: - pic_abort(pic, "logic flaw"); + printf("#", pic_env_ptr(obj)); + break; } }