3
Outputs data retrieved from LilyPond as Python code:
5
- version: the lilypond version string
6
- interfaces: maps interface names to the list of their properties
7
- grobs: maps grob names to the list of interfaces they implement
8
- contextproperties: the list of all-user-translation-properties
9
- musicglyphs: the list of all glyphs in the feta font
15
(define (sort-symbol-list list)
16
"sort a list of symbols"
17
(sort list (lambda (s1 s2)
20
(symbol->string s2)))))
23
"returns the list of keys of a hash table"
30
;; the list of properties we also want to complete, besides all
32
(define accepted-properties
38
(define (user-property? prop)
39
"is the property a user property?"
40
(or (memq prop accepted-properties)
41
(memq prop all-user-grob-properties)))
43
(define (format-string-list list indent)
44
"formats a list of strings as a python list"
53
(make-string (+ 4 indent) #\space)
59
(make-string indent #\space)
62
(define (format-dict-entry k v indent)
63
"formats a dictionary entry: key and value are string"
65
(make-string indent #\space)
66
"\"" k "\": " v ",\n"))
68
(define (format-interfaces h)
69
"formats the interfaces from ly:all-grob-interfaces as a Python dict"
79
(filter user-property?
80
(list-ref (hashq-ref h k) 2)))
85
(sort-symbol-list (hash-keys h)))
88
(define (alist-keys alist)
89
"returns the list of keys of the specified alist"
92
(append p (list (car l))))
96
(define (format-grob-interfaces)
97
"writes out all grob interfaces as a Python dict"
109
(assq-ref all-grob-descriptions k)
116
(sort-symbol-list (alist-keys all-grob-descriptions)))
119
(define (format-context-properties)
120
"writes out the list of context (translation) properties"
122
"contextproperties = "
125
(map symbol->string all-user-translation-properties)
130
(define (get-translator-names)
131
"returns the list of names of all engravers"
135
(ly:translator-name t)))
136
(ly:get-all-translators)))
138
(define (format-translators)
139
"writes the list of engravers and performers"
143
(sort (get-translator-names) string-ci<?)
147
(define (format-musicglyphs)
148
"writes the list of music glyphs"
154
(ly:otf-glyph-list (ly:system-font-load "emmentaler-20")))
163
"# generated by LilyPond " (lilypond-version) "\n\n"
164
"version = \"" (lilypond-version) "\"\n\n"
165
(format-interfaces (ly:all-grob-interfaces))
167
(format-grob-interfaces)
169
(format-context-properties)