guile-devel
[Top][All Lists]
Advanced

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

[Patch] format ~F does not maintain the column counter properly


From: Matthias Koeppe
Subject: [Patch] format ~F does not maintain the column counter properly
Date: Thu, 27 Feb 2003 14:37:56 +0100

Here is a new test for the (ice-9 format) test suite, which fails in
current Guile.  A patch that fixes the bug is attached below.

BTW, format.scm mentions an upstream test suite for format.scm
(formatst.scm).  It might be a good idea to find it and add it to
Guile's test suite.

Matthias

--- format.test.~1.1.~  Sat Jun 16 22:11:39 2001
+++ format.test Thu Feb 27 14:23:57 2003
@@ -1,7 +1,7 @@
 ;;;; format.test --- test suite for Guile's CL-ish format  -*- scheme -*-
 ;;;; Matthias Koeppe <address@hidden> --- June 2001
 ;;;;
-;;;;   Copyright (C) 2001 Free Software Foundation, Inc.
+;;;;   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 ;;;; 
 ;;;; This program is free software; you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -36,4 +36,6 @@
                (format #t "~&abc")
                (format #f "~&")        ; shall have no effect
                (format #t "~&~&")))
-           "xyz\nabc\n")))
+           "xyz\nabc\n"))
+  (pass-if "format ~F (format-out-substr) maintains the column correctly"
+          (= (string-length (format "address@hidden" 1)) 20)))

2003-02-27  Matthias Koeppe  <address@hidden>

        * format.scm (format:out-substr): Update the column counter
        correctly. This fixes the behavior of ~T (tabbing) after ~F, for
        instance. 

--- format.scm.~1.11.2.1.~      Tue Jan  8 15:12:18 2002
+++ format.scm  Thu Feb 27 14:20:15 2003
@@ -94,7 +94,7 @@
   (do ((k i (+ k 1)))
       ((= k n))
     (write-char (string-ref str k) format:port))
-  (set! format:output-col (+ format:output-col n)))
+  (set! format:output-col (+ format:output-col (- n i))))
 
 ;(define (format:out-fill n ch)       ; this allocates a new string
 ;  (format:out-str (make-string n ch)))


-- 
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe




reply via email to

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