Changeset 320


Ignore:
Timestamp:
Jan 17, 2004, 7:52:17 PM (21 years ago)
Author:
Gary Byers
Message:

TYPE-OF changes. Blame CLHS.

File:
1 edited

Legend:

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

    r277 r320  
    214214
    215215(defun type-of (form)
    216   (cond ((null form) 'null)
    217         ((arrayp form) (describe-array form))
    218         (t (let* ((class (class-of form))
    219                   (metaclass (class-of class)))
    220              (if (eq metaclass *istruct-class*)
    221                (uvref form 0)
    222                (if (or (typep metaclass 'standard-class)
    223                        (typep metaclass 'structure-class))
    224                  (let* ((class-name (class-name class)))
    225                    (if (eq class (find-class class-name nil))
    226                      class-name
    227                      class))
    228                  (%type-of form)))))))
    229 
     216  (case form
     217    ((t) 'boolean)
     218    ((0 1) 'bit)
     219    (t
     220     (typecase form
     221       (standard-char 'standard-char)
     222       (keyword 'keyword)
     223       ;; Partition integers so that the negative cases
     224       ;; are SIGNED-BYTE and the positive are UNSIGNED-BYTE
     225       (fixnum
     226        (if (< (the fixnum form) 0)
     227          'fixnum
     228          '(integer 0 #.most-positive-fixnum)))
     229       (bignum
     230        (if (< form 0)
     231          'bignum
     232          '(integer  #.(1+ most-positive-fixnum))))
     233       ((or array complex) (type-specifier (ctype-of form)))
     234       (t
     235        (if (eql (typecode form) ppc32::subtag-istruct)
     236          (%svref form 0)
     237          (let* ((class (class-of form))
     238                 (class-name (class-name class)))
     239            (if (eq class (find-class class-name nil))
     240              class-name
     241              class))))))))
    230242
    231243;;; Create the list-style description of an array.
     
    714726
    715727(setq *type-system-initialized* t)
    716    
    717 
    718 
     728
     729
     730
     731
Note: See TracChangeset for help on using the changeset viewer.