2002-09-19 Kevin Rosenberg (kevin@rosenberg.net)
- Integrate John Desoi's OpenMCL support into src-mcl
* examples/Makefile: add section for building on MacOS X (John Desoi)
- * examples/test-examples: changed from mk: to asdf: package loading
- * examples/run-examples: changed from mk: to asdf: package loading,
+ * examples/test-examples: changed from mk: to asdf: package loading (KMR)
+ * examples/run-examples: changed from mk: to asdf: package loading (KMR),
add conditional loading if UFFI not loaded (John Desoi)
- * examples/compress.cl: Add dylib to library types for MacOSX (John Desoi)
+ * examples/compress.cl: Add dylib to library types for MacOSX (John Desoi),
+ converted compressed output to hexidecimal display (KMR)
+ * examples/union.cl: Rework the tests (KMR)
* src-main/libraries.cl: add dylib as default library type on MacOSX (John Desoi)
+ * src-main/aggregates.cl: convert from uffi type in deref-array (John Desoi)
2002-09-16 Kevin Rosenberg (kevin@rosenberg.net)
- Restructure directories to move to a asdf definition file
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: compress.cl,v 1.12 2002/09/20 04:51:14 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
;;;;
(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")))
+
+;; Results of the above on my system:
+;; (compress "") => 789c300001,8
+;; (compress "test") => 789c2b492d2e1045d1c1,12
+;; (compress "test2") => 789c2b492d2e31206501f3,13
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Mar 2002
;;;;
-;;;; $Id: union.cl,v 1.8 2002/09/20 05:38:01 kevin Exp $
+;;;; $Id: union.cl,v 1.9 2002/09/20 06:03:36 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
(defun run-union-1 ()
(let ((u (uffi:allocate-foreign-object 'tunion1)))
(setf (uffi:get-slot-value u 'tunion1 'uint)
- #-sparc
- (+ (* 1 (char-code #\A))
- (* 256 (char-code #\B))
- (* 65536 (char-code #\C))
- (* 16777216 255))
- #+(or sparc sparc-v9)
- (+ (* 16777216 (char-code #\A))
- (* 65536 (char-code #\B))
- (* 256 (char-code #\C))
- (* 1 255)))
+ ;; little endian
+ #-(or sparc sparc-v9 powerpc ppc)
+ (+ (* 1 (char-code #\A))
+ (* 256 (char-code #\B))
+ (* 65536 (char-code #\C))
+ (* 16777216 128))
+ ;; big endian
+ #+(or sparc sparc-v9 powerpc ppc)
+ (+ (* 16777216 (char-code #\A))
+ (* 65536 (char-code #\B))
+ (* 256 (char-code #\C))
+ (* 1 128)))
(format *standard-output* "~&Should be #\A: ~S"
(uffi:ensure-char-character
(uffi:get-slot-value u 'tunion1 'char)))
(defun test-union-1 ()
(let ((u (uffi:allocate-foreign-object 'tunion1)))
(setf (uffi:get-slot-value u 'tunion1 'uint)
- #-sparc
+ #-(or sparc sparc-v9 powerpc ppc)
(+ (* 1 (char-code #\A))
(* 256 (char-code #\B))
(* 65536 (char-code #\C))
(* 16777216 128))
- #+(or sparc sparc-v9)
+ #+(or sparc sparc-v9 powerpc ppc)
(+ (* 16777216 (char-code #\A))
(* 65536 (char-code #\B))
(* 256 (char-code #\C))
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: aggregates.cl,v 1.1 2002/09/16 17:54:30 kevin Exp $
+;;;; $Id: aggregates.cl,v 1.2 2002/09/20 06:03:36 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
#+(or lispworks cmu) (declare (ignore type))
#+cmu `(alien:deref ,obj ,i)
#+lispworks `(fli:dereference ,obj :index ,i)
- #+allegro `(ff:fslot-value-typed ,type :c ,obj ,i)
+ #+allegro `(ff:fslot-value-typed ,(convert-from-uffi-type type :type) :c ,obj ,i)
)
(defmacro def-union (name &rest fields)
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: compress.cl,v 1.12 2002/09/20 04:51:14 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
;;;;
(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")))
+
+;; Results of the above on my system:
+;; (compress "") => 789c300001,8
+;; (compress "test") => 789c2b492d2e1045d1c1,12
+;; (compress "test2") => 789c2b492d2e31206501f3,13
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Mar 2002
;;;;
-;;;; $Id: union.cl,v 1.8 2002/09/20 05:38:01 kevin Exp $
+;;;; $Id: union.cl,v 1.9 2002/09/20 06:03:36 kevin Exp $
;;;;
;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;;
(defun run-union-1 ()
(let ((u (uffi:allocate-foreign-object 'tunion1)))
(setf (uffi:get-slot-value u 'tunion1 'uint)
- #-sparc
- (+ (* 1 (char-code #\A))
- (* 256 (char-code #\B))
- (* 65536 (char-code #\C))
- (* 16777216 255))
- #+(or sparc sparc-v9)
- (+ (* 16777216 (char-code #\A))
- (* 65536 (char-code #\B))
- (* 256 (char-code #\C))
- (* 1 255)))
+ ;; little endian
+ #-(or sparc sparc-v9 powerpc ppc)
+ (+ (* 1 (char-code #\A))
+ (* 256 (char-code #\B))
+ (* 65536 (char-code #\C))
+ (* 16777216 128))
+ ;; big endian
+ #+(or sparc sparc-v9 powerpc ppc)
+ (+ (* 16777216 (char-code #\A))
+ (* 65536 (char-code #\B))
+ (* 256 (char-code #\C))
+ (* 1 128)))
(format *standard-output* "~&Should be #\A: ~S"
(uffi:ensure-char-character
(uffi:get-slot-value u 'tunion1 'char)))
(defun test-union-1 ()
(let ((u (uffi:allocate-foreign-object 'tunion1)))
(setf (uffi:get-slot-value u 'tunion1 'uint)
- #-sparc
+ #-(or sparc sparc-v9 powerpc ppc)
(+ (* 1 (char-code #\A))
(* 256 (char-code #\B))
(* 65536 (char-code #\C))
(* 16777216 128))
- #+(or sparc sparc-v9)
+ #+(or sparc sparc-v9 powerpc ppc)
(+ (* 16777216 (char-code #\A))
(* 65536 (char-code #\B))
(* 256 (char-code #\C))