add display function API
This commit is contained in:
parent
5b2898ae5c
commit
8f5c053bd8
|
@ -207,9 +207,14 @@ void pic_warn(pic_state *, const char *);
|
||||||
|
|
||||||
const char *pic_errmsg(pic_state *);
|
const char *pic_errmsg(pic_state *);
|
||||||
|
|
||||||
pic_value pic_debug(pic_state *, pic_value);
|
pic_value pic_write(pic_state *, pic_value); /* returns given obj */
|
||||||
pic_value pic_fdebug(pic_state *, pic_value, xFILE *);
|
pic_value pic_fwrite(pic_state *, pic_value, xFILE *);
|
||||||
void pic_printf(pic_state *, const char *, ...);
|
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)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
20
src/write.c
20
src/write.c
|
@ -385,19 +385,33 @@ display(pic_state *pic, pic_value obj, xFILE *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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_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);
|
write(pic, obj, file);
|
||||||
xfflush(file);
|
xfflush(file);
|
||||||
return obj;
|
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
|
void
|
||||||
pic_printf(pic_state *pic, const char *fmt, ...)
|
pic_printf(pic_state *pic, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue