diff --git a/include/picrin.h b/include/picrin.h index 0120d3cd..fd4c8f56 100644 --- a/include/picrin.h +++ b/include/picrin.h @@ -211,6 +211,7 @@ NORETURN void pic_errorf(pic_state *, const char *, size_t, ...); void pic_warn(pic_state *, const char *); void pic_debug(pic_state *, pic_value); +void pic_fdebug(pic_state *, pic_value, XFILE *); #if defined(__cplusplus) } diff --git a/src/write.c b/src/write.c index f8629881..4925d52a 100644 --- a/src/write.c +++ b/src/write.c @@ -157,8 +157,14 @@ write(pic_state *pic, pic_value obj, XFILE *file) void pic_debug(pic_state *pic, pic_value obj) { - write(pic, obj, xstdout); - xfflush(xstdout); + pic_fdebug(pic, obj, xstdout); +} + +void +pic_fdebug(pic_state *pic, pic_value obj, XFILE *file) +{ + write(pic, obj, file); + xfflush(file); } static pic_value