-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmake-words.ly
More file actions
95 lines (92 loc) · 4.95 KB
/
make-words.ly
File metadata and controls
95 lines (92 loc) · 4.95 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#(use-modules (ice-9 format)
(ice-9 regex))
#(define (print-symbols symbols)
(let print-names ((pos 4)
(rest (sort (map (lambda (thing)
(if (symbol? thing)
(symbol->string thing)
thing))
symbols)
string<=?)))
(if (not (null? rest))
(let* ((name (car rest))
(len (string-length name)))
(if (> (+ pos len 1) 80)
(begin
(format #t "~% ")
(set! pos 4)))
(format #t "~a" name)
(if (not (null? (cdr rest)))
(format #t " "))
(print-names (+ pos len 1) (cdr rest))))))
#(define (print-word-list name symbols)
(format #t "(defconst ~a~% '(" name)
(print-symbols symbols)
(format #t "))~2%"))
#(with-output-to-file
"lyqi-words.el"
(lambda ()
(print-word-list "lyqi:lilypond-keywords"
(map car (ly:lexer-keywords (ly:parser-lexer parser))))
(print-word-list "lyqi:lilypond-music-variables"
(filter identity
(module-map (lambda (symbol variable)
(and (ly:music? (variable-ref variable))
symbol))
(current-module))))
(print-word-list "lyqi:lilypond-music-functions"
(filter identity
(module-map (lambda (symbol variable)
(and (ly:music-function? (variable-ref variable))
symbol))
(current-module))))
(print-word-list "lyqi:lilypond-markup-commands"
(hash-fold (lambda (function dummy functions)
(cons (regexp-substitute
#f (string-match "-markup"
(symbol->string (procedure-name function)))
'pre "" 'post)
functions))
'()
markup-functions-properties))
(print-word-list "lyqi:lilypond-markup-list-commands"
(hash-fold (lambda (function dummy functions)
(cons (procedure-name function) functions))
'()
markup-list-functions))
(print-word-list "lyqi:scheme-lily-procedures"
(filter identity
(module-map (lambda (symbol variable)
(if (procedure? (variable-ref variable))
(let ((name (symbol->string symbol)))
(if (string-match ".*-markup$" name)
#f
symbol))
#f))
(module-public-interface (resolve-module '(lily))))))
(print-word-list "lyqi:scheme-lily-macros"
(filter identity
(module-map (lambda (symbol variable)
(and (macro? (variable-ref variable))
symbol))
(module-public-interface (resolve-module '(lily))))))
(print-word-list "lyqi:scheme-lily-variables"
(filter identity
(module-map (lambda (symbol variable)
(and (not (or (macro? (variable-ref variable))
(procedure? (variable-ref variable))))
symbol))
(module-public-interface (resolve-module '(lily))))))
(print-word-list "lyqi:scheme-guile-procedures"
(filter identity
(module-map (lambda (symbol variable)
(and (procedure? (variable-ref variable))
symbol))
(module-public-interface (resolve-module '(guile))))))
(print-word-list "lyqi:scheme-guile-macros"
(filter identity
(module-map (lambda (symbol variable)
(and (macro? (variable-ref variable))
symbol))
(module-public-interface (resolve-module '(guile))))))
(format #t "(provide 'lyqi-words)~%")))