1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

* genio.c (scm_getc): Use SCM_TRY_CLRDY instead of SCM_CLRDY.

* genio.c, genio.h (scm_ungets): New function.
* genio.c (scm_puts): Removed mysterious TRANSCRIPT_SUPPORT code
sections.
This commit is contained in:
Mikael Djurfeldt 1998-10-30 08:23:52 +00:00
parent 327ff831a0
commit b8af68db88

View file

@ -69,10 +69,6 @@ scm_puts (s, port)
{ {
scm_sizet i = SCM_PTOBNUM (port); scm_sizet i = SCM_PTOBNUM (port);
SCM_SYSCALL ((scm_ptobs[i].fputs) (s, port)); SCM_SYSCALL ((scm_ptobs[i].fputs) (s, port));
#ifdef TRANSCRIPT_SUPPORT
if (scm_trans && (port == def_outp || port == cur_errp))
SCM_SYSCALL (fputs (s, scm_trans));
#endif
} }
void void
@ -83,10 +79,6 @@ scm_lfwrite (ptr, size, port)
{ {
scm_sizet i = SCM_PTOBNUM (port); scm_sizet i = SCM_PTOBNUM (port);
SCM_SYSCALL (scm_ptobs[i].fwrite (ptr, size, 1, port)); SCM_SYSCALL (scm_ptobs[i].fwrite (ptr, size, 1, port));
#ifdef TRANSCRIPT_SUPPORT
if (scm_trans && (port == def_outp || port == cur_errp))
SCM_SYSCALL (fwrite (ptr, size, 1, scm_trans));
#endif
} }
@ -108,11 +100,10 @@ scm_getc (port)
int c; int c;
scm_sizet i; scm_sizet i;
/* One char may be stored in the high bits of (car port) orre@nada.kth.se. */
if (SCM_CRDYP (port)) if (SCM_CRDYP (port))
{ {
c = SCM_CGETUN (port); c = SCM_CGETUN (port);
SCM_CLRDY (port); /* Clear ungetted char */ SCM_TRY_CLRDY (port); /* Clear ungetted char */
} }
else else
{ {
@ -158,8 +149,8 @@ scm_ungetc (c, port)
int c; int c;
SCM port; SCM port;
{ {
/* SCM_ASSERT(!SCM_CRDYP(port), port, SCM_ARG2, "too many scm_ungetc");*/
SCM_CUNGET (c, port); SCM_CUNGET (c, port);
if (c == '\n') if (c == '\n')
{ {
/* What should col be in this case? /* What should col be in this case?
@ -172,6 +163,23 @@ scm_ungetc (c, port)
} }
void
scm_ungets (s, n, port)
char *s;
int n;
SCM port;
{
/* This is simple minded and inefficient, but unreading strings is
* probably not a common operation, and remember that line and
* column numbers have to be handled...
*
* Please feel freee to write an optimized version!
*/
while (n--)
scm_ungetc (s[n], port);
}
char * char *
scm_do_read_line (port, len) scm_do_read_line (port, len)
SCM port; SCM port;