Changeset 35584 in project


Ignore:
Timestamp:
06/12/18 09:50:49 (12 days ago)
Author:
felix
Message:

bind 1.1: updated C5 version

Location:
release/5/bind
Files:
2 added
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/5/bind/tags/1.1/bind-translator.scm

    r34497 r35584  
    2121                         bind-foreign-lambda*)
    2222
    23 (import scheme chicken)
    24 (import (only (chicken data-structures) rassoc intersperse identity))
    25 (import (chicken string))
     23(import scheme)
     24(import (chicken base) (chicken file) (chicken port)
     25        (chicken syntax) (chicken fixnum))
    2626(import (chicken pathname))
    2727(import srfi-1)
     
    2929(import matchable)
    3030(import (chicken format))
     31(import (chicken string))
    3132(import (chicken pretty-print))
    3233
  • release/5/bind/tags/1.1/bind.egg

    r34025 r35584  
    22 (category ffi)
    33 (license "public domain")
    4  (dependencies silex matchable coops make)
     4 (dependencies silex matchable coops srfi-1)
    55 (test-dependencies test)
    66 (author "[[felix winkelmann]]")
    77 (components
    88   (host
    9      (extension bind (dependencies bind-translator))
    10      (extension bind-translator (dependencies grammar))
     9     (extension bind (component-dependencies bind-translator))
     10     (extension bind-translator (component-dependencies grammar))
    1111     (generated-source-file grammar
    1212                            (source "c.l.scm")
    13                             (custom-build "csi -s runsilex.scm"))
     13                            (custom-build "gen-lexer"))
    1414     (extension cplusplus-object)
    15      (program chicken-bind (dependencies bind-translator)))))
     15     (program chicken-bind (component-dependencies bind-translator)))))
  • release/5/bind/tags/1.1/bind.scm

    r34025 r35584  
    1313              bind-include-path)
    1414
    15 (import scheme chicken foreign)
     15(import scheme (chicken base) (chicken foreign) (chicken syntax))
    1616
    1717(begin-for-syntax
    1818  (import bind-translator)
     19  (import (chicken io))
    1920  (import srfi-1)
    20   (import srfi-13))
     21  (import srfi-13)
     22
     23  (define emitted-prelude #f)
     24  (define prelude #<<EOF
     25#define ___fixnum           int
     26#define ___number           double
     27#define ___bool             int
     28#define ___byte             char
     29#define ___scheme_value     C_word
     30#define ___scheme_pointer   void *
     31#define ___blob             void *
     32#define ___pointer_vector   void **
     33#define ___symbol           char *
     34#define ___safe
     35#define ___declare(x, y)
     36#define ___specialize
     37#define ___abstract
     38#define ___discard
     39#define ___in
     40#define ___out
     41#define ___inout
     42#define ___mutable
     43#define ___length(var)
     44#define ___pointer
     45#define ___u32              C_u32
     46#define ___s32              C_s32
     47#define ___u64              C_u64
     48#define ___s64              C_s64
     49EOF
     50))
    2151
    2252(define-syntax bind
     53 (er-macro-transformer
    2354  (lambda (x r c)
    2455    (let ((strs (append (cdr x) '("\n"))))
    2556      `(,(r 'begin)
    26         ,@(parse-easy-ffi (string-concatenate strs) r)))))
     57        ,@(parse-easy-ffi (string-concatenate strs) r))))))
    2758 
    2859(define-syntax bind*
     60 (er-macro-transformer
    2961  (lambda (x r c)
    30     (let ((strs (append (cdr x) '("\n"))))
     62    (let* ((strs (append (cdr x) '("\n")))
     63           (decls (if emitted-prelude strs (cons prelude strs))))
     64      (set! emitted-prelude #t)
    3165      `(,(r 'begin)
    32         (,(r 'declare) (foreign-declare ,@strs))
    33         (,(r 'bind) ,@strs)) ) ))
     66        (,(r 'declare) (foreign-declare ,@decls))
     67        (,(r 'bind) ,@strs)) ) )))
    3468
    3569(define-for-syntax (bind:read-file f)
     
    3973               (else
    4074                (syntax-error 'bind-file "invalid filename" f)))))
    41     (read-all fname)))
     75    (with-input-from-file fname read-list)))
    4276
    4377(define-syntax bind-file
     
    5286
    5387(define-syntax bind-include-path
     88 (er-macro-transformer
    5489  (lambda (x r c)
    5590    (set! ffi-include-path-list (append (cdr x) ffi-include-path-list))
    56     `(,(r 'void) ) ) )
     91    `(,(r 'void) ) ) ))
    5792
    5893(define-syntax bind-type
  • release/5/bind/tags/1.1/chicken-bind.scm

    r34497 r35584  
    11;;;; chicken-bind.scm - Standalone wrapper generator
    22
     3(module chicken-bind ()
    34
    4 (import scheme chicken)
     5(import scheme (chicken port))
    56(import srfi-1)
    67(import bind-translator)
    7 (import (chicken pathname) (chicken io))
     8(import (chicken pathname) (chicken io) (chicken base) (chicken port))
     9(import (chicken irregex) (chicken process-context))
     10(import (chicken pretty-print))
    811
    912(define (usage #!optional (status 0))
     
    8790    (for-each
    8891     (lambda (f)
     92       (define (read-from-file-or-stdin)
     93         (if (string=? f "-")
     94             (read-string #f (current-input-port))
     95             (call-with-input-file f (lambda (p) (read-string #f p)))))
    8996       (define (process)
    9097         (print "\n;;; GENERATED BY CHICKEN-BIND FROM " f #\newline)
    9198         (pp `(begin
    92                 ,@(parse-easy-ffi
    93                    (read-string
    94                     #f
    95                     (if (string=? f "-")
    96                         (current-input-port)
    97                         f) )
    98                    identity
    99                    chunkify-only
    100                    f)))
     99                ,@(parse-easy-ffi (read-from-file-or-stdin)
     100                                  identity
     101                                  chunkify-only
     102                                  f)))
    101103         (print "\n;;; END OF FILE"))
    102104       (cond ((equal? "-" output) (process))
     
    109111
    110112(main (command-line-arguments))
     113
     114)
  • release/5/bind/tags/1.1/cplusplus-object.scm

    r18751 r35584  
    44(module cplusplus-object (<c++-object> new delete constructor destructor)
    55
    6 (import scheme chicken)
    7 (use coops)
     6(import scheme (chicken base) coops)
    87
    98(define-class <c++-object> () (this))
  • release/5/bind/tags/1.1/runsilex.scm

    r21505 r35584  
    33; Runs silex and generates c.l.scm
    44
    5 (require-extension silex)
     5(import silex)
    66
    77(lex "c.l" "c.l.scm" 'counters 'line)
  • release/5/bind/tags/1.1/tests/cplusplus-test.scm

    r34025 r35584  
    5151(print "full specialization")
    5252
    53 (use coops-primitive-objects)
     53(import coops-primitive-objects)
    5454
    5555 (bind-options full-specialization: #t)
  • release/5/bind/tags/1.1/tests/foreign-transformer-test.scm

    r34025 r35584  
    44(import (chicken pretty-print))
    55
    6 (begin-for-syntax
    7   (import bind-translator matchable)
    8   (import (chicken pretty-print))
    9   (import (chicken data-structures))
    10   (import srfi-1))
     6(import-for-syntax bind-translator matchable)
     7(import-for-syntax (chicken pretty-print))
     8(import-for-syntax (chicken string))
     9(import-for-syntax srfi-1)
    1110
    1211(begin-for-syntax
  • release/5/bind/tags/1.1/tests/tests.scm

    r34025 r35584  
    11(import coops)
    2 (import bind foreign)
     2(import bind (chicken foreign))
    33
    44(bind* #<<EOF
  • release/5/bind/trunk/bind-translator.scm

    r34497 r35584  
    2121                         bind-foreign-lambda*)
    2222
    23 (import scheme chicken)
    24 (import (only (chicken data-structures) rassoc intersperse identity))
    25 (import (chicken string))
     23(import scheme)
     24(import (chicken base) (chicken file) (chicken port)
     25        (chicken syntax) (chicken fixnum))
    2626(import (chicken pathname))
    2727(import srfi-1)
     
    2929(import matchable)
    3030(import (chicken format))
     31(import (chicken string))
    3132(import (chicken pretty-print))
    3233
  • release/5/bind/trunk/bind.egg

    r34025 r35584  
    22 (category ffi)
    33 (license "public domain")
    4  (dependencies silex matchable coops make)
     4 (dependencies silex matchable coops srfi-1)
    55 (test-dependencies test)
    66 (author "[[felix winkelmann]]")
    77 (components
    88   (host
    9      (extension bind (dependencies bind-translator))
    10      (extension bind-translator (dependencies grammar))
     9     (extension bind (component-dependencies bind-translator))
     10     (extension bind-translator (component-dependencies grammar))
    1111     (generated-source-file grammar
    1212                            (source "c.l.scm")
    13                             (custom-build "csi -s runsilex.scm"))
     13                            (custom-build "gen-lexer"))
    1414     (extension cplusplus-object)
    15      (program chicken-bind (dependencies bind-translator)))))
     15     (program chicken-bind (component-dependencies bind-translator)))))
  • release/5/bind/trunk/bind.scm

    r34025 r35584  
    1313              bind-include-path)
    1414
    15 (import scheme chicken foreign)
     15(import scheme (chicken base) (chicken foreign) (chicken syntax))
    1616
    1717(begin-for-syntax
    1818  (import bind-translator)
     19  (import (chicken io))
    1920  (import srfi-1)
    20   (import srfi-13))
     21  (import srfi-13)
     22
     23  (define emitted-prelude #f)
     24  (define prelude #<<EOF
     25#define ___fixnum           int
     26#define ___number           double
     27#define ___bool             int
     28#define ___byte             char
     29#define ___scheme_value     C_word
     30#define ___scheme_pointer   void *
     31#define ___blob             void *
     32#define ___pointer_vector   void **
     33#define ___symbol           char *
     34#define ___safe
     35#define ___declare(x, y)
     36#define ___specialize
     37#define ___abstract
     38#define ___discard
     39#define ___in
     40#define ___out
     41#define ___inout
     42#define ___mutable
     43#define ___length(var)
     44#define ___pointer
     45#define ___u32              C_u32
     46#define ___s32              C_s32
     47#define ___u64              C_u64
     48#define ___s64              C_s64
     49EOF
     50))
    2151
    2252(define-syntax bind
     53 (er-macro-transformer
    2354  (lambda (x r c)
    2455    (let ((strs (append (cdr x) '("\n"))))
    2556      `(,(r 'begin)
    26         ,@(parse-easy-ffi (string-concatenate strs) r)))))
     57        ,@(parse-easy-ffi (string-concatenate strs) r))))))
    2758 
    2859(define-syntax bind*
     60 (er-macro-transformer
    2961  (lambda (x r c)
    30     (let ((strs (append (cdr x) '("\n"))))
     62    (let* ((strs (append (cdr x) '("\n")))
     63           (decls (if emitted-prelude strs (cons prelude strs))))
     64      (set! emitted-prelude #t)
    3165      `(,(r 'begin)
    32         (,(r 'declare) (foreign-declare ,@strs))
    33         (,(r 'bind) ,@strs)) ) ))
     66        (,(r 'declare) (foreign-declare ,@decls))
     67        (,(r 'bind) ,@strs)) ) )))
    3468
    3569(define-for-syntax (bind:read-file f)
     
    3973               (else
    4074                (syntax-error 'bind-file "invalid filename" f)))))
    41     (read-all fname)))
     75    (with-input-from-file fname read-list)))
    4276
    4377(define-syntax bind-file
     
    5286
    5387(define-syntax bind-include-path
     88 (er-macro-transformer
    5489  (lambda (x r c)
    5590    (set! ffi-include-path-list (append (cdr x) ffi-include-path-list))
    56     `(,(r 'void) ) ) )
     91    `(,(r 'void) ) ) ))
    5792
    5893(define-syntax bind-type
  • release/5/bind/trunk/chicken-bind.scm

    r34497 r35584  
    11;;;; chicken-bind.scm - Standalone wrapper generator
    22
     3(module chicken-bind ()
    34
    4 (import scheme chicken)
     5(import scheme (chicken port))
    56(import srfi-1)
    67(import bind-translator)
    7 (import (chicken pathname) (chicken io))
     8(import (chicken pathname) (chicken io) (chicken base) (chicken port))
     9(import (chicken irregex) (chicken process-context))
     10(import (chicken pretty-print))
    811
    912(define (usage #!optional (status 0))
     
    8790    (for-each
    8891     (lambda (f)
     92       (define (read-from-file-or-stdin)
     93         (if (string=? f "-")
     94             (read-string #f (current-input-port))
     95             (call-with-input-file f (lambda (p) (read-string #f p)))))
    8996       (define (process)
    9097         (print "\n;;; GENERATED BY CHICKEN-BIND FROM " f #\newline)
    9198         (pp `(begin
    92                 ,@(parse-easy-ffi
    93                    (read-string
    94                     #f
    95                     (if (string=? f "-")
    96                         (current-input-port)
    97                         f) )
    98                    identity
    99                    chunkify-only
    100                    f)))
     99                ,@(parse-easy-ffi (read-from-file-or-stdin)
     100                                  identity
     101                                  chunkify-only
     102                                  f)))
    101103         (print "\n;;; END OF FILE"))
    102104       (cond ((equal? "-" output) (process))
     
    109111
    110112(main (command-line-arguments))
     113
     114)
  • release/5/bind/trunk/cplusplus-object.scm

    r18751 r35584  
    44(module cplusplus-object (<c++-object> new delete constructor destructor)
    55
    6 (import scheme chicken)
    7 (use coops)
     6(import scheme (chicken base) coops)
    87
    98(define-class <c++-object> () (this))
  • release/5/bind/trunk/runsilex.scm

    r21505 r35584  
    33; Runs silex and generates c.l.scm
    44
    5 (require-extension silex)
     5(import silex)
    66
    77(lex "c.l" "c.l.scm" 'counters 'line)
  • release/5/bind/trunk/tests/cplusplus-test.scm

    r34025 r35584  
    5151(print "full specialization")
    5252
    53 (use coops-primitive-objects)
     53(import coops-primitive-objects)
    5454
    5555 (bind-options full-specialization: #t)
  • release/5/bind/trunk/tests/foreign-transformer-test.scm

    r34025 r35584  
    44(import (chicken pretty-print))
    55
    6 (begin-for-syntax
    7   (import bind-translator matchable)
    8   (import (chicken pretty-print))
    9   (import (chicken data-structures))
    10   (import srfi-1))
     6(import-for-syntax bind-translator matchable)
     7(import-for-syntax (chicken pretty-print))
     8(import-for-syntax (chicken string))
     9(import-for-syntax srfi-1)
    1110
    1211(begin-for-syntax
  • release/5/bind/trunk/tests/tests.scm

    r34025 r35584  
    11(import coops)
    2 (import bind foreign)
     2(import bind (chicken foreign))
    33
    44(bind* #<<EOF
Note: See TracChangeset for help on using the changeset viewer.