"VALUES-TYPE-OUT" "VALUES-TYPE-P" "VALUES-TYPE-REQUIRED"
"VALUES-TYPE-REST" "VALUES-TYPE-UNION"
"VALUES-TYPE-TYPES" "VALUES-TYPES"
- "VALUES-TYPES-EQUAL-OR-INTERSECT" "VECTOR-T-P"
+ "VALUES-TYPES-EQUAL-OR-INTERSECT"
+
+ "*VECTOR-WITHOUT-COMPLEX-TYPECODE-INFOS*"
+ "VECTOR-SINGLE-FLOAT-P" "VECTOR-DOUBLE-FLOAT-P"
+ "VECTOR-UNSIGNED-BYTE-2-P" "VECTOR-UNSIGNED-BYTE-4-P"
+ "VECTOR-UNSIGNED-BYTE-7-P" "VECTOR-UNSIGNED-BYTE-8-P"
+ "VECTOR-UNSIGNED-BYTE-15-P" "VECTOR-UNSIGNED-BYTE-16-P"
+ "VECTOR-UNSIGNED-BYTE-29-P" "VECTOR-UNSIGNED-BYTE-31-P"
+ "VECTOR-UNSIGNED-BYTE-32-P" "VECTOR-UNSIGNED-BYTE-60-P"
+ "VECTOR-UNSIGNED-BYTE-63-P" "VECTOR-UNSIGNED-BYTE-64-P"
+ "VECTOR-SIGNED-BYTE-8-P" "VECTOR-SIGNED-BYTE-16-P"
+ "VECTOR-FIXNUM-P" "VECTOR-SIGNED-BYTE-32-P"
+ "VECTOR-SIGNED-BYTE-64-P" "VECTOR-COMPLEX-SINGLE-FLOAT-P"
+ "VECTOR-COMPLEX-DOUBLE-FLOAT-P" "VECTOR-T-P"
+
"VECTOR-NIL-P"
"VECTOR-FILL*"
"VECTOR-SUBSEQ*"
(defun streamp (stream)
(typep stream 'stream))
-;;; Is X a (VECTOR T)?
-(defun vector-t-p (x)
- (or (simple-vector-p x)
- (and (complex-vector-p x)
- (do ((data (%array-data-vector x) (%array-data-vector data)))
- ((not (array-header-p data)) (simple-vector-p data))))))
+;;; various (VECTOR FOO) type predicates, not implemented as simple
+;;; widetag tests
+(macrolet
+ ((def ()
+ `(progn
+ ,@(loop for (name spec) in *vector-without-complex-typecode-infos*
+ collect `(defun ,name (x)
+ (or (typep x '(simple-array ,spec (*)))
+ (and (complex-vector-p x)
+ (do ((data (%array-data-vector x) (%array-data-vector data)))
+ ((not (array-header-p data)) (typep data '(simple-array ,spec (*))))))))))))
+ (def))
;;; Is X an extended sequence?
(defun extended-sequence-p (x)
"An alist for mapping simple array element types to their
corresponding primitive types.")
+(defvar *vector-without-complex-typecode-infos*
+ #+sb-xc-host
+ (loop for saetp across *specialized-array-element-type-properties*
+ for specifier = (saetp-specifier saetp)
+ unless (saetp-complex-typecode saetp)
+ collect (list (if (atom specifier)
+ (intern (format nil "VECTOR-~A-P" specifier))
+ ;; at the moment, all specialized array
+ ;; specifiers are either atoms or
+ ;; two-element lists.
+ (intern (format nil "VECTOR-~A-~A-P" (car specifier) (cadr specifier))))
+ specifier))
+ #-sb-xc-host
+ '#.*vector-without-complex-typecode-infos*)
+
(in-package "SB!C")
(defun find-saetp (element-type)
unsigned-byte-64-p
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
signed-byte-64-p
- vector-t-p weak-pointer-p code-component-p lra-p
+ weak-pointer-p code-component-p lra-p
funcallable-instance-p)
(t) boolean (movable foldable flushable))
+(defknown #.(loop for (name) in *vector-without-complex-typecode-infos*
+ collect name)
+ (t) boolean (movable foldable flushable))
\f
;;;; miscellaneous "sub-primitives"
(define-type-predicate unsigned-byte-64-p (unsigned-byte 64))
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate signed-byte-64-p (signed-byte 64))
-(define-type-predicate vector-t-p (vector t))
(define-type-predicate vector-nil-p (vector nil))
(define-type-predicate weak-pointer-p weak-pointer)
(define-type-predicate code-component-p code-component)
(define-type-predicate lra-p lra)
(define-type-predicate fdefn-p fdefn)
-
+(macrolet
+ ((def ()
+ `(progn ,@(loop for (name spec) in *vector-without-complex-typecode-infos*
+ collect `(define-type-predicate ,name (vector ,spec))))))
+ (def))
;;; Unlike the un-%'ed versions, these are true type predicates,
;;; accepting any type object.
(define-type-predicate %standard-char-p standard-char)
(ret (funcall fun sap 0)))
;; test for either endianness
(assert (or (= ret (+ (* 5 256) 4)) (= ret (+ (* 4 256) 5))))))
+
+(with-test (:name :coerce-type-warning)
+ (dolist (type '(t (unsigned-byte 8) (unsigned-byte 16) (unsigned-byte 32)
+ (signed-byte 8) (signed-byte 16) (signed-byte 32)))
+ (multiple-value-bind (fun warningsp failurep)
+ (compile nil `(lambda (x)
+ (declare (type simple-vector x))
+ (coerce x '(vector ,type))))
+ (assert (null warningsp))
+ (assert (null failurep))
+ (assert (typep (funcall fun #(1)) `(simple-array ,type (*)))))))
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.30.50"
+"1.0.30.51"