$sections=[
{t=>"Download",l=>"download.htm",f=>"detail",
c=>[
{t=>"Windows
Binaries",l=>"download.htm#binwin",f=>"detail"},
{t=>"Linux
Binaries",l=>"download.htm#binlin",f=>"detail"},
{t=>"Unix
Sources",l=>"download.htm#sourceunix",f=>"detail"},
{t=>"Windows
Sources",l=>"download.htm#sourcewin",f=>"detail"}
]
},
{t=>"Documentation",l=>"whatsnew.htm",f=>"detail",
c=>[
{t=>"Whats
new ?",l=>"whatsnew.htm",f=>"detail"},
{t=>"Yab
in a Nutshell",l=>"whatsnew.htm#nutshell",f=>"detail"},
{t=>"FAQ",l=>"faq.htm",f=>"detail"},
{t=>"History
of Yabasic",l=>"history.htm",f=>"detail"},
{t=>"Log
of changes",l=>"log.htm",f=>"detail"},
{t=>"Manual
of Yabasic",l=>"yabasic.htm",f=>"detail"},
{t=>"...
auch auf Deutsch",l=>"yabasic_de.htm",f=>"detail"},
{t=>"The
new docu",l=>"new_docu.htm",f=>"detail"},
{t=>"Guide
into the Guts",l=>"guts.htm",f=>"detail"}
]
},
{t=>"Support",l=>"support.htm",f=>"detail",
c=>[
{t=>"Mailing
list",l=>"https://sourceforge.net/mail/?group_id=7664",f=>"_parent"},
{t=>"FAQ",l=>"faq.htm",f=>"detail"}
]
},
{t=>"at SourceForge",l=>"https://sourceforge.net/project/?group_id=7664",f=>"_parent",
c=>[
{t=>"Mailing
list",l=>"https://sourceforge.net/mail/?group_id=7664",f=>"_parent"},
{t=>"Forum",l=>"https://sourceforge.net/forum/?group_id=7664",f=>"_parent"}
]
},
{t=>"Copyright",l=>"copyright.htm",f=>"detail",
c=>[
{t=>"Gnu
Public License",l=>"gpl.htm",f=>"detail"},
{t=>"Artistic
License",l=>"artistic.htm",f=>"detail"}
]
},
{t=>"Related
Sites",l=>"related.htm",f=>"detail",
c=>[
{t=>"Yabasic
on the PS2",l=>"related.htm#ps2",f=>"detail"},
{t=>"Yabedit",l=>"http://www.rovoscape.com",f=>"_parent"},
{t=>"Yabasic
Realms",l=>"http://www.rovoscape.com",f=>"_parent"},
{t=>"Japi",l=>"http://www.japi.de",f=>"_parent"},
{t=>"Programs
and Libaries",l=>"http://underworld.fortunecity.com/redalert/259/yabasic/",f=>"_parent"},
{t=>"Other
Yabasic Sites",l=>"related.htm#dedicated",f=>"detail"},
{t=>"Other
Basic Sites",l=>"related.htm#other",f=>"detail"}
]
},
{t=>"Not
Yabasic",l=>"other.htm",f=>"detail",
c=>[
{t=>"Sybilles
Homepage",l=>"sybille/default.htm",f=>"_parent"},
{t=>"Niklas
Homepage",l=>"niklas.htm",f=>"_parent"},
{t=>"My
html-museum",l=>"museum.htm",f=>"_parent"},
{t=>"About
this toc",l=>"about_toc.htm",f=>"detail"}
]
},
{t=>"About me",l=>"aboutme.htm",f=>"detail"}
];
$num_sec=@sec=@$sections;
print "$num_sec sections to process, expecting up to ",2**$num_sec,"
files.\n";
for $i (0 .. 2**$num_sec-1) {
undef %open;
$ofilename=$filename="new_toc.htm";
for $s (0 .. $#sec) {
if ($sec[$s]->{c} && ($i & 1<<$s))
{
$open{$s}=1;
$filename=plus($filename,$s);
}
}
next if $distinct{$filename};
$distinct{$filename}=1;
print "writing file #",++$filecount,": $filename\n";
open FILE,">$filename" or die $!;
print FILE <<'END-OF-HEADER';
<!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.0//EN">
<html>
<head>
<title>Table of Contents</title>
<link rel="stylesheet" type="text/css" href="standard.css">
<meta name="author" content="Marc-Oliver Ihm">
<meta name="generator" content="Namo WebEditor v3.0">
<style><!--
p { margin:0; padding:0; border-width:0; }
A { color:black; text-decoration:none; font-family:verdana,arial,hlvetica,sans-serif;
font-size:10pt;}
A.symbol { font-weight:900;font-size:9pt;background-color:#b3b3e0;}
A.symbol:hover { font-weight:900;font-size:9pt;background-color:#8686a8; color:white;
}
A.sub { font-size:8pt;}
A:hover { color:white; text-decoration:none;}
--></style>
<body bgcolor="#A0A0C8" text="black" link="blue"
vlink="purple" alink="red">
END-OF-HEADER
print FILE "<table>\n";
for $i (0 .. $#sec) {
$s=$sec[$i];
print FILE "<tr>\n<td nowrap>";
if ($s->{c}) {
if ($open{$i}) {
print FILE '<a class="symbol"
target="toc" href="'.minus($filename,$i).'"><b>–</b></a>';
print FILE '<a class="symbol"
target="toc" href="'.$ofilename.'"><b>=</b></a> ';
} else {
print FILE '<a class="symbol"
target="toc" href="'.plus($filename,$i).'"><b>+</b></a>';
print FILE '<a class="symbol"
target="toc" href="'.plus($ofilename,$i).'"><b>±</b></a> ';
}
}
print FILE "</td><td nowrap>";
print FILE '<a href="'.$s->{l}.'"';
print FILE 'target="'.$s->{f}.'"' if $s->{f};
print FILE ">$s->{t}</a>";
if ($s->{c} && $open{$i}) {
print FILE "</td></tr><tr><td></td><td><table>";
for $c (@{$s->{c}}) {
print FILE "<tr><td></td><td
nowrap>";
print FILE '<a class="sub"
href="'.$c->{l}.'"';
print FILE 'target="'.$c->{f}.'"'
if $c->{f};
print FILE ">$c->{t}</a>";
print FILE "</tr>\n";
}
print FILE "<tr><td height=6pt></td><td></td></tr></table>\n";
}
print FILE "</td></tr>\n";
}
print FILE "</table>\n";
print FILE <<'END-OF-TRAILER';
</body>
</html>
END-OF-TRAILER
close FILE;
}
sub plus {
my $name=shift;
my $num=shift;
my $i;
for $i (0 .. length($name)) {
if (substr($name,$i,1)>$num || substr($name,$i,1) eq ".")
{
substr($name,$i,0)=$num;
return $name;
}
}
return $name;
}
sub minus {
my $name=shift;
my $num=shift;
$name=~s/$num//;
return $name;
}