diff --git a/include/picrin.h b/include/picrin.h index 119c71ec..cbe33262 100644 --- a/include/picrin.h +++ b/include/picrin.h @@ -207,9 +207,14 @@ void pic_warn(pic_state *, const char *); const char *pic_errmsg(pic_state *); -pic_value pic_debug(pic_state *, pic_value); -pic_value pic_fdebug(pic_state *, pic_value, xFILE *); +pic_value pic_write(pic_state *, pic_value); /* returns given obj */ +pic_value pic_fwrite(pic_state *, pic_value, xFILE *); void pic_printf(pic_state *, const char *, ...); +pic_value pic_display(pic_state *, pic_value); +pic_value pic_fdisplay(pic_state *, pic_value, xFILE *); +/* obsoleted macros */ +#define pic_debug(pic,obj) pic_write(pic,obj) +#define pic_fdebug(pic,obj,file) pic_fwrite(pic,obj,file) #if defined(__cplusplus) } diff --git a/src/write.c b/src/write.c index 2fbd6b7a..97076c0d 100644 --- a/src/write.c +++ b/src/write.c @@ -385,19 +385,33 @@ display(pic_state *pic, pic_value obj, xFILE *file) } pic_value -pic_debug(pic_state *pic, pic_value obj) +pic_write(pic_state *pic, pic_value obj) { - return pic_fdebug(pic, obj, xstdout); + return pic_fwrite(pic, obj, xstdout); } pic_value -pic_fdebug(pic_state *pic, pic_value obj, xFILE *file) +pic_fwrite(pic_state *pic, pic_value obj, xFILE *file) { write(pic, obj, file); xfflush(file); return obj; } +pic_value +pic_display(pic_state *pic, pic_value obj) +{ + return pic_fdisplay(pic, obj, xstdout); +} + +pic_value +pic_fdisplay(pic_state *pic, pic_value obj, xFILE *file) +{ + display(pic, obj, file); + xfflush(file); + return obj; +} + void pic_printf(pic_state *pic, const char *fmt, ...) {