APPROVE COMMIT
Note: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1288008953 -3600
# Node ID 2474dce7304ec92f72eb42d0156ba0134aa9f6ee
# Parent bbff29a018205278529d8f0fd7245c700c2c364e
Make sure (format "%b" 0) is non-zero length, print.c
src/ChangeLog addition:
2010-10-25 Aidan Kehoe <kehoea(a)parhasard.net>
* print.c (ulong_to_bit_string): If printing zero, actually print
a zero, don't return the empty string.
tests/ChangeLog addition:
2010-10-25 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
Test format strings with %b, too.
diff -r bbff29a01820 -r 2474dce7304e src/ChangeLog
--- a/src/ChangeLog Mon Oct 25 13:04:04 2010 +0100
+++ b/src/ChangeLog Mon Oct 25 13:15:53 2010 +0100
@@ -1,3 +1,8 @@
+2010-10-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * print.c (ulong_to_bit_string): If printing zero, actually print
+ a zero, don't return the empty string.
+
2010-07-06 Stephen J. Turnbull <stephen(a)xemacs.org>
* emodules.c (emodules_load):
diff -r bbff29a01820 -r 2474dce7304e src/print.c
--- a/src/print.c Mon Oct 25 13:04:04 2010 +0100
+++ b/src/print.c Mon Oct 25 13:15:53 2010 +0100
@@ -1339,6 +1339,12 @@
}
}
}
+
+ if (!seen_high_order)
+ {
+ *p++ = '0';
+ }
+
*p = '\0';
}
diff -r bbff29a01820 -r 2474dce7304e tests/ChangeLog
--- a/tests/ChangeLog Mon Oct 25 13:04:04 2010 +0100
+++ b/tests/ChangeLog Mon Oct 25 13:15:53 2010 +0100
@@ -1,3 +1,8 @@
+2010-10-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/lisp-tests.el:
+ Test format strings with %b, too.
+
2010-06-14 Stephen J. Turnbull <stephen(a)xemacs.org>
* automated/lisp-reader-tests.el:
diff -r bbff29a01820 -r 2474dce7304e tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el Mon Oct 25 13:04:04 2010 +0100
+++ b/tests/automated/lisp-tests.el Mon Oct 25 13:15:53 2010 +0100
@@ -1325,8 +1325,11 @@
;;-----------------------------------------------------
(Assert (string= (format "%d" 10) "10"))
(Assert (string= (format "%o" 8) "10"))
+(Assert (string= (format "%b" 2) "10"))
(Assert (string= (format "%x" 31) "1f"))
(Assert (string= (format "%X" 31) "1F"))
+(Assert (string= (format "%b" 0) "0"))
+(Assert (string= (format "%b" 3) "11"))
;; MS-Windows uses +002 in its floating-point numbers. #### We should
;; perhaps fix this, but writing our own floating-point support in doprnt.c
;; is very hard.
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches