Hi Gaby,

This is untested but I wanted to get it out before you commited.

Consider:

(defun macro-missingargs (name ignore n)
    (declare (ignore ignore))
    (setq macerrorcount (+ 1 (eval 'macerrorcount)))
    (let ((nargs (abs n)))
      (error "~A requires ~:[exactly~;at least~] ~D argument~P"
             (symbol-name name) (minusp n) nargs nargs)))

Note also your version still (I think) as a problem when N is
negative, as it will fall through the CASE and wind up printing -N,
which I dont think we want.

Comments?

Thanks,
Steve



Gabriel Dos Reis <[EMAIL PROTECTED]> writes:

> Hi,
> 
>   This thinko while caugh while building build-improvements with
> SBCL.  The error is that the value of abs(N) should not be part
> of the arguments to error() and should be computed separately.
> Fixed thusly.
> 
> Applied to build-improvements.
> Will apply silver SF/SVN shortly.
> 
> -- Gaby
> 2007-06-30  Gabriel Dos Reis  <[EMAIL PROTECTED]>
> 
>       * vmlisp.lisp.pamphlet (MACRO-MISSINGARGS): Fix thinko.
> 
> *** vmlisp.lisp.pamphlet      (revision 22145)
> --- vmlisp.lisp.pamphlet      (local)
> *************** can be restored.
> *** 1855,1867 ****
>   (defun MACRO-MISSINGARGS (NAME ignore N)
>     (declare (ignore ignore))
>     (setq MACERRORCOUNT (+ 1 (eval 'MACERRORCOUNT)))
> !   (error (concatenate 'string (symbol-name NAME) " requires "
> !                        (if (minusp N) "at least " "exactly ")
> !                        (setq N (abs N))
> !                        (case N (0 "no") (1 "one") (2 "two") (3 "three")
> !                              (4 "four") (5 "five") (6 "six")
> !                              (t (princ-to-string N)))
> !                        (if (eq n 1) " argument," " arguments,"))))
>   
>   (defun MACERR (MESSAGE &rest ignore)
>     (declare (ignore ignore))
> --- 1855,1867 ----
>   (defun MACRO-MISSINGARGS (NAME ignore N)
>     (declare (ignore ignore))
>     (setq MACERRORCOUNT (+ 1 (eval 'MACERRORCOUNT)))
> !   (let ((nargs (abs N)))
> !     (error (concatenate 'string (symbol-name NAME) " requires "
> !                     (if (minusp N) "at least " "exactly ")
> !                     (case N (0 "no") (1 "one") (2 "two") (3 "three")
> !                           (4 "four") (5 "five") (6 "six")
> !                           (t (princ-to-string nargs)))
> !                     (if (eq nargs 1) " argument," " arguments,")))))
>   
>   (defun MACERR (MESSAGE &rest ignore)
>     (declare (ignore ignore))
> 
> 
> _______________________________________________
> Axiom-developer mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/axiom-developer



_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to