X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fhost-alieneval.lisp;h=e1c2488def13a56e3cd9354206803d10e6291117;hb=7c5138fcbdb302abc563a2060493f2f0304ae902;hp=bc0100b9a9bc52ae0813a21568b24eeea6d0d2da;hpb=1f7bb609de31bba1a85817496ecbde52a07edf14;p=sbcl.git diff --git a/src/code/host-alieneval.lisp b/src/code/host-alieneval.lisp index bc0100b..e1c2488 100644 --- a/src/code/host-alieneval.lisp +++ b/src/code/host-alieneval.lisp @@ -607,8 +607,8 @@ (define-alien-type-class (enum :include (integer (bits 32)) :include-args (signed)) name ; name of this enum (if any) - from ; alist from keywords to integers - to ; alist or vector from integers to keywords + from ; alist from symbols to integers + to ; alist or vector from integers to symbols kind ; kind of from mapping, :VECTOR or :ALIST offset) ; offset to add to value for :VECTOR from mapping @@ -649,8 +649,8 @@ (values (first el) (second el)) (values el (1+ prev))) (setf prev val) - (unless (keywordp sym) - (error "The enumeration element ~S is not a keyword." sym)) + (unless (symbolp sym) + (error "The enumeration element ~S is not a symbol." sym)) (unless (integerp val) (error "The element value ~S is not an integer." val)) (unless (and max (> max val)) (setq max val)) @@ -672,7 +672,7 @@ ;; If range is at least 20% dense, use vector mapping. Crossover ;; point solely on basis of space would be 25%. Vector mapping ;; is always faster, so give the benefit of the doubt. - ((< 0.2 (/ (float (length from-alist)) (float (- max min)))) + ((< 0.2 (/ (float (length from-alist)) (float (1+ (- max min))))) ;; If offset is small and ignorable, ignore it to save time. (when (< 0 min 10) (setq min 0)) (let ((to (make-array (1+ (- max min))))) @@ -718,7 +718,7 @@ (:alist `(ecase ,alien ,@(mapcar (lambda (mapping) - `(,(car mapping) ,(cdr mapping))) + `(,(car mapping) ',(cdr mapping))) (alien-enum-type-to type)))))) (define-alien-type-method (enum :deport-gen) (type value)