3 # Copyright 2004-2005 Oswald Buddenhagen <ossi@kde.org>
5 # Permission to use, copy, modify, distribute, and sell this software and its
6 # documentation for any purpose is hereby granted without fee, provided that
7 # the above copyright notice appear in all copies and that both that
8 # copyright notice and this permission notice appear in supporting
11 # The above copyright notice and this permission notice shall be included
12 # in all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 # IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 # OTHER DEALINGS IN THE SOFTWARE.
22 # Except as contained in this notice, the name of a copyright holders shall
23 # not be used in advertising or otherwise to promote the sale, use or
24 # other dealings in this Software without prior written authorization
25 # from the copyright holders.
33 print STDERR
$_[0]."\n";
39 my @src = split(/\//, abs_path
(shift));
40 my @dst = split(/\//, abs_path
(shift));
42 while (@src && @dst && $src[0] eq $dst[0]) {
46 return "../"x
@dst . join("/", @src);
54 # print "read: ".$_."\n";
63 $t =~ s
,</?
(command
|guilabel
|quote
|literal
)>,\",g
;
64 $t =~ s
,</?
(acronym
|envar
|filename
|option
|systemitem
( [^ >]+)?
)>,,g
;
65 $t =~ s
,<emphasis
>([^<]+)</emphasis
>,uc($1),ge;
71 $t =~ s
,&XDMCP
;,XDMCP
,g
;
72 $t =~ s
,&X
-Server
;,X
-server
,g
;
79 if ($v !~ /^[A-Z]{2}/) {
88 for my $c (keys %{$_[0]}) {
89 my ($then, $else) = ("", "");
90 for my $d (@
{${$_[0]}{$c}}) {
91 my $bas = "# define ".$d->[0];
92 if ($d->[1] =~ /\n/) {
93 $then .= $bas." \\\n".$d->[1]."\n";
95 $then .= $bas." ".$d->[1]."\n";
99 $ret .= "#if ".$c."\n".$then."#else\n".$else."#endif\n\n";
108 for my $i (@
{$_[2]}) {
109 push @
{${$_[3]}{$_[0]}}, [ $vn."_".$i->[1], $i->[0] ];
110 $i->[0] = $vn."_".$i->[1];
116 if ($ARGV[0] eq "--doc") {
121 @ARGV != 2 && pegout
("usage: $0 [--doc] <def-file> <out-file>");
123 open (INFILE
, $ARGV[0]) || pegout
("$0: cannot open definition file ".$ARGV[0]);
126 my %ex_sects = (); # $name -> $index
127 my @ex_config = (); # ($name, $comment, $entries)
131 my %ov_enum_conds = ();
133 my $ov_enum_defs = "";
135 my $ov_defaults = "";
137 my %arr_ov_vars = ();
138 my $ov_rd_sects = "";
141 my $ov_gen_sects = "";
142 my $ov_gen_ents = "";
145 my %ov_sec_conds = ();
146 my %ov_ent_conds = ();
147 my $ov_sect_defs = "";
148 my $ov_sect_refs = "";
150 my %ov_glob_conds = ();
152 my %ov_loc_conds = ();
155 my %ov_glob_decl_conds = ();
156 my $ov_glob_decls = "";
157 my %ov_glob_defs = ();
158 my %ov_loc_def_conds = ();
159 my %ov_loc_defs = ();
161 my %ov_greet_decl_conds = ();
162 my %ov_greet_conds = ();
163 my $ov_greet_init = "";
164 my $ov_greet_init_qapp = "";
165 my @ov_greet_decls = ();
166 my %ov_greet_defs = ();
168 my %ov_xm_conds = ();
169 my @ov_xm = ("", "");
171 my %ov_km_conds = ();
182 my $kid_seq = 0x1000;
192 ["static Ent ents".$ts."[] = { \\\n".$ov_rd_ents."};", "ENTS"],
193 ["static Ent ents".$ts."[] = { \\\n".$ov_gen_ents."};", "GENS"],
194 ["sec".$ts." = { \"".$sect."\", ents".$ts.", as(ents".$ts.") },", "SEC"],
195 ["&sec".$ts.",", "SECS"]
199 add_cond
($sect_if, $ts, \
@oa, \
%ov_sec_conds);
200 $ov_rd_sects .= " \\\n".$oa[0][0]." \\\n";
201 $ov_gen_sects .= " \\\n".$oa[1][0]." \\\n";
202 $ov_sect_defs .= " ".$oa[2][0]." \\\n";
203 $ov_sect_refs .= "\t".$oa[3][0]." \\\n";
204 $doc_ref .= "</variablelist>\n</sect2>\n\n";
208 "int" => [ "C_TYPE_INT", "", "int\t", "", "getCfgInt", "" ],
209 "bool" => [ "C_TYPE_INT", " | C_BOOL", "int\t", "bool\t", "getCfgInt", "getCfgInt" ],
210 "enum" => [ "C_TYPE_INT", " | C_ENUM", "int\t", "", "getCfgInt", "" ],
211 "group" => [ "C_TYPE_INT", " | C_GRP", "int\t", "", "getCfgInt", "" ],
212 "string" => [ "C_TYPE_STR", "", "char\t*", "QString\t", "getCfgStr", "getCfgQStr" ],
213 "path" => [ "C_TYPE_STR", " | C_PATH", "char\t*", "QString\t", "getCfgStr", "getCfgQStr" ],
214 "list" => [ "C_TYPE_ARGV", "", "char\t**", "QStringList\t", "getCfgStrArr", "getCfgQStrList" ]
217 my @tl = ("QFont\t*", "QStringList\t", "QString\t", "char\t**", "char\t*", "int\t", "bool\t");
226 init_defs
(\
%ov_glob_defs);
227 init_defs
(\
%ov_loc_defs);
228 init_defs
(\
%ov_greet_defs);
243 last if (/^<\/code
>\n$/);
246 } elsif (/^<kdmrc>$/) {
249 last if (/^<\/kdmrc
>\n$/);
252 defined($ex_sects{$1}) &&
253 pegout
("redefinition of example section [$1]");
254 push @ex_config, [$1, dedb
($comm), "", ""];
255 $ex_sects{$1} = $#ex_config;
259 $comm .= " \\\n\"\\n\"";
260 } elsif ($_ eq " _") {
261 $comm .= " \\\n\"#\\n\"";
264 $comm .= " \\\n\"#".$_."\\n\"";
268 } elsif (/^<docu>$/) {
270 last if (/^<\/docu>\n$/);
273 } elsif (/^<legacy>$/) {
283 if (/^Proc: (.+)$/) {
287 pegout
("expecting Proc keyword in legacy section");
291 while (/^Source: (.+)$/) {
293 if ($src =~ /^xdm:(.*)$/) {
295 my $dsp = ($what =~ s/^\*\.//);
296 my @oa = ([ "{ \"".$what."\", (char *)-1, 0, ".$proc." },", "XMO" ]);
297 add_cond
($kif, $what, \
@oa, \
%ov_xm_conds);
298 $ov_xm[$dsp] .= $oa[0][0]." \\\n";
299 } elsif ($src =~ /^kdm:(.*)\/(.*)$/) {
300 my ($sec, $key) = ($1, $2);
301 my @oa = ([ "{ \"".$key."\", (char *)-1, 0, ".$proc." },", "KMO".($mcnt++) ]);
302 add_cond
($kif, $key, \
@oa, \
%ov_km_conds);
303 $ov_km{$sec} .= $oa[0][0]." \\\n";
305 pegout
("invalid legacy option '$_'");
310 $nsrc || pegout
("no sources for legacy processor ".$proc);
311 last if (/^<\/legacy
>$/);
312 pegout
("unidentified section body '".$_."' in legacy section") if ($_);
318 $sect || pegout
("defining key ".$key." outside any section");
319 defined($key_names{$key}) &&
320 pegout
("redefinition of key ".$key." in section [".$sect."]");
321 $key_names{$key} = "";
330 ($key_if ?
"(".$sect_if.") && (".$key_if.")" : $sect_if) : $key_if;
331 my ($e_comm, $e_desc) = ("", "");
333 if (/^Type: (.+)$/) {
335 if ($type eq "enum") {
336 my $enum = "static const char *e".$key."[] = { ";
338 while (getl
(), /^ ([A-Za-z]+)(\/([A
-Z_
]+))?
: (.+)$/) {
340 $enum .= "\"".$e_nam."\", ";
342 ($ov_enum_defs .= "#define ".$3." ".($n_e_def++)."\n");
343 my ($comm, $desc) = (dedb
($4), $4);
344 $comm =~ s/\"/\\\"/g;
345 $e_comm .= " \\\n\"# \\\"".$e_nam."\\\" - ".$comm."\\n\"";
348 "<term><parameter>".$e_nam."</parameter></term>\n".
349 "<listitem><para>".$desc."</para></listitem>\n".
353 my @oa = ( [ $enum, "ENUM" ] );
354 add_cond
($kif, $key, \
@oa, \
%ov_enum_conds);
355 $ov_enums .= $oa[0][0]." \\\n";
356 $n_e_def && ($ov_enum_defs .= "\n");
357 } elsif ($type =~ /^(int|bool|group|string|path|list)$/) {
360 pegout
("unknown Type ".$type." for key ".$key." in section [".$sect."]");
363 pegout
("expecting Type for key ".$key." in section [".$sect."]");
365 my ($odflt, $dflt, $cdflt, $ddflt);
366 my $quot = ($type =~ /^(int|bool|enum|group)$/);
367 if (/^Default: (\*?)(.+)$/) {
369 ($odflt, $dflt) = ($2, $2);
370 $quot && ($dflt = "\"".$dflt."\"");
371 $defd && ($ov_defaults .= "#define def_".$key." ".$dflt."\n");
374 pegout
("expecting Default for key ".$key." in section [".$sect."]");
376 if (/^CDefault: (.+)$/) {
384 $cdflt = " \\\n\"# Default is ".$cdflt."\\n\"";
390 $cdflt = " \\\n\"# Default is ".$odflt."\\n\"";
392 $cdflt = " \\\n\"# Default is \\\"\" ".$dflt." \"\\\"\\n\"";
395 if (/^DDefault: -$/) {
400 if (/^PostProc: (.+)$/) {
407 my ($vname, $kid, $xkid, $ctype, $cpptype, $cget, $cppget);
408 while (/^User: (.+)$/) {
410 if ($user eq "dummy") {
412 $kid = "C_INTERNAL | C_TYPE_STR";
414 } elsif ($user =~ s/^(core|greeter|greeter-c|dep|config)(\((.+)\))?(:font)?$/$1/) {
415 my ($hvn, $isfn) = (defined($3) ?
$3 : mkvname
($key), $4);
416 ($kid, $xkid, $ctype, $cpptype, $cget, $cppget) = @
{$th{$type}};
417 $kid = sprintf "%#x | %s", $kid_seq, $kid;
418 if ($user eq "dep") {
420 $xkid .= " | C_INTERNAL";
421 } elsif ($user eq "config") {
423 $xkid .= " | C_INTERNAL | C_CONFIG";
426 if ($user eq "core") {
429 [ "{ ".$kid.", boffset(".$hvn.") },", "LOC" ],
431 add_cond
($kif, $hvn, \
@oa, \
%ov_loc_conds);
432 $ov_locs .= " \\\n".$oa[0][0];
435 [ $ctype.$hvn.";", "LDEF" ]
437 add_cond
($kif, $hvn, \
@oa, \
%ov_loc_def_conds);
438 $ov_loc_defs{$ctype} .= " \\\n\t".$oa[0][0];
441 [ "{ ".$kid.", &".$hvn." },", "GLOB" ],
442 [ $ctype.$hvn.";", "GDEF" ],
444 add_cond
($kif, $hvn, \
@oa, \
%ov_glob_conds);
445 $ov_globs .= " \\\n".$oa[0][0];
446 $ov_glob_defs{$ctype} .= " \\\n".$oa[1][0];
449 [ "extern ".$ctype.$hvn.";", "GDECL" ]
451 add_cond
($kif, $hvn, \
@oa, \
%ov_glob_decl_conds);
452 $ov_glob_decls .= " \\\n".$oa[0][0];
454 } else { # greeter(-c)?
455 my ($typ, $gtr, $isc, $qapp);
458 $gtr = "str2Font( getCfgQStr( ".$kid." ) )";
461 } elsif ($user eq "greeter" && $cppget) {
463 $gtr = $cppget."( ".$kid." )";
468 $gtr = $cget."( ".$kid.(($type eq "list") ?
", 0" : "")." )";
473 [ "_".$hvn." = ".$gtr.";", "GRINIT" ],
474 [ $typ."_".$hvn.";", "GRDEF" ],
476 add_cond
($kif, $hvn, \
@oa, \
%ov_greet_conds);
478 $ov_greet_init_qapp .= " \\\n ".$oa[0][0];
480 $ov_greet_init .= " \\\n ".$oa[0][0];
482 $ov_greet_defs{$typ} .= " \\\n".$oa[1][0];
485 [ "extern ".$typ."_".$hvn.";", "GRDECL" ]
487 add_cond
($kif, $hvn, \
@oa, \
%ov_greet_decl_conds);
488 $ov_greet_decls[$isc] .= " \\\n".$oa[0][0];
492 pegout
("unrecognized User '".$user."' for key ".$key." in section [".$sect."]");
497 $nusers || pegout
("expecting User for key ".$key." in section [".$sect."]");
499 while (/^Instance: ?(.*)$/) {
502 my $on = 1 - ($inst =~ s/^#//);
505 ($inst =~ s/^([^\/]+)\///) || pegout
("instance for key ".$key." in section [".$sect."] does not specify display");
506 $sec = "X-".$1.$sect;
510 if ($type eq "bool" && $inst eq "!") {
511 $inst = ($dflt eq "\"true\"") ?
"\"false\"" : "\"true\"";
515 $quot && ($inst = "\"".$inst."\"");
517 defined($ex_sects{$sec}) ||
518 pegout
("instantiating key ".$key." in section [".$sect."] in undeclared section");
519 my @oa = ( [ "{ \"".$key."\",\t".$inst.", ".$on." },", "INST" ] );
520 add_cond
($key_if, $key, \
@oa, \
%ex_conds);
521 $ex_config[$ex_sects{$sec}][2] .= $oa[0][0]." \\\n";
522 $ex_config[$ex_sects{$sec}][3] = $sect_if;
528 print STDERR
"Warning: key ".$key." in section [".$sect."] not instanciated\n";
529 my ($update, $prio) = ("0", "");
530 if (/^Update: ([^\/]+)(\
/(\d+))?$/) {
531 ($update, $prio) = ($1, $3);
535 ($max_prio < $prio) && ($max_prio = $prio);
540 while (/^Merge: (.+)$/) {
542 if ($merge =~ /^xdm(:([^\(]+))?(\((.+)\))?$/) {
543 my ($what, $proc) = ($2, $4);
545 [ "{ \"".($what ?
$what : lcfirst($key))."\", ".
546 "\"".(($sect =~ /^-/) ?
"X-%s" : "").$sect."\", ".
547 ($what ?
"\"".$key."\"" : "0").", ".
548 ($proc ?
$proc : "0")." },", "XM" ]
550 add_cond
($kif, $key, \
@oa, \
%ov_xm_conds);
551 $ov_xm[$sect =~ /^-/] .= $oa[0][0]." \\\n";
552 } elsif ($merge =~ /^kdm:([^\(]+)(\((.+)\))?$/) {
553 my ($where, $func) = ($1, $3);
555 ($where =~ s/^([^\/]+)\///) && ($sec = $1);
557 [ "{ \"".($where ?
$where : $key)."\", ".
558 ($sec ?
"\"".$sect."\"" : "0").", ".
559 ($where ?
"\"".$key."\"" : "0").", ".
560 ($func ?
$func : "0")." },", "KM".($mcnt++) ]
562 add_cond
($kif, $key, \
@oa, \
%ov_km_conds);
563 $ov_km{$sec ?
$sec : $sect} .= $oa[0][0]." \\\n";
565 pegout
("bogus Merge '".$merge."' for key ".$key." in section [".$sect."]");
569 # todo: handle $func here, too
570 my @oa = ( [ "{ \"".$key."\", 0, 0, 0 },", "KM" ] );
571 add_cond
($kif, $key, \
@oa, \
%ov_km_conds);
572 $ov_km{$sect} .= $oa[0][0]." \\\n";
574 if (/^Comment:(( [-&])?)$/) {
578 } elsif ($1 ne " -") {
579 while (getl
(), /^ (.*)$/) {
583 print STDERR
"Warning: key ".$key." in section [".$sect."] has empty Comment\n";
588 print STDERR
"Warning: key ".$key." in section [".$sect."] has no Comment\n";
590 if (/^Description:(( [-!])?)$/) {
594 "<term id=\"option-".lc($key)."\"><option>".$key."</option></term>\n".
599 while (getl
(), /^ (_|(.*))$/) {
603 print STDERR
"Warning: key ".$key." in section [".$sect."] has empty Description\n";
606 $desc = "<para>\n".$desc."</para>\n";
608 $e_desc = "<variablelist>\n".$e_desc."</variablelist>\n";
609 ($desc =~ s/%ENUM%/$e_desc/) ||
614 if ($ddflt eq '""') {
615 $doc_ref .= "<para>Empty by default.</para>\n";
618 $ddflt =~ s
,KDMCONF
,\
${<envar
>kde_confdir
</envar>}/kdm
,;
619 $ddflt =~ s
,KDMDATA
,\
${<envar
>kde_datadir
</envar>}/kdm
,;
620 $ddflt =~ s
,XBINDIR
,\
${<envar
>x_bindir
</envar
>},;
621 $doc_ref .= "<para>The default is <quote>".$ddflt."</quote>.</para>\n";
624 $doc_ref .= "</listitem>\n</varlistentry>\n\n";
629 print STDERR
"Warning: key ".$key." in section [".$sect."] has no Description\n";
631 pegout
("unidentified section body '".$_."' in section [".$sect."]") if ($_);
633 ($vname ne "dummy") &&
634 ($arr_ov_vars{$vname} = $kif);
635 $vname = "&V".$vname;
637 $vname = "(void *)".$pproc;
638 } elsif ($type eq "enum") {
645 $comm =~ s/([^\n]*)\n/ \\\n\"# $1\\n\"/g;
647 [ "{ \"".$key."\", ".$kid.$xkid.", ".$vname.", ".$dflt." },", "RENT" ],
648 [ "{ \"".$key."\", ".$prio.", ".$update.",".$comm.$e_comm.$cdflt." },", "GENT" ],
650 add_cond
($key_if, $key, \
@oa, \
%ov_ent_conds);
651 $ov_rd_ents .= $oa[0][0]." \\\n";
652 $ov_gen_ents .= $oa[1][0]." \\\n";
654 } elsif (/^Section: (.+)$/) {
655 emit_section
() if ($sect);
657 defined($sect_names{$sect}) && pegout
("redefinition of section [".$sect."]");
658 $sect_names{$sect} = "";
667 my ($sref, $stit, $sna);
668 if ($sect =~ /^-(.*)$/) {
671 $sna = "section class";
678 "\n<sect2 id=\"kdmrc-".$sref."\">\n".
679 "<title>The [".$stit."] ".$sna." of &kdmrc;</title>\n\n";
680 if (/^Description:(( -)?)$/) {
683 $doc_ref .= "<para>\n";
684 while (getl
(), /^ (_|(.*))$/) {
688 $doc_ref .= "</para>\n";
690 print STDERR
"Warning: section [".$sect."] has empty Description\n";
695 print STDERR
"Warning: section [".$sect."] has no Description\n";
697 $doc_ref .= "\n<variablelist>\n\n";
698 pegout
("unidentified section body '".$_."' in section [".$sect."]") if ($_);
700 pegout
("invalid section leadin: '".$_."'");
707 my $srcf = relpath
($ARGV[0], $ARGV[1]);
708 my $exen = relpath
($0, $ARGV[1]);
710 open (OUTFILE
, ">".$ARGV[1]) || pegout
("$0: cannot create output file ".$ARGV[1]);
715 "/* generated from $srcf by $exen - DO NOT EDIT! */\n\n".
716 "#ifndef CONFIG_DEFS\n".
717 "#define CONFIG_DEFS\n\n".
719 "#endif /* CONFIG_DEFS */\n\n\n";
722 "#if (defined(WANT_CORE_DECLS) || defined(WANT_GREET_DECLS)) && !defined(CONF_ENUMS_DEFINED)\n".
723 "#define CONF_ENUMS_DEFINED\n\n".
728 "#if (defined(WANT_CONF_READ) || defined(WANT_CONF_GEN)) && !defined(CONF_SECTS)\n\n".
729 emit_conds
(\
%ov_ent_conds).
730 emit_conds
(\
%ov_sec_conds).
731 "#define CONF_SECTS \\\n \\\n".
734 " *allSects[]\t= { \\\n".
739 ######### config reader definitions #########
742 "#if defined(WANT_CONF_READ) && !defined(CONF_READ_DEFINED)\n".
743 "#define CONF_READ_DEFINED\n\n";
746 my %ov_var_conds = ();
747 for my $v (keys %arr_ov_vars) {
748 my @oa = ( ["V".$v.",", "VAR"] );
749 add_cond
($arr_ov_vars{$v}, $v, \
@oa, \
%ov_var_conds);
750 $ov_vars .= " ".$oa[0][0]." \\\n";
753 emit_conds
(\
%ov_var_conds).
754 "#define CONF_READ_VARS \\\n \\\n".
760 emit_conds
(\
%ov_enum_conds).
761 "#define CONF_READ_ENTRIES \\\n \\\n".
763 $ov_rd_sects." \\\n".
767 "#endif /* WANT_CONF_READ */\n\n\n";
769 ######### core definitions #########
772 "#if defined(WANT_CORE_DECLS) && !defined(CONF_CORE_GLOBAL_DECLS)\n\n".
773 emit_conds
(\
%ov_glob_decl_conds).
774 "#define CONF_CORE_GLOBAL_DECLS \\\n".
775 $ov_glob_decls."\n\n\n".
776 emit_conds
(\
%ov_loc_def_conds).
777 "#define CONF_CORE_LOCAL_DEFS \\\n".
778 emit_defs
(\
%ov_loc_defs)."\n\n\n".
779 "#endif /* WANT_CORE_DECLS */\n\n\n";
782 "#if defined(WANT_CORE_DEFS) && !defined(CONF_CORE_GLOBAL_DEFS)\n\n".
783 emit_conds
(\
%ov_glob_conds).
784 "#define CONF_CORE_GLOBALS \\\n".
786 "#define CONF_CORE_GLOBAL_DEFS \\\n".
787 emit_defs
(\
%ov_glob_defs)."\n\n".
788 emit_conds
(\
%ov_loc_conds).
789 "#define CONF_CORE_LOCALS \\\n".
791 "#endif /* WANT_CORE_DEFS */\n\n\n";
793 ######### greeter definitions #########
796 "#if defined(WANT_GREET_DECLS) && !defined(CONF_GREET_C_DECLS)\n\n".
797 emit_conds
(\
%ov_greet_decl_conds).
798 "#define CONF_GREET_C_DECLS \\\n".
799 $ov_greet_decls[1]."\n\n\n".
800 "#define CONF_GREET_CPP_DECLS \\\n".
801 $ov_greet_decls[0]."\n\n\n".
802 "#endif /* WANT_GREET_DECLS */\n\n\n";
805 "#if defined(WANT_GREET_DEFS) && !defined(CONF_GREET_DEFS)\n\n".
806 emit_conds
(\
%ov_greet_conds).
807 "#define CONF_GREET_INIT \\\n".
808 $ov_greet_init."\n\n\n".
809 "#define CONF_GREET_INIT_QAPP \\\n".
810 $ov_greet_init_qapp."\n\n\n".
811 "#define CONF_GREET_DEFS \\\n".
812 emit_defs
(\
%ov_greet_defs)."\n\n".
813 "#endif /* WANT_GREET_DEFS */\n\n\n";
815 ######### genkdmconf definitions #########
818 "#if defined(WANT_CONF_GEN) && !defined(CONF_GEN_DEFINED)\n".
819 "#define CONF_GEN_DEFINED\n\n";
825 "#define CONF_MAX_PRIO ".$max_prio."\n\n".
826 "#define CONF_GEN_ENTRIES \\\n".
827 $ov_gen_sects." \\\n".
830 my ($ov1, $ov2) = ("", "");
831 my %ex_sec_conds = ();
832 for my $i (@ex_config) {
834 if ($i->[0] =~ /^X-(.+)-(.+)$/) {
837 } elsif ($1 eq ":*") {
838 $vn = "dEntsLocal".$2;
840 my ($t1, $t2) = ($1, $2);
842 $vn = "dEnts".$t1.$t2;
845 $vn = "dEnts".$i->[0];
848 [ "static DEnt ".$vn."[] = { \\\n".$i->[2]."};", "DSEC" ],
849 [ "{ \"".$i->[0]."\",\t".$vn.",\tas(".$vn."),".$i->[1]." },", "DSECS" ]
851 add_cond
($i->[3], $vn, \
@oa, \
%ex_sec_conds);
852 $ov1 .= $oa[0][0]." \\\n \\\n";
853 $ov2 .= $oa[1][0]." \\\n";
856 emit_conds
(\
%ex_conds).
857 emit_conds
(\
%ex_sec_conds).
858 "#define CONF_GEN_EXAMPLE \\\n \\\n".
860 "static DSect dAllSects[] = { \\\n".
865 emit_conds
(\
%ov_xm_conds).
866 "#define CONF_GEN_XMERGE \\\n \\\n".
867 "XResEnt globents[] = { \\\n".
869 "}, dpyents[] = { \\\n".
873 my $ov_km_sects = "";
874 my $ov_km_sect_refs = "";
875 for my $s (keys %ov_km) {
879 "KUpdEnt upd".$ts."[] = { \\\n".
882 $ov_km_sect_refs .= "{ \"".$s."\", upd".$ts.", as(upd".$ts.") }, \\\n";
885 emit_conds
(\
%ov_km_conds).
886 "#define CONF_GEN_KMERGE \\\n \\\n".
888 "KUpdSec kupsects[] = { \\\n".
893 "#endif /* WANT_CONF_GEN */\n";
897 $doc =~ s/%REF%/$doc_ref/;
899 "<!-- generated from $srcf - DO NOT EDIT! -->\n\n".