xlib for C5 added by mario-goulart on Mon Aug 5 11:49:13 2019
From 9a420ea4ec973d41af61600a901d59e3d8a00316 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <mario@parenteses.org> Date: Mon, 5 Aug 2019 11:41:23 +0200 Subject: [PATCH] CHICKEN 5 support --- xlib.egg | 14 ++++++++++++++ xlib.meta | 11 ----------- xlib.scm | 58 ++++++++++++++++++++++++++++++++-------------------------- xlib.setup | 8 -------- 4 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 xlib.egg delete mode 100644 xlib.meta delete mode 100644 xlib.setup diff --git a/xlib.egg b/xlib.egg new file mode 100644 index 0000000..f447888 --- /dev/null +++ b/xlib.egg @@ -0,0 +1,14 @@ +;;; xlib.egg -*- scheme -*- + +((synopsis "Xlib bindings") + (author "Richard Mann") + (maintainer "felix winkelmann") + (category graphics) + (license "unknown") + (dependencies matchable srfi-13) + (components + (extension xlib + (source-dependencies + "xlib-c.c" + "xlib-original.scm") + (link-options -L -lX11)))) diff --git a/xlib.meta b/xlib.meta deleted file mode 100644 index 96b174b..0000000 --- a/xlib.meta +++ /dev/null @@ -1,11 +0,0 @@ -;;; xlib.meta -*- Scheme -*- - -((synopsis "Xlib bindings") - (author "Richard Mann") - (maintainer "felix winkelmann") - (category graphics) - (license "unknown") - (depends matchable) - (doc-from-wiki) - (egg "xlib.egg") - (files "xlib.meta" "xlib-c.c" "xlib-original.scm" "xlib.setup" "xlib.scm" "xlib.release-info")) diff --git a/xlib.scm b/xlib.scm index 74faeeb..34917d5 100644 --- a/xlib.scm +++ b/xlib.scm @@ -17,9 +17,14 @@ (module xlib () - (import scheme chicken foreign srfi-13 data-structures) + (import scheme + srfi-13 + (chicken base) + (chicken foreign) + (chicken module) + (chicken syntax)) (begin-for-syntax (require-library matchable)) - (import-for-syntax matchable chicken) + (import-for-syntax matchable srfi-13 (chicken base) (chicken string)) (define-for-syntax (xlate-type t cn) (match (strip-syntax t) ; punt @@ -68,30 +73,31 @@ #f peek-and-free-c-string) -(eval-when (compile) - (print "Compiling xlib (this may take a while) ...")) - -(define-syntax (foreign-function x r c) - (match (cdr x) - ((name args result cname) - `(,(r 'begin) - (,(r 'export) ,name) - (,(r 'define) ,name - (,(r 'foreign-lambda) - ,(xlate-rtype result cname) - ,cname - ,@(map (cut xlate-atype <> cname) args)) ) )))) - -(define-syntax (foreign-cb-function x r c) - (match (cdr x) - ((name args result cname) - `(,(r 'begin) - (,(r 'export) ,name) - (,(r 'define) ,name - (,(r 'foreign-safe-lambda) - ,(xlate-rtype result cname) - ,cname - ,@(map (cut xlate-atype <> cname) args)) ) ) ) )) +(define-syntax foreign-function + (er-macro-transformer + (lambda (x r c) + (match (cdr x) + ((name args result cname) + `(,(r 'begin) + (,(r 'export) ,name) + (,(r 'define) ,name + (,(r 'foreign-lambda) + ,(xlate-rtype result cname) + ,cname + ,@(map (cut xlate-atype <> cname) args)) ) )))))) + +(define-syntax foreign-cb-function + (er-macro-transformer + (lambda (x r c) + (match (cdr x) + ((name args result cname) + `(,(r 'begin) + (,(r 'export) ,name) + (,(r 'define) ,name + (,(r 'foreign-safe-lambda) + ,(xlate-rtype result cname) + ,cname + ,@(map (cut xlate-atype <> cname) args)) ) ) ) )))) (define-syntax foreign-define (syntax-rules () diff --git a/xlib.setup b/xlib.setup deleted file mode 100644 index 52fa8ad..0000000 --- a/xlib.setup +++ /dev/null @@ -1,8 +0,0 @@ -(run (csc xlib.scm -j xlib -s -O2 -d0 -L "\"-L/usr/X11R6/lib -lX11\"" -C "\"-I/usr/X11R6/include\"")) -(run (csc xlib.import.scm -s -O2 -d0)) - -(install-extension - 'xlib - '("xlib.so" "xlib.import.so") - '((version 1.2) - (documentation "xlib.html"))) -- 2.11.0