mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
* fports.c (scm_fdes_to_port): always set rw_random if the fdes is
random access. rw_active needs to be maintained even for single directional ports, otherwise scm_seek and probably other things are broken. (thanks to Roland Orre). * strports.c (scm_mkstrport): set rw_random to 1 unconditionally. * ports.c (scm_add_to_port_table): initialise rw_random to 0. * ports.h (scm_port): change the comments on rw_random and rw_active.
This commit is contained in:
parent
4fcd6551ff
commit
0de97b83c0
5 changed files with 25 additions and 14 deletions
|
@ -1,3 +1,16 @@
|
|||
1999-10-18 Gary Houston <ghouston@freewire.co.uk>
|
||||
|
||||
* fports.c (scm_fdes_to_port): always set rw_random if the fdes is
|
||||
random access. rw_active needs to be maintained even for single
|
||||
directional ports, otherwise scm_seek and probably other things are
|
||||
broken. (thanks to Roland Orre).
|
||||
|
||||
* strports.c (scm_mkstrport): set rw_random to 1 unconditionally.
|
||||
|
||||
* ports.c (scm_add_to_port_table): initialise rw_random to 0.
|
||||
|
||||
* ports.h (scm_port): change the comments on rw_random and rw_active.
|
||||
|
||||
1999-10-11 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
|
||||
|
||||
* ioext.c: Added #include "feature.h".
|
||||
|
|
|
@ -310,8 +310,7 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
|
|||
if (fp == NULL)
|
||||
scm_memory_error ("scm_fdes_to_port");
|
||||
fp->fdes = fdes;
|
||||
pt->rw_random = (mode_bits & SCM_RDNG) && (mode_bits & SCM_WRTNG)
|
||||
&& SCM_FDES_RANDOM_P (fdes);
|
||||
pt->rw_random = SCM_FDES_RANDOM_P (fdes);
|
||||
SCM_SETSTREAM (port, fp);
|
||||
if (mode_bits & SCM_BUF0)
|
||||
scm_fport_buffer_add (port, 0, 0);
|
||||
|
|
|
@ -383,6 +383,7 @@ scm_add_to_port_table (SCM port)
|
|||
entry->putback_buf = 0;
|
||||
entry->putback_buf_size = 0;
|
||||
entry->rw_active = SCM_PORT_NEITHER;
|
||||
entry->rw_random = 0;
|
||||
|
||||
scm_port_table[scm_port_table_size] = entry;
|
||||
scm_port_table_size++;
|
||||
|
|
|
@ -113,16 +113,16 @@ typedef struct
|
|||
|
||||
unsigned char shortbuf; /* buffer for "unbuffered" streams. */
|
||||
|
||||
int rw_random; /* true if the port is bidirectional and
|
||||
random access. implies that the buffers
|
||||
must be flushed before switching between
|
||||
reading and writing. */
|
||||
int rw_random; /* true if the port is random access.
|
||||
implies that the buffers must be
|
||||
flushed before switching between
|
||||
reading and writing, seeking, etc. */
|
||||
|
||||
enum scm_port_rw_active rw_active; /* for bidirectional random
|
||||
ports, indicates which of the
|
||||
buffers is currently in use. can
|
||||
be SCM_PORT_WRITE, SCM_PORT_READ,
|
||||
or 0. */
|
||||
enum scm_port_rw_active rw_active; /* for random access ports,
|
||||
indicates which of the buffers
|
||||
is currently in use. can be
|
||||
SCM_PORT_WRITE, SCM_PORT_READ,
|
||||
or SCM_PORT_NEITHER. */
|
||||
|
||||
|
||||
/* a buffer for un-read chars and strings. */
|
||||
|
|
|
@ -247,9 +247,7 @@ scm_mkstrport (pos, str, modes, caller)
|
|||
pt->write_buf_size = pt->read_buf_size = str_len;
|
||||
pt->write_end = pt->read_end = pt->read_buf + pt->read_buf_size;
|
||||
|
||||
/* doesn't check (modes & SCM_RDNG), since the read_buf must be
|
||||
maintained even for output-only ports. */
|
||||
pt->rw_random = modes & SCM_WRTNG;
|
||||
pt->rw_random = 1;
|
||||
|
||||
SCM_ALLOW_INTS;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue