guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile ports.c


From: Marius Vollmer
Subject: guile/guile-core/libguile ports.c
Date: Sat, 09 Jun 2001 11:15:08 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/06/09 11:15:08

Modified files:
        guile-core/libguile: ports.c 

Log message:
        (scm_lfwrite): Maintain columnd and row count in port.
        Thanks to Matthias Köppe!

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/ports.c.diff?cvsroot=OldCVS&tr1=1.147&tr2=1.148&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/ports.c
diff -u guile/guile-core/libguile/ports.c:1.147 
guile/guile-core/libguile/ports.c:1.148
--- guile/guile-core/libguile/ports.c:1.147     Thu Jun  7 14:12:19 2001
+++ guile/guile-core/libguile/ports.c   Sat Jun  9 11:15:08 2001
@@ -975,11 +975,8 @@
 
 /* scm_lfwrite
  *
- * Currently, this function has an identical implementation to
- * scm_c_write.  We could have turned it into a macro expanding into a
- * call to scm_c_write.  However, the implementation is small and
- * might differ in the future.
- */
+ * This function differs from scm_c_write; it updates port line and
+ * column. */
 
 void 
 scm_lfwrite (const char *ptr, size_t size, SCM port)
@@ -991,6 +988,18 @@
     scm_end_input (port);
 
   ptob->write (port, ptr, size);
+
+  for (; size; ptr++, size--) {
+    if (*ptr == '\n') {
+      SCM_INCLINE(port);
+    }
+    else if (*ptr == '\t') {
+      SCM_TABCOL(port);
+    }
+    else {
+      SCM_INCCOL(port);
+    }
+  }
 
   if (pt->rw_random)
     pt->rw_active = SCM_PORT_WRITE;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]