ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/genconst
Revision: 1.4
Committed: Thu Nov 17 23:28:05 2016 UTC (7 years, 5 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -5 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl
2
3 my %const_iv;
4
5 sub gl() {
6 $_ = <>;
7
8 defined $_ or last file;
9
10 1 while s/\/\*.*?\*\///;
11 s/\/\*.*$//; # we don't handle multiline-/* comments, so hack around
12 s/\/\/.*$//;
13 s/^\s+//;
14 s/\s+$//;
15
16 $_
17 }
18
19 file:
20 while () {
21 gl;
22 if (/^#define\s+([A-Z_0-9]+)\s+(0x[0-9a-fA-F]+|[0-9\.]+)$/) {
23 undef $const_iv{$1};
24 } elsif (/^enum\b/) {
25 while () {
26 gl;
27 if (/^([a-zA-Z_0-9]+)\s*(?:,|=|$)/) {
28 undef $const_iv{$1};
29 } elsif (/^\}/) {
30 last;
31 }
32 }
33 }
34 }
35
36 for (sort keys %const_iv) {
37 print "const_iv($_)\n";
38 }