Changeset 26431 in project


Ignore:
Timestamp:
04/09/12 08:38:58 (9 years ago)
Author:
Ivan Raikov
Message:

endian-port: removed some more Chicken 3 remnants and debug stmts

Location:
release/4/endian-port/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/endian-port/trunk/endian-port.meta

    r26430 r26431  
    55 ; List here all the files that should be bundled as part of your egg. 
    66
    7  (files "endian-port.scm" "endian-port.setup" "endian-port-test.scm" "endian-port.meta" )
     7 (files "endian-port.scm" "endian-port.setup" "endian-port.meta" "tests")
    88
    99 ; Your egg's license:
  • release/4/endian-port/trunk/endian-port.scm

    r24229 r26431  
    33;; An I/O port that supports different endian formats.
    44;;
    5 ;; Copyright 2005-2008 Ivan Raikov and the Georgia Institute of Technology
     5;; Copyright 2005-2008, 2012 Ivan Raikov, Shawn Rutledge
    66;; Ported to Chicken 4 by Shawn Rutledge s@ecloud.org
    77;;
     
    275275                (let* ( [buf (make-blob 4)]
    276276                                [ret (file-read (endian-port-fileno eport) 4 buf)])
    277                         (and (eq? (cadr ret) 4) (endian-blob->ieee_float32 (byte-blob->endian-blob
    278                                         (blob->byte-blob (car ret)) byte-order) ) ))))
     277                        (and (= (cadr ret) 4)
     278                             (endian-blob->ieee_float32
     279                              (byte-blob->endian-blob
     280                               (blob->byte-blob (car ret)) byte-order) ) ))))
    279281
    280282; Procedure:
     
    288290(define (endian-port-read-ieee-float64 eport . rest)
    289291  (let-optionals rest ([byte-order (endian-port-byte-order eport)])
    290                 (let* ( [buf (make-blob 8)]
    291                                 [ret (file-read (endian-port-fileno eport) 8 buf)])
    292                         (and (eq? (cadr ret) 8) (endian-blob->ieee_float64 (byte-blob->endian-blob
    293                                         (blob->byte-blob (car ret)) byte-order) ) ))))
     292                 (let* ( [buf (make-blob 8)]
     293                         [ret (file-read (endian-port-fileno eport) 8 buf)] )
     294                   (and (= (cadr ret) 8)
     295                        (endian-blob->ieee_float64
     296                         (byte-blob->endian-blob
     297                          (blob->byte-blob (car ret)) byte-order) ) ))))
    294298
    295299
     
    479483  (let-optionals rest ([byte-order (endian-port-byte-order eport)])
    480484                (let* ( [buf (u8vector->blob (endian-blob->u8vector (ieee_float64->endian-blob word byte-order)))])
    481 (printf "trying to write float ~a, but after conversions it turns out as ~a~%" word
    482         (endian-blob->ieee_float64 (byte-blob->endian-blob (blob->byte-blob buf) byte-order) ) )
     485;(printf "trying to write float ~a, but after conversions it turns out as ~a~%" word
     486;       (endian-blob->ieee_float64 (byte-blob->endian-blob (blob->byte-blob buf) byte-order) )
    483487                        (file-write (endian-port-fileno eport) buf))))
    484488
  • release/4/endian-port/trunk/endian-port.setup

    r25787 r26431  
    55(compile -c -O2 -d1 endian-port.scm -unit endian-port -j endian-port)
    66
    7 (run (csi -qbs endian-port-eggdoc.scm > endian-port.html))
    87
    98(install-extension
     
    1312
    1413  ; Files to install for your extension:
    15   `("endian-port.so" "endian-port.import.so" "endian-port.o" "endian-port.html")
     14  `("endian-port.so" "endian-port.import.so" "endian-port.o" )
    1615
    1716  ; Assoc list with properties for your extension:
    18   `((version 3.0.1)
    19     (documentation "endian-port.html")
     17  `((version 3.0.2)
    2018    (static "endian-port.o")))
     19
  • release/4/endian-port/trunk/tests/run.scm

    r26430 r26431  
    1 (load "endian-port.so")
    2 (import endian-port endian-blob)
     1(require-extension endian-port endian-blob)
    32
    43(let ([outp (port->endian-port (open-output-file "eptest"))])
     
    1615
    1716(let ([inp (port->endian-port (open-input-file "eptest"))])
    18         (print (endian-port-read-ieee-float32 inp))
    19         (print (endian-port-read-ieee-float32 inp))
    20         (print (endian-port-read-ieee-float64 inp))
    21         (print (endian-port-read-ieee-float64 inp))
    22         (print (endian-port-read-int1 inp))
    23         (print (endian-port-read-int2 inp))
    24         (print (endian-port-read-int4 inp))
    25         (print (blob->string (endian-port-read-byte-vector inp 19)))
    26         (print (blob->string (endian-port-read-byte-vector inp 27)))
    27         (print (blob->string (endian-port-read-byte-vector inp 19)))
     17        (print "trying to read +nan.0 (32-bit): " (endian-port-read-ieee-float32 inp))
     18        (print "trying to read 5.25 (32-bit): "   (endian-port-read-ieee-float32 inp))
     19        (print "trying to read +nan.0 (64-bit): " (endian-port-read-ieee-float64 inp))
     20        (print "trying to read 5.25 (64-bit): " (endian-port-read-ieee-float64 inp))
     21        (print "trying to read " (- (expt 2 7) 1) ": "    (endian-port-read-int1 inp))
     22        (print "trying to read " (- (expt 2 15) 1) ": "  (endian-port-read-int2 inp))
     23        (print "trying to read " (- (expt 2 30) 1) ": "  (endian-port-read-int4 inp))
     24        (print "trying to read u8vector: " (blob->string (endian-port-read-byte-vector inp 19)))
     25        (print "trying to read u8vector: " (blob->string (endian-port-read-byte-vector inp 27)))
     26        (print "trying to read u8vector: " (blob->string (endian-port-read-byte-vector inp 19)))
    2827        (close-endian-port inp))
    2928
Note: See TracChangeset for help on using the changeset viewer.