From bb58879f51d870e04e6f01b3ba2c4906703079e0 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Fri, 20 Sep 2002 06:03:36 +0000 Subject: [PATCH] r2786: *** empty log message *** --- ChangeLog | 9 ++++++--- examples/compress.cl | 12 ++++++++++-- examples/union.cl | 28 +++++++++++++++------------- src-main/aggregates.cl | 4 ++-- tests/compress.cl | 12 ++++++++++-- tests/union.cl | 28 +++++++++++++++------------- 6 files changed, 58 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35e3f51..6a534db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,14 @@ 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 diff --git a/examples/compress.cl b/examples/compress.cl index 475be12..1abaff6 100644 --- a/examples/compress.cl +++ b/examples/compress.cl @@ -7,7 +7,7 @@ ;;;; 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 ;;;; @@ -63,7 +63,15 @@ (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 diff --git a/examples/union.cl b/examples/union.cl index 967fc25..7a1e72c 100644 --- a/examples/union.cl +++ b/examples/union.cl @@ -7,7 +7,7 @@ ;;;; 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 ;;;; @@ -28,16 +28,18 @@ (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))) @@ -52,12 +54,12 @@ (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)) diff --git a/src-main/aggregates.cl b/src-main/aggregates.cl index f2df49c..6a912ce 100644 --- a/src-main/aggregates.cl +++ b/src-main/aggregates.cl @@ -7,7 +7,7 @@ ;;;; 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 ;;;; @@ -110,7 +110,7 @@ of the enum-name name, separator-string, and field-name" #+(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) diff --git a/tests/compress.cl b/tests/compress.cl index 475be12..1abaff6 100644 --- a/tests/compress.cl +++ b/tests/compress.cl @@ -7,7 +7,7 @@ ;;;; 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 ;;;; @@ -63,7 +63,15 @@ (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 diff --git a/tests/union.cl b/tests/union.cl index 967fc25..7a1e72c 100644 --- a/tests/union.cl +++ b/tests/union.cl @@ -7,7 +7,7 @@ ;;;; 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 ;;;; @@ -28,16 +28,18 @@ (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))) @@ -52,12 +54,12 @@ (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)) -- 2.34.1