mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-20 10:40:19 +02:00
1999-08-04 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_putc, scm_puts), * unif.c (scm_uniform_array_write): use scm_lfwrite. * ports.c (scm_putc): change type of first argument from int to char.
This commit is contained in:
parent
82cc1b112c
commit
265e6a4d28
4 changed files with 11 additions and 54 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
1999-08-04 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
|
* ports.c (scm_putc, scm_puts),
|
||||||
|
* unif.c (scm_uniform_array_write): use scm_lfwrite.
|
||||||
|
* ports.c (scm_putc): change type of first argument from int to char.
|
||||||
|
|
||||||
1999-08-04 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
|
1999-08-04 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
|
||||||
|
|
||||||
* eval.c (SCM_CEVAL): Improvements to SCM_IM_DISPATCH and
|
* eval.c (SCM_CEVAL): Improvements to SCM_IM_DISPATCH and
|
||||||
|
|
|
@ -769,29 +769,10 @@ scm_getc (port)
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_putc (c, port)
|
scm_putc (c, port)
|
||||||
int c;
|
char c;
|
||||||
SCM port;
|
SCM port;
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_lfwrite (&c, 1, port);
|
||||||
scm_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
|
|
||||||
|
|
||||||
if (pt->rw_active == SCM_PORT_READ)
|
|
||||||
scm_read_flush (port);
|
|
||||||
|
|
||||||
*(pt->write_pos++) = (char) c;
|
|
||||||
|
|
||||||
if (pt->write_pos == pt->write_end)
|
|
||||||
ptob->fflush (port);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* check for line-buffering. */
|
|
||||||
if ((SCM_CAR (port) & SCM_BUFLINE)
|
|
||||||
&& c == '\n')
|
|
||||||
ptob->fflush (port);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pt->rw_random)
|
|
||||||
pt->rw_active = SCM_PORT_WRITE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -799,16 +780,7 @@ scm_puts (s, port)
|
||||||
char *s;
|
char *s;
|
||||||
SCM port;
|
SCM port;
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port);
|
scm_lfwrite (s, strlen (s), port);
|
||||||
scm_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port)];
|
|
||||||
|
|
||||||
if (pt->rw_active == SCM_PORT_READ)
|
|
||||||
scm_read_flush (port);
|
|
||||||
|
|
||||||
ptob->write (port, s, strlen (s));
|
|
||||||
|
|
||||||
if (pt->rw_random)
|
|
||||||
pt->rw_active = SCM_PORT_WRITE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -253,7 +253,7 @@ extern SCM scm_eof_object_p SCM_P ((SCM x));
|
||||||
extern SCM scm_force_output SCM_P ((SCM port));
|
extern SCM scm_force_output SCM_P ((SCM port));
|
||||||
extern SCM scm_flush_all_ports SCM_P ((void));
|
extern SCM scm_flush_all_ports SCM_P ((void));
|
||||||
extern SCM scm_read_char SCM_P ((SCM port));
|
extern SCM scm_read_char SCM_P ((SCM port));
|
||||||
extern void scm_putc SCM_P ((int c, 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_puts SCM_P ((char *str_data, SCM port));
|
||||||
extern void scm_lfwrite SCM_P ((char *ptr, scm_sizet size, 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_fflush SCM_P ((SCM port));
|
||||||
|
|
|
@ -1692,31 +1692,10 @@ loop:
|
||||||
|
|
||||||
if (SCM_NIMP (port_or_fd))
|
if (SCM_NIMP (port_or_fd))
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (port_or_fd);
|
|
||||||
int remaining = (cend - offset) * sz;
|
|
||||||
char *source = SCM_CHARS (v) + (cstart + offset) * sz;
|
char *source = SCM_CHARS (v) + (cstart + offset) * sz;
|
||||||
scm_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port_or_fd)];
|
|
||||||
|
|
||||||
ans = cend - offset;
|
ans = cend - offset;
|
||||||
if (pt->rw_active == SCM_PORT_READ)
|
scm_lfwrite (source, ans * sz, port_or_fd);
|
||||||
scm_read_flush (port_or_fd);
|
|
||||||
|
|
||||||
while (remaining > 0)
|
|
||||||
{
|
|
||||||
int to_copy = min (pt->write_end - pt->write_pos, remaining);
|
|
||||||
|
|
||||||
memcpy (pt->write_pos, source, to_copy);
|
|
||||||
pt->write_pos += to_copy;
|
|
||||||
source += to_copy;
|
|
||||||
remaining -= to_copy;
|
|
||||||
if (pt->write_pos == pt->write_end)
|
|
||||||
ptob->fflush (port_or_fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pt->rw_random)
|
|
||||||
{
|
|
||||||
pt->rw_active = SCM_PORT_WRITE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else /* file descriptor. */
|
else /* file descriptor. */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue