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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
sub plugin {
my $global=shift;
print "Generating cross referenced index\n";
cross($global);
print "Done with cross index index\n";
}
sub cross {
my $space=shift;
my %hash;
my $line;
my @defs;
my $columns=3;
foreach (all $space) {
# We don't want Friends, Typedefs, dtor, isA
next if ($_->is_friend());
next if ($_->is_typedef());
next if ($_->{name} =~ /^~/);
next if ($_->{name} =~ /^isA/);
next if ($_->{name} =~ /^get_type/);
next if ($_->{name} =~ /^gtkobj/);
my $name=$_->{name};
$hash{$name}=[] if (!$hash{$name});
my $r=$hash{$name};
push(@$r,$_);
}
foreach (sort keys %hash) {
$line= "<dt><b>$_</b>";
my $ref=$hash{$_};
foreach (@$ref) {
$line.="\n<dd>";
$line.=$_->type_name();
$line.=" ";
$line.=$_->href($_->{fullname});
}
$line.= "\n";
push(@defs,$line);
}
# split into columns
my $length=0;
my $num;
my $i=1;
my $j;
my @array;
my @def_length;
foreach (@defs) {
@array=split("\n",$_);
push(@def_length,$#array+1);
$length+=$#array+1;
}
push(@def_length,1000);
$num=$length/$columns+2;
my @lindex;
my @index;
my @start;
my $cindex=0;
my $end;
my $sindex=0;
#calculate column starts
while ($i<$length) {
$start[$cindex]=$sindex;
$end=$i+$num;
while($i<$end) {
$i+=$def_length[$sindex];
$sindex++;
}
$cindex++;
}
for ($i=0;$i<$columns;$i++) {
$index[$i]=$start[$i];
$lindex[$i]=0;
}
#print results
open(FILE,'>html/cross_index.html');
print FILE '
<html>
<head>
<title>ClanLib Reference: Cross Reference Index</title>
</head>
<body text=black link=blue vlink=#800080 bgcolor=white topmargin=0 leftmargin=0>
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img border=0 src="../images/eyeheader-main-yellow-a.png" alt="ClanSoft logo" width=525 height=96></td></tr>
<tr bgcolor=#dadada><td align=left valign=top><img border=0 src="../images/eyeheader-main-yellow-b.png" alt="ClanSoft logo" width=190 height=14></td><td align=right valign=top><img border=0 src="../images/clanlib_light.png" width=42 height=14></td></tr></table>
<table align=center border=0 cellspacing=10> <tr>
<td><a href="entire_class_index.html">Entire Class Index</a></td>
<td><a href="class_index.html">Main Class Index</a></td>
<td>Cross Index</td>
<td><a href="global_index.html">Global Index</a></td>
</table>
<h1 align=center>Cross Reference</h1>
<table border=0>
';
for ($i=0;$i<$num+1;$i++) {
print FILE "<tr>";
for ($j=0;$j<$columns;$j++) {
next if ($i<$lindex[$j]);
next if ($index[$j]==$start[$j+1]);
my $dl=$def_length[$index[$j]];
my $df=$defs[$index[$j]];
# print FILE
#"<td valign=\"top\" rowspan=\"${dl}\"><font size=-2>${df}</font></td>";
print FILE
"<td rowspan=\"${dl}\"><font size=-2>${df}</font></td>";
$lindex[$j]+=$def_length[$index[$j]];
$index[$j]++;
}
print FILE " <td><font size=-2> </font></td>\n";
}
print FILE '
</table>
</body>
</html>
';
}
|