From f86d524a8909e7a7ef6eaf3a332332ed3780c680 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Thu, 9 Sep 2004 00:10:02 +0000 Subject: [PATCH] (scm_getc, scm_lfwrite): Recognise \a \b and \r for port column. --- libguile/ports.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/libguile/ports.c b/libguile/ports.c index f5e0bfa58..6230dc08e 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -955,17 +955,25 @@ scm_getc (SCM port) c = *(pt->read_pos++); - if (c == '\n') + switch (c) { - SCM_INCLINE (port); - } - else if (c == '\t') - { - SCM_TABCOL (port); - } - else - { - SCM_INCCOL (port); + case '\a': + break; + case '\b': + SCM_DECCOL (port); + break; + case '\n': + SCM_INCLINE (port); + break; + case '\r': + SCM_ZEROCOL (port); + break; + case '\t': + SCM_TABCOL (port); + break; + default: + SCM_INCCOL (port); + break; } return c; @@ -1000,9 +1008,17 @@ scm_lfwrite (const char *ptr, size_t size, SCM port) ptob->write (port, ptr, size); for (; size; ptr++, size--) { - if (*ptr == '\n') { + if (*ptr == '\a') { + } + else if (*ptr == '\b') { + SCM_DECCOL(port); + } + else if (*ptr == '\n') { SCM_INCLINE(port); } + else if (*ptr == '\r') { + SCM_ZEROCOL(port); + } else if (*ptr == '\t') { SCM_TABCOL(port); }