diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 23dc2fd92..11f9ce8dc 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,9 @@ +1999-08-04 Gary Houston + + * 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 * eval.c (SCM_CEVAL): Improvements to SCM_IM_DISPATCH and diff --git a/libguile/ports.c b/libguile/ports.c index f1be1e04b..76e00592e 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -769,29 +769,10 @@ scm_getc (port) void scm_putc (c, port) - int c; + char c; SCM port; { - scm_port *pt = SCM_PTAB_ENTRY (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; + scm_lfwrite (&c, 1, port); } void @@ -799,16 +780,7 @@ scm_puts (s, port) char *s; SCM port; { - scm_port *pt = SCM_PTAB_ENTRY (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; + scm_lfwrite (s, strlen (s), port); } void diff --git a/libguile/ports.h b/libguile/ports.h index 7cc4b28f6..1b066b111 100644 --- a/libguile/ports.h +++ b/libguile/ports.h @@ -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_flush_all_ports SCM_P ((void)); 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_lfwrite SCM_P ((char *ptr, scm_sizet size, SCM port)); extern void scm_fflush SCM_P ((SCM port)); diff --git a/libguile/unif.c b/libguile/unif.c index beabdd1c3..e4b2c08d4 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -1692,31 +1692,10 @@ loop: 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; - scm_ptob_descriptor *ptob = &scm_ptobs[SCM_PTOBNUM (port_or_fd)]; ans = cend - offset; - if (pt->rw_active == SCM_PORT_READ) - 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; - } + scm_lfwrite (source, ans * sz, port_or_fd); } else /* file descriptor. */ {