projects
/
uffi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r2830: *** empty log message ***
[uffi.git]
/
tests
/
compress.cl
diff --git
a/tests/compress.cl
b/tests/compress.cl
index 05fa6ffeddc5cbed25747d960ceda80f104e7d37..1abaff6a4542dd831d4a05d02d0a14221a1e5c49 100644
(file)
--- a/
tests/compress.cl
+++ b/
tests/compress.cl
@@
-7,7
+7,7
@@
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: compress.cl,v 1.
9 2002/03/20 04:56:52
kevin Exp $
+;;;; $Id: compress.cl,v 1.
13 2002/09/20 06:03:36
kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
@@
-18,9
+18,13
@@
(in-package :cl-user)
(in-package :cl-user)
-(unless (uffi:load-foreign-library "/usr/lib/libz.so"
- :module "zlib"
- :supporting-libraries '("c"))
+(unless (uffi:load-foreign-library
+ (uffi:find-foreign-library
+ "libz"
+ '("/usr/local/lib/" "/usr/lib/" "/zlib/")
+ :types '("so" "a" "dylib"))
+ :module "zlib"
+ :supporting-libraries '("c"))
(warn "Unable to load zlib"))
(uffi:def-function ("compress" c-compress)
(warn "Unable to load zlib"))
(uffi:def-function ("compress" c-compress)
@@
-55,11
+59,19
@@
(uffi:free-foreign-object dest)))))))
(uffi:free-foreign-object dest)))))))
-#+
test
-uffi
+#+
examples
-uffi
(progn
(flet ((print-results (str)
(multiple-value-bind (compressed len) (compress str)
(progn
(flet ((print-results (str)
(multiple-value-bind (compressed len) (compress str)
- (format t "~&(compress ~S) => ~S,~D" str compressed len))))
+ (format t "~&(compress ~S) => " str)
+ (dotimes (i len)
+ (format t "~X" (char-code (char compressed i))))
+ (format t ",~D" len))))
(print-results "")
(print-results "test")
(print-results "test2")))
(print-results "")
(print-results "test")
(print-results "test2")))
+
+;; Results of the above on my system:
+;; (compress "") => 789c300001,8
+;; (compress "test") => 789c2b492d2e1045d1c1,12
+;; (compress "test2") => 789c2b492d2e31206501f3,13