my @cdl_files; sub WriteFrameset { open(FRAMESET, ">frames.html"); print FRAMESET < END_OF_HEADER close(FRAMESET); } sub WriteIndex { # list patterns to be omitted from the index my @index_files; foreach $cdl_file (@cdl_files) { next if ($cdl_file =~ /^draw/i); next if ($cdl_file =~ /^Plugin$/); next if ($cdl_file =~ /^swdraw/i); next if ($cdl_file =~ /^testtopope/i); next if ($cdl_file =~ /^xdedraw/i); next if ($cdl_file =~ /^xsdraw/i); next if ($cdl_file =~ /^wok/i); next if ($cdl_file =~ /^test[_.]/i); push(@index_files, $cdl_file); } print "CDL files: " . ($#cdl_files+1) . "\n"; print "Index files: " . ($#index_files+1) . "\n"; open(INDEX, ">index.html"); print INDEX < CDL File Index

CDL File Index

END_OF_FOOTER close(INDEX); } my $firstitem = 1; sub LinkFrom { my ($item, $from, $package) = @_; if ($package eq "class") { return "$item$from$package"; } my $cdl = "${package}_${item}.cdl"; my $found = 0; my $myfile; foreach $myfile (@cdl_files) { if ("$myfile" eq "$cdl") { $found = 1; last; } } if ($found) { return "$item$from$package"; } else { return "$item$from$package"; } } sub Convert { my ($cdl_file) = @_; my $html_file = $cdl_file; $html_file =~ s/\.cdl$/.html/; open(HTML, ">$html_file"); print HTML < $cdl_file

CDL File Index

END_OF_HEADER

  open(CDL, "<$cdl_file");
  while () {
    s/>/\>/g;
    s/$_";
    }
    else {
      s/(\w+)(\s+from\s+)(\w+)/LinkFrom($1,$2,$3)/eg;
    }
    print HTML "$_
"; } close(CDL); print HTML < END_OF_FOOTER close(HTML); } # open the current directory and read all the CDL files print "Building file list...\n"; opendir(DIR, "."); @cdl_files = grep(/\.cdl$/, readdir(DIR)); closedir(DIR); # generate the frames file print "Generating frame set (frames.html)...\n"; WriteFrameset(); # write the index file print "Generating file index (index.html)...\n"; WriteIndex(@cdl_files); # convert the CDL files to HTML foreach $cdl_file (@cdl_files) { print "Converting: $cdl_file...\n"; Convert($cdl_file); } print "Done\n";