summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtès2012-04-25 15:09:08 +0200
committerLudovic Courtès2012-04-25 15:09:08 +0200
commit30db71eba358e0df9b599af29bb77f7f733548af (patch)
treecf93e2297177fff8d2b5b6a4afc02fea5b4c69c1 /src
parent3b869766a7b047299dd3e4bb7423a86b74342d77 (diff)
downloadskribilo-30db71eba358e0df9b599af29bb77f7f733548af.tar.gz
skribilo-30db71eba358e0df9b599af29bb77f7f733548af.tar.lz
skribilo-30db71eba358e0df9b599af29bb77f7f733548af.zip
Don't define `when' and `unless' on Guile 2.0.
* src/guile/skribilo/utils/syntax.scm (unless, when): Define only when (not guile-2).
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/utils/syntax.scm48
1 files changed, 28 insertions, 20 deletions
diff --git a/src/guile/skribilo/utils/syntax.scm b/src/guile/skribilo/utils/syntax.scm
index 471ea14..5a747cb 100644
--- a/src/guile/skribilo/utils/syntax.scm
+++ b/src/guile/skribilo/utils/syntax.scm
@@ -1,6 +1,7 @@
;;; syntax.scm -- Syntactic candy for Skribilo modules. -*- coding: utf-8 -*-
;;;
-;;; Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+;;; 2012 Ludovic Courtès <ludo@gnu.org>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
@@ -23,10 +24,10 @@
:use-module (system reader compat) ;; make sure `current-reader' exists
:use-module (system reader confinement)
:export (%skribilo-module-reader skribilo-module-syntax
- set-correct-file-encoding!
- default-to-utf-8
- _ N_
- unwind-protect unless when))
+ set-correct-file-encoding!
+ default-to-utf-8
+ _ N_
+ unwind-protect))
;;; Author: Ludovic Courtès
;;;
@@ -69,21 +70,28 @@
(define-macro (unwind-protect expr1 expr2)
;; This is no completely correct.
`(dynamic-wind
- (lambda () #f)
- (lambda () ,expr1)
- (lambda () ,expr2)))
-
-(define-macro (unless condition . exprs)
- `(if (not ,condition)
- ,(if (null? (cdr exprs))
- (car exprs)
- `(begin ,@exprs))))
-
-(define-macro (when condition . exprs)
- `(if ,condition
- ,(if (null? (cdr exprs))
- (car exprs)
- `(begin ,@exprs))))
+ (lambda () #f)
+ (lambda () ,expr1)
+ (lambda () ,expr2)))
+
+(cond-expand
+ ((not guile-2)
+ ;; In Guile 2.x these macros are defined in the core.
+ (begin
+ (define-macro (unless condition . exprs)
+ `(if (not ,condition)
+ ,(if (null? (cdr exprs))
+ (car exprs)
+ `(begin ,@exprs))))
+
+ (define-macro (when condition . exprs)
+ `(if ,condition
+ ,(if (null? (cdr exprs))
+ (car exprs)
+ `(begin ,@exprs))))
+
+ (export when unless)))
+ (else (begin)))
(cond-expand
(guile-2