mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 20:30:28 +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
|
@ -59,26 +59,18 @@
|
|||
*/
|
||||
|
||||
|
||||
static int prinstpt SCM_P ((SCM exp, SCM port, scm_print_state *pstate));
|
||||
|
||||
static int
|
||||
prinstpt (exp, port, pstate)
|
||||
SCM exp;
|
||||
SCM port;
|
||||
scm_print_state *pstate;
|
||||
prinstpt (SCM exp, SCM port, scm_print_state *pstate)
|
||||
{
|
||||
scm_prinport (exp, port, "string");
|
||||
return !0;
|
||||
}
|
||||
|
||||
|
||||
static int stputc SCM_P ((int c, SCM p));
|
||||
|
||||
static int
|
||||
stputc (c, p)
|
||||
int c;
|
||||
SCM p;
|
||||
stputc (int c, SCM port)
|
||||
{
|
||||
SCM p = SCM_STREAM (port);
|
||||
scm_sizet ind = SCM_INUM (SCM_CAR (p));
|
||||
SCM_DEFER_INTS;
|
||||
if (ind >= SCM_LENGTH (SCM_CDR (p)))
|
||||
|
@ -90,15 +82,14 @@ stputc (c, p)
|
|||
}
|
||||
|
||||
|
||||
static scm_sizet stwrite SCM_P ((char *str, scm_sizet siz, scm_sizet num, SCM p));
|
||||
|
||||
static scm_sizet
|
||||
stwrite (str, siz, num, p)
|
||||
char *str;
|
||||
scm_sizet siz;
|
||||
scm_sizet num;
|
||||
SCM p;
|
||||
stwrite (char *str,
|
||||
scm_sizet siz,
|
||||
scm_sizet num,
|
||||
SCM port)
|
||||
{
|
||||
SCM p = SCM_STREAM (port);
|
||||
|
||||
scm_sizet ind = SCM_INUM (SCM_CAR (p));
|
||||
scm_sizet len = siz * num;
|
||||
char *dst;
|
||||
|
@ -114,24 +105,19 @@ stwrite (str, siz, num, p)
|
|||
}
|
||||
|
||||
|
||||
static int stputs SCM_P ((char *s, SCM p));
|
||||
|
||||
static int
|
||||
stputs (s, p)
|
||||
char *s;
|
||||
SCM p;
|
||||
stputs (char *s, SCM port)
|
||||
{
|
||||
stwrite (s, 1, strlen (s), p);
|
||||
stwrite (s, 1, strlen (s), port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int stgetc SCM_P ((SCM p));
|
||||
|
||||
static int
|
||||
stgetc (p)
|
||||
SCM p;
|
||||
stgetc (SCM port)
|
||||
{
|
||||
SCM p = SCM_STREAM (port);
|
||||
|
||||
scm_sizet ind = SCM_INUM (SCM_CAR (p));
|
||||
if (ind >= SCM_ROLENGTH (SCM_CDR (p)))
|
||||
return EOF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue