| 1 |
use strict; |
| 2 |
use POSIX qw(strftime); |
| 3 |
sub plugin { |
| 4 |
my $global=shift; |
| 5 |
print "Generation class documentation\n"; |
| 6 |
print_class_index($global); |
| 7 |
print_classes($global); |
| 8 |
print "Done with classes\n"; |
| 9 |
} |
| 10 |
|
| 11 |
sub print_classes { |
| 12 |
my $space=shift; |
| 13 |
foreach (sort byfullname $space->all()) { |
| 14 |
next if (!$_->is_class()); |
| 15 |
print_class($_); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
my %see_also; |
| 20 |
|
| 21 |
# Remember to set $new_line_flag = 0 before using this function |
| 22 |
my $new_line_flag = 0; |
| 23 |
my @classes; |
| 24 |
sub print_description { |
| 25 |
my $mydesc=shift; |
| 26 |
foreach (@classes) { |
| 27 |
my $item = $_; |
| 28 |
my $name = $$item{fullname}; |
| 29 |
# Find comment cross reference |
| 30 |
my $mylink=$item->href($$item{fullname}); |
| 31 |
$mydesc=~s/([. ,()])${name}([. ,()])/${1}${mylink}${2}/g; |
| 32 |
$mydesc=~s/([. ,()])${name}$/${1}${mylink}/g; |
| 33 |
$mydesc=~s/^${name}([. ,()])/${mylink}${1}/g; |
| 34 |
} |
| 35 |
# Check if new lines are required |
| 36 |
if ($mydesc=~/<p>/) { |
| 37 |
$new_line_flag = 1; |
| 38 |
$mydesc=~s/<p>//g; |
| 39 |
} |
| 40 |
if ($mydesc=~/<\/p>/) { |
| 41 |
$new_line_flag = 0; |
| 42 |
$mydesc=~s/<\/p>//g; |
| 43 |
} |
| 44 |
$mydesc = &addCrossRef($mydesc); |
| 45 |
if ($new_line_flag eq 0) { |
| 46 |
print FILE "$mydesc<br>"; |
| 47 |
}else { |
| 48 |
print FILE "$mydesc"; |
| 49 |
} |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
sub addCrossRef { |
| 54 |
my $text = shift; |
| 55 |
# my @sortedClasses = sort { $$b{fullname} cmp $$a{fullname} } @classes; |
| 56 |
|
| 57 |
foreach (@classes) { |
| 58 |
my $name = $$_{fullname}; |
| 59 |
my $loc = $name . ".html"; |
| 60 |
# $text =~ s/${name}/<a href="$loc">$name<\/a>/g; |
| 61 |
if ($text =~ /${name}/) { |
| 62 |
$see_also{$name} = "<a href=\"$loc\">$name<\/a>"; |
| 63 |
} |
| 64 |
} |
| 65 |
return $text; |
| 66 |
} |
| 67 |
|
| 68 |
sub print_html_header { |
| 69 |
my $html_name=shift; |
| 70 |
my $index_number=shift; |
| 71 |
my $colour=shift; |
| 72 |
print FILE ' |
| 73 |
<!-- clanlib header begin --> |
| 74 |
<HTML> |
| 75 |
<HEAD> |
| 76 |
<TITLE>', $html_name, ' - ClanLib Game SDK</TITLE> |
| 77 |
<STYLE TYPE="text/css"><!-- |
| 78 |
HTML BODY |
| 79 |
{ |
| 80 |
font-family: verdana, helvetica, sans-serif; |
| 81 |
font-size: 12px; |
| 82 |
} |
| 83 |
H1 { font-size: 22px; } |
| 84 |
H2 { font-size: 18px; } |
| 85 |
H3 { font-size: 16px; } |
| 86 |
H4 { font-size: 14px; } |
| 87 |
P { font-size: 12px; } |
| 88 |
LI { font-size: 12px; } |
| 89 |
--></STYLE> |
| 90 |
</HEAD> |
| 91 |
|
| 92 |
<body bgcolor=white text=black link=blue vlink=#800080> |
| 93 |
|
| 94 |
<center> |
| 95 |
<img src="http://clanlib.org/gfx/clanlib.png"> |
| 96 |
</center> |
| 97 |
<!-- clanlib header end --> |
| 98 |
|
| 99 |
<center> |
| 100 |
<p> |
| 101 |
<a href="http://clanlib.org/docs.html">Home</a> | |
| 102 |
<a href="classes.html">All Classes</a> | |
| 103 |
<a href="modules.html">Grouped Classes</a> | |
| 104 |
<a href="index.html">Index</a> | |
| 105 |
<a href="search.html">Search</a> |
| 106 |
</p> |
| 107 |
</center> |
| 108 |
'; |
| 109 |
|
| 110 |
# if ($index_number eq 1) |
| 111 |
# { |
| 112 |
# print FILE "<td>Entire Class Index</td>\n"; |
| 113 |
# }else |
| 114 |
# { |
| 115 |
# print FILE "<td><a href=\"entire_class_index.html\">Entire Class Index</a></td>\n"; |
| 116 |
# } |
| 117 |
# |
| 118 |
# if ($index_number eq 2) |
| 119 |
# { |
| 120 |
# print FILE "<td>Main Class Index</td>\n"; |
| 121 |
# }else |
| 122 |
# { |
| 123 |
# print FILE "<td><a href=\"class_index.html\">Main Class Index</a></td>\n"; |
| 124 |
# } |
| 125 |
# |
| 126 |
#: if ($index_number eq 3) |
| 127 |
# { |
| 128 |
# print FILE "<td>Cross Index</td>\n"; |
| 129 |
# }else |
| 130 |
# { |
| 131 |
# print FILE "<td><a href=\"cross_index.html\">Cross Index</a></td>\n"; |
| 132 |
# } |
| 133 |
# |
| 134 |
# if ($index_number eq 4) |
| 135 |
# { |
| 136 |
# print FILE "<td>Global Index</td>\n"; |
| 137 |
# }else |
| 138 |
# { |
| 139 |
# print FILE "<td><a href=\"global_index.html\">Global Index</a></td>\n"; |
| 140 |
# } |
| 141 |
# print FILE "</table>"; |
| 142 |
} |
| 143 |
|
| 144 |
sub print_html_footer { |
| 145 |
print FILE ' |
| 146 |
|
| 147 |
<!-- clanlib footer begin --> |
| 148 |
|
| 149 |
<center><br><br><font color="#a0a0a0"> |
| 150 |
Questions or comments, write to the <a href="http://clanlib.org/contact.html">ClanLib mailing list</a>. |
| 151 |
</font></center> |
| 152 |
|
| 153 |
</body> |
| 154 |
</html> |
| 155 |
<!-- clanlib footer end -->'; |
| 156 |
} |
| 157 |
|
| 158 |
my $last_group; |
| 159 |
my $last_section; |
| 160 |
my $file_open_flag; |
| 161 |
sub print_class_index { |
| 162 |
my $space=shift; |
| 163 |
my $clan_group; |
| 164 |
my $clan_section; |
| 165 |
my $id; |
| 166 |
my %hash; |
| 167 |
my %classname_hash; |
| 168 |
my $time_string = strftime "%e %b %Y", gmtime; |
| 169 |
my @alpha_classes; |
| 170 |
# Get the class in order of Group / Section / Name |
| 171 |
$id = 0; |
| 172 |
foreach (all $space) { |
| 173 |
if ($_->is_class()) |
| 174 |
{ |
| 175 |
my $cname = $_->name; |
| 176 |
$clan_group = ""; |
| 177 |
$clan_section = ""; |
| 178 |
|
| 179 |
foreach (split("\n",$$_{unique_string})) { |
| 180 |
/^!.(.*)$/; |
| 181 |
my $workbuffer; |
| 182 |
$workbuffer=$1; |
| 183 |
if (substr($workbuffer,0,4) eq "clan") |
| 184 |
{ |
| 185 |
$workbuffer = substr($workbuffer,4); |
| 186 |
($clan_group, $clan_section)=split(/=/, $workbuffer); |
| 187 |
$clan_section=~s/\"//g; |
| 188 |
} |
| 189 |
} |
| 190 |
my $name = "$clan_group=$clan_section=$cname=$id\n"; |
| 191 |
$hash{$name}=[] if (!$hash{$name}); |
| 192 |
|
| 193 |
my $classname = "$cname=$clan_group=$clan_section=$id\n"; |
| 194 |
$classname_hash{$classname}=[] if (!$classname_hash{$classname}); |
| 195 |
} |
| 196 |
$id = $id + 1; |
| 197 |
} |
| 198 |
my @entire_list = $space->all(); |
| 199 |
|
| 200 |
foreach (sort keys %hash) |
| 201 |
{ |
| 202 |
my $cname; |
| 203 |
($clan_group, $clan_section, $cname, $id) = split(/=/, $_); |
| 204 |
if ($cname =~ /^CL_/) |
| 205 |
{ |
| 206 |
push(@classes, $entire_list[$id]); |
| 207 |
} |
| 208 |
} |
| 209 |
|
| 210 |
my $num_alpha = 0; |
| 211 |
foreach (sort keys %classname_hash) |
| 212 |
{ |
| 213 |
my $cname; |
| 214 |
($cname, $clan_group, $clan_section, $id) = split(/=/, $_); |
| 215 |
if ($cname =~ /^CL_/) |
| 216 |
{ |
| 217 |
push(@alpha_classes, $entire_list[$id]); |
| 218 |
$num_alpha = $num_alpha + 1; |
| 219 |
} |
| 220 |
} |
| 221 |
|
| 222 |
open(FILE,">html/classes.html"); |
| 223 |
print_html_header("All Classes", 1, "green"); |
| 224 |
print FILE "<h1>All Classes</h1>\n"; |
| 225 |
|
| 226 |
print FILE "<table width=100%>\n"; |
| 227 |
print FILE "<tr><td valign=top><p>\n"; |
| 228 |
|
| 229 |
my $last_letter=""; |
| 230 |
|
| 231 |
my $next_tr = int ($num_alpha/3-5); |
| 232 |
foreach (@alpha_classes) { |
| 233 |
|
| 234 |
my $cname = $_->name; |
| 235 |
$cname =~ /CL_(.)/; |
| 236 |
my $letter = $1; |
| 237 |
|
| 238 |
if ($last_letter ne $letter) |
| 239 |
{ |
| 240 |
if ($next_tr < 3) |
| 241 |
{ |
| 242 |
print FILE "</p></td>\n<td valign=top><p>\n"; |
| 243 |
$next_tr = int ($num_alpha/3-5); |
| 244 |
} |
| 245 |
|
| 246 |
if ($next_tr < int ($num_alpha/3-5)) |
| 247 |
{ |
| 248 |
print FILE "<br>"; |
| 249 |
$next_tr = $next_tr - 1; |
| 250 |
} |
| 251 |
print FILE "<b>$letter</b><br>\n"; |
| 252 |
$last_letter = $letter; |
| 253 |
$next_tr = $next_tr - 1; |
| 254 |
} |
| 255 |
|
| 256 |
print FILE "<a href=\"$$_{name}.html\">$$_{name}</a><br>\n"; |
| 257 |
$next_tr = $next_tr - 1; |
| 258 |
if ($next_tr == 0) |
| 259 |
{ |
| 260 |
print FILE "</p></td>\n<td valign=top><p>\n"; |
| 261 |
$next_tr = int ($num_alpha/3-5); |
| 262 |
} |
| 263 |
} |
| 264 |
print FILE "</p></td></tr>\n"; |
| 265 |
print FILE "</table>\n"; |
| 266 |
print_html_footer(); |
| 267 |
close(FILE); |
| 268 |
|
| 269 |
|
| 270 |
open(FILE,">html/modules.html"); |
| 271 |
print_html_header("Grouped Classes", 1, "green"); |
| 272 |
print FILE "<h1>Grouped Classes</h1>\n"; |
| 273 |
|
| 274 |
print FILE "<table width=100%>\n"; |
| 275 |
print FILE "<tr><td valign=top><p>\n"; |
| 276 |
|
| 277 |
my $last_group=""; |
| 278 |
my $last_section=""; |
| 279 |
my %func_hash; |
| 280 |
my %empty; |
| 281 |
|
| 282 |
my $next_tr = int ($num_alpha/2)-22; |
| 283 |
foreach (@classes) { |
| 284 |
|
| 285 |
my $cname = $_->name; |
| 286 |
|
| 287 |
$clan_group = ""; |
| 288 |
$clan_section = ""; |
| 289 |
|
| 290 |
foreach (split("\n",$$_{unique_string})) { |
| 291 |
/^!.(.*)$/; |
| 292 |
my $workbuffer; |
| 293 |
$workbuffer=$1; |
| 294 |
if (substr($workbuffer,0,4) eq "clan") |
| 295 |
{ |
| 296 |
$workbuffer = substr($workbuffer,4); |
| 297 |
($clan_group, $clan_section)=split(/=/, $workbuffer); |
| 298 |
$clan_section=~s/\"//g; |
| 299 |
} |
| 300 |
} |
| 301 |
|
| 302 |
if ($last_group ne $clan_group || $last_section ne $clan_section) |
| 303 |
{ |
| 304 |
my $key; |
| 305 |
foreach $key (sort keys %func_hash) |
| 306 |
{ |
| 307 |
print FILE $func_hash{$key}; |
| 308 |
$next_tr = $next_tr - 1; |
| 309 |
if ($next_tr <= 0) |
| 310 |
{ |
| 311 |
print FILE "</p></td>\n<td valign=top><p>\n"; |
| 312 |
$next_tr = int ($num_alpha/2)-22; |
| 313 |
} |
| 314 |
} |
| 315 |
%func_hash = %empty; |
| 316 |
|
| 317 |
if ($next_tr < 3) |
| 318 |
{ |
| 319 |
print FILE "</p></td>\n<td valign=top><p>\n"; |
| 320 |
$next_tr = int ($num_alpha/2)-22; |
| 321 |
} |
| 322 |
|
| 323 |
if ($next_tr < int ($num_alpha/2-22)) |
| 324 |
{ |
| 325 |
print FILE "<br>"; |
| 326 |
$next_tr = $next_tr - 1; |
| 327 |
} |
| 328 |
|
| 329 |
if ($last_group ne $clan_group) |
| 330 |
{ |
| 331 |
print FILE "<b>$clan_group</b><br>\n"; |
| 332 |
$next_tr = $next_tr - 1; |
| 333 |
} |
| 334 |
|
| 335 |
print FILE "<i>$clan_section</i><br>\n"; |
| 336 |
$next_tr = $next_tr - 1; |
| 337 |
|
| 338 |
$last_group = $clan_group; |
| 339 |
$last_section = $clan_section; |
| 340 |
} |
| 341 |
|
| 342 |
$func_hash{$$_{name}} = "<a href=\"$$_{name}.html\">$$_{name}</a><br>\n"; |
| 343 |
|
| 344 |
} |
| 345 |
|
| 346 |
|
| 347 |
my $key; |
| 348 |
foreach $key (sort keys %func_hash) |
| 349 |
{ |
| 350 |
print FILE $func_hash{$key}; |
| 351 |
$next_tr = $next_tr - 1; |
| 352 |
if ($next_tr <= 0) |
| 353 |
{ |
| 354 |
print FILE "</p></td>\n<td valign=top><p>\n"; |
| 355 |
$next_tr = int ($num_alpha/2)-22; |
| 356 |
} |
| 357 |
} |
| 358 |
%func_hash = %empty; |
| 359 |
|
| 360 |
|
| 361 |
print FILE "</p></td></tr>\n"; |
| 362 |
print FILE "</table>\n"; |
| 363 |
print_html_footer(); |
| 364 |
close(FILE); |
| 365 |
|
| 366 |
# Print index: |
| 367 |
my %index; |
| 368 |
foreach (sort byfullname $space->all()) { |
| 369 |
next if (!$_->is_class()); |
| 370 |
|
| 371 |
my $dfilename = $$_{fullname}; |
| 372 |
$dfilename=~s/::/__/g; |
| 373 |
$index{$$_{fullname}} .= "<dd><a href=\"$dfilename.html\">$$_{fullname}</a></dd>\n"; |
| 374 |
|
| 375 |
if ($_->functions()) { |
| 376 |
my $access; |
| 377 |
foreach $access ($Enum::PUBLIC, $Enum::PROTECTED, $Enum::PRIVATE) { |
| 378 |
foreach ($_->get_by_access($access)) { |
| 379 |
next if ($$_{name} =~ /^~/); # no destructors please. |
| 380 |
|
| 381 |
# Replace :: with __ for filenames |
| 382 |
my $dummyfilename = $$_{fullname}; |
| 383 |
$dummyfilename=~s/::/__/g; |
| 384 |
|
| 385 |
my $func_ref = "<dd><a href=\"$dummyfilename.html\">$$_{fullname}</a></dd>\n"; |
| 386 |
$index{$$_{name}} .= $func_ref if ($_->is_function()); |
| 387 |
# $index{$$_{name}} .= $func_ref if ($_->is_function() && !($index{$$_{name}} =~ /$func_ref/)); |
| 388 |
} |
| 389 |
} |
| 390 |
} |
| 391 |
} |
| 392 |
|
| 393 |
open(FILE,">html/index.html"); |
| 394 |
print_html_header("Index", 1, "green"); |
| 395 |
print FILE "<h1>Index</h1>\n"; |
| 396 |
|
| 397 |
my $key; |
| 398 |
foreach $key (sort keys %index) { |
| 399 |
print FILE "<p><dt>$key</dt>\n$index{$key}</p>\n"; |
| 400 |
} |
| 401 |
|
| 402 |
print_html_footer(); |
| 403 |
close(FILE); |
| 404 |
|
| 405 |
|
| 406 |
open(FILE,">html/search.html"); |
| 407 |
print_html_header("Search", 1, "green"); |
| 408 |
print FILE "<h1>Search</h1>\n"; |
| 409 |
|
| 410 |
print FILE "<table width=100% topmargin=0 leftmargin=0 cellpadding=0 cellspacing=0 border=0 align=center>\n"; |
| 411 |
print FILE "<tr><td valign=top>\n"; |
| 412 |
print FILE "<table cellpadding=4 cellspacing=0 border=0>\n"; |
| 413 |
print FILE "<tr><td>\n"; |
| 414 |
print FILE "<form\n"; |
| 415 |
print FILE " action=\"http://search.ankiro.dk/s/search_3a5812cd894444669a903e56c7414ecb.asp\"\n"; |
| 416 |
print FILE " method=\"get\"\n"; |
| 417 |
print FILE " id=\"SearchForm\"\n"; |
| 418 |
print FILE " name=\"SearchForm\">\n"; |
| 419 |
print FILE "<input type=\"text\" name=\"q\">\n"; |
| 420 |
print FILE "<input type=\"submit\" value=\"Search\" id=\"submitButton\" name=\"submitButton\">\n"; |
| 421 |
print FILE "</form>\n"; |
| 422 |
print FILE "</td></tr>\n"; |
| 423 |
print FILE "</table>\n"; |
| 424 |
print FILE "</td></tr>\n"; |
| 425 |
print FILE "</table>\n"; |
| 426 |
|
| 427 |
print_html_footer(); |
| 428 |
close(FILE); |
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
# open(FILE,">html/entire_class_index.html"); |
| 433 |
# print_html_header("Entire Class Index", 1, "green"); |
| 434 |
# print FILE "<h1 align=center>Entire Class Index</h1>\n<ul type=disc>\n"; |
| 435 |
# $last_group="E R R O R"; |
| 436 |
# $last_section="E R R O R"; |
| 437 |
# foreach (@classes) { |
| 438 |
# print_class_full_index($_); |
| 439 |
# } |
| 440 |
# print FILE "</ul>Documentation Created : $time_string\n</body></html>"; |
| 441 |
# print_html_footer(); |
| 442 |
# close(FILE); |
| 443 |
# |
| 444 |
# open(FILE,">html/class_index.html"); |
| 445 |
# print_html_header("Main Index", 2, "orange"); |
| 446 |
# print FILE "<h1 align=center>Main Index</h1>\n<ul type=disc>\n"; |
| 447 |
# $last_group="E R R O R"; |
| 448 |
# $last_section="E R R O R"; |
| 449 |
# foreach (@classes) { |
| 450 |
# print_class_main_index($_); |
| 451 |
# } |
| 452 |
# print FILE "</ul>Documentation Created : $time_string\n</body></html>"; |
| 453 |
# print_html_footer(); |
| 454 |
# close(FILE); |
| 455 |
# |
| 456 |
# $last_group="E R R O R"; |
| 457 |
# $last_section="E R R O R"; |
| 458 |
# $file_open_flag = 0; |
| 459 |
# foreach (@classes) { |
| 460 |
# print_class_section_index($_); |
| 461 |
# } |
| 462 |
# |
| 463 |
# # Close the old file |
| 464 |
# if ($file_open_flag ne 0) |
| 465 |
# { |
| 466 |
# $file_open_flag = 0; |
| 467 |
# print_html_footer(); |
| 468 |
# close(FILE); |
| 469 |
# } |
| 470 |
|
| 471 |
} |
| 472 |
|
| 473 |
sub print_class_section_index { |
| 474 |
my $item=shift; |
| 475 |
|
| 476 |
my $clan_group=""; |
| 477 |
my $clan_section=""; |
| 478 |
my $workbuffer; |
| 479 |
|
| 480 |
foreach (split("\n",$$_{unique_string})) { |
| 481 |
/^!.(.*)$/; |
| 482 |
$workbuffer=$1; |
| 483 |
if (substr($workbuffer,0,4) eq "clan") |
| 484 |
{ |
| 485 |
$workbuffer = substr($workbuffer,4); |
| 486 |
($clan_group, $clan_section)=split(/=/, $workbuffer); |
| 487 |
$clan_section=~s/\"//g; |
| 488 |
} |
| 489 |
} |
| 490 |
# Start of a new group |
| 491 |
if ($clan_group ne $last_group) |
| 492 |
{ |
| 493 |
# Close the old file |
| 494 |
if ($file_open_flag ne 0) |
| 495 |
{ |
| 496 |
$file_open_flag = 0; |
| 497 |
print_html_footer(); |
| 498 |
close(FILE); |
| 499 |
} |
| 500 |
# Open a new file |
| 501 |
open(FILE,">html/${clan_group}_index.html"); |
| 502 |
print_html_header("$clan_group Index", 0, "orange"); |
| 503 |
print FILE "<h1 align=center>$clan_group Index</h1>\n<ul type=disc>\n"; |
| 504 |
$file_open_flag = 1; |
| 505 |
$last_group = $clan_group; |
| 506 |
$last_section = "E R R O R"; |
| 507 |
} |
| 508 |
|
| 509 |
# Start of a new section |
| 510 |
if ($clan_section ne $last_section ) |
| 511 |
{ |
| 512 |
print FILE '<hr size="1" width="70%" align="left" noshade="noshade">'; |
| 513 |
print FILE "<h3>$clan_group - $clan_section </h3>"; |
| 514 |
$last_section = $clan_section; |
| 515 |
} |
| 516 |
print FILE "<li><b>",$item->href($$item{fullname}),"</b>\n"; |
| 517 |
} |
| 518 |
|
| 519 |
#sub print_class_main_index { |
| 520 |
# my $item=shift; |
| 521 |
# |
| 522 |
# my $clan_group=""; |
| 523 |
# my $clan_section=""; |
| 524 |
# my $workbuffer; |
| 525 |
# my $comment_found_flag = 0; |
| 526 |
# |
| 527 |
# foreach (split("\n",$$_{unique_string})) { |
| 528 |
# /^!.(.*)$/; |
| 529 |
# $workbuffer=$1; |
| 530 |
# if (substr($workbuffer,0,4) eq "clan") |
| 531 |
# { |
| 532 |
# $workbuffer = substr($workbuffer,4); |
| 533 |
# ($clan_group, $clan_section)=split(/=/, $workbuffer); |
| 534 |
# } |
| 535 |
# } |
| 536 |
# if ($clan_group ne $last_group) |
| 537 |
# { |
| 538 |
# |
| 539 |
# print FILE '<hr size="1" width="70%" align="left" noshade="noshade">'; |
| 540 |
# print FILE "<li><b><a href=\"${clan_group}_index.html\"> $clan_group </a> </b><br>\n"; |
| 541 |
# $last_group = $clan_group; |
| 542 |
# |
| 543 |
# $new_line_flag = 0; |
| 544 |
# foreach (split("\n", $file_global_string)) |
| 545 |
# { |
| 546 |
# /(.*)$/; |
| 547 |
# my $mydesc = $1; |
| 548 |
# |
| 549 |
# # A new comment found - it will always need processing |
| 550 |
# if (substr($mydesc,0, 2) eq "! ") |
| 551 |
# { |
| 552 |
# $comment_found_flag = 0; |
| 553 |
# } |
| 554 |
# |
| 555 |
# if ($comment_found_flag eq 0) |
| 556 |
# { |
| 557 |
# # Find the correct comment |
| 558 |
# if ($mydesc eq "! ${clan_group}") |
| 559 |
# { |
| 560 |
# $comment_found_flag = 1; |
| 561 |
# } |
| 562 |
# }else |
| 563 |
# { |
| 564 |
# $mydesc = substr($mydesc, 1); |
| 565 |
# print_description($mydesc); |
| 566 |
# } |
| 567 |
# } |
| 568 |
# } |
| 569 |
#} |
| 570 |
# |
| 571 |
# |
| 572 |
#sub print_class_full_index { |
| 573 |
# my $item=shift; |
| 574 |
# |
| 575 |
# my $clan_group=""; |
| 576 |
# my $clan_section=""; |
| 577 |
# my $workbuffer; |
| 578 |
# |
| 579 |
# foreach (split("\n",$$_{unique_string})) { |
| 580 |
# /^!.(.*)$/; |
| 581 |
# $workbuffer=$1; |
| 582 |
# if (substr($workbuffer,0,4) eq "clan") |
| 583 |
# { |
| 584 |
# $workbuffer = substr($workbuffer,4); |
| 585 |
# ($clan_group, $clan_section)=split(/=/, $workbuffer); |
| 586 |
# $clan_section=~s/\"//g; |
| 587 |
# } |
| 588 |
# } |
| 589 |
# if (($clan_group ne $last_group) || ($clan_section ne $last_section )) |
| 590 |
# { |
| 591 |
# print FILE '<hr size="1" width="70%" align="left" noshade="noshade">'; |
| 592 |
# print FILE "<h3>$clan_group - $clan_section </h3>"; |
| 593 |
# $last_group = $clan_group; |
| 594 |
# $last_section = $clan_section; |
| 595 |
# } |
| 596 |
# |
| 597 |
# print FILE "<li><b>",$item->href($$item{fullname}),"</b>\n"; |
| 598 |
#} |
| 599 |
|
| 600 |
sub print_class { |
| 601 |
$_=shift; |
| 602 |
|
| 603 |
# Replace :: with __ for filenames |
| 604 |
my $dummyfilename = $$_{fullname}; |
| 605 |
$dummyfilename=~s/::/__/g; |
| 606 |
|
| 607 |
print "Generating $$_{fullname}\n"; |
| 608 |
open(FILE,">html/$dummyfilename.html"); |
| 609 |
|
| 610 |
my $classname = $$_{fullname}; |
| 611 |
my $classfilename = $dummyfilename; |
| 612 |
|
| 613 |
print_html_header("$$_{fullname}", 0, "purple"); |
| 614 |
print FILE "<h1>Class $$_{fullname}</h1>\n"; |
| 615 |
|
| 616 |
my $workbuffer=""; |
| 617 |
my $clan_group=""; |
| 618 |
my $clan_section=""; |
| 619 |
my $clan_header=""; |
| 620 |
foreach (split("\n",$$_{unique_string})) { |
| 621 |
/^!.(.*)$/; |
| 622 |
$workbuffer=$1; |
| 623 |
if (substr($workbuffer,0, 7) eq "header=") |
| 624 |
{ |
| 625 |
$clan_header = substr($workbuffer, 7); |
| 626 |
} |
| 627 |
if (substr($workbuffer,0,4) eq "clan") |
| 628 |
{ |
| 629 |
$workbuffer = substr($workbuffer,4); |
| 630 |
($clan_group, $clan_section)=split(/=/, $workbuffer); |
| 631 |
$clan_section=~s/\"//g; |
| 632 |
} |
| 633 |
} |
| 634 |
|
| 635 |
print FILE "<p>$$_{short} <a href=\"#description\">More...</a></p>\n"; |
| 636 |
|
| 637 |
# Print containing space |
| 638 |
my $space=$$_{space}; |
| 639 |
my $tempname = $space->href($$space{fullname}); |
| 640 |
# Fix to change global to global_index |
| 641 |
$tempname=~s/global.html/global_index.html/g; |
| 642 |
# print FILE "Contained in: ",$tempname,"<br>\n"; |
| 643 |
|
| 644 |
# Print base classes |
| 645 |
print FILE "<p>Derived from:\n"; |
| 646 |
if ($_->parents()) { |
| 647 |
foreach (sort byname parents $_) { |
| 648 |
print FILE $_->href("$$_{fullname}"),"\n"; |
| 649 |
} |
| 650 |
} |
| 651 |
else {print FILE "<i>none</i>\n"; } |
| 652 |
print FILE "<br>\n"; |
| 653 |
|
| 654 |
# Print derived classes |
| 655 |
print FILE "Derived by:\n"; |
| 656 |
if ($_->children()) { |
| 657 |
foreach (sort byname children $_) { |
| 658 |
|
| 659 |
# Replace :: with __ for filenames |
| 660 |
$dummyfilename = $$_{fullname}; |
| 661 |
$dummyfilename=~s/::/__/g; |
| 662 |
|
| 663 |
print FILE "<a href=\"$dummyfilename.html\">$$_{fullname}</a>\n"; |
| 664 |
#print FILE "<a href=\"$$_{fullname}.html\">$$_{fullname}</a>\n"; |
| 665 |
} |
| 666 |
} |
| 667 |
else { print FILE "<i>none</i>\n"; } |
| 668 |
|
| 669 |
print FILE "<br>Group: $clan_group ($clan_section)</p>\n"; |
| 670 |
|
| 671 |
print FILE "<p>\n"; |
| 672 |
print FILE "#include \<ClanLib/$clan_header\>\n"; |
| 673 |
print FILE "<p>\n"; |
| 674 |
|
| 675 |
my %functions; |
| 676 |
|
| 677 |
if ($_->functions()) { |
| 678 |
my $access; |
| 679 |
|
| 680 |
my $current_function_type = ""; |
| 681 |
|
| 682 |
print FILE "<table border=0 width=100%>\n"; |
| 683 |
foreach $access ($Enum::PUBLIC, $Enum::PROTECTED) { |
| 684 |
|
| 685 |
my @group; |
| 686 |
foreach ($_->get_by_access($access)) { |
| 687 |
push(@group,$_); # if ($_->is_function()); |
| 688 |
} |
| 689 |
next if (!@group); |
| 690 |
|
| 691 |
|
| 692 |
foreach (@group) { |
| 693 |
# See if a different function type required (using the "! c=" identifier) |
| 694 |
my $this_name=""; |
| 695 |
my $this_value=""; |
| 696 |
foreach (split("\n",$$_{unique_string})) { |
| 697 |
/(.*)$/; |
| 698 |
($this_name, $this_value)=split(/=/, $1); |
| 699 |
if ($this_name eq "! c") |
| 700 |
{ |
| 701 |
if ($this_value ne $current_function_type) |
| 702 |
{ |
| 703 |
print FILE "</table>\n"; |
| 704 |
$current_function_type = $this_value; |
| 705 |
print FILE "<p><b>$this_value</b></p>\n"; |
| 706 |
print FILE "<table border=0 width=100%>\n"; |
| 707 |
} |
| 708 |
} |
| 709 |
} |
| 710 |
|
| 711 |
next if ($$_{name} =~ /^~/); # Skip destructors. |
| 712 |
next if ($current_function_type eq "Implementation"); # Skip Implementation group. |
| 713 |
|
| 714 |
# Replace :: with __ for filenames |
| 715 |
my $dummyfilename = $$_{fullname}; |
| 716 |
$dummyfilename=~s/::/__/g; |
| 717 |
|
| 718 |
if (!$functions{$dummyfilename}) # Only write function description once. |
| 719 |
{ |
| 720 |
my $hint = ""; |
| 721 |
$hint = " <i>static</i>" if ($$_{type} =~ /^static/); |
| 722 |
print FILE "<tr><td width=30% valign=top><p><a href=\"$dummyfilename.html\">$$_{name}</a>$hint</p></td><td valign=top><p>$$_{short}</p></td></tr>"; |
| 723 |
$functions{$dummyfilename} = []; |
| 724 |
} |
| 725 |
} |
| 726 |
} |
| 727 |
print FILE "</table>\n"; |
| 728 |
} |
| 729 |
|
| 730 |
print FILE "<a name=\"#description\"><p><b>Detailed description:</b></p>\n"; |
| 731 |
|
| 732 |
# print FILE "<p>"; |
| 733 |
# |
| 734 |
# $new_line_flag = 0; |
| 735 |
# foreach (split("\n",$$_{long})) { |
| 736 |
# /(.*)$/; |
| 737 |
# print_description($1); |
| 738 |
# } |
| 739 |
# print FILE "</p>\n"; |
| 740 |
|
| 741 |
print FILE "$$_{long}\n"; |
| 742 |
|
| 743 |
print_html_footer(); |
| 744 |
close(FILE); |
| 745 |
|
| 746 |
my %funcname; |
| 747 |
my %funcshort; |
| 748 |
my %funcproto; |
| 749 |
my %funcparams; |
| 750 |
my %funcretval; |
| 751 |
my %funcdesc; |
| 752 |
|
| 753 |
my $access; |
| 754 |
foreach $access ($Enum::PUBLIC, $Enum::PROTECTED) { |
| 755 |
foreach ($_->get_by_access($access)) { |
| 756 |
|
| 757 |
# if ($_->functions()) { |
| 758 |
# foreach (sort byname $_->functions()) { |
| 759 |
my $impl; |
| 760 |
|
| 761 |
# Replace :: with __ for filenames |
| 762 |
my $filename = $$_{fullname}; |
| 763 |
$filename=~s/::/__/g; |
| 764 |
|
| 765 |
my $proto = ""; |
| 766 |
$proto .= "\n\t"; |
| 767 |
$proto .= "$$_{type} " if ($$_{type} ne ""); |
| 768 |
$proto .= "$$_{name}"; |
| 769 |
|
| 770 |
if ($_->is_function()) { |
| 771 |
$proto .= "("; |
| 772 |
$proto .= "\n\t\t$$_{args}" if ($$_{args}); |
| 773 |
$proto .= ")"; |
| 774 |
} |
| 775 |
|
| 776 |
$proto .= ";\n"; |
| 777 |
|
| 778 |
# Html. Replace < and > with < and > |
| 779 |
$proto =~ s/</\</g; |
| 780 |
$proto =~ s/>/\>/g; |
| 781 |
|
| 782 |
my $retval; |
| 783 |
my $params; |
| 784 |
my $param_name; |
| 785 |
my $param_value; |
| 786 |
foreach (split("\n",$$_{comments})) { |
| 787 |
if (/^param (.+?): (.+)$/) { |
| 788 |
if ($param_name ne $1) { |
| 789 |
if ($param_name) |
| 790 |
{ |
| 791 |
$params .= "<dt><i>$param_name</i></dt><dd>$param_value</dd>\n"; |
| 792 |
} |
| 793 |
$param_name = $1; |
| 794 |
$param_value = ""; |
| 795 |
} |
| 796 |
$param_value .= $2; |
| 797 |
} |
| 798 |
elsif (/^return: (.+)$/) { |
| 799 |
$retval .= $1; |
| 800 |
} |
| 801 |
} |
| 802 |
if ($param_name) |
| 803 |
{ |
| 804 |
$params .= "<dt><i>$param_name</i></dt><dd>$param_value</dd>\n"; |
| 805 |
} |
| 806 |
|
| 807 |
$funcname{$filename} = $$_{fullname}; |
| 808 |
$funcshort{$filename} .= $$_{short}; |
| 809 |
$funcproto{$filename} .= $proto; |
| 810 |
$funcparams{$filename} .= $params; |
| 811 |
$funcretval{$filename} .= $retval if ($retval); |
| 812 |
$funcdesc{$filename} .= $$_{long}; |
| 813 |
} |
| 814 |
} |
| 815 |
|
| 816 |
my $filename; |
| 817 |
foreach $filename (keys %funcname) |
| 818 |
{ |
| 819 |
my %empty; |
| 820 |
%see_also = %empty; |
| 821 |
|
| 822 |
open(FILE,">html/$filename.html"); |
| 823 |
|
| 824 |
print_html_header("$funcname{$filename}", 0, "purple"); |
| 825 |
print FILE "<h1>$funcname{$filename}</h1>\n"; |
| 826 |
|
| 827 |
print FILE &addCrossRef("<p>$funcshort{$filename}</p>\n"); |
| 828 |
|
| 829 |
print FILE &addCrossRef("<pre>$funcproto{$filename}</pre>\n"); |
| 830 |
|
| 831 |
if ($funcparams{$filename}) |
| 832 |
{ |
| 833 |
print FILE "<p><b>Parameters:</b></p>\n"; |
| 834 |
|
| 835 |
print FILE "<dl>\n"; |
| 836 |
print FILE &addCrossRef("$funcparams{$filename}"); |
| 837 |
print FILE "</dl>\n"; |
| 838 |
} |
| 839 |
|
| 840 |
if ($funcretval{$filename}) |
| 841 |
{ |
| 842 |
print FILE "<p><b>Return value:</b></p>\n"; |
| 843 |
print FILE "<p>"; |
| 844 |
print_description(&addCrossRef($funcretval{$filename})); |
| 845 |
print FILE "</p>\n"; |
| 846 |
} |
| 847 |
|
| 848 |
if ($funcdesc{$filename}) { |
| 849 |
print FILE "<p><b>Detailed description:</b></p>"; |
| 850 |
print FILE &addCrossRef("$funcdesc{$filename}\n"); |
| 851 |
|
| 852 |
# my $longhtmlstring = $funcdesc{$filename}; |
| 853 |
# $longhtmlstring=~s/\n/<br>/g; |
| 854 |
# print FILE "<br><blockquote>$longhtmlstring</blockquote>\n"; |
| 855 |
} |
| 856 |
|
| 857 |
print FILE "<p><b>See also:</b></p>\n"; |
| 858 |
# print FILE "<p><a href=\"$classfilename.html\">$classname</a>\n"; |
| 859 |
|
| 860 |
$see_also{$classname} = "<a href=\"$classfilename.html\">$classname</a>"; |
| 861 |
|
| 862 |
my $str; |
| 863 |
my $cur_also; |
| 864 |
foreach $cur_also (sort keys %see_also) |
| 865 |
{ |
| 866 |
$str .= " | " if ($str ne ""); |
| 867 |
$str .= $see_also{$cur_also}; |
| 868 |
} |
| 869 |
|
| 870 |
print FILE "<p>$str</p>\n"; |
| 871 |
|
| 872 |
print_html_footer(); |
| 873 |
close(FILE); |
| 874 |
} |
| 875 |
} |