Started working on a gauche implementation

This commit is contained in:
2025-03-02 20:20:16 +02:00
parent 32638523f4
commit cb9b2f87be
7 changed files with 46 additions and 51 deletions
-27
View File
@@ -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)
+20
View File
@@ -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.
-6
View File
@@ -1,6 +0,0 @@
(in-module pffi)
(inline-stub
(.include "pffi-gauche.h")
(define-cproc foo (x::<int>) foo))