2 # Script for formatting documentation from definition lists
3 # (they get out of extract-doc.pl as a side-product).
4 # (c) 2008 Michal Vaner <vorner@ucw.cz>
11 open OUT, ">$out" or die "Could not write output $out ($!)\n";
12 open HEAD, $head or die "Could not open head $head ($!)\n";
13 print OUT foreach( <HEAD> );
17 $dir =~ s/\/[^\/]+$//;
21 while( defined( my $line = <> ) ) {
23 push @dump, [ split /,/, $line, 5 ];
36 'struct' => 'Structs',
39 'def' => 'Preprocessor definitions'
44 foreach( sort { ( $groups{$a->[2]} <=> $groups{$b->[2]} ) or ( $a->[3] cmp $b->[3] ); } @dump ) {
45 my( $file, $anchor, $type, $name, $text ) = @{$_};
46 if( $lasttype ne $type ) {
48 print OUT "\n== $heads{$type} [[$type]]\n\n";
51 while( shift @{[ $dircp =~ /([^\/]+)/, "//" ]} eq shift @{[ $file =~ /([^\/]+)/, "///" ]} ) {
52 $dircp =~ s/[^\/]+\/?//;
53 $file =~ s/[^\/]+\/?//;
55 $dircp =~ s/[^\/]+/../g;
56 $file = $dircp."/".$file;
58 $file =~ s/\.[^.]+$//;
59 $text =~ s/\(/!!PARENT_OPEN!!/g;
60 $text =~ s/(\.\.\.)/\\$1/g;
61 print OUT "<<$file:$anchor,`$name`>>:: `$text`\n";