add pic_printf

This commit is contained in:
Yuichi Nishiwaki 2014-03-03 22:43:59 +09:00
parent 408255381c
commit a9d3d847af
2 changed files with 17 additions and 0 deletions

View File

@ -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)
}

View File

@ -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)
{