Changeset 36185 in project


Ignore:
Timestamp:
08/11/18 21:55:42 (14 months ago)
Author:
Kooda
Message:

Port foreigners to CHICKEN 5

Location:
release/5
Files:
4 added
4 deleted
5 edited
4 copied

Legend:

Unmodified
Added
Removed
  • release/5/egg-locations

    r36176 r36185  
    2929(fast-generic "http://code.call-cc.org/release-info?egg={egg-name};release={chicken-release}")
    3030(fmt "http://code.call-cc.org/release-info?egg={egg-name};release={chicken-release}")
     31(foreigners "http://code.call-cc.org/release-info?egg={egg-name};release={chicken-release}")
    3132(gochan "https://github.com/Adellica/chicken-gochan/raw/master/gochan.release-info")
    3233(html-parser "http://code.call-cc.org/release-info?egg={egg-name};release={chicken-release}")
  • release/5/foreigners/tags/1.5/foreigners.egg

    r36086 r36185  
    1 ((synopsis
    2    "Foreign helper macros for Chicken 4")
     1((synopsis "Foreign helper macros")
    32 (author "Jim Ursetto")
    43 (license "BSD")
    5  (egg "foreigners.egg")
    64 (category lang-exts)
    7  (doc-from-wiki)
    8  (needs matchable)
    9  (files "foreigners.scm" "foreigners.release-info" "tests/enum-1.scm" "foreigners.meta" "foreigners.setup"))
     5 (dependencies matchable)
     6 (test-dependencies test)
     7 (components (extension foreigners)))
     8
  • release/5/foreigners/tags/1.5/foreigners.scm

    r33658 r36185  
    1212  ;;      body ...)
    1313  (define-syntax with-renamed
     14    (er-macro-transformer
    1415    (lambda (f r c)
    1516      (##sys#check-syntax 'with-renamed f '(_ _ (_ . _) . _))
     
    2324                  `(,(munger x) (,renamer ',x)))
    2425                identifiers)
    25           ,@body)))))
     26          ,@body))))))
    2627
    2728;;; define-foreign-record-type
     
    3031  (define-foreign-record-type define-foreign-enum-type)
    3132
    32   (import scheme chicken foreign)
     33  (import scheme (chicken bitwise))
     34  (import-for-syntax (chicken format)
     35                     (chicken keyword)
     36                     (chicken string))
    3337
    3438  (define-syntax define-foreign-record-type
     39    (er-macro-transformer
    3540    (lambda (f r c)
    3641      (##sys#check-syntax 'define-foreign-record-type f '(_ _ . _))
     
    6368                                        "invalid foreign record-type declaration" (car slts))) )) )
    6469       
    65           (##sys#hash-table-set! ##compiler#foreign-type-table tname `(c-pointer ,fname))
     70          (chicken.compiler.support#register-foreign-type! tname `(c-pointer ,fname))
    6671
    6772          (let ((%void 'void)  ; foreign-lambda* recognizes renamed type identifiers now,
     
    8489                                      (if (pair? (cadr slot)) ; (type (name size) ...)
    8590                                          (sprintf "~A[~A];"
    86                                                    (##compiler#foreign-type-declaration
     91                                                   (chicken.compiler.c-backend#foreign-type-declaration
    8792                                                    (car slot)
    8893                                                    (->string (caadr slot)) )
    8994                                                   (cadadr slot) )
    9095                                          (sprintf "~A;" ; (type name ...)
    91                                                    (##compiler#foreign-type-declaration
     96                                                   (chicken.compiler.c-backend#foreign-type-declaration
    9297                                                    (car slot)
    9398                                                    (->string (cadr slot)) ) ) )
     
    175180                                ;;                     "bad slot spec" slot)]
    176181                                )))
    177                         slots))))))))
     182                        slots)))))))))
    178183
    179184;;; define-foreign-enum-type
    180185
    181 (require-library matchable)
    182186(import-for-syntax matchable)
    183 (import-for-syntax renaming)
     187(import-syntax-for-syntax renaming)
    184188
    185189;; Ignored case where typename is a symbol, for now.
    186190;; Permit string or symbol as REALTYPE in ENUMSPEC.
    187191(define-syntax define-foreign-enum-type
     192  (er-macro-transformer
    188193  (lambda (f r c)
    189194    (match
     
    255260     ((_ (type-name native-type) . rest)
    256261      `(define-foreign-enum-type (,type-name ,native-type '()) ,@rest))
    257      ))))
     262     )))))
    258263
    259264
     
    281286#|
    282287;; for interactive testing
    283 (define (##compiler#foreign-type-declaration t n)
     288(define (chicken.compiler.c-backend#foreign-type-declaration t n)
    284289  (conc t " " n))
    285 (define ##compiler#foreign-type-table (make-hash-table))
    286 (define (##sys#hash-table-set! . args) (display "hash-table-set! ") (write args) (newline))
     290(define (chicken.compiler.support#register-foreign-type! . args)
     291  (display "chicken.compiler.support#register-foreign-type! ")
     292  (write args)
     293  (newline))
    287294|#
  • release/5/foreigners/tags/1.5/tests/enum-1.scm

    r13841 r36185  
    1515   get-status set-status busy?)
    1616
    17   (import scheme chicken foreigners)
     17  (import scheme (chicken foreign) foreigners)
    1818
    1919  (define-foreign-enum-type (foo:status int)
     
    3131  )
    3232
    33 (require-extension test)
     33(import test)
    3434(import enum-1)
    3535
     
    4242;; therefore visible inside entire compilation unit.
    4343(test "status/fail" 'fail (int->status status/fail))
     44(test-exit)
  • release/5/foreigners/trunk/foreigners.egg

    r36086 r36185  
    1 ((synopsis
    2    "Foreign helper macros for Chicken 4")
     1((synopsis "Foreign helper macros")
    32 (author "Jim Ursetto")
    43 (license "BSD")
    5  (egg "foreigners.egg")
    64 (category lang-exts)
    7  (doc-from-wiki)
    8  (needs matchable)
    9  (files "foreigners.scm" "foreigners.release-info" "tests/enum-1.scm" "foreigners.meta" "foreigners.setup"))
     5 (dependencies matchable)
     6 (test-dependencies test)
     7 (components (extension foreigners)))
     8
  • release/5/foreigners/trunk/foreigners.scm

    r33658 r36185  
    1212  ;;      body ...)
    1313  (define-syntax with-renamed
     14    (er-macro-transformer
    1415    (lambda (f r c)
    1516      (##sys#check-syntax 'with-renamed f '(_ _ (_ . _) . _))
     
    2324                  `(,(munger x) (,renamer ',x)))
    2425                identifiers)
    25           ,@body)))))
     26          ,@body))))))
    2627
    2728;;; define-foreign-record-type
     
    3031  (define-foreign-record-type define-foreign-enum-type)
    3132
    32   (import scheme chicken foreign)
     33  (import scheme (chicken bitwise))
     34  (import-for-syntax (chicken format)
     35                     (chicken keyword)
     36                     (chicken string))
    3337
    3438  (define-syntax define-foreign-record-type
     39    (er-macro-transformer
    3540    (lambda (f r c)
    3641      (##sys#check-syntax 'define-foreign-record-type f '(_ _ . _))
     
    6368                                        "invalid foreign record-type declaration" (car slts))) )) )
    6469       
    65           (##sys#hash-table-set! ##compiler#foreign-type-table tname `(c-pointer ,fname))
     70          (chicken.compiler.support#register-foreign-type! tname `(c-pointer ,fname))
    6671
    6772          (let ((%void 'void)  ; foreign-lambda* recognizes renamed type identifiers now,
     
    8489                                      (if (pair? (cadr slot)) ; (type (name size) ...)
    8590                                          (sprintf "~A[~A];"
    86                                                    (##compiler#foreign-type-declaration
     91                                                   (chicken.compiler.c-backend#foreign-type-declaration
    8792                                                    (car slot)
    8893                                                    (->string (caadr slot)) )
    8994                                                   (cadadr slot) )
    9095                                          (sprintf "~A;" ; (type name ...)
    91                                                    (##compiler#foreign-type-declaration
     96                                                   (chicken.compiler.c-backend#foreign-type-declaration
    9297                                                    (car slot)
    9398                                                    (->string (cadr slot)) ) ) )
     
    175180                                ;;                     "bad slot spec" slot)]
    176181                                )))
    177                         slots))))))))
     182                        slots)))))))))
    178183
    179184;;; define-foreign-enum-type
    180185
    181 (require-library matchable)
    182186(import-for-syntax matchable)
    183 (import-for-syntax renaming)
     187(import-syntax-for-syntax renaming)
    184188
    185189;; Ignored case where typename is a symbol, for now.
    186190;; Permit string or symbol as REALTYPE in ENUMSPEC.
    187191(define-syntax define-foreign-enum-type
     192  (er-macro-transformer
    188193  (lambda (f r c)
    189194    (match
     
    255260     ((_ (type-name native-type) . rest)
    256261      `(define-foreign-enum-type (,type-name ,native-type '()) ,@rest))
    257      ))))
     262     )))))
    258263
    259264
     
    281286#|
    282287;; for interactive testing
    283 (define (##compiler#foreign-type-declaration t n)
     288(define (chicken.compiler.c-backend#foreign-type-declaration t n)
    284289  (conc t " " n))
    285 (define ##compiler#foreign-type-table (make-hash-table))
    286 (define (##sys#hash-table-set! . args) (display "hash-table-set! ") (write args) (newline))
     290(define (chicken.compiler.support#register-foreign-type! . args)
     291  (display "chicken.compiler.support#register-foreign-type! ")
     292  (write args)
     293  (newline))
    287294|#
  • release/5/foreigners/trunk/tests/enum-1.scm

    r13841 r36185  
    1515   get-status set-status busy?)
    1616
    17   (import scheme chicken foreigners)
     17  (import scheme (chicken foreign) foreigners)
    1818
    1919  (define-foreign-enum-type (foo:status int)
     
    3131  )
    3232
    33 (require-extension test)
     33(import test)
    3434(import enum-1)
    3535
     
    4242;; therefore visible inside entire compilation unit.
    4343(test "status/fail" 'fail (int->status status/fail))
     44(test-exit)
Note: See TracChangeset for help on using the changeset viewer.