From d183aa487d99baea3746f79759c17cf36c55dfbf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 1 Aug 2020 12:49:29 +0200 Subject: build: Remove support for Guile 1.8. * configure.ac: Remove "1.8" from 'GUILE_PKG'. Remove 'HAVE_GUILE2' conditional. Remove checks for (srfi srfi-34), (srfi srfi-35), and (srfi srfi-37). * guilec.am: Inline what was in HAVE_GUILE2 and remove the alternate. * src/guile/skribilo/debug.scm (debug-item): Remove 'cond-expand' and keep only the 'guile-2' variant. * src/guile/skribilo/engine.scm (engine-loaded?): Likewise. * src/guile/skribilo/lib.scm (&invocation-location, define-markup): Likewise. * src/guile/skribilo/utils/syntax.scm (%skribilo-module-reader): Likewise. * web/index.skb: Remove mention of 1.8. * README: Likewise. --- src/guile/Makefile.am | 7 +-- src/guile/skribilo/debug.scm | 16 ++----- src/guile/skribilo/engine.scm | 12 ++--- src/guile/skribilo/lib.scm | 92 +++++++++++++++---------------------- src/guile/skribilo/utils/syntax.scm | 12 +---- 5 files changed, 48 insertions(+), 91 deletions(-) (limited to 'src') diff --git a/src/guile/Makefile.am b/src/guile/Makefile.am index 6599581..7001377 100644 --- a/src/guile/Makefile.am +++ b/src/guile/Makefile.am @@ -1,5 +1,5 @@ # Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2012, -# 2015, 2018 Ludovic Courtès +# 2015, 2018, 2020 Ludovic Courtès # # This file is part of Skribilo. # @@ -95,15 +95,10 @@ nobase_nodist_module_DATA = \ skribilo/config.scm \ skribilo/utils/images.scm -if HAVE_GUILE2 - nobase_nodist_guileobject_DATA += \ skribilo/config.go \ skribilo/utils/images.go -endif HAVE_GUILE2 - - BUILT_SOURCES = \ skribilo/config.scm \ skribilo/utils/images.scm diff --git a/src/guile/skribilo/debug.scm b/src/guile/skribilo/debug.scm index f3da3b9..80ab952 100644 --- a/src/guile/skribilo/debug.scm +++ b/src/guile/skribilo/debug.scm @@ -1,6 +1,6 @@ ;;; debug.scm -- Debugging facilities. -*- coding: iso-8859-1 -*- ;;; -;;; Copyright 2005, 2006, 2009, 2012 Ludovic Courtès +;;; Copyright 2005, 2006, 2009, 2012, 2020 Ludovic Courtès ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI ;;; ;;; This file is part of Skribilo. @@ -110,17 +110,9 @@ (for-each (lambda (a) (display a (*debug-port*))) args) (newline (*debug-port*)))) -(cond-expand - (guile-2 - (define-syntax-rule (debug-item args ...) - (if (*debug-item?*) - (%do-debug-item args ...)))) - (else - (begin - ;; Work around Guile 1.8's broken macro support. - (export %do-debug-item) - (define-macro (debug-item . args) - `(if (*debug-item?*) (%do-debug-item ,@args)))))) +(define-syntax-rule (debug-item args ...) + (if (*debug-item?*) + (%do-debug-item args ...))) ;;; diff --git a/src/guile/skribilo/engine.scm b/src/guile/skribilo/engine.scm index b1df2ce..a9e5701 100644 --- a/src/guile/skribilo/engine.scm +++ b/src/guile/skribilo/engine.scm @@ -1,7 +1,7 @@ ;;; engine.scm -- Skribilo engines. ;;; -*- coding: iso-8859-1 -*- ;;; -;;; Copyright 2005, 2007, 2008, 2009, 2010, 2018 Ludovic Courtès +;;; Copyright 2005, 2007, 2008, 2009, 2010, 2018, 2020 Ludovic Courtès ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI ;;; ;;; @@ -278,14 +278,8 @@ (define (engine-loaded? id) "Check whether engine @var{id} is already loaded." ;; Trick taken from `resolve-module' in `boot-9.scm'. - (cond-expand (guile-2 - (nested-ref-module (resolve-module '() #f) - (engine-id->module-name id))) - (else - ;; This method works for 1.8 but is deprecated in 1.9/2.0 and - ;; doesn't work with 1.9.11 anyway. - (nested-ref the-root-module - `(%app modules ,@(engine-id->module-name id)))))) + (nested-ref-module (resolve-module '() #f) + (engine-id->module-name id))) ;; A mapping of engine names to hooks. (define %engine-load-hook (make-hash-table)) diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm index 5543644..ef18bda 100644 --- a/src/guile/skribilo/lib.scm +++ b/src/guile/skribilo/lib.scm @@ -1,6 +1,6 @@ ;;; lib.scm -- Utilities. -*- coding: iso-8859-1 -*- ;;; -;;; Copyright 2005, 2007, 2009, 2012, 2013, 2016 Ludovic Courtès +;;; Copyright 2005, 2007, 2009, 2012, 2013, 2016, 2020 Ludovic Courtès ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI ;;; ;;; @@ -109,60 +109,44 @@ ;; keyword style, and a couple other differences handled by ;; `dsssl->guile-formals'. -(cond-expand - (guile-2 - ;; On Guile 2.0, `define-markup' generates a macro for the markup, such - ;; that the macro captures its invocation source location using - ;; `current-source-location'. - - (define-syntax-parameter &invocation-location - (identifier-syntax #f)) - - (define-syntax define-markup - (lambda (s) - (syntax-case s () - ;; Note: Use a dotted pair for formals, to allow for dotted forms - ;; like: `(define-markup (foo x . rest) ...)'. - ((_ (name . formals) body ...) - (let ((formals (map (lambda (s) - (datum->syntax #'formals s)) - (dsssl->guile-formals (syntax->datum #'formals)))) - (internal (symbol-append '% (syntax->datum #'name) - '-internal))) - (with-syntax ((internal/loc (datum->syntax #'name internal))) - #`(begin - (define* (internal/loc loc #,@formals) - (syntax-parameterize ((&invocation-location - (identifier-syntax loc))) - body ...)) - (define-syntax name - (lambda (s) - (syntax-case s () - ((_ . args) - #'(let ((loc (source-properties->location +;; On Guile 2.0, `define-markup' generates a macro for the markup, such +;; that the macro captures its invocation source location using +;; `current-source-location'. + +(define-syntax-parameter &invocation-location + (identifier-syntax #f)) + +(define-syntax define-markup + (lambda (s) + (syntax-case s () + ;; Note: Use a dotted pair for formals, to allow for dotted forms + ;; like: `(define-markup (foo x . rest) ...)'. + ((_ (name . formals) body ...) + (let ((formals (map (lambda (s) + (datum->syntax #'formals s)) + (dsssl->guile-formals (syntax->datum #'formals)))) + (internal (symbol-append '% (syntax->datum #'name) + '-internal))) + (with-syntax ((internal/loc (datum->syntax #'name internal))) + #`(begin + (define* (internal/loc loc #,@formals) + (syntax-parameterize ((&invocation-location + (identifier-syntax loc))) + body ...)) + (define-syntax name + (lambda (s) + (syntax-case s () + ((_ . args) + #'(let ((loc (source-properties->location + (current-source-location)))) + (internal/loc loc . args))) + (_ + #'(lambda args + (let ((loc (source-properties->location (current-source-location)))) - (internal/loc loc . args))) - (_ - #'(lambda args - (let ((loc (source-properties->location - (current-source-location)))) - (apply internal/loc loc args))))))) - internal/loc ; mark it as used - (export name))))))))) - - (else ; Guile 1.8 - ;; On Guile 1.8, a markup is a procedure. Its invocation source location - ;; is captured by walking the stack, which is fragile. - - (define-macro (define-markup bindings . body) - (let ((name (car bindings)) - (opts (cdr bindings))) - `(define*-public ,(cons name (dsssl->guile-formals opts)) - ;; Memorize the invocation location. Note: the invocation depth - ;; passed to `invocation-location' was determined experimentally and - ;; may change as Guile changes (XXX). - (let ((&invocation-location (invocation-location 3))) - ,@body)))))) + (apply internal/loc loc args))))))) + internal/loc ; mark it as used + (export name)))))))) ;;; diff --git a/src/guile/skribilo/utils/syntax.scm b/src/guile/skribilo/utils/syntax.scm index c771507..5c606fc 100644 --- a/src/guile/skribilo/utils/syntax.scm +++ b/src/guile/skribilo/utils/syntax.scm @@ -1,7 +1,7 @@ ;;; syntax.scm -- Syntactic candy for Skribilo modules. -*- coding: utf-8 -*- ;;; ;;; Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, -;;; 2012, 2016, 2018 Ludovic Courtès +;;; 2012, 2016, 2018, 2020 Ludovic Courtès ;;; ;;; ;;; This file is part of Skribilo. @@ -56,15 +56,7 @@ "") (G_ "unexpected character in Skribilo module")) chr))) - - (cond-expand - (guile-2 '(reader/record-positions)) - (else - ;; On Guile 1.8, don't record positions by default: this yields a - ;; nice read performance improvement. - (if (memq 'positions (debug-options)) - (list 'reader/record-positions) - '()))))) + '(reader/record-positions))) (define-macro (skribilo-module-syntax) "Install the syntax reader for Skribilo modules." -- cgit v1.2.3