Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
rename I/O functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyuichi committed Jun 19, 2016
1 parent a1116d3 commit 9515060
Show file tree
Hide file tree
Showing 22 changed files with 979 additions and 1,021 deletions.
2 changes: 1 addition & 1 deletion contrib/20.r7rs/src/file.c
Expand Up @@ -21,7 +21,7 @@ open_file(pic_state *pic, const char *fname, const char *mode)
if ((fp = fopen(fname, mode)) == NULL) {
file_error(pic, "could not open file...");
}
return pic_open_port(pic, xfopen_file(pic, fp, mode));
return pic_fopen(pic, fp, mode);
}

pic_value
Expand Down
4 changes: 2 additions & 2 deletions contrib/20.r7rs/src/load.c
Expand Up @@ -21,11 +21,11 @@ pic_load_load(pic_state *pic)
pic_error(pic, "load: could not open file", 1, pic_cstr_value(pic, fn));
}

port = pic_open_port(pic, xfopen_file(pic, fp, "r"));
port = pic_fopen(pic, fp, "r");

pic_load(pic, port);

pic_close_port(pic, port);
pic_fclose(pic, port);

return pic_undef_value(pic);
}
Expand Down
8 changes: 2 additions & 6 deletions contrib/40.srfi/src/106.c
Expand Up @@ -297,15 +297,11 @@ xf_socket_close(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie))
static pic_value
make_socket_port(pic_state *pic, struct pic_socket_t *sock, const char *mode)
{
xFILE *fp;

if (*mode == 'r') {
fp = xfunopen(pic, sock, xf_socket_read, 0, xf_socket_seek, xf_socket_close);
return pic_funopen(pic, sock, xf_socket_read, 0, xf_socket_seek, xf_socket_close);
} else {
fp = xfunopen(pic, sock, 0, xf_socket_write, xf_socket_seek, xf_socket_close);
return pic_funopen(pic, sock, 0, xf_socket_write, xf_socket_seek, xf_socket_close);
}

return pic_open_port(pic, fp);
}

static pic_value
Expand Down
2 changes: 1 addition & 1 deletion etc/mkloader.pl
Expand Up @@ -55,7 +55,7 @@
}
pic_catch(e) {
/* error! */
xfputs(pic, "fatal error: failure in loading $dirname/$basename\\n", xstderr);
pic_fputs(pic, "fatal error: failure in loading $dirname/$basename\\n", pic_stderr(pic));
pic_raise(pic, e);
}
EOL
Expand Down
4 changes: 1 addition & 3 deletions extlib/benz/debug.c
Expand Up @@ -38,10 +38,8 @@ pic_get_backtrace(pic_state *pic)
#if PIC_USE_WRITE

void
pic_print_error(pic_state *pic, xFILE *file, pic_value err)
pic_print_error(pic_state *pic, pic_value port, pic_value err)
{
pic_value port = pic_open_port(pic, file);

if (! pic_error_p(pic, err)) {
pic_fprintf(pic, port, "raise: ~s", err);
} else {
Expand Down
3 changes: 1 addition & 2 deletions extlib/benz/error.c
Expand Up @@ -26,15 +26,14 @@ pic_panic(pic_state *pic, const char *msg)
void
pic_warnf(pic_state *pic, const char *fmt, ...)
{
xFILE *file = pic_fileno(pic, pic_stderr(pic));
va_list ap;
pic_value err;

va_start(ap, fmt);
err = pic_vstrf_value(pic, fmt, ap);
va_end(ap);

xfprintf(pic, file, "warn: %s\n", pic_str(pic, err));
pic_fprintf(pic, pic_stderr(pic), "warn: %s\n", pic_str(pic, err));
}

static pic_value
Expand Down

0 comments on commit 9515060

Please sign in to comment.