summaryrefslogtreecommitdiffstats
path: root/tools/sed-enums
blob: 13ce112f87a703672e7d017b77d326412e1b7629 (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
s/.*(enum\s+[a-zA-Z0-9_]+).*$/typedef \1 { /
T
h
:attrs
n
s/^\s*([A-Z0-9_]+).*$/\1, /
T next;H;b attrs
:next
/^\s*\}/ ! b attrs
s/^\s*}\s*([a-zA-Z0-9_]+).*$/ } \1;/
t end
# TODO fix above !!
/^\s*\}\s*;.*$/ {
    :loop2
    n
    /typedef/ ! b loop2
    s/^\s*typedef\s+enum\s+[a-zA-Z0-9_]+\s+([a-zA-Z0-9_]+)/ } \1/
    t end
}
:end
H;x
s/\n//g
s/ {2,}/ /g
s/, }/ }/p