Changeset 24645 for lang/commonlisp

Show
Ignore:
Timestamp:
11/22/08 20:07:56 (4 years ago)
Author:
quek
Message:

apply Matthew D. Swank's patch. Thanks!

Location:
lang/commonlisp/cl-win32ole/trunk
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • lang/commonlisp/cl-win32ole/trunk/api

    • Property svn:ignore set to
      *.fas
      *.lib
  • lang/commonlisp/cl-win32ole/trunk/api/compat.lisp

    r10948 r24645  
    22 
    33(defun finalize (object lambda) 
    4   #+sbcl 
    5   (sb-ext:finalize object lambda)) 
     4  (tg:finalize object lambda)) 
  • lang/commonlisp/cl-win32ole/trunk/api/variant.lisp

    r10948 r24645  
    1414    (cond ((variant-array-p ptr) 
    1515           (variant-array-to-lisp ptr)) 
    16           (t (ecase (logand type (lognot VT_BYREF)) 
    17                (#.VT_EMPTY nil) 
    18                (#.VT_I4 v) 
    19                (#.VT_R4 v) 
    20                (#.VT_R8 v) 
    21                (#.VT_BSTR (bstr->lisp v)) 
    22                (#.VT_BOOL (= VARIANT_TRUE v)) 
    23                (#.VT_DISPATCH (let ((dispatch (make-dispatch v))) 
    24                                 (add-ref dispatch) 
    25                                 dispatch))))))) 
     16          (t (eswitch (logand type (lognot VT_BYREF)) 
     17               (VT_EMPTY nil) 
     18               (VT_I4 v) 
     19               (VT_R4 v) 
     20               (VT_R8 v) 
     21               (VT_BSTR (bstr->lisp v)) 
     22               (VT_BOOL (= VARIANT_TRUE v)) 
     23               (VT_DISPATCH (let ((dispatch (make-dispatch v))) 
     24                              (add-ref dispatch) 
     25                              dispatch))))))) 
    2626 
    2727(defun map-dim (fn list) 
  • lang/commonlisp/cl-win32ole/trunk/cl-win32ole-sys.asd

    r10948 r24645  
    2020                         (:file "safearray") 
    2121                         ))) 
    22   :depends-on (cffi cl-ppcre)) 
     22  :depends-on (cffi cl-ppcre trivial-garbage)) 
  • lang/commonlisp/cl-win32ole/trunk/sys

    • Property svn:ignore set to
      *.fas
      *.lib
  • lang/commonlisp/cl-win32ole/trunk/sys/ole-variant.lisp

    r10948 r24645  
    9898  (cond ((variant-array-p variant) 
    9999         'pointer) 
    100         (t (ecase (variant-type variant) 
    101              (#.VT_EMPTY 'long-long) 
    102              (#.VT_I4 'long) 
    103              (#.VT_R4 'float) 
    104              (#.VT_R8 'double) 
    105              (#.VT_BSTR 'pointer) 
    106              (#.VT_BOOL 'bool) 
    107              (#.VT_VARIANT 'pointer) 
    108              (#.VT_DISPATCH 'pointer) 
     100        (t (eswitch (variant-type variant) 
     101             (VT_EMPTY 'long-long) 
     102             (VT_I4 'long) 
     103             (VT_R4 'float) 
     104             (VT_R8 'double) 
     105             (VT_BSTR 'pointer) 
     106             (VT_BOOL 'bool) 
     107             (VT_VARIANT 'pointer) 
     108             (VT_DISPATCH 'pointer) 
    109109             )))) 
    110110 
     
    183183    (setf (variant-type variant) type) 
    184184    (setf (variant-value variant) 
    185           (ecase (variant-type variant) 
    186             (#.VT_I4 value) 
    187             (#.VT_R4 value) 
    188             (#.VT_R8 value) 
    189             (#.VT_BSTR (lisp->bstr value)) 
    190             (#.VT_BOOL (if value VARIANT_TRUE VARIANT_FALSE)) 
    191             (#.VT_VARIANT value) 
    192             (#.VT_DISPATCH value) 
    193             (#.(logior VT_VARIANT VT_ARRAY) value) 
     185          (eswitch (variant-type variant) 
     186            (VT_I4 value) 
     187            (VT_R4 value) 
     188            (VT_R8 value) 
     189            (VT_BSTR (lisp->bstr value)) 
     190            (VT_BOOL (if value VARIANT_TRUE VARIANT_FALSE)) 
     191            (VT_VARIANT value) 
     192            (VT_DISPATCH value) 
     193            ((logior VT_VARIANT VT_ARRAY) value) 
    194194            )) 
    195195    variant)) 
  • lang/commonlisp/cl-win32ole/trunk/sys/ole.lisp

    r10948 r24645  
    3636           do (let ((c (code-char 
    3737                        (cffi:mem-aref buffer :unsigned-short i)))) 
    38                 (unless (member c '(#\CR #\LF)) 
     38                (unless (member c '(#\Return #\Linefeed)) 
    3939                  (write-char c)))))))) 
    4040 
  • lang/commonlisp/cl-win32ole/trunk/sys/package.lisp

    r10948 r24645  
    136136 
    137137           #:p 
     138           #:switch 
     139           #:eswitch 
    138140           )) 
    139141 
  • lang/commonlisp/cl-win32ole/trunk/sys/util.lisp

    r10948 r24645  
    66                        `(format t "~30a ; => ~a~%" ',arg ,arg)) 
    77                    body))) 
     8 
     9(defmacro switch (keyform &body cases) 
     10  "Switch is like case, except that it does not quote keys, and only accepts 
     11one key per case." 
     12  (let ((k (gensym))) 
     13    `(let ((,k ,keyform)) 
     14       ,(reduce (lambda (case rest) 
     15                  (destructuring-bind (key &body forms) case 
     16                    `(cond ((eql ,key ,k) ,@forms) 
     17                           (t ,rest)))) 
     18                cases 
     19                :from-end t 
     20                :initial-value nil)))) 
     21  
     22(defmacro eswitch (keyform &body cases) 
     23  "ESwitch is like ecase, except that it does not quote keys, and only accepts 
     24one key per case." 
     25  (let ((k (gensym)) 
     26        (cases (mapcar (lambda (case) 
     27                         (destructuring-bind (key &body forms) case 
     28                           (cons (list (gensym) key) forms))) 
     29                       cases))) 
     30    `(let ((,k ,keyform) 
     31           ,@(mapcar #'car cases)) 
     32       ,(reduce (lambda (case rest) 
     33                  (destructuring-bind ((key-val key) &body forms) case 
     34                    (declare (ignore key)) 
     35                    `(cond ((eql ,key-val ,k) ,@forms) 
     36                           (t ,rest)))) 
     37                cases 
     38                :from-end t 
     39                :initial-value `(error "~a fell through ESWITCH expression. Wanted one of ~a" 
     40                                       ,k (list ,@(mapcar #'caar cases))))))) 
     41