blob: 69fdcea714f1496853d0cccb8626efe0111d79ed (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/guile \
-s
!#
;;; Commentary:
;;; Script for finding all top level `config' forms. Run this from the
;;; project root.
;;; Code:
(add-to-load-path (string-append (dirname (dirname (current-filename))) "/module"))
(use-modules
(hnh util)
(ice-9 ftw)
(ice-9 match)
(srfi srfi-1)
(srfi srfi-88)
(hnh module-introspection all-modules)
(hnh module-introspection module-introspection)
((hnh module-introspection)
:select (get-forms))
((calp translation)
:select (translate))
)
;; TODO split this into separate read and write stages
;; TODO and add texinfo output (besides ini output)
(for (filename module-name)
in (all-files-and-modules-under-directory "module")
(define forms (call-with-input-file filename get-forms))
(define configurations
(filter (lambda (form)
(and (list? form) (not (null? form))
(eq? 'define-config (car form))))
forms))
(unless (null? configurations)
(format #t "~%[~{~a~^ ~}]" module-name)
(for-each (match-lambda
(('define-config name default kvs ...)
(cond ((memv description: kvs)
=> (match-lambda
((description: ('_ desc) rest ...)
(format #t "~%; ~a"
(gettext desc "calp")))
((description: desc rest ...)
(format #t "~%; ~a" desc)))))
(format #t "~%~a = ~s~%"
name default)))
configurations)))
|