Changeset 14394 in project


Ignore:
Timestamp:
04/23/09 06:25:38 (11 years ago)
Author:
Ivan Raikov
Message:

fpio ported to Chicken 4

Location:
release/4/fpio/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/fpio/trunk/fpio.meta

    r10574 r14394  
     1;; -*- Hen -*-
     2
    13((egg "fpio.egg") ; This should never change
    24
  • release/4/fpio/trunk/fpio.scm

    r10558 r14394  
    1717;;
    1818
    19 (define-extension fpio)
     19(module fpio
    2020
    21 (declare (export fp->string string->fp))
     21 (export fp->string string->fp)
     22                   
     23 (import scheme chicken data-structures  )
    2224
     25
     26(define (fp->string x . rest)
     27  (let-optionals rest ((ndig 0 ))
     28    (let* ((bufsize (max (+ ndig 20) 1024))
     29           (buffer (make-blob bufsize)))
     30      (dtoa buffer x ndig bufsize))))
     31
     32
     33(define (string->fp s . rest)
     34  (let-optionals rest ((rounding 'toward-zero ))
     35      (strtord s (case rounding
     36                   ((toward-zero) 0)
     37                   ((nearest)     1)
     38                   ((toward+Inf)  2)
     39                   ((toward-Inf)  3)))))
    2340
    2441#>
     
    5875
    5976
    60 (define (fp->string x . rest)
    61   (let-optionals rest ((ndig 0 ))
    62     (let* ((bufsize (max (+ ndig 20) 1024))
    63            (buffer (make-blob bufsize)))
    64       (dtoa buffer x ndig bufsize))))
    65 
    66 
    67 (define (string->fp s . rest)
    68   (let-optionals rest ((rounding 'toward-zero ))
    69       (strtord s (case rounding
    70                    ((toward-zero) 0)
    71                    ((nearest)     1)
    72                    ((toward+Inf)  2)
    73                    ((toward-Inf)  3)))))
     77)
  • release/4/fpio/trunk/fpio.setup

    r10575 r14394  
    1 
    2 (define has-exports? (string>=? (chicken-version) "2.310"))
     1;; -*- Hen -*-
    32
    43(define (dynld-name fn)         
     
    76(run (make))
    87
    9 (compile -O2 -d0 -s -o ,(dynld-name "fpio")  -I.
    10          ,@(if has-exports? '(-check-imports -emit-exports fpio.exports) '())
    11          fpio.scm gdtoa.a)
     8(compile -O2 -d0 -I. -s fpio.scm gdtoa.a -j fpio)
     9(compile -O2 -d0 -s fpio.import.scm)
    1210
    1311(install-extension
     
    1715
    1816  ; Files to install for your extension:
    19   `(,(dynld-name "fpio")
    20     ,@(if has-exports? '("fpio.exports") (list)) )
     17  `(,(dynld-name "fpio") ,(dynld-name "fpio.import") )
    2118
    2219  ; Assoc list with properties for your extension:
    23   `((version 1.2)
     20  `((version 1.3)
    2421    (documentation "fpio.html")
    25     ,@(if has-exports? `((exports "fpio.exports")) (list)) ))
     22    ))
     23
Note: See TracChangeset for help on using the changeset viewer.