mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 17:20:29 +02:00
Change the definition of the functions in scm_ptobfuns so that
they get passed the port object, not the port's stream. * ports.h (scm_ptobfuns): Rename all `stream' arguments to `port'. * gc.c (scm_gc_sweep): Pass the port itself to the free function. * genio.c (scm_putc, scm_puts, scm_lfwrite, scm_fflush, scm_getc): Pass the port itself to the scm_ptobs function. * ports.c (scm_close_port, scm_force_output, scm_flush_all_ports, scm_generic_fgets): Same. (putc_void_port, puts_void_port, write_void_port, flush_void_port, getc_void_port, fgets_void_port, close_void_port): Just change the argument names; these functions don't really do anything. * fports.c (local_fgetc, local_fgets, local_fclose, local_fflush, local_fputc, local_fputs, local_ffwrite, local_pclose): Take the port as an argument, and use SCM_STREAM to get the stdio FILE *. Also, use prototyped definitions, and get rid of the extra declarations. (scm_fptob, scm_pipob): We don't need casts here any more. * strports.c (prinstpt): Use prototype declarations. (stputc, stwrite, stputs, stgetc): Take the port as an argument, and use SCM_STREAM to get the string info. Also, use prototyped definitions, and get rid of the extra declarations. * vports.c (sfputc, sfwrite, sfputs, sfflush, sfgetc, sfclose, noop0): Same.
This commit is contained in:
parent
ea9fc30d4b
commit
0f88a8f3bd
5 changed files with 48 additions and 81 deletions
|
@ -431,7 +431,7 @@ scm_close_port (port)
|
|||
SCM_DEFER_INTS;
|
||||
if (scm_ptobs[i].fclose)
|
||||
{
|
||||
SCM_SYSCALL (rv = (scm_ptobs[i].fclose) (SCM_STREAM (port)));
|
||||
SCM_SYSCALL (rv = (scm_ptobs[i].fclose) (port));
|
||||
/* ports with a closed file descriptor can be reclosed without error. */
|
||||
if (rv < 0 && errno != EBADF)
|
||||
scm_syserror (s_close_port);
|
||||
|
@ -530,7 +530,7 @@ scm_force_output (port)
|
|||
}
|
||||
{
|
||||
scm_sizet i = SCM_PTOBNUM (port);
|
||||
SCM_SYSCALL ((scm_ptobs[i].fflush) (SCM_STREAM (port)));
|
||||
SCM_SYSCALL ((scm_ptobs[i].fflush) (port));
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ scm_flush_all_ports (void)
|
|||
if (SCM_OPOUTPORTP (port))
|
||||
{
|
||||
scm_sizet ptob = SCM_PTOBNUM (port);
|
||||
(scm_ptobs[ptob].fflush) (SCM_STREAM (port));
|
||||
(scm_ptobs[ptob].fflush) (port);
|
||||
}
|
||||
}
|
||||
return SCM_UNSPECIFIED;
|
||||
|
@ -605,7 +605,6 @@ scm_generic_fgets (port, len)
|
|||
SCM port;
|
||||
int *len;
|
||||
{
|
||||
SCM f = SCM_STREAM (port);
|
||||
scm_sizet p = SCM_PTOBNUM (port);
|
||||
|
||||
char *buf;
|
||||
|
@ -637,7 +636,7 @@ scm_generic_fgets (port, len)
|
|||
limit *= 2;
|
||||
}
|
||||
|
||||
c = (scm_ptobs[p].fgetc) (f);
|
||||
c = (scm_ptobs[p].fgetc) (port);
|
||||
if (c != EOF)
|
||||
buf[(*len)++] = c;
|
||||
|
||||
|
@ -839,19 +838,19 @@ print_void_port (SCM exp, SCM port, scm_print_state *pstate)
|
|||
}
|
||||
|
||||
static int
|
||||
putc_void_port (int c, SCM strm)
|
||||
putc_void_port (int c, SCM port)
|
||||
{
|
||||
return 0; /* vestigial return value */
|
||||
}
|
||||
|
||||
static int
|
||||
puts_void_port (char *s, SCM strm)
|
||||
puts_void_port (char *s, SCM port)
|
||||
{
|
||||
return 0; /* vestigial return value */
|
||||
}
|
||||
|
||||
static scm_sizet
|
||||
write_void_port (char *ptr, scm_sizet size, scm_sizet nitems, SCM strm)
|
||||
write_void_port (char *ptr, scm_sizet size, scm_sizet nitems, SCM port)
|
||||
{
|
||||
int len;
|
||||
len = size * nitems;
|
||||
|
@ -860,26 +859,26 @@ write_void_port (char *ptr, scm_sizet size, scm_sizet nitems, SCM strm)
|
|||
|
||||
|
||||
static int
|
||||
flush_void_port (SCM strm)
|
||||
flush_void_port (SCM port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getc_void_port (SCM strm)
|
||||
getc_void_port (SCM port)
|
||||
{
|
||||
return EOF;
|
||||
}
|
||||
|
||||
static char *
|
||||
fgets_void_port (SCM strm, int *len)
|
||||
fgets_void_port (SCM port, int *len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
close_void_port (SCM strm)
|
||||
close_void_port (SCM port)
|
||||
{
|
||||
return 0; /* this is ignored by scm_close_port. */
|
||||
}
|
||||
|
@ -893,7 +892,7 @@ noop0 (SCM stream)
|
|||
}
|
||||
|
||||
|
||||
static struct scm_ptobfuns void_port_ptob =
|
||||
static struct scm_ptobfuns void_port_ptob =
|
||||
{
|
||||
0,
|
||||
noop0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue