[Bug-openmcl] format ~A, ~{..~}

bryan o'connor bryan-openmcl at lunch.org
Thu Dec 9 01:02:56 MST 2004


mincol, minpad are allowed to be negative.

non-list args for ~{..~} should signal type-error.

	...bryan


-------------- next part --------------
Index: lib/format.lisp
===================================================================
RCS file: /usr/local/tmpcvs/ccl-0.14-dev/ccl/lib/format.lisp,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 format.lisp
*** lib/format.lisp	19 Oct 2003 08:57:12 -0000	1.1.1.1
--- lib/format.lisp	9 Dec 2004 04:44:11 -0000
***************
*** 720,726 ****
                                  (*format-original-arguments* args))
                             (declare (special *format-colon-rest*))
                             (unless (listp *format-arguments*)
!                              (format-error "Argument must be a list"))
                             (if (functionp start)
                               (apply start stream args)
                               (sub-format stream start end)))
--- 720,726 ----
                                  (*format-original-arguments* args))
                             (declare (special *format-colon-rest*))
                             (unless (listp *format-arguments*)
!                              (report-bad-arg *format-arguments* 'list))
                             (if (functionp start)
                               (apply start stream args)
                               (sub-format stream start end)))
***************
*** 739,745 ****
                 (*format-top-level* nil)
                 (*format-original-arguments* *format-arguments*))
            (unless (listp *format-arguments*)
!             (format-error "Argument must be a list"))
            (do-iteration-1 stream start end colon at-least-once-p)))))
    
  
--- 739,745 ----
                 (*format-top-level* nil)
                 (*format-original-arguments* *format-arguments*))
            (unless (listp *format-arguments*)
!             (report-bad-arg *format-arguments* 'list))
            (do-iteration-1 stream start end colon at-least-once-p)))))
    
  
***************
*** 867,878 ****
        (format-logical-block stream colon atsign eatsign start *format-index* parms))
       (t (setq *format-index* start)
          (with-format-parameters parms ((mincol 0) (colinc 1) (minpad 0) (padchar #\space))
!           (unless (and (integerp mincol) (not (minusp mincol)))
!             (format-error "Mincol must be a non-negative integer - ~S" mincol))
            (unless (and (integerp colinc) (plusp colinc))
              (format-error "Colinc must be a positive integer - ~S" colinc))
!           (unless (and (integerp minpad) (not (minusp minpad)))
!             (format-error "Minpad must be a non-negative integer - ~S" minpad))
            (unless (characterp padchar)
              (if (typep padchar `(integer 0 #.char-code-limit))
                (setq padchar (code-char padchar))
--- 867,878 ----
        (format-logical-block stream colon atsign eatsign start *format-index* parms))
       (t (setq *format-index* start)
          (with-format-parameters parms ((mincol 0) (colinc 1) (minpad 0) (padchar #\space))
!           (unless (integerp mincol)
!             (format-error "Mincol must be an integer - ~S" mincol))
            (unless (and (integerp colinc) (plusp colinc))
              (format-error "Colinc must be a positive integer - ~S" colinc))
!           (unless (integerp minpad)
!             (format-error "Minpad must be an integer - ~S" minpad))
            (unless (characterp padchar)
              (if (typep padchar `(integer 0 #.char-code-limit))
                (setq padchar (code-char padchar))
***************
*** 1736,1748 ****
  
  (defun format-write-field (stream string mincol colinc minpad padchar padleft)
    (unless (or (null mincol)
!               (and (integerp mincol)
!                    (not (minusp mincol))))
!     (format-error "Mincol must be a non-negative integer - ~S" mincol))
    (unless (and (integerp colinc) (plusp colinc))
      (format-error "Colinc must be a positive integer - ~S" colinc))
!   (unless (and (integerp minpad) (not (minusp minpad)))
!     (format-error "Minpad must be a non-negative integer - ~S" minpad))
    (unless (characterp padchar)
      (if (typep padchar `(integer 0 #.char-code-limit))
        (setq padchar (code-char padchar))
--- 1736,1747 ----
  
  (defun format-write-field (stream string mincol colinc minpad padchar padleft)
    (unless (or (null mincol)
!               (integerp mincol))
!     (format-error "Mincol must be an integer - ~S" mincol))
    (unless (and (integerp colinc) (plusp colinc))
      (format-error "Colinc must be a positive integer - ~S" colinc))
!   (unless (integerp minpad)
!     (format-error "Minpad must be an integer - ~S" minpad))
    (unless (characterp padchar)
      (if (typep padchar `(integer 0 #.char-code-limit))
        (setq padchar (code-char padchar))
-------------- next part --------------




More information about the Bug-openmcl mailing list