| 1 |
|
| 2 |
sub plugin { |
| 3 |
my $global=shift; |
| 4 |
print "Generating cross referenced index\n"; |
| 5 |
cross($global); |
| 6 |
print "Done with cross index index\n"; |
| 7 |
} |
| 8 |
|
| 9 |
sub cross { |
| 10 |
my $space=shift; |
| 11 |
my %hash; |
| 12 |
my $line; |
| 13 |
my @defs; |
| 14 |
my $columns=3; |
| 15 |
|
| 16 |
foreach (all $space) { |
| 17 |
# We don't want Friends, Typedefs, dtor, isA |
| 18 |
next if ($_->is_friend()); |
| 19 |
next if ($_->is_typedef()); |
| 20 |
next if ($_->{name} =~ /^~/); |
| 21 |
next if ($_->{name} =~ /^isA/); |
| 22 |
next if ($_->{name} =~ /^get_type/); |
| 23 |
next if ($_->{name} =~ /^gtkobj/); |
| 24 |
|
| 25 |
my $name=$_->{name}; |
| 26 |
|
| 27 |
$hash{$name}=[] if (!$hash{$name}); |
| 28 |
my $r=$hash{$name}; |
| 29 |
push(@$r,$_); |
| 30 |
} |
| 31 |
|
| 32 |
foreach (sort keys %hash) { |
| 33 |
$line= "<dt><b>$_</b>"; |
| 34 |
my $ref=$hash{$_}; |
| 35 |
foreach (@$ref) { |
| 36 |
$line.="\n<dd>"; |
| 37 |
$line.=$_->type_name(); |
| 38 |
$line.=" "; |
| 39 |
$line.=$_->href($_->{fullname}); |
| 40 |
} |
| 41 |
$line.= "\n"; |
| 42 |
push(@defs,$line); |
| 43 |
} |
| 44 |
|
| 45 |
# split into columns |
| 46 |
my $length=0; |
| 47 |
my $num; |
| 48 |
my $i=1; |
| 49 |
my $j; |
| 50 |
my @array; |
| 51 |
my @def_length; |
| 52 |
foreach (@defs) { |
| 53 |
@array=split("\n",$_); |
| 54 |
push(@def_length,$#array+1); |
| 55 |
$length+=$#array+1; |
| 56 |
} |
| 57 |
push(@def_length,1000); |
| 58 |
$num=$length/$columns+2; |
| 59 |
|
| 60 |
my @lindex; |
| 61 |
my @index; |
| 62 |
my @start; |
| 63 |
my $cindex=0; |
| 64 |
my $end; |
| 65 |
my $sindex=0; |
| 66 |
#calculate column starts |
| 67 |
while ($i<$length) { |
| 68 |
$start[$cindex]=$sindex; |
| 69 |
$end=$i+$num; |
| 70 |
while($i<$end) { |
| 71 |
$i+=$def_length[$sindex]; |
| 72 |
$sindex++; |
| 73 |
} |
| 74 |
$cindex++; |
| 75 |
} |
| 76 |
|
| 77 |
for ($i=0;$i<$columns;$i++) { |
| 78 |
$index[$i]=$start[$i]; |
| 79 |
$lindex[$i]=0; |
| 80 |
} |
| 81 |
|
| 82 |
#print results |
| 83 |
open(FILE,'>html/cross_index.html'); |
| 84 |
|
| 85 |
print FILE ' |
| 86 |
<html> |
| 87 |
<head> |
| 88 |
<title>ClanLib Reference: Cross Reference Index</title> |
| 89 |
</head> |
| 90 |
<body text=black link=blue vlink=#800080 bgcolor=white topmargin=0 leftmargin=0> |
| 91 |
<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> |
| 92 |
<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> |
| 93 |
<table align=center border=0 cellspacing=10> <tr> |
| 94 |
<td><a href="entire_class_index.html">Entire Class Index</a></td> |
| 95 |
<td><a href="class_index.html">Main Class Index</a></td> |
| 96 |
<td>Cross Index</td> |
| 97 |
<td><a href="global_index.html">Global Index</a></td> |
| 98 |
</table> |
| 99 |
<h1 align=center>Cross Reference</h1> |
| 100 |
<table border=0> |
| 101 |
'; |
| 102 |
|
| 103 |
for ($i=0;$i<$num+1;$i++) { |
| 104 |
print FILE "<tr>"; |
| 105 |
for ($j=0;$j<$columns;$j++) { |
| 106 |
next if ($i<$lindex[$j]); |
| 107 |
next if ($index[$j]==$start[$j+1]); |
| 108 |
my $dl=$def_length[$index[$j]]; |
| 109 |
my $df=$defs[$index[$j]]; |
| 110 |
# print FILE |
| 111 |
#"<td valign=\"top\" rowspan=\"${dl}\"><font size=-2>${df}</font></td>"; |
| 112 |
print FILE |
| 113 |
"<td rowspan=\"${dl}\"><font size=-2>${df}</font></td>"; |
| 114 |
$lindex[$j]+=$def_length[$index[$j]]; |
| 115 |
$index[$j]++; |
| 116 |
} |
| 117 |
print FILE " <td><font size=-2> </font></td>\n"; |
| 118 |
} |
| 119 |
|
| 120 |
print FILE ' |
| 121 |
</table> |
| 122 |
</body> |
| 123 |
</html> |
| 124 |
'; |
| 125 |
} |