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
|
$NetBSD: patch-al,v 1.1 2005/10/27 01:08:06 rillig Exp $
The SunPro compiler does not like empty arrays, so let's not create C++
source files that have them.
--- gen/mk-static-filter.pl.orig 2004-06-29 02:18:17.000000000 +0200
+++ gen/mk-static-filter.pl 2005-10-27 02:45:45.784646500 +0200
@@ -130,38 +130,44 @@ printf STATICFILTERS "\n };\n";
printf STATICFILTERS "\n const unsigned int standard_filters_size = ".
"sizeof(standard_filters)/sizeof(FilterEntry);\n";
+my %empty_filters = ();
#create KeyInfo structures for each static filter
while ($filter = shift @filterhashes) {
- printf STATICFILTERS "\n static KeyInfo ".${$filter}{"NAME"}."_options[] = {\n";
+ my $txt = "\n static KeyInfo ".${$filter}{"NAME"}."_options[] = {\n";
#create KeyInfo structs and begin end handles
$firstopt = 1;
while (($name,$option)=each %{$filter}) {
($name=~/(?:NAME|(?:DE|EN)CODER|FILTER|DESCRIPTION)/) && next;
- ( $firstopt != 1 ) && ( printf STATICFILTERS ",\n" );
+ ( $firstopt != 1 ) && ( $txt .= ",\n" );
$firstopt = 0;
- printf STATICFILTERS " {\n".
+ $txt .= " {\n".
" \"f-${$filter}{NAME}-$name\",\n";
( (lc ${$option}{"TYPE"}) eq "bool") &&
- printf STATICFILTERS " KeyInfoBool,\n";
+ ($txt .= " KeyInfoBool,\n");
( (lc ${$option}{"TYPE"}) eq "int") &&
- printf STATICFILTERS " KeyInfoInt,\n";
+ ($txt .= " KeyInfoInt,\n");
( (lc ${$option}{"TYPE"}) eq "string") &&
- printf STATICFILTERS " KeyInfoString,\n";
+ ($txt .= " KeyInfoString,\n");
( (lc ${$option}{"TYPE"}) eq "list") &&
- printf STATICFILTERS " KeyInfoList,\n";
- print STATICFILTERS " \"".${$option}{"DEFAULT"}."\",\n".
+ ($txt .= " KeyInfoList,\n");
+ $txt .= " \"".${$option}{"DEFAULT"}."\",\n".
" \"".${$option}{"DESCRIPTION"}."\"\n".
" }";
}
- printf STATICFILTERS "\n };\n";
- printf STATICFILTERS "\n const KeyInfo * ".${$filter}{"NAME"}."_options_begin = ".
+ $txt .= "\n };\n";
+ $txt .= "\n const KeyInfo * ".${$filter}{"NAME"}."_options_begin = ".
${$filter}{"NAME"}."_options;\n";
- printf STATICFILTERS "\n const KeyInfo * ".${$filter}{"NAME"}."_options_end = ".
+ $txt .= "\n const KeyInfo * ".${$filter}{"NAME"}."_options_end = ".
${$filter}{"NAME"}."_options+sizeof(".
${$filter}{"NAME"}."_options)/".
"sizeof(KeyInfo);\n";
+ if ($firstopt != 1) {
+ print STATICFILTERS $txt;
+ } else {
+ $empty_filters{$filter->{"NAME"}} = 1;
+ }
}
#finally create filter modules list.
@@ -170,6 +176,7 @@ printf STATICFILTERS "\n\n static Conf
#printf STATICFILTERS " {\"fm\",0,modes_module_begin,modes_module_end}";
$firstopt = 1;
while ($filter = shift @rallfilters) {
+ if (!exists($empty_filters{$filter})) {
( $firstopt != 1 ) && ( printf STATICFILTERS ",\n" );
$firstopt = 0;
printf STATICFILTERS " {\n".
@@ -177,6 +184,7 @@ while ($filter = shift @rallfilters) {
" \"".${${filters}{$filter}}{DESCRIPTION}."\",\n" .
" ${filter}_options_begin,${filter}_options_end\n" .
" }";
+ }
}
printf STATICFILTERS "\n };\n";
printf STATICFILTERS "\n const ConfigModule * filter_modules_begin = ".
|