aboutsummaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Courtès2020-08-06 18:49:31 +0200
committerLudovic Courtès2020-08-06 18:49:31 +0200
commit47fd87d615102e20ec9b6ea648401caf91828711 (patch)
treebe73967a60521dc2f88414a8c8289d7e2f7c2d16 /src/guile
parent34c340fc7b3fa5c7218b4e42a37e8267c7258245 (diff)
downloadskribilo-47fd87d615102e20ec9b6ea648401caf91828711.tar.gz
skribilo-47fd87d615102e20ec9b6ea648401caf91828711.tar.lz
skribilo-47fd87d615102e20ec9b6ea648401caf91828711.zip
Remove 'cond-expand' clauses for Guile 1.8.
This is a followup to d183aa487d99baea3746f79759c17cf36c55dfbf. * src/guile/skribilo/debug.scm (with-debug): Remove 'cond-expand' and keep only 'guile-2' version. * src/guile/skribilo/engine/html.scm (&html-generic-document)[set-output-encoding]: Likewise. * src/guile/skribilo/engine/info.scm (document): Likewise. * src/guile/skribilo/engine/latex.scm (document): Likewise. * src/guile/skribilo/engine/lout.scm (document): Likewise. * src/guile/skribilo/evaluator.scm (%evaluate): Likewise. * src/guile/skribilo/location.scm <top level>: Likewise. * src/guile/skribilo/module.scm (maybe-set-module-name!): Likewise. * src/guile/skribilo/package/base.scm <top level>: Likewise. * src/guile/skribilo/utils/syntax.scm (unless, when): Remove. (set-correct-file-encoding!, default-to-utf-8): Keep only 'guile-2' variant. * tests/location.test <top level>: Likewise. * tests/readers/rss-2.test <top level>: Likewise.
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/debug.scm31
-rw-r--r--src/guile/skribilo/engine/html.scm13
-rw-r--r--src/guile/skribilo/engine/info.scm5
-rw-r--r--src/guile/skribilo/engine/latex.scm15
-rw-r--r--src/guile/skribilo/engine/lout.scm25
-rw-r--r--src/guile/skribilo/evaluator.scm16
-rw-r--r--src/guile/skribilo/location.scm10
-rw-r--r--src/guile/skribilo/module.scm5
-rw-r--r--src/guile/skribilo/package/base.scm8
-rw-r--r--src/guile/skribilo/utils/syntax.scm58
-rw-r--r--src/guile/skribilo/writer.scm5
11 files changed, 53 insertions, 138 deletions
diff --git a/src/guile/skribilo/debug.scm b/src/guile/skribilo/debug.scm
index 80ab952..4bdc2b5 100644
--- a/src/guile/skribilo/debug.scm
+++ b/src/guile/skribilo/debug.scm
@@ -141,28 +141,15 @@
;; We have this as a macro in order to avoid procedure calls in the
;; non-debugging case. Unfortunately, the macro below duplicates BODY,
;; which has a negative impact on memory usage and startup time (XXX).
-(cond-expand
- (guile-2
- (define-syntax with-debug
- (lambda (s)
- (syntax-case s ()
- ((_ level label body ...)
- (integer? (syntax->datum #'level))
- #'(if (or (>= (*debug*) level)
- (memq label (*watched-symbols*)))
- (%do-with-debug level label (lambda () body ...))
- (begin body ...)))))))
- (else
- (begin
- (export %do-with-debug)
- (define-macro (with-debug level label . body)
- (if (number? level)
- `(if (or (>= (*debug*) ,level)
- (memq ,label (*watched-symbols*)))
- (%do-with-debug ,level ,label (lambda () ,@body))
- (begin ,@body))
- (error "with-debug: syntax error"))))))
-
+(define-syntax with-debug
+ (lambda (s)
+ (syntax-case s ()
+ ((_ level label body ...)
+ (integer? (syntax->datum #'level))
+ #'(if (or (>= (*debug*) level)
+ (memq label (*watched-symbols*)))
+ (%do-with-debug level label (lambda () body ...))
+ (begin body ...))))))
; Example:
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 9055486..5120631 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -1161,14 +1161,11 @@
;*---------------------------------------------------------------------*/
(define (&html-generic-document n title e)
(define (set-output-encoding)
- (cond-expand
- (guile-2
- ;; Make sure the output is suitably encoded.
- (and=> (engine-custom e 'charset)
- (lambda (charset)
- (set-port-encoding! (current-output-port) charset)
- (set-port-conversion-strategy! (current-output-port) 'error))))
- (else #t)))
+ ;; Make sure the output is suitably encoded.
+ (and=> (engine-custom e 'charset)
+ (lambda (charset)
+ (set-port-encoding! (current-output-port) charset)
+ (set-port-conversion-strategy! (current-output-port) 'error))))
(let* ((id (markup-ident n))
(header (new markup
diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm
index 81b4071..a66acde 100644
--- a/src/guile/skribilo/engine/info.scm
+++ b/src/guile/skribilo/engine/info.scm
@@ -189,10 +189,7 @@
:options '(:title :author :ending)
:action (lambda (doc e)
(check-node-title-conflicts doc e)
-
- (cond-expand
- (guile-2 (set-port-encoding! (current-output-port) "UTF-8"))
- (else #t))
+ (set-port-encoding! (current-output-port) "UTF-8")
(let ((title (markup-option doc :title))
(authors (markup-option doc :author))
diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm
index 6cd98e9..5f5b300 100644
--- a/src/guile/skribilo/engine/latex.scm
+++ b/src/guile/skribilo/engine/latex.scm
@@ -1,7 +1,7 @@
;;; latex.scm -- LaTeX engine.
;;; -*- coding: iso-8859-1 -*-
;;;
-;;; Copyright 2007, 2009, 2012, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2007, 2009, 2012, 2015, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright 2003, 2004 Manuel Serrano
;;;
;;;
@@ -519,14 +519,11 @@
(begin (display dc) (newline))
(display "\\documentclass{article}\n")))
- (cond-expand
- (guile-2
- (let ((encoding (engine-custom e 'encoding)))
- (set-port-encoding! (current-output-port) encoding)
- (set-port-conversion-strategy! (current-output-port) 'error)
- (if (string-ci=? encoding "UTF-8") ; FIXME: other encodings?
- (display "\\usepackage[utf8]{inputenc}\n"))))
- (else #t))
+ (let ((encoding (engine-custom e 'encoding)))
+ (set-port-encoding! (current-output-port) encoding)
+ (set-port-conversion-strategy! (current-output-port) 'error)
+ (when (string-ci=? encoding "UTF-8") ; FIXME: other encodings?
+ (display "\\usepackage[utf8]{inputenc}\n")))
(if (latex-color? e)
(display (engine-custom e 'color-usepackage)))
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm
index bfc60dc..8fbcfc9 100644
--- a/src/guile/skribilo/engine/lout.scm
+++ b/src/guile/skribilo/engine/lout.scm
@@ -1101,20 +1101,17 @@
(markup-writer 'document
:options '(:title :author :ending :keywords :env)
:before (lambda (n e) ;; `e' is the engine
- (cond-expand
- (guile-2
- ;; Make sure the output is suitably encoded.
- (let ((encoding (engine-custom e 'encoding)))
- (set-port-encoding! (current-output-port) encoding)
- (set-port-conversion-strategy! (current-output-port) 'error)
- (cond ((string-ci=? encoding "ISO-8859-2")
- (display "@SysInclude { latin2 }\n"))
- ((not (string-ci=? encoding "ISO-8859-1"))
- (raise (condition
- (&invalid-argument-error
- (proc-name 'lout)
- (argument encoding))))))))
- (else #t))
+ ;; Make sure the output is suitably encoded.
+ (let ((encoding (engine-custom e 'encoding)))
+ (set-port-encoding! (current-output-port) encoding)
+ (set-port-conversion-strategy! (current-output-port) 'error)
+ (cond ((string-ci=? encoding "ISO-8859-2")
+ (display "@SysInclude { latin2 }\n"))
+ ((not (string-ci=? encoding "ISO-8859-1"))
+ (raise (condition
+ (&invalid-argument-error
+ (proc-name 'lout)
+ (argument encoding)))))))
(let* ((doc-type (let ((d (engine-custom e 'document-type)))
(if (string? d)
diff --git a/src/guile/skribilo/evaluator.scm b/src/guile/skribilo/evaluator.scm
index 02babfd..870f4f0 100644
--- a/src/guile/skribilo/evaluator.scm
+++ b/src/guile/skribilo/evaluator.scm
@@ -58,21 +58,7 @@
;; Evaluate EXPR in the current module. EXPR is an arbitrary S-expression
;; that may contain calls to the markup functions defined in a markup
;; package such as `(skribilo package base)', e.g., `(bold "hello")'.
- (cond-expand
- (guile-2 (eval expr module))
- (else
- (let ((opts (debug-options)))
- (dynamic-wind
- (lambda ()
- ;; Force use of the debugging evaluator so that we can track source
- ;; location.
- (debug-enable 'debug)
- (debug-enable 'backtrace))
- (lambda ()
- (eval expr module))
- (lambda ()
- ;; Restore previous evaluator options.
- (debug-options opts)))))))
+ (eval expr module))
;;;
diff --git a/src/guile/skribilo/location.scm b/src/guile/skribilo/location.scm
index 520fe22..43bdc6e 100644
--- a/src/guile/skribilo/location.scm
+++ b/src/guile/skribilo/location.scm
@@ -1,7 +1,6 @@
;;; location.scm -- Skribilo source location.
-;;; -*- coding: iso-8859-1 -*-
;;;
-;;; Copyright 2005, 2007, 2009, 2010, 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2005, 2007, 2009, 2010, 2012, 2013, 2015, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;
;;;
@@ -23,15 +22,12 @@
(define-module (skribilo location)
#:use-module (oop goops)
#:use-module ((skribilo utils syntax) :select (skribilo-module-syntax))
- #:autoload (srfi srfi-13) (string-prefix?)
#:export (<location> location? ast-location
location-file location-line location-column
invocation-location
source-properties->location
location->string))
-;;; Author: Ludovic Courtès
-;;;
;;; Commentary:
;;;
;;; An abstract data type to keep track of source locations.
@@ -81,10 +77,6 @@
;;; Getting an invocation's location.
;;;
-(cond-expand
- (guile-2 (use-modules (system vm frame)))
- (else #t))
-
(define (invocation-location . depth)
;; Return a location object denoting the place of invocation of this
;; function's caller. Debugging must be enable for this to work, via
diff --git a/src/guile/skribilo/module.scm b/src/guile/skribilo/module.scm
index e7fa2c5..f651305 100644
--- a/src/guile/skribilo/module.scm
+++ b/src/guile/skribilo/module.scm
@@ -1,7 +1,7 @@
;;; module.scm -- Execution environment for Skribilo documents.
;;; -*- coding: iso-8859-1 -*-
;;;
-;;; Copyright 2005, 2006, 2007, 2009 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2005, 2006, 2007, 2009, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;;
;;; This file is part of Skribilo.
@@ -109,8 +109,7 @@
;;
;; Consequently, on Guile 2.x, we just let Guile choose a module name and
;; do the right thing.
- (cond-expand ((not guile-2) set-module-name!)
- (else (lambda (m n) #t))))
+ (lambda (m n) #t))
(define (make-skribe-user-module)
"Return a new module that imports all the necessary bindings required for
diff --git a/src/guile/skribilo/package/base.scm b/src/guile/skribilo/package/base.scm
index 647ebb5..c28027b 100644
--- a/src/guile/skribilo/package/base.scm
+++ b/src/guile/skribilo/package/base.scm
@@ -48,7 +48,7 @@
index? resolve-the-index)
#:autoload (skribilo sui) (load-sui sui-ref->url)
- #:replace (symbol))
+ #:replace (symbol include))
(skribilo-module-syntax)
@@ -73,12 +73,6 @@
(invalid-argument-error 'include file 'file))
(include-document file))
-(cond-expand
- (guile-2
- ;; On Guile 2.x, replace the 'include' core binding.
- (module-replace! (current-module) '(include)))
- (else #t))
-
;*---------------------------------------------------------------------*/
;* document ... */
;*---------------------------------------------------------------------*/
diff --git a/src/guile/skribilo/utils/syntax.scm b/src/guile/skribilo/utils/syntax.scm
index 5c606fc..e10fd18 100644
--- a/src/guile/skribilo/utils/syntax.scm
+++ b/src/guile/skribilo/utils/syntax.scm
@@ -71,49 +71,21 @@
(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
- (define-syntax set-correct-file-encoding!
- (syntax-rules ()
- ((_)
- (set-correct-file-encoding! (current-input-port)))
- ((_ port)
- ;; Use the encoding specified by the `coding:' comment.
- (let ((e (false-if-exception (file-encoding port))))
- (and (string? e)
- (set-port-encoding! port e))))))
-
- (define-syntax default-to-utf-8
- (syntax-rules ()
- ((_ body ...)
- (with-fluids ((%default-port-encoding "UTF-8"))
- body ...)))))
-
- (else
- (define-macro (set-correct-file-encoding! . p)
- #f)
-
- (define-macro (default-to-utf-8 . body)
- `(begin ,@body))))
+(define-syntax set-correct-file-encoding!
+ (syntax-rules ()
+ ((_)
+ (set-correct-file-encoding! (current-input-port)))
+ ((_ port)
+ ;; Use the encoding specified by the `coding:' comment.
+ (let ((e (false-if-exception (file-encoding port))))
+ (and (string? e)
+ (set-port-encoding! port e))))))
+
+(define-syntax default-to-utf-8
+ (syntax-rules ()
+ ((_ body ...)
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ body ...))))
;;;
diff --git a/src/guile/skribilo/writer.scm b/src/guile/skribilo/writer.scm
index 77d85f0..75ae81b 100644
--- a/src/guile/skribilo/writer.scm
+++ b/src/guile/skribilo/writer.scm
@@ -90,10 +90,7 @@
(define (%procedure-arity proc)
;; Return the minimum number of required arguments for PROC.
- (cond-expand (guile-2
- (car (procedure-minimum-arity proc)))
- (else
- (car (procedure-property proc 'arity)))))
+ (car (procedure-minimum-arity proc)))
(define (make-writer-predicate markup predicate class)
(let* ((t2 (if class