aboutsummaryrefslogtreecommitdiff
path: root/dump/documentation.scm
blob: 5228559638d9f50d4a0fa6202e69f76b1245ecab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(define-module (dump documentation)
  #:use-module (srfi srfi-9 gnu)
  #:use-module (srfi srfi-26)
  #:export (dump-configuration
            dump-configuration?
            dump-configuration-triples?
            dump-configuration-table-metadata?
            dump-configuration-path
            call-with-documentation))


(define-immutable-record-type <dump-configuration>
  (%dump-configuration triples? table-metadata? path)
  dump-configuration?
  (triples? dump-configuration-triples?)
  (table-metadata? dump-configuration-table-metadata?)
  (path dump-configuration-path))

(define* (dump-configuration
          #:optional
          (triples? #t)
          (table-metadata? #f)
          (path #f))
  "Return a new configuration."
  (%dump-configuration triples? table-metadata? path))


(define (call-with-documentation conf proc)
  (let ((port #f)
        (path (dump-configuration-path conf)))
    (when path
      (dynamic-wind
        (lambda ()
          (set! port (open-file path "w")))
        (cut proc port)
        (cut close port)))))