Changeset 5760


Ignore:
Timestamp:
Jan 20, 2007, 11:05:54 PM (18 years ago)
Author:
Gary Byers
Message:

Use argument/result coercion functions in os::expand-ff-call.

Location:
trunk/ccl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/ffi-linuxppc32.lisp

    r5754 r5760  
    3737
    3838
    39 (defun linux32::expand-ff-call (callform args)
     39(defun linux32::expand-ff-call (callform args &key (arg-coerce #'null-coerce-foreign-arg) (result-coerce #'null-coerce-foreign-result))
    4040  (let* ((result-type-spec (or (car (last args)) :void))
    4141         (enclosing-form nil)
     
    6262        (unless (evenp (length args))
    6363          (error "~s should be an even-length list of alternating foreign types and values" args))       
    64                 (do* ((args args (cddr args)))
     64        (do* ((args args (cddr args)))
    6565             ((null args))
    6666          (let* ((arg-type-spec (car args))
     
    7979                  (progn
    8080                    (argforms (foreign-type-to-representation-type ftype))
    81                     (argforms arg-value-form)))))))
     81                    (argforms (funcall arg-coerce arg-type-spec arg-value-form))))))))
    8282        (argforms (foreign-type-to-representation-type result-type))
    83         (let* ((call `(,@callform ,@(argforms))))
     83        (let* ((call (funcall result-coerce result-type-spec `(,@callform ,@(argforms)))))
    8484          (if enclosing-form
    8585            `(,@enclosing-form ,call)
  • trunk/ccl/lib/ffi-linuxppc64.lisp

    r5756 r5760  
    3636      (typep ftype 'foreign-record-type))))
    3737
    38 (defun linux64::expand-ff-call (callform args)
     38(defun linux64::expand-ff-call (callform args &key (arg-coerce #'null-coerce-foreign-arg) (result-coerce #'null-coerce-foreign-result))
    3939  (let* ((result-type-spec (or (car (last args)) :void)))
    4040    (multiple-value-bind (result-type error)
     
    7575                  (progn
    7676                    (argforms (foreign-type-to-representation-type ftype))
    77                     (argforms arg-value-form)))))))
     77                    (argforms (funcall arg-coerce arg-type-spec arg-value-form))))))))
    7878        (argforms (foreign-type-to-representation-type result-type))
    79         `(,@callform ,@(argforms))))))
     79        (funcall result-coerce result-type-spec `(,@callform ,@(argforms)))))))
Note: See TracChangeset for help on using the changeset viewer.