file.h is now stdio.h-free

This commit is contained in:
Yuichi Nishiwaki 2015-06-19 05:13:57 +09:00
parent a0d6c5800c
commit 20cb77bbbe
5 changed files with 12 additions and 7 deletions

View File

@ -4,6 +4,8 @@
#include "picrin.h"
#include <stdio.h>
PIC_NORETURN static void
file_error(pic_state *pic, const char *msg)
{

View File

@ -50,9 +50,9 @@ foreach my $file (@ARGV) {
}
pic_catch {
/* error! */
fputs("fatal error: failure in loading $dirname/$basename\\n", stderr);
fputs(pic_errmsg(pic), stderr);
abort();
xfputs(pic, "fatal error: failure in loading $dirname/$basename\\n", xstderr);
xfputs(pic, pic_errmsg(pic), xstderr);
pic_panic(pic, "load error");
}
EOL
}

View File

@ -105,7 +105,7 @@ int x_flushbuf(pic_state *pic, int x, xFILE *fp) {
}
fp->ptr = fp->base;
fp->cnt = BUFSIZ - 1;
fp->cnt = XBUFSIZ - 1;
}
if (num_written == bufsize) {

View File

@ -5,8 +5,6 @@
extern "C" {
#endif
#include <stdio.h>
#ifndef EOF
# define EOF (-1)
#endif

View File

@ -4,6 +4,8 @@
#include "picrin.h"
#include <stdio.h>
pic_value
pic_eof_object()
{
@ -69,7 +71,10 @@ file_seek(pic_state PIC_UNUSED(*pic), void *cookie, long pos, int whence) {
whence = SEEK_END;
break;
}
return fseek(cookie, pos, whence);
if (fseek(cookie, pos, whence) == 0) {
return ftell(cookie);
}
return -1;
}
static int