From 08d6c24263ee2aff90a3b055a6bf8bfd4dbb22f6 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 29 Apr 2018 18:35:22 +0200 Subject: [PATCH] mes: Upgrade Guile module support. * module/mes/boot-0.scm (define-module): New macro with minimal Guile support. (use-modules): New macro. --- module/mes/boot-0.scm | 9 +++++++++ module/mes/getopt-long.mes | 1 - module/mes/optargs.mes | 1 - module/mes/pmatch.mes | 3 --- module/srfi/srfi-16.mes | 1 - 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/module/mes/boot-0.scm b/module/mes/boot-0.scm index b4c10752..a0768719 100644 --- a/module/mes/boot-0.scm +++ b/module/mes/boot-0.scm @@ -220,6 +220,15 @@ (mes-use-module (mes catch)) (mes-use-module (mes posix)) + +(define-macro (define-module module . rest) + `(if ,(and (pair? module) + (= 1 (length module)) + (symbol? (car module))) + (define (,(car module) . arguments) (main (command-line))))) + +(define-macro (use-modules . rest) #t) + ;; ;; end boot-0.scm (mes-use-module (mes getopt-long)) diff --git a/module/mes/getopt-long.mes b/module/mes/getopt-long.mes index 0193bfef..b2c66fd7 100644 --- a/module/mes/getopt-long.mes +++ b/module/mes/getopt-long.mes @@ -26,5 +26,4 @@ (mes-use-module (srfi srfi-9)) (mes-use-module (srfi srfi-13)) (mes-use-module (mes optargs)) -(define-macro (define-module module . rest) #t) (include-from-path "mes/getopt-long.scm") diff --git a/module/mes/optargs.mes b/module/mes/optargs.mes index 269c7ca1..cf6e6702 100644 --- a/module/mes/optargs.mes +++ b/module/mes/optargs.mes @@ -32,7 +32,6 @@ (define-macro (set-procedure-property! proc key value) proc) -(define-macro (define-module module . rest) #t) (include-from-path "mes/optargs.scm") (define-macro (define-macro* NAME+ARGLIST . BODY) diff --git a/module/mes/pmatch.mes b/module/mes/pmatch.mes index 114825ee..3f6fba4c 100644 --- a/module/mes/pmatch.mes +++ b/module/mes/pmatch.mes @@ -22,9 +22,6 @@ ;;; Code: -(define-macro (define-module module . rest) #t) -(define-macro (use-modules . rest) #t) - ;;(mes-use-module (mes guile)) (mes-use-module (mes quasiquote)) (mes-use-module (mes syntax)) diff --git a/module/srfi/srfi-16.mes b/module/srfi/srfi-16.mes index be69949a..c42d4a86 100644 --- a/module/srfi/srfi-16.mes +++ b/module/srfi/srfi-16.mes @@ -22,6 +22,5 @@ ;;; Code: -(define-macro (define-module module . rest) #t) (define (cond-expand-provide . rest) #t) (include-from-path "srfi/srfi-16.scm")