Started working on a gauche implementation
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
(use gauche.cgen)
|
||||
|
||||
(define unit (make <cgen-unit> :name "pffi-gauche"))
|
||||
(cgen-current-unit unit)
|
||||
|
||||
|
||||
(cgen-decl "#include <ffi.h>")
|
||||
(cgen-decl "#include <stdio.h>")
|
||||
|
||||
(cgen-init "printf(\"initialization function\\n\");")
|
||||
|
||||
(cgen-body "void foo(int n) { printf(\"got %u\\n\", n); }")
|
||||
|
||||
(cgen-extern "void foo(int n);")
|
||||
|
||||
;(cgen-extern "void foo(int n);")
|
||||
|
||||
#;(parameterize ([cgen-current-unit *unit*])
|
||||
(cgen-decl "#include <ffi.h>")
|
||||
(cgen-decl "#include <stdio.h>")
|
||||
(cgen-body "void foo(int n) { printf(\"got %u\\n\", n); }")
|
||||
(cgen-extern "void foo(int n);")
|
||||
(cgen-init "printf(\"initialization function\\n\");")
|
||||
)
|
||||
|
||||
(cgen-emit-c unit)
|
||||
(cgen-emit-h unit)
|
||||
@@ -0,0 +1,20 @@
|
||||
;;;
|
||||
;;; spigot - 'spigot' extension module example
|
||||
;;;
|
||||
;;; Written by Shiro Kawai (shiro@acm.org)
|
||||
;;; I put this program in public domain. Use it as you like.
|
||||
;;;
|
||||
|
||||
(in-module retropikzel.pffi.gauche)
|
||||
|
||||
;;
|
||||
;; The 'define-cproc' forms exposes C functions to Scheme world.
|
||||
;;
|
||||
|
||||
(inline-stub
|
||||
(.include "pffi-gauche.h")
|
||||
(define-cproc spigot-calculate-pi (digits::<int>) Spigot_calculate_pi)
|
||||
(define-cproc spigot-calculate-e (digits::<int>) Spigot_calculate_e)
|
||||
)
|
||||
|
||||
;; You can define Scheme functions here if you want.
|
||||
@@ -1,6 +0,0 @@
|
||||
(in-module pffi)
|
||||
|
||||
(inline-stub
|
||||
(.include "pffi-gauche.h")
|
||||
(define-cproc foo (x::<int>) foo))
|
||||
|
||||
Reference in New Issue
Block a user