Changeset 278


Ignore:
Timestamp:
Jan 13, 2004, 4:55:02 PM (21 years ago)
Author:
Gary Byers
Message:

Fix ASSOC and friends, broken just a few days ago. Signal PROGRAM-ERROR
when detecting argument mismatches in macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-utils.lisp

    r260 r278  
    279279(setf (type-predicate 'macptr) 'macptrp)
    280280
    281 (defun null-or-handlep (arg)
    282   (and (macptrp arg)
    283        (or (%null-ptr-p arg)
    284            (handlep arg))))
    285 
    286 (defun require-null-or-handlep (arg)
    287   (if (null-or-handlep arg)
    288     arg
    289     (require-type arg '(satisfies null-or-handlep))))
     281
    290282
    291283
     
    309301(defun %check-extra-arguments (ptr)
    310302  (when (destructure-state.current ptr)
    311     (error "Extra arguments in ~s don't match lambda list ~s."
    312                (destructure-state.whole ptr) (destructure-state.lambda ptr))))
     303    (signal-program-error "Extra arguments in ~s don't match lambda list ~s."
     304                          (destructure-state.whole ptr) (destructure-state.lambda ptr))))
    313305
    314306(defun %keyword-present-p (keys keyword)
     
    324316        (signal-simple-program-error "Odd length keyword list: ~s" actual))))
    325317  (setq allow-others (or allow-others (getf actual :allow-other-keys)))
    326   (unless allow-others
    327     (do* ((a actual (cddr a))
    328           (k (car a) (car a)))
    329          ((null a))
    330       (unless (or (eq k :allow-other-keys)
    331                   (member k keys))
    332         (signal-simple-program-error "Unknown keyword argument ~s in ~s.  ~&Valid keyword arguments are ~s." k actual keys)))))
     318  (do* ((a actual (cddr a))
     319        (k (car a) (car a)))
     320       ((null a))
     321    (unless (typep k 'symbol)
     322      (signal-simple-program-error
     323       "Invalid keyword argument ~s in ~s.  ~&Valid keyword arguments are ~s." k actual keys))
     324    (unless (or allow-others
     325                (eq k :allow-other-keys)
     326                (member k keys))
     327      (signal-simple-program-error "Unknown keyword argument ~s in ~s.  ~&Valid keyword arguments are ~s." k actual keys))))
    333328
    334329(%fhave 'set-macro-function #'%macro-have)   ; redefined in sysutils.
     
    450445      (if pair
    451446        (if (eql item (car pair))
    452           (return pair))
    453         (report-bad-arg pair 'cons)))
     447          (return pair))))
    454448    (assq item list)))
    455449
     
    462456    (if pair
    463457      (if (funcall test-fn item (car pair))
    464         (return pair))
    465       (report-bad-arg pair 'cons))))
     458        (return pair)))))
    466459
    467460
     
    475468    (if pair
    476469      (if (not (funcall test-not-fn item (car pair)))
    477         (return pair))
    478       (report-bad-arg pair 'cons))))
     470        (return pair)))))
    479471
    480472(defun assoc (item list &key test test-not key)
     
    492484          (if pair
    493485            (if (funcall test item (funcall key (car pair)))
    494               (return pair))
    495             (report-bad-arg pair 'cons)))
     486              (return pair))))
    496487        (dolist (pair list)
    497488          (if pair
    498489            (unless (funcall test-not item (funcall key (car pair)))
    499               (return pair))
    500             (report-bad-arg pair 'cons)))))))
     490              (return pair))))))))
    501491
    502492
     
    851841(defun eval-constant (form)
    852842  (if (quoted-form-p form) (%cadr form)
    853       (if (constant-symbol-p form) (symbol-value form)
    854           (if (self-evaluating-p form) form
    855               (report-bad-arg form '(satsifies constantp))))))
     843    (if (constant-symbol-p form) (symbol-value form)
     844      (if (self-evaluating-p form) form
     845        (report-bad-arg form '(satisfies constantp))))))
    856846
    857847; SETQ'd above before we could DEFVAR.
Note: See TracChangeset for help on using the changeset viewer.