guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Transform R6RS SRFI module name on definition.


From: Taylan Ulrich Bayırlı/Kammer
Subject: Re: [PATCH] Transform R6RS SRFI module name on definition.
Date: Thu, 03 Dec 2015 10:14:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

address@hidden (Taylan Ulrich "Bayırlı/Kammer") writes:

> Ping.

Oh and here's a version of the patch without copyright by me.

>From f4d509cf09c2771c4962745d0f04ab297a8647c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <address@hidden>
Date: Fri, 2 Oct 2015 23:29:08 +0200
Subject: [PATCH] Transform R6RS SRFI module names on definition.

* module/ice-9/r6rs-libraries.scm (library): Transform the names of
  defined SRFI modules from (srfi :n ...) to (srfi srfi-n ...).
---
 module/ice-9/r6rs-libraries.scm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.scm
index a68df3c..934332d 100644
--- a/module/ice-9/r6rs-libraries.scm
+++ b/module/ice-9/r6rs-libraries.scm
@@ -1,6 +1,6 @@
 ;;; r6rs-libraries.scm --- Support for the R6RS `library' and `import' forms
 
-;;      Copyright (C) 2010 Free Software Foundation, Inc.
+;;      Copyright (C) 2010, 2015 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -158,7 +158,22 @@
               (else
                (lp #'rest (cons #'id e) r x))))))))
 
-    (syntax-case stx (export import)
+    (syntax-case stx (export import srfi)
+      ;; (srfi :n ...) -> (srfi srfi-n)
+      ((_ (srfi colon-n name ...) rest ...)
+       (and (and-map identifier? #'(srfi name ...))
+            (symbol? (syntax->datum #'colon-n))
+            (eqv? (string-ref (symbol->string (syntax->datum #'colon-n)) 0)
+                  #\:))
+       (let ((srfi-n (datum->syntax
+                      #'colon-n
+                      (string->symbol
+                       (string-append
+                        "srfi-"
+                        (substring (symbol->string (syntax->datum #'colon-n))
+                                   1))))))
+         #`(library (srfi #,srfi-n name ...)
+             rest ...)))
       ((_ (name name* ...)
           (export espec ...)
           (import ispec ...)
-- 
2.6.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]