Re: SRFI 66 & 74

David Van Horn <[email protected]> Fri, 09 Jun 2006 16:58:59 -0400
Newsgroups gmane.lisp.scheme.plt.schematics
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------090602030401090500000306
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

David Van Horn wrote:
> The SRFI 74 reference implementation has been patched and the
> implementation I sent should use the new reference implementation.  You
> should fetch a fresh copy of blob.scm from:
> 
>    http://srfi.schemers.org/srfi-74/blob.scm
> 
> And place it in srfi/74/.

It appears this didn't happen; the PLT svn contains the old blob.scm
reference implementation.

Here is a patch that takes care of the problem and also changes
`endianness' to use `system-big-endian?' in the native case.

David

--------------090602030401090500000306
Content-Type: text/x-patch;
 name="blob.scm.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="blob.scm.patch"

Index: blob.scm
===================================================================
--- blob.scm	(revision 3309)
+++ blob.scm	(working copy)
@@ -24,6 +24,8 @@
 
 ; This uses SRFIs 23, 26, 60, and 66
 
+; This use PLT system-big-endian? to determine native endianness.
+
 (define *endianness/little* (list 'little))
 (define *endianness/big* (list 'big))
 
@@ -32,7 +34,10 @@
     ((endianness little) *endianness/little*)
     ((endianness big) *endianness/big*)
     ;; change this to the endianness of your architecture
-    ((endianness native) *endianness/big*)))
+    ((endianness native)
+     (if (system-big-endian?)
+         *endianness/big*
+         *endianness/little*))))
 
 (define blob? u8vector?)
 
@@ -143,12 +148,12 @@
   (cut blob-sint-set! size <> <> <> <>))
 
 (define (make-ref/native base base-ref)
-  (lambda (endness blob index)
+  (lambda (blob index)
     (ensure-aligned index base)
     (base-ref (endianness native) blob index)))
 
 (define (make-set!/native base base-set!)
-  (lambda (endness blob index val)
+  (lambda (blob index val)
     (ensure-aligned index base)
     (base-set! (endianness native) blob index val)))
 

--------------090602030401090500000306
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--------------090602030401090500000306
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Schematics-development mailing list
Schematics-development-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/schematics-development

--------------090602030401090500000306--