X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=examples%2Fc-test-fns.lisp;fp=examples%2Fc-test-fns.lisp;h=fad44b420adfeaebd1e2b40a32bc5989916f2092;hb=72190043201239567658cfbae1c36bbd7233419b;hp=880bd2e9781b032dc28a6f7074e65546e049c0e5;hpb=da9ef130a96ba9102fc0cf68b1fe8cd0a90e67b7;p=uffi.git diff --git a/examples/c-test-fns.lisp b/examples/c-test-fns.lisp index 880bd2e..fad44b4 100644 --- a/examples/c-test-fns.lisp +++ b/examples/c-test-fns.lisp @@ -15,10 +15,10 @@ (in-package :cl-user) -(unless (uffi:load-foreign-library - (uffi:find-foreign-library "c-test-fns" - (list *load-truename* "/home/kevin/debian/src/uffi/examples/")) - :supporting-libraries '("c")) +(unless (uffi:load-foreign-library + (uffi:find-foreign-library "c-test-fns" + (list *load-truename* "/home/kevin/debian/src/uffi/examples/")) + :supporting-libraries '("c")) (warn "Unable to load c-test-fns library")) (uffi:def-function ("cs_to_upper" cs-to-upper) @@ -48,10 +48,10 @@ (uffi:def-constant +double-vec-length+ 10) (defun test-half-double-vector () (let ((vec (uffi:allocate-foreign-object :double +double-vec-length+)) - results) + results) (dotimes (i +double-vec-length+) - (setf (uffi:deref-array vec '(:array :double) i) - (coerce i 'double-float))) + (setf (uffi:deref-array vec '(:array :double) i) + (coerce i 'double-float))) (half-double-vector +double-vec-length+ vec) (dotimes (i +double-vec-length+) (push (uffi:deref-array vec '(:array :double) i) results)) @@ -73,22 +73,22 @@ (system:without-gcing (half-double-vector +double-vec-length+ (system:vector-sap vec))) vec)) - + #+examples-uffi -(format t "~&(string-to-upper \"this is a test\") => ~A" - (string-to-upper "this is a test")) +(format t "~&(string-to-upper \"this is a test\") => ~A" + (string-to-upper "this is a test")) #+examples-uffi -(format t "~&(string-to-upper nil) => ~A" - (string-to-upper nil)) +(format t "~&(string-to-upper nil) => ~A" + (string-to-upper nil)) #+examples-uffi -(format t "~&(string-count-upper \"This is a Test\") => ~A" - (string-count-upper "This is a Test")) +(format t "~&(string-count-upper \"This is a Test\") => ~A" + (string-count-upper "This is a Test")) #+examples-uffi -(format t "~&(string-count-upper nil) => ~A" - (string-count-upper nil)) +(format t "~&(string-count-upper nil) => ~A" + (string-count-upper nil)) #+examples-uffi (format t "~&Half vector: ~S" (test-half-double-vector)) @@ -99,20 +99,20 @@ (progn (util.test:test (string= (string-to-upper "this is a test") "THIS IS A TEST") t - :test #'eql - :fail-info "Error with string-to-upper") + :test #'eql + :fail-info "Error with string-to-upper") (util.test:test (string-to-upper nil) nil - :fail-info "string-to-upper with nil failed") + :fail-info "string-to-upper with nil failed") (util.test:test (string-count-upper "This is a Test") - 2 - :test #'eql - :fail-info "Error with string-count-upper") + 2 + :test #'eql + :fail-info "Error with string-count-upper") (util.test:test (string-count-upper nil) -1 - :test #'eql - :fail-info "string-count-upper with nil failed") + :test #'eql + :fail-info "string-count-upper with nil failed") (util.test:test (test-half-double-vector) - '(0.0d0 0.5d0 1.0d0 1.5d0 2.0d0 2.5d0 3.0d0 3.5d0 4.0d0 4.5d0) - :test #'equal - :fail-info "Error comparing half-double-vector") + '(0.0d0 0.5d0 1.0d0 1.5d0 2.0d0 2.5d0 3.0d0 3.5d0 4.0d0 4.5d0) + :test #'equal + :fail-info "Error comparing half-double-vector") )