From baf2cb533c83f921849c54db3eb371d2bf03a063 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 15 Apr 2008 20:29:17 +0200 Subject: Use SRFI-35 conditions in `(skribilo index)'. * src/guile/skribilo/index.scm (resolve-the-index)[index-ref]: Raise a `&message' exception instead of using `skribe-error'. --- src/guile/skribilo/index.scm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/index.scm b/src/guile/skribilo/index.scm index c6ee2d1..b537fb4 100644 --- a/src/guile/skribilo/index.scm +++ b/src/guile/skribilo/index.scm @@ -1,7 +1,7 @@ ;;; index.scm ;;; +;;; Copyright 2005, 2006, 2008 Ludovic Courtès ;;; Copyright 2003, 2004 Manuel Serrano -;;; Copyright 2005, 2006 Ludovic Courtès ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -24,6 +24,8 @@ :use-syntax (skribilo lib) :use-module (skribilo ast) + :autoload (srfi srfi-34) (raise) + :use-module (srfi srfi-35) :use-module (srfi srfi-39) ;; XXX: The use of `mark' here introduces a cross-dependency between @@ -31,6 +33,8 @@ ;; modules autoloads the other one. :autoload (skribilo package base) (mark) + :autoload (skribilo location) (location?) + :export (index? make-index-table *index-table* default-index resolve-the-index)) @@ -83,7 +87,17 @@ (define (index-ref n) (let ((name (markup-option n 'name))) (if (>= char-offset (string-length name)) - (skribe-error 'the-index "char-offset out of bound" char-offset) + (let ((loc (if (location? loc) + (format #f "~a:~a:~a: " + (location-file loc) + (location-line loc) + (location-column loc)) + "")) + (msg (format + #f (_ "the-index: char-offset `~A' out of bounds~%") + char-offset))) + (raise (condition (&message + (condition-message (string-append loc msg)))))) (string-ref name char-offset)))) ;; sort a bucket of entries (the entries in a bucket share there name) (define (sort-entries-bucket ie) -- cgit v1.2.3