From 16077267f2b9018ce714d0b22c684e6addac9db9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Tue, 3 Jan 2006 23:16:53 +0000 Subject: Cleaned up the use of a Skribe-compatible `gensym'. * src/guile/skribilo.scm (gensym): Removed. * src/guile/skribilo/lib.scm (define-simple-markup): Comply with Guile's version of `gensym'. (define-simple-container): Likewise. * src/guile/skribilo/skribe/api.scm (gensym): Improved. Exported via `#:replace'. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-18 --- ChangeLog | 21 +++++++++++++++++++++ src/guile/skribilo.scm | 16 ---------------- src/guile/skribilo/lib.scm | 6 ++++-- src/guile/skribilo/skribe/api.scm | 18 +++++++++++------- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index e941de2..74c46bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,27 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2 # +2006-01-03 23:16:53 GMT Ludovic Courtes patch-18 + + Summary: + Cleaned up the use of a Skribe-compatible `gensym'. + Revision: + skribilo--devel--1.2--patch-18 + + * src/guile/skribilo.scm (gensym): Removed. + + * src/guile/skribilo/lib.scm (define-simple-markup): Comply with Guile's + version of `gensym'. + (define-simple-container): Likewise. + + * src/guile/skribilo/skribe/api.scm (gensym): Improved. Exported via + `#:replace'. + + modified files: + ChangeLog src/guile/skribilo.scm src/guile/skribilo/lib.scm + src/guile/skribilo/skribe/api.scm + + 2005-12-06 23:22:51 GMT Ludovic Courtes patch-17 Summary: diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm index a560b46..e131ff3 100644 --- a/src/guile/skribilo.scm +++ b/src/guile/skribilo.scm @@ -39,22 +39,6 @@ exec ${GUILE-guile} --debug -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;;;; ;;;; Code: -(let ((gensym-orig gensym)) - ;; In Skribe, `gensym' expects a symbol as its (optional) argument, while - ;; Guile's `gensym' expect a string. XXX - (set! gensym - (lambda args - (if (null? args) - (gensym-orig) - (let ((the-arg (car args))) - (cond ((symbol? the-arg) - (gensym-orig (symbol->string the-arg))) - ((string? the-arg) - (gensym-orig the-arg)) - (else - (skribe-error 'gensym "Invalid argument type" - the-arg)))))))) - (define-module (skribilo) diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm index 7a0c306..fc00896 100644 --- a/src/guile/skribilo/lib.scm +++ b/src/guile/skribilo/lib.scm @@ -111,7 +111,8 @@ `(define-markup (,markup :rest opts :key ident class loc) (new markup (markup ',markup) - (ident (or ident (symbol->string (gensym ',markup)))) + (ident (or ident (symbol->string + (gensym ',(symbol->string markup))))) (loc loc) (class class) (required-options '()) @@ -126,7 +127,8 @@ `(define-markup (,markup :rest opts :key ident class loc) (new container (markup ',markup) - (ident (or ident (symbol->string (gensym ',markup)))) + (ident (or ident (symbol->string + (gensym ',(symbol->string markup))))) (loc loc) (class class) (required-options '()) diff --git a/src/guile/skribilo/skribe/api.scm b/src/guile/skribilo/skribe/api.scm index a300606..9a6369d 100644 --- a/src/guile/skribilo/skribe/api.scm +++ b/src/guile/skribilo/skribe/api.scm @@ -19,7 +19,8 @@ ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;; USA. -(define-skribe-module (skribilo skribe api)) +(define-skribe-module (skribilo skribe api) + :replace (gensym)) ;;; Author: Manuel Serrano ;;; Commentary: @@ -32,13 +33,16 @@ ;;; The contents of the file below are unchanged compared to Skribe 1.2d's ;;; `api.scm' file found in the `common' directory. -(let ((gensym-orig gensym)) +(define %gensym-orig (module-ref the-root-module 'gensym)) + +(define gensym ;; In Skribe, `gensym' accepts a symbol. Guile's `gensym' accepts only - ;; strings. - (set! gensym - (lambda (obj) - (gensym-orig (cond ((symbol? obj) (symbol->string obj)) - (else obj)))))) + ;; strings (or no argument). + (lambda obj + (apply %gensym-orig + (cond ((null? obj) '()) + ((symbol? (car obj)) (list (symbol->string (car obj)))) + (else (skribe-error 'gensym "invalid argument" obj)))))) ;*---------------------------------------------------------------------*/ -- cgit v1.2.3