code:
;;;; (texinfo reflection) -- documenting Scheme as stexinfo
;;;;
;;;; 	Copyright (C) 2009, 2010  Free Software Foundation, Inc.
;;;;    Copyright (C) 2003,2004,2009  Andy Wingo <wingo at pobox dot com>
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;;;

;;; Commentary:
;;
;;Routines to generare @code{stexi} documentation for objects and
;;modules.
;;
;;Note that in this context, an @dfn{object} is just a value associated
;;with a location. It has nothing to do with GOOPS.
;;
;;; Code:

(define-module (texinfo reflection)
  #:use-module ((srfi srfi-1) #:select (append-map))
  #:use-module (oop goops)
  #:use-module (texinfo)
  #:use-module (texinfo plain-text)
  #:use-module (srfi srfi-13)
  #:use-module (ice-9 session)
  #:use-module (ice-9 documentation)
  #:use-module (ice-9 optargs)
  #:use-module ((sxml transform) #:select (pre-post-order))
  #:export (module-stexi-documentation
            script-stexi-documentation
            object-stexi-documentation
            package-stexi-standard-copying
            package-stexi-standard-titlepage
            package-stexi-generic-menu
            package-stexi-standard-menu
            package-stexi-extended-menu
            package-stexi-standard-prologue
            package-stexi-documentation
            package-stexi-documentation-for-include))

;; List for sorting the definitions in a module
(define defs
  '(deftp defcv defivar deftypeivar defop deftypeop defmethod
    deftypemethod defopt defvr defvar deftypevr deftypevar deffn
    deftypefn defmac defspec defun deftypefun))

(define (sort-defs ordering a b)
  (define (def x)
    ;; a and b are lists of the form ((anchor ...) (def* ...)...)
    (cadr x))
  (define (name x)
    (cadr (assq 'name (cdadr (def x)))))
  (define (priority x)
    (list-index defs (car (def x))))
  (define (order x)
    (or (list-index ordering (string->symbol (name x)))
        ;; if the def is not in the list, a big number
        1234567890))
  (define (compare-in-order proc eq? < . args)
    (if (not (eq? (proc a) (proc b)))
        (< (proc a) (proc b))
        (or (null? args)
            (apply compare-in-order args))))
  (compare-in-order order = <
                    priority = <
                    name string=? string<=?))

(define (list*-join l infix restfix)
  (let lp ((in l) (out '()))
    (cond ((null? in) (reverse! out))
          ((symbol? in) (reverse! (cons* in restfix out)))
          (else (lp (cdr in) (if (null? out)
                                 (list (car in))
                                 (cons* (car in) infix out)))))))

(define (process-args args)
  (map (lambda (x) (if (symbol? x) (symbol->string x) x))
       (list*-join (or args '())
                   " " " . ")))

(define (get-proc-args proc)
  (cond
   ((procedure-arguments proc)
    => (lambda (args)
         (let ((required-args (assq-ref args 'required))
               (optional-args (assq-ref args 'optional))
               (keyword-args  (assq-ref args 'keyword))
               (rest-arg (assq-ref args 'rest)))
           (process-args
            (append
             ;; start with the required args...
             (map symbol->string required-args)

             ;; add any optional args if needed...
             (map (lambda (a)
                    (if (list? a)
                        (format #f "[~a = ~s]" (car a) (cadr a))
                        (format #f "[~a]" a)))
                  optional-args)

             ;; now the keyword args..
             (map (lambda (a)
                    (if (pair? a)
                        (format #f "[~a]" (car a))
                        (format #f "[#:~a]" a)))
                  keyword-args)

             ;; now the rest arg...
             (if rest-arg
                 (list "." (symbol->string rest-arg))
                 '()))))))))

(define (macro-arguments name type transformer)
  (process-args
   (case type
     ((syntax-rules)
      (let ((patterns (procedure-property transformer 'patterns)))
        (if (pair? patterns)
            (car patterns)
            '())))
     ((identifier-syntax)
      '())
     ((defmacro)
      (or (procedure-property transformer 'defmacro-args)
          '()))
     (else
      ;; a procedural (syntax-case) macro. how to document these?
      '()))))

(define (macro-additional-stexi name type transformer)
  (case type
    ((syntax-rules)
     (let ((patterns (procedure-property transformer 'patterns)))
       (if (pair? patterns)
           (map (lambda (x)
                  `(defspecx (% (name ,name)
                                (arguments ,@(process-args x)))))
                (cdr patterns))
           '())))
    (else
     '())))

(define many-space? (make-regexp "[[:space:]][[:space:]][[:space:]]"))
(define initial-space? (make-regexp "^[[:space:]]"))
(define (string->stexi str)
  (or (and (or (not str) (string-null? str))
           '(*fragment*))
      (and (or (string-index str #\@)
               (and (not (regexp-exec many-space? str))
                    (not (regexp-exec initial-space? str))))
           (false-if-exception
            (texi-fragment->stexi str)))
      `(*fragment* (verbatim ,str))))

(define method-formals
  (and (defined? 'method-formals) method-formals))

(define (method-stexi-arguments method)
  (cond
   (method-formals
    (let lp ((formals (method-formals method))
             (specializers (method-specializers method))
             (out '()))
      (define (arg-texinfo formal specializer)
        `(" (" (var ,(symbol->string formal)) " "
          (code ,(symbol->string (class-name specializer))) ")"))
      (cond
       ((null? formals) (reverse out))
       ((pair? formals)
        (lp (cdr formals) (cdr specializers)
            (append (reverse (arg-texinfo (car formals) (car specializers)))
                    out)))
       (else
        (append (reverse out) (arg-texinfo formals specializers)
                (list "..."))))))
   ((method-source method)
    (let lp ((bindings (cadr (method-source method))) (out '()))
      (define (arg-texinfo arg)
        `(" (" (var ,(symbol->string (car arg))) " "
          (code ,(symbol->string (cadr arg))) ")"))
      (cond
       ((null? bindings)
        (reverse out))
       ((not (pair? (car bindings)))
        (append (reverse out) (arg-texinfo bindings) (list "...")))
       (else
        (lp (cdr bindings)
            (append (reverse (arg-texinfo (car bindings))) out))))))
   (else (warn method) '())))

(define* (object-stexi-documentation object #:optional (name "[unknown]")
                                     #:key (force #f))
  (if (symbol? name)
      (set! name (symbol->string name)))
  (let ((stexi ((lambda (x)
                  (cond ((string? x) (string->stexi x))
                        ((and (pair? x) (eq? (car x) '*fragment*)) x)
                        (force `(*fragment*))
                        (else #f)))
                (object-documentation
                 (if (is-a? object <method>)
                     (method-procedure object)
                     object)))))
    (define (make-def type args)
      `(,type (% ,@args) ,@(cdr stexi)))
    (cond
     ((not stexi) #f)
     ;; stexi is now a list, headed by *fragment*.
     ((and (pair? (cdr stexi)) (pair? (cadr stexi))
           (memq (caadr stexi) defs))
      ;; it's already a deffoo.
      stexi)
     ((is-a? object <class>)
      (make-def 'deftp `((name ,name)
                         (category "Class"))))
     ((is-a? object <macro>)
      (let* ((proc (macro-transformer object))
             (type (and proc (procedure-property proc 'macro-type))))
        `(defspec (% (name ,name)
                     (arguments ,@(macro-arguments name type proc)))
           ,@(macro-additional-stexi name type proc)
           ,@(cdr stexi))))

     ((is-a? object <procedure>)
      (make-def 'defun `((name ,name)
                         (arguments ,@(get-proc-args object)))))
     ((is-a? object <method>)
      (make-def 'deffn `((category "Method")
                         (name ,name)
                         (arguments ,@(method-stexi-arguments object)))))
     ((is-a? object <generic>)
      `(*fragment*
        ,(make-def 'deffn `((name ,name)
                            (category "Generic")))
        ,@(map
           (lambda (method)
             (object-stexi-documentation method name #:force force))
           (generic-function-methods object))))
     (else
      (make-def 'defvar `((name ,name)))))))

(define (module-name->node-name sym-name)
  (string-join (map symbol->string sym-name) " "))

;; this copied from (ice-9 session); need to find a better way
(define (module-filename name)
  (let* ((name (map symbol->string name))
         (reverse-name (reverse name))
	 (leaf (car reverse-name))
	 (dir-hint-module-name (reverse (cdr reverse-name)))
	 (dir-hint (apply string-append
                          (map (lambda (elt)
                                 (string-append elt "/"))
                               dir-hint-module-name))))
    (%search-load-path (in-vicinity dir-hint leaf))))

(define (read-module name)
  (let ((filename (module-filename name)))
    (if filename
        (let ((port (open-input-file filename)))
          (let lp ((out '()) (form (read port)))
            (if (eof-object? form)
                (reverse out)
                (lp (cons form out) (read port)))))
        '())))

(define (module-export-list sym-name)
  (define (module-form-export-list form)
    (and (pair? form)
         (eq? (car form) 'define-module)
         (equal? (cadr form) sym-name)
         (and=> (memq #:export (cddr form)) cadr)))
  (let lp ((forms (read-module sym-name)))
    (cond ((null? forms) '())
          ((module-form-export-list (car forms)) => identity)
          (else (lp (cdr forms))))))

(define* (module-stexi-documentation sym-name
                                     #:optional (docs-resolver
                                                 (lambda (name def) def)))
  "Return documentation for the module named @var{sym-name}. The
documentation will be formatted as @code{stexi}
 (@pxref{texinfo,texinfo})."
  (let* ((commentary (and=> (module-commentary sym-name)
                            (lambda (x) (string-trim-both x #\newline))))
         (stexi (string->stexi commentary))
         (node-name (module-name->node-name sym-name))
         (name-str (with-output-to-string
                     (lambda () (display sym-name))))
         (module (resolve-interface sym-name))
         (export-list (module-export-list sym-name)))
    (define (anchor-name sym)
      (string-append node-name " " (symbol->string sym)))
    (define (make-defs)
      (sort!
       (module-map
        (lambda (sym var)
          `((anchor (% (name ,(anchor-name sym))))
            ,@((lambda (x)
                 (if (eq? (car x) '*fragment*)
                     (cdr x)
                     (list x)))
               (if (variable-bound? var)
                   (docs-resolver
                    sym
                    (object-stexi-documentation (variable-ref var) sym
                                                #:force #t))
                   (begin
                     (warn "variable unbound!" sym)
                     `(defvar (% (name ,(symbol->string sym)))
                        "[unbound!]"))))))
        module)
       (lambda (a b) (sort-defs export-list a b))))

    `(texinfo (% (title ,name-str))
              (node (% (name ,node-name)))
              (section "Overview")
              ,@(cdr stexi)
              (section "Usage")
              ,@(apply append! (make-defs)))))

(define (script-stexi-documentation scriptpath)
  "Return documentation for given script. The documentation will be
taken from the script's commentary, and will be returned in the
@code{stexi} format (@pxref{texinfo,texinfo})."
  (let ((commentary (file-commentary scriptpath)))
    `(texinfo (% (title ,(basename scriptpath)))
              (node (% (name ,(basename scriptpath))))
              ,@(if commentary
                    (cdr
                     (string->stexi
                      (string-trim-both commentary #\newline)))
                    '()))))

(cond
 ((defined? 'add-value-help-handler!)
  (add-value-help-handler!
   (lambda (name value)
     (stexi->plain-text
      (object-stexi-documentation value name #:force #t))))
  (add-name-help-handler!
   (lambda (name)
    (and (list? name)
         (and-map symbol? name)
         (stexi->plain-text (module-stexi-documentation name)))))))

;; we could be dealing with an old (ice-9 session); fondle it to get
;; module-commentary
(define module-commentary (@@ (ice-9 session) module-commentary))

(define (package-stexi-standard-copying name version updated years
                                        copyright-holder permissions)
  "Create a standard texinfo @code{copying} section.

@var{years} is a list of years (as integers) in which the modules
being documented were released. All other arguments are strings."
  `(copying
    (para "This manual is for " ,name
          " (version " ,version ", updated " ,updated ")")
    (para "Copyright " ,(string-join (map number->string years) ",")
          " " ,copyright-holder)
    (quotation
     (para ,permissions))))

(define (package-stexi-standard-titlepage name version updated authors)
  "Create a standard GNU title page.

@var{authors} is a list of @code{(@var{name} . @var{email})}
pairs. All other arguments are strings.

Here is an example of the usage of this procedure:

@smallexample
 (package-stexi-standard-titlepage
  \"Foolib\"
  \"3.2\"
  \"26 September 2006\"
  '((\"Alyssa P Hacker\" . \"alyssa@@example.com\"))
  '(2004 2005 2006)
  \"Free Software Foundation, Inc.\"
  \"Standard GPL permissions blurb goes here\")
@end smallexample
"
  `(;(setchapternewpage (% (all "odd"))) makes manuals too long
    (titlepage
     (title ,name)
     (subtitle "version " ,version ", updated " ,updated)
     ,@(map (lambda (pair)
              `(author ,(car pair)
                       " (" (email ,(cdr pair)) ")"))
            authors)
     (page)
     (vskip (% (all "0pt plus 1filll")))
     (insertcopying))))

(define (package-stexi-generic-menu name entries)
  "Create a menu from a generic alist of entries, the car of which
should be the node name, and the cdr the description. As an exception,
an entry of @code{#f} will produce a separator."
  (define (make-entry node description)
    `("* " ,node "::"
      ,(make-string (max (- 21 (string-length node)) 2) #\space)
      ,@description "\n"))
  `((ifnottex
     (node (% (name "Top")))
     (top (% (title ,name)))
     (insertcopying)
     (menu
      ,@(apply
         append
         (map
          (lambda (entry)
            (if entry
                (make-entry (car entry) (cdr entry))
                '("\n")))
          entries))))
    (iftex
     (shortcontents))))

(define (package-stexi-standard-menu name modules module-descriptions
                                     extra-entries)
  "Create a standard top node and menu, suitable for processing
by makeinfo."
  (package-stexi-generic-menu
   name
   (let ((module-entries (map cons
                              (map module-name->node-name modules)
                              module-descriptions))
         (separate-sections (lambda (x) (if (null? x) x (cons #f x)))))
     `(,@module-entries
       ,@(separate-sections extra-entries)))))

(define (package-stexi-extended-menu name module-pairs script-pairs
                                     extra-entries)
  "Create an \"extended\" menu, like the standard menu but with a
section for scripts."
  (package-stexi-generic-menu
   name
   (let ((module-entries (map cons
                              (map module-name->node-name
                                   (map car module-pairs))
                              (map cdr module-pairs)))
         (script-entries (map cons
                              (map basename (map car script-pairs))
                              (map cdr script-pairs)))
         (separate-sections (lambda (x) (if (null? x) x (cons #f x)))))
     `(,@module-entries
       ,@(separate-sections script-entries)
       ,@(separate-sections extra-entries)))))

(define (package-stexi-standard-prologue name filename category
                                         description copying titlepage
                                         menu)
  "Create a standard prologue, suitable for later serialization
to texinfo and .info creation with makeinfo.

Returns a list of stexinfo forms suitable for passing to
@code{package-stexi-documentation} as the prologue. @xref{texinfo
reflection package-stexi-documentation}, @ref{texinfo reflection
package-stexi-standard-titlepage,package-stexi-standard-titlepage},
@ref{texinfo reflection
package-stexi-standard-copying,package-stexi-standard-copying},
and @ref{texinfo reflection
package-stexi-standard-menu,package-stexi-standard-menu}."
  `(,copying
    (dircategory (% (category ,category)))
    (direntry
     "* " ,name ": (" ,filename ").  " ,description ".")
    ,@titlepage
    ,@menu))

(define (stexi->chapter stexi)
  (pre-post-order
   stexi
   `((texinfo . ,(lambda (tag attrs node . body)
                   `(,node
                     (chapter ,@(assq-ref (cdr attrs) 'title))
                     ,@body)))
     (*text* . ,(lambda (tag text) text))
     (*default* . ,(lambda args args)))))

(define* (package-stexi-documentation modules name filename
                                      prologue epilogue
                                      #:key
                                      (module-stexi-documentation-args
                                       '())
                                      (scripts '()))
  "Create stexi documentation for a @dfn{package}, where a
package is a set of modules that is released together.

@var{modules} is expected to be a list of module names, where a
module name is a list of symbols. The stexi that is returned will
be titled @var{name} and a texinfo filename of @var{filename}.

@var{prologue} and @var{epilogue} are lists of stexi forms that
will be spliced into the output document before and after the
generated modules documentation, respectively.
@xref{texinfo reflection package-stexi-standard-prologue}, to
create a conventional GNU texinfo prologue.

@var{module-stexi-documentation-args} is an optional argument that, if
given, will be added to the argument list when
@code{module-texi-documentation} is called. For example, it might be
useful to define a @code{#:docs-resolver} argument."
  (define (verify-modules-list l)
    (define (all pred l)
      (and (pred (car l))
           (or (null? (cdr l)) (all pred (cdr l)))))
    (false-if-exception
     (all (lambda (x) (all symbol? x)) modules)))
  (if (not (verify-modules-list modules))
      (error "expected modules to be a list of a list of symbols"
             modules))

  `(texinfo
    (% (title ,name)
       (filename ,filename))
    ,@prologue
    ,@(append-map (lambda (mod)
                    (stexi->chapter
                     (apply module-stexi-documentation
                            mod module-stexi-documentation-args)))
                  modules)
    ,@(append-map (lambda (script)
                    (stexi->chapter
                     (script-stexi-documentation script)))
                  scripts)
    ,@epilogue))

(define* (package-stexi-documentation-for-include modules module-descriptions
                                                  #:key
                                                  (module-stexi-documentation-args '()))
  "Create stexi documentation for a @dfn{package}, where a
package is a set of modules that is released together.

@var{modules} is expected to be a list of module names, where a
module name is a list of symbols. Returns an stexinfo fragment.

Unlike @code{package-stexi-documentation}, this function simply produces
a menu and the module documentations instead of producing a full texinfo
document. This can be useful if you write part of your manual by hand,
and just use @code{@@include} to pull in the automatically generated
parts.

@var{module-stexi-documentation-args} is an optional argument that, if
given, will be added to the argument list when
@code{module-texi-documentation} is called. For example, it might be
useful to define a @code{#:docs-resolver} argument."
  (define (make-entry node description)
    `("* " ,node "::"
      ,(make-string (max (- 21 (string-length node)) 2) #\space)
      ,@description "\n"))
  `(*fragment*
    (menu
     ,@(append-map (lambda (modname desc)
                     (make-entry (module-name->node-name modname)
                                 desc))
                   modules
                   module-descriptions))
    ,@(append-map (lambda (modname)
                    (stexi->chapter
                     (apply module-stexi-documentation
                            modname
                            module-stexi-documentation-args)))
                  modules)))

;;; arch-tag: bbe2bc03-e16d-4a9e-87b9-55225dc9836c


code:
;;;; (texinfo serialize) -- rendering stexinfo as texinfo
;;;;
;;;; 	Copyright (C) 2009  Free Software Foundation, Inc.
;;;;    Copyright (C) 2003,2004,2009  Andy Wingo <wingo at pobox dot com>
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;;;

;;; Commentary:
;;
;;Serialization of @code{stexi} to plain texinfo.
;;
;;; Code:

(define-module (texinfo serialize)
  #:use-module (texinfo)
  #:use-module (texinfo string-utils)
  #:use-module (sxml transform)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-13)
  #:export (stexi->texi))

(define (list-intersperse src-l elem)
  (if (null? src-l) src-l
      (let loop ((l (cdr src-l)) (dest (cons (car src-l) '())))
        (if (null? l) (reverse dest)
            (loop (cdr l) (cons (car l) (cons elem dest)))))))

;; converts improper lists to proper lists.
(define (filter* pred l)
  (let lp ((in l) (out '()))
    (cond ((null? in)
           (reverse! out))
          ((pair? in)
           (lp (cdr in) (if (pred (car in)) (cons (car in) out) out)))
          (else
           (lp '() (if (pred in) (cons in out) out))))))

;; (list* 'a '(b c) 'd '(e f g)) => '(a b c d e f g)
(define (list* . args)
  (let* ((args (reverse args))
         (tail (car args)))
    (let lp ((in (cdr args)) (out tail))
      (cond ((null? in) out)
            ((pair? (car in)) (lp (cdr in) (append (car in) out)))
            ((null? (car in)) (lp (cdr in) out))
            (else (lp (cdr in) (cons (car in) out)))))))

;; Why? Well, because syntax-case defines `include', and carps about its
;; wrong usage below...
(eval-when (eval load compile)
  (define (include exp lp command type formals args accum)
    (list* "\n"
           (list-intersperse
            args
            " ")
           " " command "@" accum)))

(define (empty-command exp lp command type formals args accum)
  (list* " " command "@" accum))

(define (inline-text exp lp command type formals args accum)
  (if (not (string=? command "*braces*")) ;; fixme :(
      (list* "}"
             (append-map (lambda (x) (lp x '())) (reverse (cdr exp)))
             "{" command "@" accum)
      (list* "@}"
             (append-map (lambda (x) (lp x '())) (reverse (cdr exp)))
             "@{" accum)))

(define (inline-args exp lp command type formals args accum)
  (list* "}"
         (if (not args) ""
             (list-intersperse
              (map
               (lambda (x)
                 (cond ((not x) "")
                       ((pair? x)
                        (if (pair? (cdr x))
                            (warn "Strange inline-args!" args))
                        (car x))
                       (else (error "Invalid inline-args" args))))
               (drop-while not
                           (map (lambda (x) (assq-ref args x))
                                (reverse formals))))
              ","))
         "{" command "@" accum))

(define (serialize-text-args lp formals args)
  (apply
   append
   (list-intersperse
    (map (lambda (arg) (append-map (lambda (x) (lp x '())) arg))
         (map
          reverse
          (drop-while
           not (map (lambda (x) (assq-ref args x))
                    (reverse formals)))))
    '(" "))))

(define (eol-text-args exp lp command type formals args accum)
  (list* "\n"
         (serialize-text-args lp formals args)
         " " command "@" accum))

(define (eol-text exp lp command type formals args accum)
  (list* "\n"
         (append-map (lambda (x) (lp x '()))
                     (reverse (if args (cddr exp) (cdr exp))))
         " " command "@" accum))

(define (eol-args exp lp command type formals args accum)
  (list* "\n"
         (list-intersperse
          (apply append
                 (drop-while not
                             (map (lambda (x) (assq-ref args x))
                                  (reverse formals))))
          ", ")
         " " command "@" accum))

(define (environ exp lp command type formals args accum)
  (case (car exp)
    ((texinfo)
     (list* "@bye\n"
            (append-map (lambda (x) (lp x '())) (reverse (cddr exp)))
            "\n@c %**end of header\n\n"
            (reverse (assq-ref args 'title)) "@settitle "
            (or (and=> (assq-ref args 'filename)
                       (lambda (filename)
                         (cons "\n" (reverse (cons "@setfilename " filename)))))
                "")
            "\\input texinfo   @c -*-texinfo-*-\n@c %**start of header\n"
            accum))
    (else
     (list* "\n\n" command "@end "
            (let ((body (append-map (lambda (x) (lp x '()))
                                    (reverse (if args (cddr exp) (cdr exp))))))
              (if (or (null? body)
                      (eqv? (string-ref (car body)
                                        (1- (string-length (car body))))
                            #\newline))
                  body
                  (cons "\n" body)))
            "\n"
            (serialize-text-args lp formals args)
            " " command "@" accum))))

(define (table-environ exp lp command type formals args accum)
  (list* "\n\n" command "@end "
         (append-map (lambda (x) (lp x '()))
                     (reverse (if args (cddr exp) (cdr exp))))
         "\n"
         (let* ((arg (if args (cadar args) ""))) ;; zero or one args
           (if (pair? arg)
               (list (symbol->string (car arg)) "@")
               arg))
         " " command "@" accum))

(define (wrap strings)
  (fill-string (string-concatenate strings)
               #:line-width 72))

(define (paragraph exp lp command type formals args accum)
  (list* "\n\n"
         (wrap
          (reverse
           (append-map (lambda (x) (lp x '())) (reverse (cdr exp)))))
         accum))

(define (item exp lp command type formals args accum)
  (list* (append-map (lambda (x) (lp x '())) (reverse (cdr exp)))
         "@item\n"
         accum))

(define (entry exp lp command type formals args accum)
  (list* (append-map (lambda (x) (lp x '())) (reverse (cddr exp)))
         "\n"
         (append-map (lambda (x) (lp x '())) (reverse (cdar args)))
         "@item "
         accum))

(define (fragment exp lp command type formals args accum)
  (list* "\n@c %end of fragment\n"
         (append-map (lambda (x) (lp x '())) (reverse (cdr exp)))
         "\n@c %start of fragment\n\n"
         accum))

(define serializers
  `((EMPTY-COMMAND . ,empty-command)
    (INLINE-TEXT . ,inline-text)
    (INLINE-ARGS . ,inline-args)
    (EOL-TEXT . ,eol-text)
    (EOL-TEXT-ARGS . ,eol-text-args)
    (INDEX . ,eol-text-args)
    (EOL-ARGS . ,eol-args)
    (ENVIRON . ,environ)
    (TABLE-ENVIRON . ,table-environ)
    (ENTRY . ,entry)
    (ITEM . ,item)
    (PARAGRAPH . ,paragraph)
    (FRAGMENT . ,fragment)
    (#f . ,include))) ; support writing include statements

(define (serialize exp lp command type formals args accum)
  ((or (assq-ref serializers type)
       (error "Unknown command type" exp type))
   exp lp command type formals args accum))

(define escaped-chars '(#\} #\{ #\@))
(define (escape str)
  "Escapes any illegal texinfo characters (currently @{, @}, and @@)."
  (let loop ((in (string->list str)) (out '()))
    (if (null? in)
        (apply string (reverse out))
        (if (memq (car in) escaped-chars)
            (loop (cdr in) (cons* (car in) #\@ out))
            (loop (cdr in) (cons (car in) out))))))

(define (stexi->texi tree)
  "Serialize the stexi @var{tree} into plain texinfo."
  (string-concatenate-reverse
   (let lp ((in tree) (out '()))
     (cond
      ((or (not in) (null? in)) out)
      ((string? in) (cons (escape in) out))
      ((pair? in)
       (let ((command-spec (assq (car in) texi-command-specs)))
         (if (not command-spec)
             (begin
               (warn "Unknown stexi command, not rendering" in)
               out)
             (serialize in
                        lp
                        (symbol->string (car in))
                        (cadr command-spec)
                        (filter* symbol? (cddr command-spec))
                        (cond
                         ((and (pair? (cdr in)) (pair? (cadr in))
                               (eq? (caadr in) '%))
                          (cdadr in))
                         ((not (cadr command-spec))
                          ;; include
                          (cdr in))
                         (else
                          #f))
                        out))))
      (else
       (error "Invalid stexi" in))))))

;;; arch-tag: d3fa16ea-0bf7-4ec5-ab9f-3f08490f77f5

license: mit


code:
;;;; (texinfo string-utils) -- text filling and wrapping
;;;;
;;;;    Copyright (C) 2009  Free Software Foundation, Inc.
;;;;    Copyright (C) 2003  Richard Todd
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;;;

;;; Commentary:
;; Module @samp{(texinfo string-utils)} provides various string-related
;; functions useful to Guile's texinfo support.
;;; Code:

(define-module (texinfo string-utils)
  #:use-module (srfi srfi-13)
  #:use-module (srfi srfi-14)
  #:use-module (oop goops)
  #:export (escape-special-chars
            transform-string
            expand-tabs
            center-string
            left-justify-string
            right-justify-string
            collapse-repeated-chars
            make-text-wrapper
            fill-string
            string->wrapped-lines))

(define* (transform-string str match? replace #:optional (start #f) (end #f))
"Uses @var{match?} against each character in @var{str}, and performs a
replacement on each character for which matches are found.

@var{match?} may either be a function, a character, a string, or
@code{#t}.  If @var{match?}  is a function, then it takes a single
character as input, and should return @samp{#t} for matches.
@var{match?} is a character, it is compared to each string character
using @code{char=?}.  If @var{match?} is a string, then any character
in that string will be considered a match.  @code{#t} will cause
every character to be a match.

If @var{replace} is a function, it is called with the matched
character as an argument, and the returned value is sent to the output
string via @samp{display}.  If @var{replace} is anything else, it is
sent through the output string via @samp{display}.

Note that te replacement for the matched characters does not need to
be a single character.  That is what differentiates this function from
@samp{string-map}, and what makes it useful for applications such as
converting @samp{#\\&} to @samp{\"&\"} in web page text.  Some other
functions in this module are just wrappers around common uses of
@samp{transform-string}.  Transformations not possible with this
function should probably be done with regular expressions.

If @var{start} and @var{end} are given, they control which portion
of the string undergoes transformation.  The entire input string
is still output, though.  So, if @var{start} is @samp{5}, then the
first five characters of @var{str} will still appear in the returned
string.

@lisp
; these two are equivalent...
 (transform-string str #\\space #\\-) ; change all spaces to -'s
 (transform-string str (lambda (c) (char=? #\\space c)) #\\-)
@end lisp"
  ;;  I had implemented this with string-fold, but it was
  ;; slower...
  (let* ((os (open-output-string))
         (matcher (cond ((char? match?)
                         (lambda (c) (char=? match? c)))
                        ((procedure? match?)
                         match?)
                        ((string? match?)
                         (lambda (c) (string-index match? c)))
                        ((boolean? match?)
                         (lambda (c) match?))
                        (else (throw 'bad-type "expected #t, char, string, or procedure"))))
         (replacer (if (procedure? replace)
                       (lambda (c) (display (replace c) os))
                       (lambda (c) (display replace os)))))

    ;; put the first part in, un-transformed if they asked for it...
    (if (and start (<= start (string-length str)))
        (display (substring str 0 start) os))

    ;; process the portion they want processed....
    (string-for-each
     (lambda (c)
       (if (matcher c)
           ;; we have a match! replace the char as directed...
           (replacer c)

           ;; not a match, just insert the character itself...
           (write-char c os)))
     str
     (or start 0)
     (or end (string-length str)))

    ;; if there was any at the end, tack it on...
    (if (and end (< end (string-length str)))
        (display (substring str end) os))

    (get-output-string os)))

(define* (expand-tabs str #:optional (tab-size 8))
"Returns a copy of @var{str} with all tabs expanded to spaces.  @var{tab-size} defaults to 8.

Assuming tab size of 8, this is equivalent to: @lisp
 (transform-string str #\\tab \"        \")
@end lisp"
  (transform-string str
                    #\tab
                    (make-string tab-size #\space)))

(define (escape-special-chars str special-chars escape-char)
"Returns a copy of @var{str} with all given special characters preceded
by the given @var{escape-char}.

@var{special-chars} can either be a single character, or a string consisting
of all the special characters.

@lisp
;; make a string regexp-safe...
 (escape-special-chars \"***(Example String)***\"
                      \"[]()/*.\"
                      #\\\\)
=> \"\\\\*\\\\*\\\\*\\\\(Example String\\\\)\\\\*\\\\*\\\\*\"

;; also can escape a singe char...
 (escape-special-chars \"richardt@@vzavenue.net\"
                      #\\@@
                      #\\@@)
=> \"richardt@@@@vzavenue.net\"
@end lisp"
  (transform-string str
                    (if (char? special-chars)
                        ;; if they gave us a char, use char=?
                        (lambda (c) (char=? c special-chars))

                        ;; if they gave us a string, see if our character is in it
                        (lambda (c) (string-index special-chars c)))

                    ;; replace matches with the character preceded by the escape character
                    (lambda (c) (string escape-char c))))

(define* (center-string str #:optional (width 80) (chr #\space) (rchr #f))
"Returns a copy of @var{str} centered in a field of @var{width}
characters.  Any needed padding is done by character @var{chr}, which
defaults to @samp{#\\space}.  If @var{rchr} is provided, then the
padding to the right will use it instead.  See the examples below.
left and @var{rchr} on the right.  The default @var{width} is 80.  The
default @var{lchr} and @var{rchr} is @samp{#\\space}.  The string is
never truncated.
@lisp
 (center-string \"Richard Todd\" 24)
=> \"      Richard Todd      \"

 (center-string \" Richard Todd \" 24 #\\=)
=> \"===== Richard Todd =====\"

 (center-string \" Richard Todd \" 24 #\\< #\\>)
=> \"<<<<< Richard Todd >>>>>\"
@end lisp"
  (let* ((len (string-length str))
         (lpad (make-string (max (quotient (- width len) 2) 0) chr))
         ;; right-char == char unless it has been provided by the user
         (right-chr (or rchr chr))
         (rpad (if (char=? right-chr chr)
                   lpad
                   (make-string (max (quotient (- width len) 2) 0) right-chr))))
    (if (>= len width)
        str
        (string-append lpad str rpad (if (odd? (- width len)) (string right-chr) "")))))

(define* (left-justify-string str #:optional (width 80) (chr #\space))
"@code{left-justify-string str [width chr]}.
Returns a copy of @var{str} padded with @var{chr} such that it is left
justified in a field of @var{width} characters.  The default
@var{width} is 80.  Unlike @samp{string-pad} from srfi-13, the string
is never truncated."
  (let* ((len (string-length str))
         (pad (make-string (max (- width len) 0) chr)))
    (if (>= len width)
        str
        (string-append str pad))))

(define* (right-justify-string str #:optional (width 80) (chr #\space))
"Returns a copy of @var{str} padded with @var{chr} such that it is
right justified in a field of @var{width} characters.  The default
@var{width} is 80.  The default @var{chr} is @samp{#\\space}.  Unlike
@samp{string-pad} from srfi-13, the string is never truncated."
  (let* ((len (string-length str))
         (pad (make-string (max (- width len) 0) chr)))
    (if (>= len width)
        str
        (string-append pad str))))

 (define* (collapse-repeated-chars str #:optional (chr #\space) (num 1))
"Returns a copy of @var{str} with all repeated instances of
@var{chr} collapsed down to at most @var{num} instances.
The default value for @var{chr} is @samp{#\\space}, and
the default value for @var{num} is 1.

@lisp
 (collapse-repeated-chars \"H  e  l  l  o\")
=> \"H e l l o\"
 (collapse-repeated-chars \"H--e--l--l--o\" #\\-)
=> \"H-e-l-l-o\"
 (collapse-repeated-chars \"H-e--l---l----o\" #\\- 2)
=> \"H-e--l--l--o\"
@end lisp"
   ;; define repeat-locator as a stateful match? function which remembers
   ;; the last character it had seen.
   (let ((repeat-locator
          ;; initialize prev-chr to something other than what we're seeking...
          (let ((prev-chr (if (char=? chr #\space) #\A #\space))
                (match-count 0))
            (lambda (c)
              (if (and (char=? c prev-chr)
                       (char=? prev-chr chr))
                  ;; found enough duplicates if the match-count is high enough
                  (begin
                    (set! match-count (+ 1 match-count))
                    (>= match-count num))

                  ;; did not find a duplicate
                  (begin (set! match-count 0)
                         (set! prev-chr c)
                         #f))))))

     ;; transform the string with our stateful matcher...
     ;; deleting matches...
     (transform-string str repeat-locator "")))

;; split a text string into segments that have the form...
;;  <ws non-ws>  <ws non-ws> etc..
(define (split-by-single-words str)
  (let ((non-wschars (char-set-complement char-set:whitespace)))
    (let loop ((ans '())
               (index 0))
      (let ((next-non-ws (string-index str non-wschars index)))
        (if next-non-ws
          ;; found non-ws...look for ws following...
          (let ((next-ws (string-index str char-set:whitespace next-non-ws)))
            (if next-ws
                ;; found the ws following...
                (loop (cons (substring str index next-ws) ans)
                      next-ws)
                ;; did not find ws...must be the end...
                (reverse (cons (substring str index) ans))))
          ;; did not find non-ws... only ws at end of the string...
          (reverse ans))))))

(define* (make-text-wrapper #:key
                            (line-width 80)
                            (expand-tabs? #t)
                            (tab-width 8)
                            (collapse-whitespace? #t)
                            (subsequent-indent "")
                            (initial-indent "")
                            (break-long-words? #t))
  "Returns a procedure that will split a string into lines according to the
given parameters.

@table @code
@item #:line-width
This is the target length used when deciding where to wrap lines.
Default is 80.

@item #:expand-tabs?
Boolean describing whether tabs in the input should be expanded. Default
is #t.

@item #:tab-width
If tabs are expanded, this will be the number of spaces to which they
expand. Default is 8.

@item #:collapse-whitespace?
Boolean describing whether the whitespace inside the existing text
should be removed or not.  Default is #t.

If text is already well-formatted, and is just being wrapped to fit in a
different width, then set this to @samp{#f}. This way, many common text
conventions (such as two spaces between sentences) can be preserved if
in the original text. If the input text spacing cannot be trusted, then
leave this setting at the default, and all repeated whitespace will be
collapsed down to a single space.

@item #:initial-indent
Defines a string that will be put in front of the first line of wrapped
text. Default is the empty string, ``''.

@item #:subsequent-indent
Defines a string that will be put in front of all lines of wrapped
text, except the first one.  Default is the empty string, ``''.

@item #:break-long-words?
If a single word is too big to fit on a line, this setting tells the
wrapper what to do.  Defaults to #t, which will break up long words.
When set to #f, the line will be allowed, even though it is longer
than the defined @code{#:line-width}.
@end table

The return value is a procedure of one argument, the input string, which
returns a list of strings, where each element of the list is one line."
  (lambda (str)
    ;; replace newlines with spaces
    (set! str (transform-string str (lambda (c) (char=? c #\nl)) #\space))

    ;; expand tabs if they wanted us to...
    (if expand-tabs?
        (set! str (expand-tabs str tab-width)))

    ;; collapse whitespace if they wanted us to...
    (if collapse-whitespace?
        (set! str (collapse-repeated-chars str)))

    ;; drop any whitespace from the front...
    (set! str (string-trim str))

    ;; now start breaking the text into lines...
    (let loop ((ans '())
               (words (split-by-single-words str))
               (line initial-indent)
               (count 0))
      (if (null? words)
          ;; out of words? ...done!
          (reverse (if (> count 0)
                       (cons line ans)
                       ans))

          ;; not out of words...keep going...
          (let ((length-left (- line-width
                                (string-length line)))
                (next-word (if (= count 0)
                               (string-trim (car words))
                               (car words))))
            (cond
             ;; does the next entry fit?
             ((<= (string-length next-word)
                  length-left)
              (loop ans
                    (cdr words)
                    (string-append line next-word)
                    (+ count 1)))

             ;; ok, it didn't fit...is there already at least one word on the line?
             ((> count 0)
              ;; try to use it for the next line, then...
              (loop (cons line ans)
                    words
                    subsequent-indent
                    0))

             ;; ok, it didn't fit...and it's the first word.
             ;; were we told to break up long words?
             (break-long-words?
              ;; break the like at the limit, since the user wants us to...
              (loop (cons (string-append line (substring next-word 0 length-left))
                          ans)
                    (cons (substring next-word length-left)
                          (cdr words))
                    subsequent-indent
                    0))

             ;; well, then is it the first word and we *shouldn't* break long words, then...
             (else
              (loop (cons (string-append line next-word)
                          ans)
                    (cdr words)
                    subsequent-indent
                    0))))))))

(define (string->wrapped-lines str . kwargs)
  "@code{string->wrapped-lines str keywds ...}. Wraps the text given in
string @var{str} according to the parameters provided in @var{keywds},
or the default setting if they are not given. Returns a list of strings
representing the formatted lines. Valid keyword arguments are discussed
in @code{make-text-wrapper}."
  ((apply make-text-wrapper kwargs) str))

(define (fill-string str . kwargs)
  "Wraps the text given in string @var{str} according to the parameters
provided in @var{keywds}, or the default setting if they are not
given.  Returns a single string with the wrapped text.  Valid keyword
arguments are discussed in @code{make-text-wrapper}."
  (string-join (apply string->wrapped-lines str kwargs)
               "\n"
               'infix))


code:
2008-08-30  Julian Graham <joolean@gmail.com>

       * srfi-18.scm: Raise error if Guile not built with threading
       support.

2008-08-25  Ludovic Courtès  <ludo@gnu.org>

	* Makefile.am (AM_CFLAGS): New.

2008-06-28  Ludovic Courtès  <ludo@gnu.org>

	* Makefile.am (INCLUDES): Renamed to...
	(AM_CPPFLAGS): this, to match current Automake conventions.

	* srfi-19.scm (priv:read-tai-utc-data): Use `eof-object?'
	instead of comparing LINE with `eof'.

2008-05-15  Julian Graham  <joolean@gmail.com>

	* srfi-18.scm: New file.

2008-04-28  Ludovic Courtès  <ludo@gnu.org>

	* srfi-1.c (scm_srfi1_partition): Properly type-check LIST.
	Reported by Julian Graham <joolean@gmail.com>.

2008-04-27  Ludovic Courtès  <ludo@gnu.org>

	* srfi-1.c: Include <config.h>.

2008-04-26  Ludovic Courtès  <ludo@gnu.org>

	* srfi-35.scm: Provide `srfi-35' through `cond-expand-provide'.

2008-04-26  Ludovic Courtès  <ludo@gnu.org>

	* Makefile.am (srfi_DATA): Add `srfi-88.scm'.
	* srfi-88.scm: New file.

2008-03-12  Ludovic Courtès  <ludo@gnu.org>

	* srfi-37.scm (args-fold)[short-option]: Set ARGS to `(cdr
	args)' before calling `next-arg'.  This fixes parsing of
	argument-less options when using short names.

2008-01-22  Neil Jerram  <neil@ossau.uklinux.net>

	* srfi-39.scm: Update copyright statement to LGPL.

2007-12-13  Stephen Compall  <s11@member.fsf.org>

	* srfi-69.scm (without-keyword-args): Use `cdr' instead of
	`rest'.

2007-12-03  Stephen Compall  <s11@member.fsf.org>

	* srfi-69.scm: New file.
	* Makefile.am: Add it.

2007-09-10  Ludovic Courtès  <ludo@gnu.org>

	* srfi-35.scm (make-compound-condition-type): When PARENTS
	contains only one element, return its car.  This improves the
	output of `print-condition' for non-compound conditions returned
	by `make-compound-condition'.

2007-08-11  Ludovic Courtès  <ludo@gnu.org>

	* srfi-35.scm: New file.
	* Makefile.am (srfi_DATA): Added `srfi-35.scm'.

2007-07-29  Ludovic Courtès  <ludo@gnu.org>

	* Makefile.am (INCLUDES): Added Gnulib includes.
	(libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD):
	Added `../lib/libgnu.la'.
	(libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD):
	Likewise.
	(libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD):
	Likewise.
	(libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD):
	Likewise.

2007-07-18  Stephen Compall  <s11@member.fsf.org>

	* srfi-37.scm: New file.
	* Makefile.am: Add it.

2007-07-09  Ludovic Courtès  <ludo@gnu.org>

	* srfi-19.scm (date->julian-day): Take OFFSET into account.
	Patch by Jon Wilson <j85wilson@fastmail.fm>.

2007-05-09  Ludovic Courtès  <ludo@chbouib.org>

	* srfi-19.scm (priv:current-time-process): Removed shadowing
	definition that returned a list.  Use the right argument order to
	`make-time'.  Reported by Scott Shedden.

2007-02-04  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* srfi/srfi-19.scm (priv:locale-abbr-weekday): Add one to the day
	number before invoking `locale-day-short'.  Failing to do so
	resulted in days shifted by one in the result of `date->string',
	or in the failure of `date->string' when the day is zero.
	(priv:locale-long-weekday): Likewise.

2007-01-31  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* srfi-19.scm: Use `(ice-9 i18n)'.
	(priv:locale-abbr-weekday-vector, priv:locale-long-weekday-vector,
	priv:locale-abbr-month-vector, priv:locale-long-month-vector):
	Removed.
	(priv:locale-number-separator, priv:locale-pm, priv:locale-am,
	priv:locale-abbr-weekday, priv:locale-long-weekday,
	priv:locale-abbr-month, priv:locale-long-month): Aliases for their
	respective `(ice-9 i18n)' equivalent.
	(priv:vector-find): Removed, replaced by...
	(priv:date-reverse-lookup): New procedure.  Updated callers.
	(priv:locale-am/pm): Use `priv:locale-pm' and `priv:locale-am' as
	procedures.
	(priv:directives): Use `priv:locale-number-separator' as a
	procedure.

2006-12-02  Kevin Ryde  <user42@zip.com.au>

	* srfi-60.c (scm_srfi60_copy_bit): Should be long not int for fixnum
	bitshift, fixes 64-bit systems setting a bit between 32 and 63.
	Reported by Aaron M. Ucko, Debian bug 396119.

2006-05-28  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (append-reverse, append-reverse!):
	Rewrite in C.

2006-05-20  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c (scm_srfi1_assoc): Correction to comparison procedure
	argument order, SRFI-1 specifies given key is first.

2006-02-06  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.scm, srfi-60.scm: Updated versions in library name to
	match GUILE-VERSION.

2006-02-04  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c (scm_srfi1_delete, scm_srfi1_delete_duplicates): Use a
	count to protect against nasty code in the equality procedure changing
	the lists we're working on.  The results don't have to be sensible in
	that case, just not hang or access non-cells.

	* srfi-60.c (booleans->integer): Avoid newline in macro, it breaks the
	snarfer.

2005-11-24  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (lset-difference!): Rewrite in C.

2005-08-19  Kevin Ryde  <user42@zip.com.au>

	* srfi-19.scm (priv:leap-second-table): Add new 2005 leap second.

2005-08-12  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.c: Use scm_is_null instead of SCM_NULLP.  Thanks to
	Peter Gavin!

2005-08-01  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.c (check_map_args): Move check_map_error label and elt
	variable outside of loop scope so that we do not jump past the
	initialization of elt.

2005-06-12  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.c: Do not use INUM macros, they are deprecated.

2005-05-07  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (car+cdr, fold, last, list-index,
	list-tabulate, not-pair, xcons): Rewrite in C.

2005-05-04  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (break, break!, drop-right!,
	drop-while, eighth, fifth, lset-adjoin, ninth, reduce, reduce-right,
	seventh, sixth, span, span!, take!, take-while, take-while!, tenth):
	Rewrite in C.

2005-04-23  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c (scm_srfi1_count, scm_srfi1_filter_map): Don't modify the
	rest argument, that belongs to the caller when reached from apply.
	Use a temp vector like scm_srfi1_for_each.

2005-04-04  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c, srfi-1.h (scm_srfi1_concatenate, scm_srfi1_concatenate_x):
	Add code to check argument is a list, scm_append and scm_append_x
	don't do that on their "rest" list (in a normal build).

2005-04-02  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c (scm_srfi1_count): Use scm_list_copy to make arg list,
	instead of an inline loop.  Share final list check between all cases
	to save some code.

	* srfi-1.c (scm_srfi1_filter_map): Have 2-arg case share finalization
	code of 1-arg case.

	* srfi-1.scm (alist-cons): Define just as acons, not a call to acons.

	* srfi-1.scm, srfi-1.c, srfi-1.h (alist-copy): Rewrite in C.

	* srfi-1.scm (lset-union): Rewrite to accumulate result by consing in
	the order specified by the SRFI.

2005-03-29  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-60.c: Replaced SCM_INUMP with SCM_I_INUMP and SCM_INUM with
	SCM_I_INUM throughout.

2005-03-26  Marius Vollmer  <mvo@zagadka.de>

	* Makefile.am (srfiinclude_HEADERS): Added srfi-60.h.

2005-03-18  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (filter-map): Rewrite in C.

2005-03-16  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (drop-right, partition!, remove!,
	split-at, split-at!, take-right): Rewrite in C.  remove! derived from
	core filter!.

2005-03-14  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm, srfi-1.c, srfi-1.h (find, find-tail): Rewrite in C.

2005-03-13  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (lset-union): Call `=' procedure with args in the order
	specified by the SRFI.

	* srfi-60.scm, srfi-60.c, srfi-60.h: New files.
	* Makefile.am: Add them.

2005-03-02  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-1.c: Use scm_is_pair instead of SCM_CONSP; use scm_is_null
	instead of SCM_NULLP.

2005-02-18  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (lset-adjoin): Revert change using `list' not `acc', the
	spec is not quite clear, but reference code uses acc, so do that.

2005-02-12  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (reduce, reduce-right): Don't call f with ridentity, use
	it only if lst is empty, per srfi and intended optimization reduce
	represents over fold.

2005-02-04  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (list=): Correction to arguments passed to given elt=,
	spec is (elt= e[i] e[i+1]) for lists i and i+1, previously the first
	arg was always from list 0 not list i.

2005-01-29  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (lset-adjoin): Actually use the given `=' procedure.
	Test membership only on the given `list', not `acc', as per the spec.

	* srfi-1.c, srfi-1.scm (remove): Rewrite in C, a trivial adaption from
	scm_filter in the core.
	* srfi-1.scm (remove!): Use filter!.

2005-01-28  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (lset=): Correction to pred call arg order, srfi spec is
	(= e[i] e[i+1]), but had some calls the other way around.

2005-01-24  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c (scm_srfi1_member): Correction to pred call arg order, srfi
	spec is (PRED X elem).  Update docstring from manual.

	* srfi-1.scm (lset=): Allow no list arguments, per srfi spec example.

2005-01-18  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm: Remove (ice-9 session) and (ice-9 receive), not used.

2005-01-12  Kevin Ryde  <user42@zip.com.au>

	* srfi-39.scm (current-input-port, current-output-port): Parameter
	replacements for core functions, per SRFI spec.
	(current-error-port): The same, for consistency.

2005-01-10  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.c (check_args): Bugfix to change from 2005-01-02: ARGV is
	the vector to check, not ARGS.

2005-01-02  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.c: Use new vector elements API or simple vector API, as
	appropriate.

2005-01-02  Kevin Ryde  <user42@zip.com.au>

	* Makefile.am (srfi_DATA): Add srfi-39.scm.

2004-12-20  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* README: Update, document available SRFIs.

2004-12-06  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (alist-copy, alist-delete, break, span): Change to
	tail-recursive forms.

	* srfi-1.scm (alist-delete): Correction to equality proc call argument
	order, spec is for given KEY param first.

2004-12-05  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (filter-map): Change to a tail-recursive form.
	(append-map, append-map!): Rewrite as simple "concatenate map" forms,
	for tail recursiveness.

2004-10-26  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-4.scm, srfi-4.h, srfi-4.c: Moved content into core; only
	the skeletons remains.

2004-10-22  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-4.c (print_int64, print_uint64): Removed.
	(uvec_print): Use scm_intprint for signed elemets and
	scm_uintprint for unsigned ones.  Do not use print_int64 and
	print_uint64 since scm_intprint and scm_Uintprint can handle 64
	bits now.

2004-09-03  Stefan Jahn  <stefan@lkcc.org>

	* srfi-1.c, srfi-1.h: Renamed any 'lst1' into 'list1' because
	lst1 is a #define on Win32 systems.

2004-08-26  Kevin Ryde  <user42@zip.com.au>

	* srfi-31.scm (rec): Add missing `error' to else clause.

2004-08-26  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* Makefile.am: Added appropriate @LIBGUILE_*_MAJOR@ substitutions
	to the library names.
	* srfi-1.scm, srfi-4.scm: Use the new library names with
	load-extension.

2004-08-25  Marius Vollmer  <mvo@zagadka.de>

	SRFI-13 and SRFI-14 have been moved into the core.

	* srfi-13.scm, srfi-14.scm: Simply re-export the relevant
	bindings.

	* srfi-13.h, srfi-13.c, srfi-14.h, srfi-14.c: Removed all real
	content except for the init functions.

2004-08-19  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-13.h, srfi-13.c: (scm_substring_shared): Renamed to
	scm_substring_sharedS.

	* srfi-14.c, srfi-13.c: Adapted to new internal string and symbol
	API.

	* srfi-13.scm (substring/shared): Export as replacement since we
	now have a version in the core.

2004-08-15  Marius Vollmer  <mvo@zagadka.de>

	* srfi-39.scm: New, from Jose A Ortega Ruiz.  Thanks!

2004-08-14  Kevin Ryde  <user42@zip.com.au>

	* srfi-13.c (scm_string_any, scm_string_every): Add support for char
	and charset as predicates, per SRFI-13 spec.

2004-08-12  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-13.c (MY_VALIDATE_SUBSTRING_SPEC_COPY,
	MY_VALIDATE_STRING_COPY): Modernized clones of the deprecated
	validation macros.  Replaced every use.

2004-08-05  Kevin Ryde  <user42@zip.com.au>

	* srfi-13.c (scm_string_any, scm_string_every): Enhance docstrings as
	per doc/ref/srfi-modules.texi.

2004-08-02  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-4.c: Replaced scm_num2* and scm_*2num with scm_to_* and
	scm_from_*, respectively.
	(print_int64, print_uint64): Rewritten by just calling scm_iprin1
	on a SCM.

2004-08-02  Kevin Ryde  <user42@zip.com.au>

	* srfi-13.c (scm_string_every): Correction to initial "res" value,
	return should be #t for an empty string.  Reported by Andreas Vögele.

2004-07-10  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-13.c, srfi-14.c, srfi-4.c: Changed all uses of
	SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY, SCM_VALIDATE_BIGINT,
	SCM_VALIDATE_INUM_MIN, SCM_VALIDATE_INUM_MIN_COPY,
	SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
	SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
	SCM_VALIDATE_INUM_RANGE_COPY to scm_to_size_t or similar.

2004-07-06  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-1.c, srfi-13.c, srfi-14.c, srfi-4.c: Replaced all uses of
	deprecated SCM_FALSEP, SCM_NFALSEP, SCM_BOOL, SCM_NEGATE_BOOL, and
	SCM_BOOLP with scm_is_false, scm_is_true, scm_from_bool, and
	scm_is_bool, respectively.

2004-07-05  Kevin Ryde  <user42@zip.com.au>

	* srfi-4.c (uvec_sizes): Add "const".

	* srfi-31.scm: Correction to heading comment.

2004-06-20  Rob Browning  <rlb@defaultvalue.org>

	* srfi-4.c: fix #ifdef checks for 64-bit types; should be #if.
	Add separate symmetric test for SCM_HAVE_T_UINT64 in one case.
	(uvec_print): rewrite using a union to make more
	compact, and use static print_uint64 and print_int64 to print
	64-bit elements.
	(print_int64): new static function (temporary fix).
	(print_uint64): new static function (temporary fix).

	* Makefile.am (srfi_DATA): add srfi-31.scm.

	* srfi-31.scm: new file.

2004-04-24  Dirk Herrmann  <dirk@dirk-herrmanns-seiten.de>

	* srfi-17.scm (setter, car, cdr etc.): When within one define
	expression a new variable in the local module is defined in terms
	of an equally named variable from some other module, use @ to
	refer to the variable in the other module.  This is necessary due
	to section 5.2.1 of R5RS: In a define expression first the new
	binding is created and then the expression is evaluated.

2004-04-24  Kevin Ryde  <user42@zip.com.au>

	* srfi-11.scm (let-values): Use make-symbol rather than gensym, for
	guaranteed uniqueness of temp variable symbols.

2004-04-15  Kevin Ryde  <user42@zip.com.au>

	* srfi-13.c (scm_string_trim, scm_string_trim_right,
	scm_string_trim_both): Cast to unsigned char for isspace.

2004-04-06  Han-Wen Nienhuys   <hanwen@xs4all.nl>

	* srfi-13.c (s_scm_string_map): convert character to unsigned char
	before converting to unsigned int. This prevents hi-bit ascii as
	being converted large integers.
	(string_upcase_x): change caller for scm_{up,down}case to
	scm_c_{up,down}case

2004-03-23  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (circular-list): Rewrite using set-cdr!, no need to copy
	parameter list.

2004-02-08  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* Makefile.am (TAGS_FILES): Use this variable instead of
	ETAGS_ARGS so that TAGS can be built using separate build
	directory.

2004-01-24  Marius Vollmer  <mvo@zagadka.de>

	* Makefile.am (srfi_DATA): Added srfi-26.scm.

2004-01-21  Marius Vollmer  <m.vollmer@ping.de>

	* srfi-26.scm: New, from Daniel Skarda.  Thanks!

2003-12-03  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c, srfi-1.h, srfi-1.scm (count): Rewrite in C, avoiding
	non-tail recursion.

	* srfi-1.scm (map!): Define as an alias for map, previous definition
	was not tail-recursive.

2003-08-23  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c, srfi-1.h, srfi-1.scm (list-copy): New function, derived
	from core list-copy but allowing improper lists, per SRFI-1 spec.

	* srfi-19.scm (date-week-number): Correction, day of week starting
	week applied was off by one.

2003-07-29  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c, srfi-1.scm (concatenate, concatenate!): Use scm_append and
	scm_append_x.

	* srfi-1.c, srfi-1.h, srfi-1.scm (length+): Rewrite using scm_ilength.

	* srfi-34.scm: Add cond-expand-provide srfi-34.

2003-07-14  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

	* srfi-1.c, srfi-1.h (scm_srfi1_partition), srfi-1.scm (partition):
	Re-implement in C to avoid stack overflows for long input lists.

2003-07-08  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.c, srfi-1.h (scm_srfi1_delete, scm_srfi1_delete_x,
	scm_srfi1_delete_duplicates, scm_srfi1_delete_duplicates_x): New
	functions.  scm_srfi1_delete_x is derived from scm_delete_x.
	* srfi-1.scm (delete, delete!, delete-duplicates, delete-duplicates!):
	Remove.

2003-06-07  Kevin Ryde  <user42@zip.com.au>

	* srfi-6.scm: #:re-export open-input-string, open-output-string and
	get-output-string, for the benefit of applications wanting to use
	#:select on the module.

2003-05-29  Stefan Jahn  <stefan@lkcc.org>

	* Makefile.am (libguile_srfi_srfi_1_la_LDFLAGS,
	libguile_srfi_srfi_4_la_LDFLAGS,
	libguile_srfi_srfi_13_14__la_LDFLAGS): Added the -no-undefined
	option for the mingw32 build.

2003-05-13  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (delete): Fix predicate arg order to match srfi-1 spec.

2003-05-10  Kevin Ryde  <user42@zip.com.au>

	* srfi-1.scm (take): Make this an alias for list-head.
	(drop): Make this an alias for list-tail.

2003-04-30  Neil Jerram  <neil@ossau.uklinux.net>

	* srfi-34.scm: New file.

2003-04-23  Marius Vollmer  <mvo@zagadka.de>

	* srfi-1.scm: Removed stray "o" from exports list.

2003-04-21  Dirk Herrmann  <D.Herrmann@tu-bs.de>

	* srfi-1.c (srfi1_ilength): Prefer !SCM_CONSP over SCM_NCONSP.
	Now, guile itself does not include any calls to SCM_NCONSP any
	more.

2003-04-05  Marius Vollmer  <mvo@zagadka.de>

        * Changed license terms to the plain LGPL thru-out.

2003-03-25  Rob Browning  <rlb@defaultvalue.org>

	* srfi-4.c: replace typedefs for basic types with typedefs using
	new standard int types (i.e. scm_t_uint8, etc.) -- should probably
	remove typedefs altogether later.

2003-03-24  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* srfi-1.scm: Re-export all srfi-1 bindings implemented by the
	core.  (Thanks to Kevin Ryde.)

2003-03-12  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* srfi-13.scm: Mark replacements.

	* srfi-17.scm: Mark replacements.

2003-03-11  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* srfi-1.scm (iota, map, for-each, map-in-order, list-index,
	member, delete, delete!, assoc): Marked as replacements.
	(filter, filter!): Removed.  (Now implemented in the core.)

2003-03-06  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* srfi-1.c (scm_init_srfi_1): Extend root module map and for-each
	with the versions in this module using
	scm_c_extend_primitive_generic.

2003-02-03  Mikael Djurfeldt  <djurfeldt@nada.kth.se>

	* srfi-1.c (srfi1_for_each): Corrected argument checking for the
	case of two argument lists.  (Thanks to Kevin Ryde.)

2002-12-08  Rob Browning  <rlb@defaultvalue.org>

	* Makefile.am (srfidir): VERSION -> GUILE_EFFECTIVE_VERSION.

2002-12-02  Marius Vollmer  <mvo@zagadka.ping.de>

	* Makefile.am (srfiinclude_HEADERS): Added srfi-1.h.

2002-12-01  Mikael Djurfeldt  <mdj@linnaeus>

	* srfi-1.scm: Load srfi-1 extension.
	(map, map-in-order, for-each, member, assoc): Replaced by
	primitives in srfi-1.c.
	(map1): Defined as `map'.

	* Makefile.am: Added rules for srfi-1.c.

	* srfi-1.c, srfi-1.h: New files.

2002-05-06  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-13.c (scm_string_tokenize): Instead of using "isgraphic" as
	the subtitute for char-set:graphic when then token-set hsa been
	defaulted, grab the real char-set:graphic from (srfi srfi-14).

	* srfi-14.h (SCM_CHARSET_GET): Cast IDX to unsigned char so that
	it works for 8-bit characters.  Thanks to Matthias Koeppe!  No,
	make that "Köppe".

2002-04-24  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-13.c (s_scm_string_tokenize): Only take character sets as
	the second arg.  Collect characters belonging to this set into
	tokens (as specified by the SRFI), instead of splitting at these
	characters.  Default to an equivalent of char-set:graphic instead
	of everything-but-whitespace.  Thanks to Matthias Koeppe!

2002-04-10  Rob Browning  <rlb@defaultvalue.org>

	* .cvsignore: add *.c.clean.c.

2002-03-27  Thien-Thi Nguyen  <ttn@giblet.glug.org>

	* srfi-1.scm, srfi-13.scm, srfi-17.scm, srfi-4.scm, srfi-9.scm,
	srfi-10.scm, srfi-14.scm, srfi-19.scm, srfi-6.scm, srfi-11.scm,
	srfi-16.scm, srfi-2.scm, srfi-8.scm: Update copyright.
	Point to manual in commentary; nfc.

2002-03-24  Marius Vollmer  <mvo@zagadka.ping.de>

	* Makefile.am (.c.x): Pass "-o $@" to guile-snarf.

2002-03-13  Thien-Thi Nguyen  <ttn@giblet.glug.org>

	* srfi-13.c, srfi-14.c, srfi-4.c:
	Retire inclusion guard macro SCM_MAGIC_SNARFER.

	* Makefile.am (snarfcppopts): New var.
	(.c.x): Use $(snarfcppopts). Rework guile-snarf usage.

2002-03-11  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-13.c (string_titlecase_x): Treat characters as unsigned so
	that 8-bit chars work.  Thanks to David Pirotte!

2002-02-24  Rob Browning  <rlb@defaultvalue.org>

	* Makefile.am (libguile_srfi_srfi_4_la_LDFLAGS): use
	@LIBGUILE_SRFI_SRFI_4_INTERFACE@.
	(libguile_srfi_srfi_13_14_la_LDFLAGS): use
	@LIBGUILE_SRFI_SRFI_13_14_INTERFACE@.

2002-02-23  Neil Jerram  <neil@ossau.uklinux.net>

	* srfi-19.scm (priv:month-assoc): Correct numbers so that they
	match the expectations of priv:year-day.

2002-02-22  Neil Jerram  <neil@ossau.uklinux.net>

	* srfi-19.scm (priv:year-day): Index into priv:month-assoc using
	month number, not day number.  (Thanks to Sébastien de Menten de
	Horne for reporting the problem.)

2002-02-11  Marius Vollmer  <marius.vollmer@uni-dortmund.de>

	* srfi-14.c, srfi-4.c: Use scm_gc_malloc/scm_malloc and
	scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
	appropriate.

2002-01-21  Thien-Thi Nguyen  <ttn@giblet.glug.org>

	* srfi-1.scm (count1, take-while): Rewrite to be tail-recursive.
	Thanks to Panagiotis Vossos.

2002-01-20  Thien-Thi Nguyen  <ttn@giblet.glug.org>

	* srfi-1.scm (map1): Rewrite to be tail-recursive.
	Thanks to Panagiotis Vossos for the bug report.

2001-12-16  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-11.scm (let-values): Use `gensym' instead of `gentemp'.

2001-11-30  Neil Jerram  <neil@ossau.uklinux.net>

	* Makefile.am (ETAGS_ARGS): Added.

2001-11-12  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-4.c: Use HAVE_LONG_LONG instead of HAVE_LONG_LONGS and test
	it with `#ifdef' instead of `#if'.

2001-11-07  Neil Jerram  <neil@ossau.uklinux.net>

	* srfi-13.c (scm_string_unfold, scm_string_unfold_right),
	srfi-14.c (scm_char_set_unfold, scm_char_set_unfold_x): Remove
	superfluous whitespace at end of docstring lines.

2001-11-06  Thien-Thi Nguyen  <ttn@glug.org>

	* srfi-19.scm (time-monotonic->time-monotonic): Spurious;
	remove from exports.

2001-11-04  Stefan Jahn  <stefan@lkcc.org>

	* srfi-13.h, srfi-14.h, srfi-4.h: Follow-up patch.  Renamed
	__FOO__	macros into FOO.

2001-11-03  Marius Vollmer  <mvo@zagadka.ping.de>

	* Makefile.am (libguile_srfi_srfi_4_la_LIBADD,
	libguile_srfi_srfi_13_14_la_LIBADD): Refer to build directory, not
	the source directory, for libguile.la.  Thanks to Ken Raeburn.

2001-11-02  Marius Vollmer  <mvo@zagadka.ping.de>

	Support for native Win32.  Thanks to Stefan Jahn!

        * Makefile.am:  Put `-no-undefined' into LDFLAGS to support linkers
        which do not allow unresolved symbols inside shared libraries.

        * srfi-13.h, srfi-14.h: Defined SCM_SRFI1314_API.  Prefixed each
        exported symbol with SCM_SRFI1314_API.

        * srfi-4.h: Defined SCM_SRFI4_API.  Prefixed each exported
        symbol with SCM_SRFI4_API.

2001-10-21  Mikael Djurfeldt  <mdj@linnaeus>

	* srfi-2.scm, srfi-4.scm, srfi-8.scm, srfi-9.scm, srfi-10.scm,
	srfi-11.scm, srfi-14.scm, srfi-16.scm: Move module the system
	directives `export', `export-syntax', `re-export' and
	`re-export-syntax' into the `define-module' form.  This is the
	recommended way of exporting bindings.

2001-09-22  Mikael Djurfeldt  <mdj@linnaeus>

	* srfi-19.scm (priv:split-real): Inserted missing call to
	inexact->exact.

2001-09-21  Rob Browning  <rlb@defaultvalue.org>

	* srfi-14.h (SCM_CHARSET_GET): need 1L, not just 1 in "<<".

	* srfi-14.c (SCM_CHARSET_SET): need 1L, not just 1 in "<<".
	(scm_char_set_hash): val needs to be long, not just unsigned.
	(scm_char_set): need 1L, not just 1 in "<<".
	(scm_list_to_char_set): need 1L, not just 1 in "<<".
	(scm_list_to_char_set_x): need 1L, not just 1 in "<<".
	(scm_list_to_char_set_x): FUNC_NAME was wrong - added a _x.
	(scm_string_to_char_set): string length var needed to be
	scm_sizet, not int.
	(scm_string_to_char_set): need 1L, not just 1 in "<<".
	(scm_string_to_char_set_x): string length var needed to be
	scm_sizet, not int.
	(scm_string_to_char_set_x): need 1L, not just 1 in "<<".
	(scm_char_set_filter): need 1L, not just 1 in "<<".
	(scm_char_set_filter_x): need 1L, not just 1 in "<<".
	(scm_ucs_range_to_char_set): need 1L, not just 1 in "<<".
	(scm_ucs_range_to_char_set_x): need 1L, not just 1 in "<<".
	(scm_char_set_adjoin): need 1L, not just 1 in "<<".
	(scm_char_set_delete): need 1L, not just 1 in "<<".
	(scm_char_set_adjoin_x): need 1L, not just 1 in "<<".
	(scm_char_set_delete_x): need 1L, not just 1 in "<<".

2001-09-12  Gary Houston  <ghouston@arglist.com>

	* srfi-1.scm (filter): change "caller" to "filter" in check-arg-type.

2001-08-31  Dirk Herrmann  <D.Herrmann@tu-bs.de>

	* srfi-1.scm, srfi-13.scm: Remove the defines that were needed to
	trick export from the beginning of the files.

2001-08-25  Thien-Thi Nguyen  <ttn@revel.glug.org>

	* srfi-19.scm (add-duration): Fix bug: Call `add-duration!' w/
	two args.  Thanks to Alex Shinn.

2001-08-25  Marius Vollmer  <mvo@zagadka.ping.de>

	* Makefile.am (AUTOMAKE_OPTIONS): Change "foreign" to "gnu".

2001-08-24  Thien-Thi Nguyen  <ttn@revel.glug.org>

	* srfi-13.h (scm_string_map, scm_string_map_x,
	scm_string_for_each): Reverse order of first two args.
	(scm_string_for_each_index): New proc.

	* srfi-13.c (scm_string_for_each): Reverse order of first 2 args.
	(scm_string_for_each_index): New func.

	* srfi-13.scm (string-for-each-index): New exported proc.

	Thanks to Alex Shinn.

2001-08-22  Mikael Djurfeldt  <mdj@linnaeus.mit.edu>

	* srfi-13.c (string-map): Swapped order of string and proc args to
	conform with the srfi.  (Thanks to Alex Shinn.)

2001-08-05  Gary Houston  <ghouston@arglist.com>

	* srfi-1.scm (check-arg-type, non-negative-integer?): a couple of new
	internal definitions.
	(list-tabulate, iota): check for bad arguments that otherwise
	give weird output.
	(filter): check for proper list, to avoid infinite recursion on
	a circular list.

2001-08-04  Gary Houston  <ghouston@arglist.com>

	* srfi-1.scm (filter): replaced with a tail-recursive version.
	(remove): implement using filter, to make it tail-recursive.

2001-07-31  Gary Houston  <ghouston@arglist.com>

	* srfi-14.c (scm_char_set_diff_plus_intersection): wasn't correctly
	accounting for the (char-set-union cs2...) in the spec.  i.e.,
	(char-set-diff+intersection a) -> copy-of-a, empty-set
	and the following are equivalent:
	(char-set-diff+intersection a (char-set #\a) (char-set #\b))
	(char-set-diff+intersection a (char-set #\a #\b))

	(scm_char_set_xor_x): disabled the side-effecting code, since it
	gives inconsistent results to scm_char_set_xor for the case
	(char-set-xor! a a a).

	(scm_char_set_diff_plus_intersection_x): added cs2 argument, since
	two arguments are compulsory in final spec.  also similar changes
	as for scm_char_set_diff_plus_intersection.
	* srfi-14.h (scm_char_set_diff_plus_intersection_x): added cs2.

2001-07-22  Gary Houston  <ghouston@arglist.com>

	* srfi-14.c (scm_char_set_intersection, scm_char_set_xor): remove
	the compulsory cs1 arguments: all args are optional in final spec.

	* srfi-14.h: declarations updated.

2001-07-18  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-11.scm, srfi-8.scm: Update copyright notice.

2001-07-17  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-14.c: Okay.  Now I got it.  Really.  This time it's fixed.
	Guaranteed. (Maybe)

	* srfi-19.scm: Define `current-time' before exporting it.

2001-07-17  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-14.c: Fix for bug caused by brain-malfunctioning on my
	side.  Bit sets were handled wrong because I couldn't tell bit
	counts from byte counts.  Also, the bit array should be 256 / 8
	bytes long.  Thank you, Gary!

	Removed unnecessary protoype for scm_char_set_copy.

2001-07-16  Gary Houston  <ghouston@arglist.com>

	* srfi-14.scm: export string->char-set!, not string-char-set!.

	* srfi-14.c (scm_char_set_ref, scm_char_set_cursor_next,
	scm_end_of_char_set_p): reject negative	cursor values.
	(scm_list_to_char_set, scm_list_to_char_set_x): when reporting
	type error in list component, omit the position (was always 1).

2001-07-16  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	(scm_char_set_map): Bug-fix: char-set-map was modifying the
	argument instead of the return value.

2001-07-16  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-14.c: Allocate correct memory size for charsets (32 bytes),
	use this value for initializing and comparing charsets.
	(scm_char_set_hash): Use ``better'' hash algorithm which produces
	more values.

2001-07-15  Gary Houston  <ghouston@arglist.com>

	* srfi-14.c (scm_char_set_hash): recognise 0 instead of #f in the
	opt arg to give default bound, as in final spec.  don't allow
	negative bounds.
	(scm_char_set_hash): bug fix: was overrunning the buffer and
	calculating based on garbage.
	(scm_char_set_eq, scm_char_set_leq): fix argument number in error
	reporting: wasn't incremented due to macro coding.
	(scm_char_set): report argument number in error reporting: was
	hard coded to 1.  remove a couple of local variables.

2001-07-13  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-2.scm (and-let*): Use `re-export-syntax' instead of
	`export-syntax'.

2001-07-11  Gary Houston  <ghouston@arglist.com>

	* srfi-14.c (s_scm_char_set_eq): bug fix: (char-set=) should
	return #t instead of giving wrong-number-of-arguments . take a
	single "rest" argument.  use memcmp instead of a loop to compare
	the values.
	(s_scm_char_set_leq): similarly, (char-set<=) should return #t.
	take a single "rest" argument.
	srfi-14.h: update the declarations.

2001-07-09  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* README: Cleanup.

2001-07-06  Gary Houston  <ghouston@arglist.com>

	* srfi-1.scm (iota, map, for-each, list-index, member, delete,
	delete!, assoc): roll back the previous change.  instead place
	dummy definitions in a deprecated block at the beginning as in
	srfi-13.scm.

2001-07-06  Rob Browning  <rlb@defaultvalue.org>

	* srfi-19.scm (priv:locale-reader): don't need open-output-string.

2001-07-03  Gary Houston  <ghouston@arglist.com>

	* srfi-1.scm (iota, map, for-each, list-index, member, delete,
	delete!, assoc): don't export until the new bindings have been
	created.  otherwise "export" thinks they are being re-exported and
	a deprecation warning is produced.
	(map-in-order): defined and exported, to support lists of unequal
	length.

2001-07-03  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-1.scm (list-tabulate): Do not go into infinite loop for
	invalid arguments.  Same fix for several other procedures (do not
	use zero?, use <= 0).

2001-07-02  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-1.scm: Replaced calls to `map' in several procedures to
	calls to `map1'.
	(map, for-each): New procedures, extended from R5RS.

2001-06-28  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-4.c: Minor cleanups.

	* srfi-14.c (scm_char_set_fold, scm_char_set_unfold)
	(scm_char_set_unfold_x, scm_char_set_for_each)
	(scm_char_set_map, scm_char_set_filter)
	(scm_char_set_filter_x, scm_char_set_count)
	(scm_char_set_every, scm_char_set_any): Replace calls to
	scm_apply() with the corresponding scm_call_N() functions.

	* srfi-14.c (scm_char_set_ref, scm_char_set_cursor_next)
	(scm_char_set_unfold, scm_char_set_unfold_x)
	(scm_char_set_map, scm_char_set_diff_plus_intersection)
	(scm_char_set_diff_plus_intersection_x): Replace deprecated macros
	SCM_LISTN with calls to scm_list_N().

	* srfi-13.c (scm_string_tabulate, scm_string_map)
	(scm_string_map_x, scm_string_unfold)
	(scm_string_unfold_right): Replace deprecated macros SCM_LISTN
	with calls to scm_list_N().

	* srfi-13.c (scm_string_any, scm_string_every),
	(scm_string_tabulate, scm_string_trim),
	(scm_string_trim_right, scm_string_trim_both),
	(scm_string_compare, scm_string_compare_ci),
	(scm_string_indexS, scm_string_index_right),
	(scm_string_skip, scm_string_skip_right, scm_string_count),
	(scm_string_map, scm_string_map_x, scm_string_fold),
	(scm_string_fold_right, scm_string_unfold),
	(scm_string_unfold_right, scm_string_for_each),
	(scm_string_filter, scm_string_delete): Replace calls to
	scm_apply() with the corresponding scm_call_N() functions.

2001-06-27  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* Makefile.am: Added SRFI-4 files in various places.

	* srfi-4.c, srfi-4.h, srfi-4.scm: New files implementing SRFI-4.

2001-06-26  Dirk Herrmann  <D.Herrmann@tu-bs.de>

	* srfi-13.c (scm_string_copyS, scm_string_take, scm_string_drop,
	scm_string_take_right, scm_string_drop_right, scm_string_trim,
	scm_string_trim_right, scm_string_trim_both, scm_string_tokenize):
	Use scm_mem2string instead of scm_makfromstr.

	(scm_reverse_list_to_string, string_titlecase_x):  Prefer
	!SCM_<pred> over SCM_N<pred>.

2001-06-25  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-8.scm: Use `re-export-syntax' to correctly re-export
	`receive'.

2001-06-18  Matthias Koeppe  <mkoeppe@mail.math.uni-magdeburg.de>

        The SRFI-19 implementation was completely broken.  Already the
	reference implementation did not handle DST and time zones
	properly and relied on non-R5RS-isms like passing reals to
	`quotient'.  For Guile, some additional fixes were needed because
	of the incomplete numeric tower implementation.  See also
	srfi-19.test.

	* srfi-19.scm (date-zone-offset): Fixed typo in export clause.
	(add-duration): Renamed from priv:add-duration.
	(priv:time-normalize!): Handle fractional nanoseconds; remove
	duplicate definition.
	(priv:current-time-tai): Fixed typo.
	(time=?, time<=?): Fixed typos.
	(time-tai->time-utc, time-utc->time-tai,
	time-utc->time-monotonic): Use make-time-unnormalized instead of
	make-time when uninitialized time fields are used.
	(set-date-nanosecond!, set-date-second!, set-date-minute!,
	set-date-hour!, set-date-day!, set-date-month!, set-date-year!,
	set-date-zone-offset!): Define.
	(priv:local-tz-offset): Take an extra argument in order to handle
	DST effects.
	(time-utc->date, time-tai->date, time-monotonic->date): Handle the
	changed signature of priv:local-tz-offset. Don't pass non-integer
	arguments to quotient (non-R5RS, not supported by Guile).
	(date->time-utc): Ensure that seconds in a date structure are
	always exact integers.  Handle DST properly.
	(current-date, julian-day->date, modified-julian-day->date):
	Handle the changed signature of priv:local-tz-offset.
	(julian-day->time-utc): Reverted earlier inexact->exact hack;
	make-time now handles inexact arguments.
	(priv:locale-print-time-zone): At least print the numerical time
	zone.
	(priv:integer-reader): Fixed named let iteration.
	(priv:read-directives): Use set-date-month! instead of
	priv:set-date-month! etc.
	(string->date): Handle DST properly.

2001-06-14  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-13.scm: Prevent `export' from re-exporting core bindings.

2001-06-07  Dirk Herrmann  <D.Herrmann@tu-bs.de>

	* srfi-14.c (charset_print): Mark unused parameters with
	SCM_UNUSED.

2001-06-07  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-1.scm (fold, fold-pair): Fixed a buggy call to apply.
	(delete-duplicates): Now the first occurrence of an element is
	retained, as required.
	(member, assoc): Fixed wrong order of equality predicate
	application.

2001-06-06  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* README: Update.

	* srfi-1.scm: New file.

2001-06-04  Marius Vollmer  <mvo@zagadka.ping.de>

	Added exception notice to all files.

2001-05-31  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-14.scm, srfi-13.scm: Use `load-extension' for loading the
	shared library.

2001-05-31  Michael Livshin  <mlivshin@bigfoot.com>

	* Makefile.am (MKDEP): copied from libguile/Makefile.am, just in
	case.
	(CLEANFILES): added *.x (and removed from DISTCLEANFILES)

2001-05-28  Michael Livshin  <mlivshin@bigfoot.com>

	* srfi-19.scm: removed a stray open parenthesis. (thanks to
	Matthias Köppe for the report).

2001-05-23  Rob Browning  <rlb@cs.utexas.edu>

	* srfi-19.scm (:optional): renamed to optional to avoid reader
	keywords conflict.  Time passes... Removed :optional altogether
	and just handle optional args directly.  Thanks to Matthias Koeppe
	for the report of this and the two bits below.
	(priv:decode-julian-day-number): add inexact->exact for truncate
	result.
	(time-utc->date): add inexact->exact and floor so quotient will
	work.

2001-05-22  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* README: Update, document available SRFIs.

2001-05-21  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-19.scm, srfi-17.scm, srfi-16.scm, srfi-14.scm, srfi-13.scm,
	srfi-11.scm, srfi-10.scm, srfi-9.scm, srfi-8.scm, srfi-6.scm,
	srfi-2.scm: Use `cond-expand-provide' for providing features to
	`cond-expand'.

2001-05-20  Marius Vollmer  <mvo@zagadka.ping.de>

	* srfi-14.c (scm_c_init_srfi_14): Added "int" to declaration of
	`initialized'.

2001-05-19  Marius Vollmer  <mvo@zagadka.ping.de>

	Avoid using module operations from C.

	* srfi-13.c (scm_init_srfi_13_14): Removed.
	* srfi-14.h, srfi-14.c (scm_c_init_srfi_14): New.  Contains
	initializations needed by C clients of srfi-14.
	(scm_init_srfi_13, scm_init_srfi_14): Call it.
	* srfi-13.scm: Call "scm_init_srfi_13" instead of
	"scm_init_srfi_13_14".
	* srfi-14.scm: Call "scm_init_srfi_14" instead of
	"scm_init_srfi_13_14".

2001-05-16  Rob Browning  <rlb@cs.utexas.edu>

	* srfi-19.scm (priv:integer-reader-exact): minor cleanups.

2001-05-14  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* Makefile.am (srfi_DATA): Added srfi-16.scm.

	* srfi-16.scm: New file.

2001-05-10  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-13.c (scm_string_delete): Logic was inversed for charset.
	Fixed.

2001-05-08  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-13.c (scm_string_copyS): Fixed nasty bug.

2001-05-05  Rob Browning  <rlb@cs.utexas.edu>

	* Makefile.am (srfi_DATA): added srfi-19.scm.

	* srfi-19.scm: New file - time/date SRFI.  Thanks to Will
	Fitzgerald.

2001-05-02  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* srfi-14.c, srfi-13.c: Added @bullet to various @itemize lists.

	* srfi-10.scm: Typo fix.

2001-05-02  Rob Browning  <rlb@cs.utexas.edu>

	* srfi-11.scm (let-values): fix (a b c . d) case.  Thanks Martin.

2001-05-02  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* Makefile.am (srfi_DATA): Added srfi-10.scm and srfi-17.scm.

	* srfi-10.scm: New file.

	* srfi-17.scm: New file, contributed by Matthias Koeppe.  Thanks a
	lot!
	Added `Commentary:' tag.

	* srfi-9.scm: Added `Commentary:' tag.

2001-04-27  Rob Browning  <rlb@cs.utexas.edu>

	* srfi-13.h
	(scm_reverse_string_concatenate): renamed to
	scm_string_concatentate_reverse.
	(scm_reverse_string_concatenate_shared): renamed to
	scm_string_concatenate_reverse_shared.

2001-04-27  Gary Houston  <ghouston@arglist.com>

	* srfi-13.c (scm_init_srfi_13), srfi-14.c (scm_init_srfi_14):
	add "srfi/" to lines including .x files so they can be found
	when build_dir != src_dir.

2001-04-27  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* Makefile.am (srfi_DATA): Added srfi-9.scm.

	* srfi-9.scm: New file.  Exports `define-record-type'.

2001-04-26  Rob Browning  <rlb@cs.utexas.edu>

	* Makefile.am (srfi_DATA): added srfi-6.scm.
	(srfi_DATA): added srfi-11.scm.
	(srfi_DATA): added srfi-8.scm.
	(srfi_DATA): added srfi-2.scm.

	* srfi-11.scm: new file - exports let-values and let*-values.

	* srfi-6.scm: new file - guile already has srfi-6 procedures
	loaded by default, so this is a dummy file right now.

	* srfi-8.scm: new file - exports receive.

	* srfi-2.scm: new file - just use/export (ice-9 and-let-star)

2001-04-26  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	Changed two procedure names to match final SRFI document.  Thanks
	to Rob Browning for spotting this.

	* srfi-13.scm (string-concatenate-reverse),
	(string-concatenate-reverse/shared): Rename from
	reverse-string-concatenate[/shared].

	* srfi-13.c (scm_string_concatenate_reverse_shared): Renamed from
	scm_reverse_string_concatenate_shared.
	(scm_string_concatenate_reverse): Renamed from
	scm_reverse_string_concatenate.

2001-04-25  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* configure.in, autogen.sh: Removed.

	* srfi-13.c (scm_string_replace): Take sizeof (char) into account
	when using memmove().

	* srfi-14.h: Added prototypes for all exported procedures..

	* srfi-13.c: Include srfi-13.h

	* srfi-13.h: New file containing the prototypes.

	* Makefile.am: Removed guile-srfi.texi and info_TEXINFOS variable.
	(libguile_srfi_srfi_13_14_la_SOURCES): Added srfi-14.h, so it gets
	distributed.
	(libguile_srfi_srfi_13_14_la_SOURCES): Added srfi-13.h.

2001-04-24  Neil Jerram  <neil@ossau.uklinux.net>

	* Makefile.am: Fixed "srf-14.x" typo.

2001-04-24  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* guile-srfi.texi: Removed, because merged with the GRM.

	* guile-srfi.texi: The docs are now up to date with the
	implementation and have new introductory material.

2001-04-23  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	Integrated the guile-srfi package into the Guile distribution.

	* srfi-13.c: All procedures so specified in the SRFI now accept
	character set arguments.

	* Makefile.am: Snarfed some variables from the guile-readline
	directory.

	* srfi-14.c, srfi-14.h: Add prefix SCM_ to exported macros.

	* srfi-13.scm, srfi-14.scm, srfi-13.c, srfi-14.c, srfi-14.h,
	configure.in, Makefile.am: Added FSF copyright and Guile license
	information.

	* srfi-13.c, srfi-14.c: Include srfi-14.h.
	(scm_init_srfi_13_14): Initialize the complete module, if not
	already done so.

	* srfi-14.h: New file.

	* srfi-13.scm, srfi-14.scm: Load new combined library.

	* Makefile.am: Build only one library,
	`libguile-srfi-srfi-13-14.la'

2001-04-04  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* guile-srfi.texi: Integrated the SRFI-14 documentation.

	* srfi-14.c, srfi-14.scm: Made the procedures and variables
	compliant to the final SRFI document.

	* Renamed the package to guile-srfi.

2001-04-03  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* NEWS: New section for 0.0.3.

	* configure.in, README, guile-srfi-13.texi: Bumped version number
	to 0.0.3.

	* Released version 0.0.2.

	* Makefile.am: Added rules for builing the SRFI-14 library.

	* srfi-14.c, srfi-14.scm: New files, implementing SRFI-14
	(character set library).

2001-03-27  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* README: Updated procedure and incompatibility list.

	* srfi-13.c (string_upcase_x, scm_string_upcase_xS),
	(scm_string_upcase, string_downcase_x, scm_string_downcase_xS),
	(scm_string_downcaseS, string_titlecase_x),
	(scm_string_titlecase_x, scm_string_titlecase),
	(scm_string_fill_xS, scm_string_copyS, scm_string_to_listS): New
	procedures.

	* srfi-13.scm: Export new case mapping procedures.

	* guile-srfi-13.texi (What cannot be done): Removed case mapping
	procedures from incompatibility list.
	(Case Mapping): New section for case mapping procedures.

2001-03-26  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* NEWS: New section for 0.0.2

	* configure.in, README, guile-srfi-13.texi: Bumbed version number
	to 0.0.2

	* Released version 0.0.1.

	* README: Made procedure list up-to-date.

	* guile-srfi-13.texi: Fixed typos, completed reference and added
	introductory blurb.

	* srfi-13.c, srfi-13.scm: Filled in the last missing pieces.

2001-03-22  Martin Grabmueller  <mgrabmue@cs.tu-berlin.de>

	* Started guile-srfi-13 package.  Files are copied from the
	guile-gdbm and slightly modified.

;; Local Variables:
;; coding: utf-8
;; End:


code:
## Process this file with Automake to create Makefile.in
##
##   Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
##
##   This file is part of GUILE.
##
##   GUILE is free software; you can redistribute it and/or modify it
##   under the terms of the GNU Lesser General Public License as
##   published by the Free Software Foundation; either version 3, or
##   (at your option) any later version.
##
##   GUILE is distributed in the hope that it will be useful, but
##   WITHOUT ANY WARRANTY; without even the implied warranty of
##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##   GNU Lesser General Public License for more details.
##
##   You should have received a copy of the GNU Lesser General Public
##   License along with GUILE; see the file COPYING.LESSER.  If not,
##   write to the Free Software Foundation, Inc., 51 Franklin Street,
##   Fifth Floor, Boston, MA 02110-1301 USA

include $(top_srcdir)/am/snarf

AUTOMAKE_OPTIONS = gnu

## Prevent automake from adding extra -I options
DEFS = @DEFS@ @EXTRA_DEFS@
## Check for headers in $(srcdir)/.., so that #include
## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
## building.  Also look for Gnulib headers in `lib'.
AM_CPPFLAGS = -I.. -I$(srcdir)/..				\
	      -I$(top_srcdir)/lib -I$(top_builddir)/lib

AM_CFLAGS = $(GCC_CFLAGS)
AM_LDFLAGS = $(GNU_LD_FLAGS)

# FIXME: should be libguile/srfi
srfiincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/srfi

# These headers are visible as <guile/srfi/mumble.h>
srfiinclude_HEADERS = srfi-1.h srfi-4.h srfi-13.h srfi-14.h srfi-60.h

lib_LTLIBRARIES = \
  libguile-srfi-srfi-1-v-@LIBGUILE_SRFI_SRFI_1_MAJOR@.la \
  libguile-srfi-srfi-4-v-@LIBGUILE_SRFI_SRFI_4_MAJOR@.la \
  libguile-srfi-srfi-13-14-v-@LIBGUILE_SRFI_SRFI_13_14_MAJOR@.la \
  libguile-srfi-srfi-60-v-@LIBGUILE_SRFI_SRFI_60_MAJOR@.la

BUILT_SOURCES = srfi-1.x srfi-4.x srfi-13.x srfi-14.x srfi-60.x

libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_SOURCES = srfi-1.c
libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD =		\
   $(top_builddir)/libguile/libguile-@GUILE_EFFECTIVE_VERSION@.la $(top_builddir)/lib/libgnu.la
libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LDFLAGS = -no-undefined -export-dynamic -version-info @LIBGUILE_SRFI_SRFI_1_INTERFACE@

libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_SOURCES = srfi-4.c
libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD =		\
   $(top_builddir)/libguile/libguile-@GUILE_EFFECTIVE_VERSION@.la $(top_builddir)/lib/libgnu.la
libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LDFLAGS = -no-undefined -export-dynamic -version-info @LIBGUILE_SRFI_SRFI_4_INTERFACE@

libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_SOURCES = srfi-13.c srfi-14.c
libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD =	\
   $(top_builddir)/libguile/libguile-@GUILE_EFFECTIVE_VERSION@.la $(top_builddir)/lib/libgnu.la
libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LDFLAGS = -no-undefined -export-dynamic -version-info @LIBGUILE_SRFI_SRFI_13_14_INTERFACE@

libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_SOURCES = srfi-60.c
libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD =	\
   $(top_builddir)/libguile/libguile-@GUILE_EFFECTIVE_VERSION@.la $(top_builddir)/lib/libgnu.la
libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LDFLAGS = -no-undefined -export-dynamic -version-info @LIBGUILE_SRFI_SRFI_60_INTERFACE@

EXTRA_DIST = ChangeLog-2008

MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)

snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)

SUFFIXES = .x

.c.x:
	$(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)

CLEANFILES = *.x


code:
This directory includes most of Guile's SRFI support.       -*- text -*-

For more details about what SRFI means, and what the various numbers
stand for, please refer to the SRFI homepage at

  http://srfi.schemers.org

SRFI-0: cond-expand

  Supported by default, no module required.

SRFI-1: List Library

  A full toolbox of list processing procedures.  (use-modules (srfi
  srfi-1)) will make them available for use.

SRFI-2: and-let*

  (use-modules (srfi srfi-2)) to make and-let* available.

SRFI-4: Homogeneous numeric vector datatypes

SRFI-6: open-input-string, open-output-string and get-output-string

  (use-modules (srfi srfi-6)) to make these available. (Currently,
  these procedures are available without using the module, but the
  procedures might be factored out of the core library in the
  future.)

SRFI-8: receive

  (use-modules (srfi srfi-8)) to make receive available.

SRFI-9: define-record-type

  A mechanism for defining record types.  (use-modules (srfi srfi-9))
  makes this syntactic form available.

SRFI-10: #,()

  The hash-comma reader extension.  (use-modules (srfi srfi-10))
  activates the extension.

SRFI-11: let-values and let-values*

  Syntactic extensions for handling multiple values.  (use-modules
  (srfi srfi-11)) makes these syntactic forms available.

SRFI-13: string library

  A lot of (more or less) useful string processing procedures.
  (use-modules (srfi srfi-13)) loads the procedures.

SRFI-14: character-set library

  Character-set library.  (use-modules (srfi srfi-14)) loads the
  procedures and standard variables.

SRFI-16: case-lambda

  Syntactic form which permits writing functions acting different
  according to the number of arguments passed.  (use-modules (srfi
  srfi-16)) makes this syntactic form available.

SRFI-17: Generalized set!

  Guile supports generalized set! by default, but this module makes it
  fully compliant to the SRFI.  (use-modules (srfi srfi-17)) loads the
  procedures.

SRFI-19: Time Data Types and Procedures

  A lot of data types and procedures for dealing with times and
  dates.  (use-modules (srfi srfi-19)) loads the procedures.

SRFI-23: Error reporting mechanism

  Guile fully supports this SRFI.  No need to load any module.

SRFI-26: Notation for Specializing Parameters without Currying

  Exports: cut, cute.

SRFI-31: A special form for recursive evaluation

  Exports: rec.

SRFI-34: Exception Handling for Programs

  Exports: with-exception-handler, raise.
  Exports syntax: guard.

SRFI-39: Parameter objects

  Exports: make-parameter, with-parameters*.
  Exports syntax: parameterize.

SRFI-55: require-extension

  Supported by default, no module required.

path: srfi/README