1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

1999-08-11 Gary Houston <ghouston@easynet.co.uk>

* fports.c (fport_input_waiting): if select is used, return 1
	instead of whatever FD_ISSET expands to.  maybe it will be useful
	to interpret the value from the input_waiting ptob procedure as a
	lower bound on the number of bytes available.

	* Mikael asked for a few names to be changed...

	* ports.c (scm_make_port_type): take the write procedure as the
	second argument instead of the flush procedure.
	* ports.h (scm_ptob_descriptor): rename the ptob procedures:
	fflush -> flush,  read_flush -> end_input,  fclose -> close,
	fill_buffer -> fill_input,  ftruncate -> truncate,
	input_waiting_p -> input_waiting.

	* ports.c (end_input_void_port): was read_flush_void_port.
	(scm_set_port_end_input): was scm_set_port_flush_input.
	(scm_set_port_flush): was scm_set_port_write.
	(scm_set_port_input_waiting): was scm_set_port_input_waiting_p
	(scm_end_input): was scm_read_flush.
	(scm_fill_input): was scm_fill_buffer.
	(scm_flush): was scm_fflush.
	* fports.c (fport_input_waiting): renamed from fport_input_waiting_p.
	(fport_end_input): was local_read_flush.
	(fport_flush): was local_fflush.
	(fport_close): was local_fclose.
	(fport_truncate): was local_ftruncate.
	(fport_seek): was local_seek.
	(fport_free): was local_free.
	(fport_fill_input): was fport_fill_buffer.
	* strports.c (st_end_input): was st_read_flush.
	(st_truncate): was st_ftruncate.
	* vports.c: (sf_flush): was sfflush.
	(sf_close): was sfclose.
	(sf_fill_input): was sf_fill_buffer.

	* ports.c, fports.c, strports, vports.c, ioext.c, unif.c, filesys.c:
	change callers.
This commit is contained in:
Gary Houston 1999-08-11 18:35:42 +00:00
parent df061ffca7
commit affc96b533
9 changed files with 165 additions and 131 deletions

View file

@ -1,3 +1,43 @@
1999-08-11 Gary Houston <ghouston@easynet.co.uk>
* fports.c (fport_input_waiting): if select is used, return 1
instead of whatever FD_ISSET expands to. maybe it will be useful
to interpret the value from the input_waiting ptob procedure as a
lower bound on the number of bytes available.
* Mikael asked for a few names to be changed...
* ports.c (scm_make_port_type): take the write procedure as the
second argument instead of the flush procedure.
* ports.h (scm_ptob_descriptor): rename the ptob procedures:
fflush -> flush, read_flush -> end_input, fclose -> close,
fill_buffer -> fill_input, ftruncate -> truncate,
input_waiting_p -> input_waiting.
* ports.c (end_input_void_port): was read_flush_void_port.
(scm_set_port_end_input): was scm_set_port_flush_input.
(scm_set_port_flush): was scm_set_port_write.
(scm_set_port_input_waiting): was scm_set_port_input_waiting_p
(scm_end_input): was scm_read_flush.
(scm_fill_input): was scm_fill_buffer.
(scm_flush): was scm_fflush.
* fports.c (fport_input_waiting): renamed from fport_input_waiting_p.
(fport_end_input): was local_read_flush.
(fport_flush): was local_fflush.
(fport_close): was local_fclose.
(fport_truncate): was local_ftruncate.
(fport_seek): was local_seek.
(fport_free): was local_free.
(fport_fill_input): was fport_fill_buffer.
* strports.c (st_end_input): was st_read_flush.
(st_truncate): was st_ftruncate.
* vports.c: (sf_flush): was sfflush.
(sf_close): was sfclose.
(sf_fill_input): was sf_fill_buffer.
* ports.c, fports.c, strports, vports.c, ioext.c, unif.c, filesys.c:
change callers.
1999-08-06 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
* eval.c (SCM_IM_DISPATCH): Rewrote dispatch protocol. Dispatch

View file

@ -956,7 +956,7 @@ scm_fsync (SCM object)
if (SCM_NIMP (object) && SCM_OPFPORTP (object))
{
scm_fflush (object);
scm_flush (object);
fdes = SCM_FPORT_FDES (object);
}
else

View file

@ -311,9 +311,9 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
}
/* Check whether an fport's fdes can supply input. */
/* Return a lower bound on the number of bytes available for input. */
static int
fport_input_waiting_p (SCM port)
fport_input_waiting (SCM port)
{
int fdes = SCM_FSTREAM (port)->fdes;
@ -335,14 +335,14 @@ fport_input_waiting_p (SCM port)
if (select (SELECT_SET_SIZE,
&read_set, &write_set, &except_set, &timeout)
< 0)
scm_syserror ("fport_input_waiting_p");
return FD_ISSET (fdes, &read_set);
scm_syserror ("fport_input_waiting");
return FD_ISSET (fdes, &read_set) ? 1 : 0;
#elif defined (FIONREAD)
int remir;
ioctl(fdes, FIONREAD, &remir);
return remir;
#else
scm_misc_error ("fport_input_waiting_p",
scm_misc_error ("fport_input_waiting",
"Not fully implemented on this platform",
SCM_EOL);
#endif
@ -392,7 +392,7 @@ fport_wait_for_input (SCM port)
{
int fdes = SCM_FSTREAM (port)->fdes;
if (!fport_input_waiting_p (port))
if (!fport_input_waiting (port))
{
int n;
SELECT_TYPE readfds;
@ -412,13 +412,13 @@ fport_wait_for_input (SCM port)
}
#endif
static void local_fflush (SCM port);
static void fport_flush (SCM port);
/* fill a port's read-buffer with a single read.
returns the first char and moves the read_pos pointer past it.
or returns EOF if end of file. */
static int
fport_fill_buffer (SCM port)
fport_fill_input (SCM port)
{
int count;
scm_port *pt = SCM_PTAB_ENTRY (port);
@ -429,7 +429,7 @@ fport_fill_buffer (SCM port)
#endif
SCM_SYSCALL (count = read (fp->fdes, pt->read_buf, pt->read_buf_size));
if (count == -1)
scm_syserror ("fport_fill_buffer");
scm_syserror ("fport_fill_input");
if (count == 0)
return EOF;
else
@ -441,18 +441,18 @@ fport_fill_buffer (SCM port)
}
static off_t
local_seek (SCM port, off_t offset, int whence)
fport_seek (SCM port, off_t offset, int whence)
{
struct scm_fport *fp = SCM_FSTREAM (port);
off_t result = lseek (fp->fdes, offset, whence);
if (result == -1)
scm_syserror ("local_seek");
scm_syserror ("fport_seek");
return result;
}
static void
local_ftruncate (SCM port, off_t length)
fport_truncate (SCM port, off_t length)
{
struct scm_fport *fp = SCM_FSTREAM (port);
@ -486,12 +486,12 @@ fport_write (SCM port, void *data, size_t size)
size -= write_len;
input += write_len;
if (write_len == space)
local_fflush (port);
fport_flush (port);
}
/* handle line buffering. */
if ((SCM_CAR (port) & SCM_BUFLINE) && memchr (data, '\n', size))
local_fflush (port);
fport_flush (port);
}
}
@ -500,7 +500,7 @@ fport_write (SCM port, void *data, size_t size)
extern int terminating;
static void
local_fflush (SCM port)
fport_flush (SCM port)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
struct scm_fport *fp = SCM_FSTREAM (port);
@ -530,7 +530,7 @@ local_fflush (SCM port)
pt->write_pos = pt->write_buf + remaining;
}
if (!terminating)
scm_syserror ("local_fflush");
scm_syserror ("fport_flush");
else
{
const char *msg = "Error: could not flush file-descriptor ";
@ -552,7 +552,7 @@ local_fflush (SCM port)
/* clear the read buffer and adjust the file position for unread bytes. */
static void
local_read_flush (SCM port, int offset)
fport_end_input (SCM port, int offset)
{
struct scm_fport *fp = SCM_FSTREAM (port);
scm_port *pt = SCM_PTAB_ENTRY (port);
@ -565,22 +565,22 @@ local_read_flush (SCM port, int offset)
/* will throw error if unread-char used at beginning of file
then attempting to write. seems correct. */
if (lseek (fp->fdes, -offset, SEEK_CUR) == -1)
scm_syserror ("local_read_flush");
scm_syserror ("fport_end_input");
}
pt->rw_active = 0;
}
static int
local_fclose (SCM port)
fport_close (SCM port)
{
struct scm_fport *fp = SCM_FSTREAM (port);
scm_port *pt = SCM_PTAB_ENTRY (port);
int rv;
local_fflush (port);
fport_flush (port);
SCM_SYSCALL (rv = close (fp->fdes));
if (rv == -1 && errno != EBADF)
scm_syserror ("local_fclose");
scm_syserror ("fport_close");
if (pt->read_buf == pt->putback_buf)
pt->read_buf = pt->saved_read_buf;
if (pt->read_buf != &pt->shortbuf)
@ -592,9 +592,9 @@ local_fclose (SCM port)
}
static scm_sizet
local_free (SCM port)
fport_free (SCM port)
{
local_fclose (port);
fport_close (port);
return 0;
}
@ -603,15 +603,15 @@ void scm_make_fptob (void); /* Called from ports.c */
void
scm_make_fptob ()
{
long tc = scm_make_port_type ("file", fport_fill_buffer, local_fflush);
scm_set_port_free (tc, local_free);
long tc = scm_make_port_type ("file", fport_fill_input, fport_write);
scm_set_port_free (tc, fport_free);
scm_set_port_print (tc, prinfport);
scm_set_port_write (tc, fport_write);
scm_set_port_flush_input (tc, local_read_flush);
scm_set_port_close (tc, local_fclose);
scm_set_port_seek (tc, local_seek);
scm_set_port_truncate (tc, local_ftruncate);
scm_set_port_input_waiting_p (tc, fport_input_waiting_p);
scm_set_port_flush (tc, fport_flush);
scm_set_port_end_input (tc, fport_end_input);
scm_set_port_close (tc, fport_close);
scm_set_port_seek (tc, fport_seek);
scm_set_port_truncate (tc, fport_truncate);
scm_set_port_input_waiting (tc, fport_input_waiting);
}
void

View file

@ -196,7 +196,7 @@ scm_do_read_line (SCM port, int *len_p)
break;
/* Get more characters. */
if (scm_fill_buffer (port) == EOF)
if (scm_fill_input (port) == EOF)
{
/* If we're missing a final newline in the file, return
what we did get, sans newline. */
@ -252,7 +252,7 @@ scm_read_line (port)
pt = SCM_PTAB_ENTRY (port);
if (pt->rw_active == SCM_PORT_WRITE)
scm_ptobs[SCM_PTOBNUM (port)].fflush (port);
scm_ptobs[SCM_PTOBNUM (port)].flush (port);
s = scm_do_read_line (port, &slen);
@ -341,9 +341,9 @@ scm_redirect_port (old, new)
/* must flush to old fdes. */
if (pt->rw_active == SCM_PORT_WRITE)
ptob->fflush (new);
ptob->flush (new);
else if (pt->rw_active == SCM_PORT_READ)
scm_read_flush (new);
scm_end_input (new);
ans = dup2 (oldfd, newfd);
if (ans == -1)
scm_syserror (s_redirect_port);

View file

@ -89,32 +89,19 @@ scm_markstream (ptr)
}
/*
* This is how different port types currently use ptob fields.
*
* fports: free, flush, read_flush, close,
* fill_buffer, seek, truncate, input_waiting_p
*
* strports: mark, flush, read_flush,
* fill_buffer, seek, truncate
*
* softports: mark, flush, read_flush, close,
* fill_buffer
*
* voidports: (default values)
*
* We choose to use an interface similar to the smob interface with
* fill_buffer and write_flush as standard fields, passed to the port
* fill_input and write as standard fields, passed to the port
* type constructor, and optional fields set by setters.
*/
static void flush_void_port (SCM port);
static void read_flush_void_port (SCM port, int offset);
static void end_input_void_port (SCM port, int offset);
static void write_void_port (SCM port, void *data, size_t size);
long
scm_make_port_type (char *name,
int (*fill_buffer) (SCM port),
void (*write_flush) (SCM port))
int (*fill_input) (SCM port),
void (*write) (SCM port, void *data, size_t size))
{
char *tmp;
if (255 <= scm_numptob)
@ -126,21 +113,24 @@ scm_make_port_type (char *name,
if (tmp)
{
scm_ptobs = (scm_ptob_descriptor *) tmp;
scm_ptobs[scm_numptob].name = name;
scm_ptobs[scm_numptob].mark = 0;
scm_ptobs[scm_numptob].free = scm_free0;
scm_ptobs[scm_numptob].print = scm_port_print;
scm_ptobs[scm_numptob].equalp = 0;
scm_ptobs[scm_numptob].write = write_void_port;
scm_ptobs[scm_numptob].fflush = (write_flush
? write_flush
: flush_void_port);
scm_ptobs[scm_numptob].read_flush = read_flush_void_port;
scm_ptobs[scm_numptob].fclose = 0;
scm_ptobs[scm_numptob].fill_buffer = fill_buffer;
scm_ptobs[scm_numptob].close = 0;
scm_ptobs[scm_numptob].write = write;
scm_ptobs[scm_numptob].flush = flush_void_port;
scm_ptobs[scm_numptob].end_input = end_input_void_port;
scm_ptobs[scm_numptob].fill_input = fill_input;
scm_ptobs[scm_numptob].input_waiting = 0;
scm_ptobs[scm_numptob].seek = 0;
scm_ptobs[scm_numptob].ftruncate = 0;
scm_ptobs[scm_numptob].input_waiting_p = 0;
scm_ptobs[scm_numptob].truncate = 0;
scm_numptob++;
}
SCM_ALLOW_INTS;
@ -179,22 +169,21 @@ scm_set_port_equalp (long tc, SCM (*equalp) (SCM, SCM))
}
void
scm_set_port_write (long tc, void (*write_proc) (SCM port, void *data,
size_t size))
scm_set_port_flush (long tc, void (*flush) (SCM port))
{
scm_ptobs[SCM_TC2PTOBNUM (tc)].write = write_proc;
scm_ptobs[SCM_TC2PTOBNUM (tc)].flush = flush;
}
void
scm_set_port_flush_input (long tc, void (*flush_input) (SCM port, int offset))
scm_set_port_end_input (long tc, void (*end_input) (SCM port, int offset))
{
scm_ptobs[SCM_TC2PTOBNUM (tc)].read_flush = flush_input;
scm_ptobs[SCM_TC2PTOBNUM (tc)].end_input = end_input;
}
void
scm_set_port_close (long tc, int (*close) (SCM))
{
scm_ptobs[SCM_TC2PTOBNUM (tc)].fclose = close;
scm_ptobs[SCM_TC2PTOBNUM (tc)].close = close;
}
void
@ -208,13 +197,13 @@ scm_set_port_seek (long tc, off_t (*seek) (SCM port,
void
scm_set_port_truncate (long tc, void (*truncate) (SCM port, off_t length))
{
scm_ptobs[SCM_TC2PTOBNUM (tc)].ftruncate = truncate;
scm_ptobs[SCM_TC2PTOBNUM (tc)].truncate = truncate;
}
void
scm_set_port_input_waiting_p (long tc, int (*waitingp) (SCM))
scm_set_port_input_waiting (long tc, int (*input_waiting) (SCM))
{
scm_ptobs[SCM_TC2PTOBNUM (tc)].input_waiting_p = waitingp;
scm_ptobs[SCM_TC2PTOBNUM (tc)].input_waiting = input_waiting;
}
@ -246,8 +235,8 @@ scm_char_ready_p (port)
{
scm_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
if (ptob->input_waiting_p)
return (ptob->input_waiting_p (port)) ? SCM_BOOL_T : SCM_BOOL_F;
if (ptob->input_waiting)
return (ptob->input_waiting (port)) ? SCM_BOOL_T : SCM_BOOL_F;
else
return SCM_BOOL_T;
}
@ -580,8 +569,8 @@ scm_close_port (port)
if (SCM_CLOSEDP (port))
return SCM_BOOL_F;
i = SCM_PTOBNUM (port);
if (scm_ptobs[i].fclose)
rv = (scm_ptobs[i].fclose) (port);
if (scm_ptobs[i].close)
rv = (scm_ptobs[i].close) (port);
else
rv = 0;
scm_remove_from_port_table (port);
@ -671,7 +660,7 @@ scm_force_output (port)
SCM_ASSERT (SCM_NIMP (port) && SCM_OPOUTPORTP (port), port, SCM_ARG1,
s_force_output);
}
scm_fflush (port);
scm_flush (port);
return SCM_UNSPECIFIED;
}
@ -684,7 +673,7 @@ scm_flush_all_ports (void)
for (i = 0; i < scm_port_table_size; i++)
{
if (SCM_OPOUTPORTP (scm_port_table[i]->port))
scm_fflush (scm_port_table[i]->port);
scm_flush (scm_port_table[i]->port);
}
return SCM_UNSPECIFIED;
}
@ -707,10 +696,10 @@ scm_read_char (port)
}
/* this should only be called when the read buffer is empty. it
tries to refill the buffer. it returns the first char from
tries to refill the read buffer. it returns the first char from
the port, which is either EOF or *(pt->read_pos). */
int
scm_fill_buffer (SCM port)
scm_fill_input (SCM port)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
@ -724,7 +713,7 @@ scm_fill_buffer (SCM port)
if (pt->read_pos < pt->read_end)
return *(pt->read_pos);
}
return scm_ptobs[SCM_PTOBNUM (port)].fill_buffer (port);
return scm_ptobs[SCM_PTOBNUM (port)].fill_input (port);
}
int
@ -736,8 +725,8 @@ scm_getc (port)
if (pt->rw_active == SCM_PORT_WRITE)
{
/* may be marginally faster than calling scm_fflush. */
scm_ptobs[SCM_PTOBNUM (port)].fflush (port);
/* may be marginally faster than calling scm_flush. */
scm_ptobs[SCM_PTOBNUM (port)].flush (port);
}
if (pt->rw_random)
@ -745,7 +734,7 @@ scm_getc (port)
if (pt->read_pos >= pt->read_end)
{
if (scm_fill_buffer (port) == EOF)
if (scm_fill_input (port) == EOF)
return EOF;
}
@ -793,7 +782,7 @@ scm_lfwrite (ptr, size, port)
scm_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
if (pt->rw_active == SCM_PORT_READ)
scm_read_flush (port);
scm_end_input (port);
ptob->write (port, ptr, size);
@ -803,15 +792,15 @@ scm_lfwrite (ptr, size, port)
void
scm_fflush (port)
scm_flush (port)
SCM port;
{
scm_sizet i = SCM_PTOBNUM (port);
(scm_ptobs[i].fflush) (port);
(scm_ptobs[i].flush) (port);
}
void
scm_read_flush (port)
scm_end_input (port)
SCM port;
{
int offset;
@ -828,7 +817,7 @@ scm_read_flush (port)
else
offset = 0;
scm_ptobs[SCM_PTOBNUM (port)].read_flush (port, offset);
scm_ptobs[SCM_PTOBNUM (port)].end_input (port, offset);
}
@ -1015,9 +1004,9 @@ scm_lseek (SCM object, SCM offset, SCM whence)
else
{
if (pt->rw_active == SCM_PORT_READ)
scm_read_flush (object);
scm_end_input (object);
else if (pt->rw_active == SCM_PORT_WRITE)
ptob->fflush (object);
ptob->flush (object);
rv = ptob->seek (object, off, how);
}
@ -1064,14 +1053,14 @@ scm_truncate_file (SCM object, SCM length)
scm_port *pt = SCM_PTAB_ENTRY (object);
scm_ptob_descriptor *ptob = scm_ptobs + SCM_PTOBNUM (object);
if (!ptob->ftruncate)
if (!ptob->truncate)
scm_misc_error (s_truncate_file, "port is not truncatable", SCM_EOL);
if (pt->rw_active == SCM_PORT_READ)
scm_read_flush (object);
scm_end_input (object);
else if (pt->rw_active == SCM_PORT_WRITE)
ptob->fflush (object);
ptob->flush (object);
ptob->ftruncate (object, c_length);
ptob->truncate (object, c_length);
rv = 0;
}
else
@ -1241,7 +1230,7 @@ flush_void_port (SCM port)
}
static void
read_flush_void_port (SCM port, int offset)
end_input_void_port (SCM port, int offset)
{
}
@ -1294,6 +1283,6 @@ scm_init_ports ()
scm_sysintern ("SEEK_CUR", SCM_MAKINUM (SEEK_CUR));
scm_sysintern ("SEEK_END", SCM_MAKINUM (SEEK_END));
scm_tc16_void_port = scm_make_port_type ("void", 0, 0);
scm_tc16_void_port = scm_make_port_type ("void", 0, write_void_port);
#include "ports.x"
}

View file

@ -169,6 +169,7 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */
/* port-type description. */
typedef struct scm_ptob_descriptor
{
char *name;
@ -176,14 +177,18 @@ typedef struct scm_ptob_descriptor
scm_sizet (*free) (SCM);
int (*print) (SCM exp, SCM port, scm_print_state *pstate);
SCM (*equalp) (SCM, SCM);
int (*close) (SCM port);
void (*write) (SCM port, void *data, size_t size);
void (*fflush) (SCM port);
void (*read_flush) (SCM port, int offset);
int (*fclose) (SCM port);
int (*fill_buffer) (SCM port);
void (*flush) (SCM port);
void (*end_input) (SCM port, int offset);
int (*fill_input) (SCM port);
int (*input_waiting) (SCM port);
off_t (*seek) (SCM port, off_t OFFSET, int WHENCE);
void (*ftruncate) (SCM port, off_t length);
int (*input_waiting_p) (SCM port);
void (*truncate) (SCM port, off_t length);
} scm_ptob_descriptor;
#define SCM_TC2PTOBNUM(x) (0x0ff & ((x) >> 8))
@ -201,8 +206,9 @@ extern int scm_port_table_room;
extern SCM scm_markstream SCM_P ((SCM ptr));
extern long scm_make_port_type (char *name,
int (*fill_buffer) (SCM port),
void (*write_flush) (SCM port));
int (*fill_input) (SCM port),
void (*write) (SCM port, void *data,
size_t size));
extern void scm_set_port_mark (long tc, SCM (*mark) (SCM));
extern void scm_set_port_free (long tc, scm_sizet (*free) (SCM));
extern void scm_set_port_print (long tc,
@ -210,14 +216,13 @@ extern void scm_set_port_print (long tc,
SCM port,
scm_print_state *pstate));
extern void scm_set_port_equalp (long tc, SCM (*equalp) (SCM, SCM));
extern void scm_set_port_write (long tc,
void (*write_proc) (SCM port,
void *data,
size_t size));
extern void scm_set_port_flush_input (long tc,
void (*flush_input) (SCM port,
int offset));
extern void scm_set_port_close (long tc, int (*close) (SCM));
extern void scm_set_port_flush (long tc,
void (*flush) (SCM port));
extern void scm_set_port_end_input (long tc,
void (*end_input) (SCM port,
int offset));
extern void scm_set_port_seek (long tc,
off_t (*seek) (SCM port,
off_t OFFSET,
@ -225,7 +230,7 @@ extern void scm_set_port_seek (long tc,
extern void scm_set_port_truncate (long tc,
void (*truncate) (SCM port,
off_t length));
extern void scm_set_port_input_waiting_p (long tc, int (*waitingp) (SCM));
extern void scm_set_port_input_waiting (long tc, int (*input_waiting) (SCM));
extern SCM scm_char_ready_p SCM_P ((SCM port));
extern SCM scm_drain_input (SCM port);
extern SCM scm_current_input_port SCM_P ((void));
@ -256,9 +261,9 @@ extern SCM scm_read_char SCM_P ((SCM port));
extern void scm_putc SCM_P ((char c, SCM port));
extern void scm_puts SCM_P ((char *str_data, SCM port));
extern void scm_lfwrite SCM_P ((char *ptr, scm_sizet size, SCM port));
extern void scm_fflush SCM_P ((SCM port));
extern void scm_read_flush (SCM port);
extern int scm_fill_buffer (SCM port);
extern void scm_flush SCM_P ((SCM port));
extern void scm_end_input (SCM port);
extern int scm_fill_input (SCM port);
extern int scm_getc SCM_P ((SCM port));
extern void scm_ungetc SCM_P ((int c, SCM port));
extern void scm_ungets SCM_P ((char *s, int n, SCM port));

View file

@ -141,7 +141,7 @@ st_write (SCM port, void *data, size_t size)
}
static void
st_read_flush (SCM port, int offset)
st_end_input (SCM port, int offset)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
@ -197,7 +197,7 @@ st_seek (SCM port, off_t offset, int whence)
}
static void
st_ftruncate (SCM port, off_t length)
st_truncate (SCM port, off_t length)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
@ -376,12 +376,12 @@ void scm_make_stptob (void); /* Called from ports.c */
void
scm_make_stptob ()
{
long tc = scm_make_port_type ("string", stfill_buffer, st_flush);
long tc = scm_make_port_type ("string", stfill_buffer, st_write);
scm_set_port_mark (tc, scm_markstream);
scm_set_port_flush_input (tc, st_read_flush);
scm_set_port_write (tc, st_write);
scm_set_port_end_input (tc, st_end_input);
scm_set_port_flush (tc, st_flush);
scm_set_port_seek (tc, st_seek);
scm_set_port_truncate (tc, st_ftruncate);
scm_set_port_truncate (tc, st_truncate);
}
void

View file

@ -1547,7 +1547,7 @@ loop:
char *dest = SCM_CHARS (v) + (cstart + offset) * sz;
if (pt->rw_active == SCM_PORT_WRITE)
scm_fflush (port_or_fd);
scm_flush (port_or_fd);
ans = cend - offset;
while (remaining > 0)
@ -1564,7 +1564,7 @@ loop:
}
else
{
if (scm_fill_buffer (port_or_fd) == EOF)
if (scm_fill_input (port_or_fd) == EOF)
{
if (remaining % sz != 0)
{

View file

@ -60,7 +60,7 @@
static void
sfflush (SCM port)
sf_flush (SCM port)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
SCM stream = pt->stream;
@ -96,9 +96,9 @@ sf_write (SCM port, void *data, size_t size)
but perhaps softports could the use port buffer in the same way as
fports. */
/* returns a single character. */
/* places a single char in the input buffer. */
static int
sf_fill_buffer (SCM port)
sf_fill_input (SCM port)
{
SCM p = SCM_STREAM (port);
SCM ans;
@ -106,7 +106,7 @@ sf_fill_buffer (SCM port)
ans = scm_apply (SCM_VELTS (p)[3], SCM_EOL, SCM_EOL); /* get char. */
if (SCM_FALSEP (ans) || SCM_EOF_OBJECT_P (ans))
return EOF;
SCM_ASSERT (SCM_ICHRP (ans), ans, SCM_ARG1, "sf_fill_buffer");
SCM_ASSERT (SCM_ICHRP (ans), ans, SCM_ARG1, "sf_fill_input");
{
scm_port *pt = SCM_PTAB_ENTRY (port);
@ -119,7 +119,7 @@ sf_fill_buffer (SCM port)
static int
sfclose (SCM port)
sf_close (SCM port)
{
SCM p = SCM_STREAM (port);
SCM f = SCM_VELTS (p)[4];
@ -165,10 +165,10 @@ void scm_make_sfptob (void); /* Called from ports.c */
void
scm_make_sfptob ()
{
long tc = scm_make_port_type ("soft", sf_fill_buffer, sfflush);
long tc = scm_make_port_type ("soft", sf_fill_input, sf_write);
scm_set_port_mark (tc, scm_markstream);
scm_set_port_write (tc, sf_write);
scm_set_port_close (tc, sfclose);
scm_set_port_flush (tc, sf_flush);
scm_set_port_close (tc, sf_close);
}
void