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= "
$_"; my $ref=$hash{$_}; foreach (@$ref) { $line.="\n
"; $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 ' ClanLib Reference: Cross Reference Index
ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Cross Reference

'; for ($i=0;$i<$num+1;$i++) { print FILE ""; 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 #""; print FILE ""; $lindex[$j]+=$def_length[$index[$j]]; $index[$j]++; } print FILE " \n"; } print FILE '
${df}${df} 
'; }