add pic_printf
This commit is contained in:
parent
408255381c
commit
a9d3d847af
|
@ -209,6 +209,7 @@ const char *pic_errmsg(pic_state *);
|
|||
|
||||
pic_value pic_debug(pic_state *, pic_value);
|
||||
pic_value pic_fdebug(pic_state *, pic_value, xFILE *);
|
||||
void pic_printf(pic_state *, const char *, ...);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
16
src/write.c
16
src/write.c
|
@ -371,6 +371,22 @@ pic_fdebug(pic_state *pic, pic_value obj, xFILE *file)
|
|||
return obj;
|
||||
}
|
||||
|
||||
void
|
||||
pic_printf(pic_state *pic, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
pic_str *str;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
str = pic_str_ptr(pic_car(pic, pic_vformat(pic, fmt, ap)));
|
||||
|
||||
va_end(ap);
|
||||
|
||||
printf("%s", pic_str_cstr(str));
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static pic_value
|
||||
pic_write_write(pic_state *pic)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue