From 0c0669cc7348c68ed80942d12a52524ee0db1761 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Fri, 9 Oct 1998 10:00:55 +0000 Subject: [PATCH] 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. * ports.h (scm_ptobfuns): Replace uses of SCM_P with a straight prototype; it's okay (preferred, even!) to use ANSI C in Guile. --- libguile/ports.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/libguile/ports.h b/libguile/ports.h index a7ea3e158..205a4ac42 100644 --- a/libguile/ports.h +++ b/libguile/ports.h @@ -124,17 +124,20 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */ typedef struct scm_ptobfuns { - SCM (*mark) SCM_P ((SCM)); - int (*free) SCM_P ((SCM)); - int (*print) SCM_P ((SCM exp, SCM port, scm_print_state *pstate)); - SCM (*equalp) SCM_P ((SCM, SCM)); - int (*fputc) SCM_P ((int, SCM stream)); - int (*fputs) SCM_P ((char *, SCM stream)); - scm_sizet (*fwrite) SCM_P ((char *ptr, scm_sizet size, scm_sizet nitems, SCM stream)); - int (*fflush) SCM_P ((SCM stream)); - int (*fgetc) SCM_P ((SCM stream)); - char * (*fgets) SCM_P ((SCM stream, int *len)); - int (*fclose) SCM_P ((SCM stream)); + SCM (*mark) (SCM); + int (*free) (SCM); + int (*print) (SCM exp, SCM port, scm_print_state *pstate); + SCM (*equalp) (SCM, SCM); + int (*fputc) (int, SCM port); + int (*fputs) (char *, SCM port); + scm_sizet (*fwrite) SCM_P ((char *ptr, + scm_sizet size, + scm_sizet nitems, + SCM port)); + int (*fflush) (SCM port); + int (*fgetc) (SCM port); + char * (*fgets) (SCM port, int *len); + int (*fclose) (SCM port); } scm_ptobfuns; #define SCM_PTOBNUM(x) (0x0ff & (SCM_CAR(x)>>8))