diff options
Diffstat (limited to '')
-rw-r--r-- | doc/tools/src2html1.4a/src2html | 704 | ||||
-rw-r--r-- | doc/tools/src2html1.4a/src2html.1 | 244 | ||||
-rw-r--r-- | doc/tools/src2html1.4a/src2html.cgi | 100 |
3 files changed, 0 insertions, 1048 deletions
diff --git a/doc/tools/src2html1.4a/src2html b/doc/tools/src2html1.4a/src2html deleted file mode 100644 index 98d9d83d7f..0000000000 --- a/doc/tools/src2html1.4a/src2html +++ /dev/null @@ -1,704 +0,0 @@ -#!/usr/bin/perl -# Src2html: Take a source tree and generate Html documents that have hyperlinks -# to the definition of structures, variables, functions, and preprocessor -# definitions. Read the manual page for details on how to use the program. -# -# Version 1.4-alpha. Written by Warren Toomey wkt@cs.adfa.oz.au -# -# 19th January 1996 -# -# $Id$ -# - -if ($#ARGV <= 0 || $#ARGV > 4) { # Check arg count - print(STDERR "Usage: $0 [-na] [-nl] [-d num] input_description\n"); - print(STDERR " -na: Don't produce top-level category files\n"); - print(STDERR " -nl: Don't produce per-letter files\n"); - print(STDERR " -d: Set debugging to given number (0-3)\n"); - exit(1); -} - -# Set up default option values -$NoLetters= 0; -$NoAll= 0; -$Debug=0; -$Top= $ARGV[$#ARGV]; -$Top=~ s/\.s2h$//; - -# Parse the options -for ($i=0; $i<= $#ARGV; $i++) { - if ($ARGV[$i] eq "-na") { $NoAll= 1; next; } - if ($ARGV[$i] eq "-nl") { $NoLetters= 1; next; } - if ($ARGV[$i] eq "-d") { $i++; $Debug= $ARGV[$i]; next; } -} - -$Title{"m"}= "C Macros"; -$Title{"d"}= "C Defines"; -$Title{"f"}= "C Functions"; -$Title{"v"}= "C Variables"; -$Title{"s"}= "C Structs"; -$Title{"u"}= "C Unions"; -$Title{"t"}= "C Typedefs"; -$Title{"e"}= "C Enums"; -$Title{"AdaType"}= "Ada Types"; -$Title{"AdaProcedure"}= "Ada Procedures"; -$Title{"AdaFunction"}= "Ada Functions"; -$Title{"AdaPackage"}= "Ada Packages"; -$Title{"AdaTask"}= "Ada Tasks"; -$Title{"g"}= "All symbols"; - -&get_s2h; # Read the description file -&make_dirs; # Make directories as needed -&make_ctags; # Generate ctags for all src -&parse_ctags; # Parse ctags, generate html ptr files -foreach $i (keys(%Dirinfo)) -{ &rewrite_src($i); } # Rewrite the src code -exit(0); # and exit - - -## get_s2h: Opens the source description file, reads it, and sets up some -## variables describing where some directories are, and the source directories -## to process. Variables used are: -## Srctree - The root of the source tree we are processing -## Htmlroot - The directory where all WWW documents are kept -## Htmldir - The directory under Htmlroot for this source tree -## Htmltree - The root of the destination tree for the Html code -## Newsrctree - The directory in Htmltree to store the new Htmlised code -## Headers - The directory where we keep information to prepend in some docs -## Formdir - The place to put the index searching script -## Dirinfo{} - The list of dirs and the info about the directory -## Dotdir{} - The directory name with /'s -> .'s - -sub get_s2h { - $Newsrctree= 'newsrc'; # Set up as default - $Headers= '.'; - - - ######################################################### - # make sure we dump out the last bit of the last file.... - - # Print out the remainder of the - # current file, incl. the buffered line - if ($In_file == 1) { - if ("$line" ne "") { print OUT $line; } - while (<IN>) { - s/\&/&/g; s/\</</g; s/\>/>/g; print OUT; - } - print OUT "\n\n\n\n\n\n\n\n</pre></body>\n"; - close(IN); close(OUT); - } - ######################################################### - - open(S2H,$ARGV[$#ARGV]) # Open descript - || die "$0: can't open $ARGV[$#ARGV]: $!\n"; - - while(<S2H>) { # Read in input lines - next if /^#/; # Skip comments - if ( /^set\s+Srctree\s+(\S+)/ ) { - $Srctree = $1; next; # Set the variable - } - if ( /^set\s+Htmlroot\s+(\S+)/ ) { - $Htmlroot = $1; next; # Set the variable - } - if ( /^set\s+Htmldir\s+(\S+)/ ) { - $Htmldir = $1; next; # Set the variable - } - if ( /^set\s+Newsrctree\s+(\S+)/ ) { - $Newsrctree = $1; next; # Set the variable - } - if ( /^set\s+Headers\s+(\S+)/ ) { - $Headers = $1; next; # Set the variable - } - if ( /^set\s+Formdir\s+(\S+)/ ) { - $Formdir = $1; next; # Set the variable - } - if ( /^dir\s+(\S+)\s+(.*)/ ) { - $Dirinfo{$1}= $2; $Dotdir{$1}=$1; - $Dotdir{$1}=~ s/\//./g; - next; # Get dir commands - } - if ( /^\n/ ) { next; } # Ignore blank lines - # Bad input line, give warning - chop; print "$_: Bad line, ignoring\n"; next; - } - close(S2H); - if (!defined($Srctree)) { die "$0: Srctree undefined in $ARGV[$#ARGV]\n"; } - if (!defined($Htmlroot)) { die "$0: Htmlroot undefined in $ARGV[$#ARGV]\n"; } - if (!defined($Htmldir)) { die "$0: Htmldir undefined in $ARGV[$#ARGV]\n"; } - $Htmltree= "$Htmlroot/$Htmldir"; -} - -## make_dirs: Make the directories need to store the Html documents, and also -## check to make sure that the input directories exist. We depend upon mkdir(1) -## having the -p option to make intermediate directories as needed. - -sub make_dirs { - local($i); - - foreach $i (keys(%Dirinfo)) { # Check that the directories exist - if (! -e "$Srctree/$i") { - die "$0: Input dir $Srctree/$i doesn't exist\n"; - } - if (! -d "$Srctree/$i") { - die "$0: Input dir $Srctree/$i is not a directory\n"; - } - } - if (! -e "$Htmltree") { - system("mkdir -p $Htmltree") && die "$0: Can't mkdir $Htmltree\n"; - } - if (! -e "$Htmltree/$Newsrctree") { - system("mkdir -p $Htmltree/$Newsrctree") - && die "$0: Can't mkdir $Htmltree/$Newsrctree\n"; - } - if (! -e "$Htmltree/ctags") { - system("mkdir -p $Htmltree/ctags") && die "$0: Can't mkdir ctags\n"; - } - foreach $i (keys(%Dirinfo)) { - if (! -e "$Htmltree/$Newsrctree/$i") { - system("mkdir -p $Htmltree/$Newsrctree/$i") - && die "$0: Can't mkdir $Htmltree/$Newsrctree/$i\n"; - } - } -} - -## make_ctags: Process all the source code, creating the ctags files. -## The Ctagsfile{} array is set up to hold the name of the ctags files -## created. - -sub make_ctags { - local($i); - - foreach $i (keys(%Dirinfo)) { - $Ctagsfile{$i}= "$Htmltree/ctags/$Dotdir{$i}.ctags"; - if ($Debug > 0 ) { print "Generating ctags for $Ctagsfile{$i}\n"; } - system("(cd $Srctree; /usr1/rtems/rtemsdoc-work/tools/src2html/ctags-wr $i) > $Ctagsfile{$i}") - && print "$0: ctags failed on $Srctree/$i\n"; - } -} - - -## parse_ctags: Parse the ctags file produced by make_ctags, creating several -## arrays of information. The arrays created are: -## Macro{} - The name of every macro and its name lowercased -## Def{} - The name of every define and its name lowercased -## Func{} - The name of every function and its name lowercased -## Var{} - The name of every variable and its name lowercased -## Struct{} - The name of every struct and its name lowercased -## Union{} - The name of every union and its name lowercased -## Type{} - The name of every typedef and its name lowercased -## Enum{} - The name of every enum and its name lowercased -## Nfile{} - The directory in which the symbol was found -## Nline{} - The line number where the symbol was found - -sub parse_ctags { - local($i); - local($low); - local($count); - - $count = 0; - - foreach $i (keys(%Dirinfo)) { - open(CTAGS,$Ctagsfile{$i}) || die "$0: Can't open $Ctagsfile{$i}, $!\n"; - if ($Debug > 0) { print "Parsing $Ctagsfile{$i} to build ptr files\n"; } - while (<CTAGS>) { - $count ++; - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+Preprocessor macro/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Macro{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+Preprocessor define/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Def{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+C struct/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Struct{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+C union/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Union{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+C typedef/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Type{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+C enum/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Enum{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+C function/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Func{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\s+(\d+)\s+(\S+)\s+C variable/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $Var{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(return)\/.\s+(\d+)\s+(\S+)\s+.*/ ) { - next; - # Code like the following line results in "return" as ctag - # "type Action is access function return Boolean; - } - if ( /^(\w+)\/.\s+(\d+)\s+(\S+)\s+use .*/ ) { - next; - # throw away lines like "use type System" - } - - if ( /^(\w+)\/.\s+(\d+)\s+(\S+)\s+type .*/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $AdaType{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\/.+\s+(\d+)\s+(\S+)\s+procedure .*/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $AdaProcedure{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\/.+\s+(\d+)\s+(\S+)\s+function .*/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $AdaFunction{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\".+)\/.+\s+(\d+)\s+(\S+)\s+function .*/ ) { - next; - # throw away functions like "*" - } - if ( /^(\w+)\/.\s+(\d+)\s+(\S+)\s+package .*/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $AdaPackage{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^(\w+)\/.\s+(\d+)\s+(\S+)\s+task .*/ ) { - ($low=$1)=~tr/A-Z_/a-z/d; $k="$low$count"; - $AdaTask{$k}=$1; $Nline{$k}= $2; - $Nfile{$k}= $3; next; - } - if ( /^([\w\/]+)\s+(\d+)\s+(\S+)\s+use type .*/ ) { - next; - } - if ( /^([\w\/\(]+)\s+(\d+)\s+(\S+)\s+type .*/ ) { - next; - } - if ( /^;([\w\/\(]+)\s+(\d+)\s+(\S+)\s+type .*/ ) { - next; - } - if ( /^\(([\w\/\(]+)\s+(\d+)\s+(\S+)\s+procedure .*/ ) { - next; - } - print "$0: In Ctagsfile{$i}, don't recognise $_"; - } - close(CTAGS); - &make_dir_html($i); - undef %Macro; undef %Def; undef %Func; undef %Var; - undef %Struct; undef %Union; undef %Type; undef %Enum; - undef %AdaType; undef %AdaProcedure; undef %AdaFunction; - undef %AdaPackage; undef %AdaTask; - } - &make_top_html; -} - -## make_letters_html: Make the lowest HTML documents, i.e those per-directory -## per-type per-letter Htmls that point directly at the source code. -## Arguments are: Dir name, prefix, title, Name/dir list -## If the file is created, set $Exists(letter) positive, else to 0. - -sub make_letters_html { - local($dir)= $_[0]; - local($pref)= $_[1]; - local($title)= $_[2]; - local(*type)= $_[3]; - local($htmlfile); - local($let)="@"; - - foreach $i ( "a".."z", - "AdaType", "AdaProcedure", "AdaFunction", "AdaPackage", "AdaTask" ) { - $Exists{$i}=0; - } - foreach $name (sort keys( %type )) { - if (substr($name,0,1) ne $let) { - if ($let ne "@") { - print HTML "</ul></body>\n"; - close(HTML); - $Exists{$let}= 1; - } - $let= substr($name, 0, 1); - $htmlfile= "$Htmltree/$Dotdir{$dir}.$pref$let.html"; - open(HTML, "> $htmlfile") || die "$0: Can't open $htmlfile, $!\n"; - - print HTML "<head>\n<title>$title starting with "; - print HTML "`$let' in $dir</title>\n"; - print HTML "</head><body><h1>$title starting with "; - print HTML "`$let' in $dir</h1><p>\n"; - print HTML "<ul>\n"; - } - # print HTML "<li><a href=\"$Newsrctree/$Nfile{$type{$name}}"; - # print HTML ".html#$type{$name}\">$type{$name}</a> "; - # print HTML "$Nfile{$type{$name}}:$Nline{$type{$name}}\n"; next; - - print HTML "<li><a href=\"$Newsrctree/$Nfile{$name}"; - print HTML ".html#$type{$name}\">$type{$name}</a> "; - print HTML "$Nfile{$name}:$Nline{$name}\n"; next; - } - print HTML "</ul></body>\n"; - close(HTML); - $Exists{$let}= 1; -} - -## make_type_html: Make the type htmls. If there are <50 symbols for the -## directory, create the per-directory per-type html document only. Otherwise -## for every letter grep symbols, call make_lowest_letter_html, and -## finally create the per-directory per-type html document that points only -## at the letter files created. -## Arguments are: Dir name, prefix, title, Name/dir list - -sub make_type_html { - local($dir)= $_[0]; - local($pref)= $_[1]; - local($title)= $_[2]; - local(*type)= $_[3]; - local($i); - local($htmlfile); - local(@keys)= keys(%type); - local($name); - - $Exists{$title}=0; - if ( $#keys < 0 ) { return; } - if ($Debug > 0) { - $i= $#keys + 1; - print "The associative array for $dir $title has $i elements\n"; - } - if ( ($#keys < 50) || ($NoLetters == 1) ) { - $htmlfile= "$Htmltree/$Dotdir{$dir}.$pref.html"; - open(HTML, "> $htmlfile") || die "$0: Can't open $htmlfile, $!\n"; - print HTML "<head>\n<title>$title in $dir</title>\n"; - print HTML "</head><body><h1>$title in $dir</h1>\n"; - print HTML "<ul>\n"; - foreach $name (sort keys( %type )) { - # print HTML "<li><a href=\"$Newsrctree/$Nfile{$type{$name}}"; - # print HTML ".html#$type{$name}\">$type{$name}</a> "; - # print HTML "$Nfile{$type{$name}}:$Nline{$type{$name}}\n"; next; - - print HTML "<li><a href=\"$Newsrctree/$Nfile{$name}"; - print HTML ".html#$type{$name}\">$type{$name}</a> "; - print HTML "$Nfile{$name}:$Nline{$name}\n"; next; - } - print HTML "</ul></body>\n"; - close(HTML); - $Exists{$title}=1; - } - else { - &make_letters_html($dir, $pref, $title, *type); - - open(HTML, "> $Htmltree/$Dotdir{$dir}.$pref.html") - || die "$0: Can't open $htmlfile.$pref.html, $!\n"; - print HTML "<head>\n<title>$title in $dir</title>\n"; - print HTML "</head><body><h1>$title in $dir</h1><p>\n"; - print HTML "<ul>\n"; - - foreach $i ( "a".."z", - "AdaType", "AdaProcedure", "AdaFunction", "AdaPackage", "AdaTask" ) { - if ($Exists{$i} > 0) { # A file exists - print HTML "<li><a href=\"$Dotdir{$dir}.$pref$i.html\">"; - print HTML "$i</a>\n"; $Exists{$title}++; $Exists{$i}=0; - } - } - print HTML "</ul></body>\n"; - close(HTML); - if ($Exists{$title} == 0) { unlink($htmlfile); } - } -} - -## asappend: Append the contents of the second associative array to the -## first. - -sub asappend { - local(*To)= $_[0]; - local(*From)= $_[1]; - local($i); - - foreach $i (keys(%From)) { $To{$i}= $From{$i} ; } -} - -## make_dir_html: Make the html document for the directory. Use the -## Exist{} array to determine what types to include on the document. -## Arguments are: Dir name - -sub make_dir_html { - local($dir)= $_[0]; - local($i); - local(@keys); - - if ($Debug > 1) { print"In makedir, dir is $dir\n"; } - &make_type_html($dir, "f", $Title{"f"}, *Func); - &make_type_html($dir, "m", $Title{"m"}, *Macro); - &make_type_html($dir, "d", $Title{"d"}, *Def); - &make_type_html($dir, "v", $Title{"v"}, *Var); - &make_type_html($dir, "s", $Title{"s"}, *Struct); - &make_type_html($dir, "u", $Title{"u"}, *Union); - &make_type_html($dir, "t", $Title{"t"}, *Type); - &make_type_html($dir, "e", $Title{"e"}, *Enum); - &make_type_html($dir, "AdaType", $Title{"AdaType"}, *AdaType); - &make_type_html($dir, - "AdaProcedure", $Title{"AdaProcedure"}, *AdaProcedure); - &make_type_html($dir, "AdaFunction", $Title{"AdaFunction"}, *AdaFunction); - &make_type_html($dir, "AdaPackage", $Title{"AdaPackage"}, *AdaPackage); - &make_type_html($dir, "AdaTask", $Title{"AdaTask"}, *AdaTask); - - if ($NoAll != 1) { - &asappend(*GFunc, *Func); - &asappend(*GMacro, *Macro); - &asappend(*GDef, *Def); - &asappend(*GVar, *Var); - &asappend(*GStruct, *Struct); - &asappend(*GUnion, *Union); - &asappend(*GType, *Type); - &asappend(*GEnum, *Enum); - &asappend(*GAdaType, *AdaType); - &asappend(*GAdaProcedure, *AdaProcedure); - &asappend(*GAdaFunction, *AdaFunction); - &asappend(*GAdaPackage, *AdaPackage); - &asappend(*GAdaTask, *AdaTask); - } - - &asappend(*Alldir, *Func); - &asappend(*Alldir, *Macro); - &asappend(*Alldir, *Def); - &asappend(*Alldir, *Var); - &asappend(*Alldir, *Struct); - &asappend(*Alldir, *Union); - &asappend(*Alldir, *Type); - &asappend(*Alldir, *Enum); - &asappend(*Alldir, *AdaType); - &asappend(*Alldir, *AdaProcedure); - &asappend(*Alldir, *AdaFunction); - &asappend(*Alldir, *AdaPackage); - &asappend(*Alldir, *AdaTask); - - if ($NoLetters != 1) { - &make_letters_html($dir, "g", $Title{"g"}, *Alldir); - } - undef %Alldir; - - open(HTML, "> $Htmltree/$Dotdir{$dir}.html") - || die "$0: Can't open $Htmltree/$Dotdir{$dir}.html, $!\n"; - print HTML "<head>\n<title>Cross-references for $dir</title>\n"; - print HTML "</head><body><h1>Cross-references for $dir</h1><p>\n"; - if (-f "$Headers/$Dotdir{$dir}.hdr" ) { - open(TOPHDR, "$Headers/$Dotdir{$dir}.hdr"); - while (<TOPHDR>) { print HTML; } - close(TOPHDR); - } - - if (defined($Formdir)) { - print HTML "<hr><form action=\"$Formdir/src2html.cgi\" "; - print HTML "method=\"POST\">\n"; - print HTML "<input type=\"submit\" value=\"Search\">\n"; - print HTML "<input type= \"text\" "; - print HTML "name=\"$Htmldir/$Newsrctree\">\n"; - print HTML "Enter a symbol's name here to quickly find it.\n"; - print HTML "</form><hr>\n"; - } - print HTML "<h1>Cross-references for $dir by type</h1><p><ul>\n"; - - foreach $i ( "f","m","d","v","s","u","t","e", - "AdaType", "AdaProcedure", "AdaFunction", "AdaPackage", "AdaTask" ) { - if ($Exists{$Title{$i}} > 0) { # A type exists - print HTML "<li><a href=\"$Dotdir{$dir}.$i.html\">"; - print HTML "$Title{$i}</a>\n"; - $Exists{$dir}++; $Exists{$Title{$i}}=0; - } - } - print HTML "</ul><p>\n"; - if ($NoLetters != 1) { - print HTML "<h1>Cross-references for $dir by letter</h1><p><ul>\n"; - foreach $i ( "a".."z" ) { - if ($Exists{$i} > 0) { # A letter exists - print HTML "<li><a href=\"$Dotdir{$dir}.g$i.html\">"; - print HTML "$i</a>\n"; $Exists{$i}=0; - } - } - } - print HTML "</ul></body>\n"; - close(HTML); -} - -## Make_top_html: Make the top html document by making the ones below -## it and then adding links to them. - -sub make_top_html { - local($i); - local(@keys); - - $Dotdir{$Top}=$Top; - &make_type_html($Top, "f", $Title{"f"}, *GFunc); - &make_type_html($Top, "m", $Title{"m"}, *GMacro); - &make_type_html($Top, "d", $Title{"d"}, *GDef); - &make_type_html($Top, "v", $Title{"v"}, *GVar); - &make_type_html($Top, "s", $Title{"s"}, *GStruct); - &make_type_html($Top, "u", $Title{"u"}, *GUnion); - &make_type_html($Top, "t", $Title{"t"}, *GType); - &make_type_html($Top, "e", $Title{"e"}, *GEnum); - &make_type_html($Top, "AdaType", $Title{"AdaType"}, *GAdaType); - &make_type_html($Top, "AdaProcedure", $Title{"AdaProcedure"}, *GAdaProcedure); - &make_type_html($Top, "AdaFunction", $Title{"AdaFunction"}, *GAdaFunction); - &make_type_html($Top, "AdaPackage", $Title{"AdaPackage"}, *GAdaPackage); - &make_type_html($Top, "AdaTask", $Title{"AdaTask"}, *GAdaTask); - - open(HTMLTOP, "> $Htmltree/$Top.html") - || die "$0: Can't open $Htmltree/$Top.html, $!\n"; - print HTMLTOP "<head>\n<title>Cross-references for $Top</title>\n"; - print HTMLTOP "</head><body><h1>Cross-references for $Top</h1><p>\n"; - - if (-f "$Headers/$Top.hdr" ) { - open(TOPHDR, "$Headers/$Top.hdr"); - while (<TOPHDR>) { print HTMLTOP; } - close(TOPHDR); - } - - if (defined($Formdir)) { - print HTMLTOP "<hr><form action=\"$Formdir/src2html.cgi\" "; - print HTMLTOP "method=\"POST\">\n"; - print HTMLTOP "<input type=\"submit\" value=\"Search\">\n"; - print HTMLTOP "<input type= \"text\" "; - print HTMLTOP "name=\"$Htmldir/$Newsrctree\">\n"; - print HTMLTOP "Enter a symbol's name here to quickly find it.\n"; - print HTMLTOP "</form><hr>\n"; - } - print HTMLTOP "<h2>Cross-references by directory</h2><p>\n"; - print HTMLTOP "<ul>\n"; - - foreach $i (sort keys(%Dirinfo)) { - if ($Exists{$i} > 0) { # A dir exists - print HTMLTOP "<li><a href=\"$Dotdir{$i}.html\">"; - print HTMLTOP "$i</a> $Dirinfo{$i}\n"; $Exists{$i}=0; - } - } - if ($NoAll != 1) { - print HTMLTOP "</ul><p><h2>Cross-references by type</h2><p><ul>\n"; - foreach $i ( "f","m","d","v","s","u","t","e", - "AdaType", "AdaProcedure", "AdaFunction", "AdaPackage", "AdaTask" ) { - if ($Exists{$Title{$i}} > 0) { # A type exists - print HTMLTOP "<li><a href=\"$Top.$i.html\">"; - print HTMLTOP "$Title{$i}</a>\n"; - } - } - if ($NoLetters != 1) { - print HTMLTOP "</ul><p><h2>All Cross-references for $Top"; - print HTMLTOP "</h2><p><ul>\n"; - &asappend(*Alltop, *GFunc); - &asappend(*Alltop, *GMacro); - &asappend(*Alltop, *GDef); - &asappend(*Alltop, *GVar); - &asappend(*Alltop, *GStruct); - &asappend(*Alltop, *GUnion); - &asappend(*Alltop, *GType); - &asappend(*Alltop, *GEnum); - &asappend(*Alltop, *GAdaType); - &asappend(*Alltop, *GAdaProcedure); - &asappend(*Alltop, *GAdaFunction); - &asappend(*Alltop, *GAdaPackage); - &asappend(*Alltop, *GAdaTask); - - if ($Debug > 0) { print "Making top letters\n"; } - &make_letters_html($Top, "g", $Title{"g"}, *Alltop); - if ($Debug > 0) { print "Making top letters, part 2\n"; } - foreach $i ( "a".."z" ) { - if ($Exists{$i} > 0) { - print HTMLTOP "<li><a href=\"$Dotdir{$Top}.g$i.html\">"; - print HTMLTOP "$i</a>\n"; - } - } - } - } - print HTMLTOP "</ul>\n"; - print HTMLTOP "<hr>This source tree was made with "; - print HTMLTOP "<a href=\"http://minnie.cs.adfa.oz.au/Src2html/index.html"; - print HTMLTOP "\">src2html</a>.</body>\n"; - close(HTMLTOP); -} - - -## rewrite_src: Reread the ctags file for the given directory, and -## rewrite the source code, adding in anchor points and bolding symbols. -## This is messy as we can have multiple symbols on a single source line, -## therefore we must buffer each line while reading from the ctags file. -## -sub rewrite_src { - local($dir)= $_[0]; - local($i); - local($file)=""; - local($line)=""; - local($symb); - local($cnt); - local($nextcnt); - - $In_file=0; - open(CTAGS,"sort +2 -3 +1n -2 $Ctagsfile{$dir} |") - || die "$0: Can't open sorted $Ctagsfile{$dir}, $!\n"; - if ($Debug > 0) { print "Rewriting source in $dir\n"; } - while (<CTAGS>) { - # Get the next file, line, symbol - if (/^([\w\/]+)\s+(\d+)\s+([A-Za-z0-9_\+\-\.\/]+)/) { - if ($Debug > 2) { print "Symb $1 at $2 in $3\n"; } - $fname=$3; $nextcnt= $2; $symb=$1; - $symb=~ s/\/.//g; - - # If it's in a new file - if ("$file" ne "$fname") { - # Print out the remainder of the - # current file, incl. the buffered line - if ($In_file == 1) { - if ("$line" ne "") { print OUT $line; } - while (<IN>) { - s/\&/&/g; s/\</</g; s/\>/>/g; print OUT; - } - print OUT "\n\n\n\n\n\n\n\n\n\n</pre></body>\n"; - close(IN); close(OUT); - } - $file= "$fname"; - # Open the new file & do the preamble - open(IN, "$Srctree/$file") || - print "Cannot open $Srctree/$file\n"; - open(OUT, "> $Htmltree/$Newsrctree/$file.html"); - $In_file=1; - print OUT "<head>\n<title>$file Source</title>\n"; - print OUT "</head><body>\n"; - print OUT "<h1>Source to $file</h1>\n"; - if (defined($Formdir)) { - print OUT "<hr><form action=\"$Formdir/src2html.cgi\" "; - print OUT "method=\"POST\">\n"; - print OUT "<input type=\"submit\" value=\"Search\">\n"; - print OUT "<input type= \"text\" "; - print OUT "name=\"$Htmldir/$Newsrctree\">\n"; - print OUT "Enter a symbol's name here to quickly find it.\n"; - print OUT "</form><hr>\n"; - } - print OUT "<pre>\n"; - # Get the first line - $cnt=1; $line = <IN>; - $line=~ s/\&/&/g; - $line=~ s/\</</g; - $line=~ s/\>/>/g; - } - } - # Print all lines until one with a symb - while ($cnt < $nextcnt) { - print OUT $line; $cnt++; $line= <IN>; - $line=~ s/\&/&/g; - $line=~ s/\</</g; - $line=~ s/\>/>/g; - } - # Now rewrite the line - $line=~ s/\b$symb\b/<a name="$symb"<\/a><b>$symb<\/b>/; - next; - } - close(CTAGS); close(IN); close(OUT); -} diff --git a/doc/tools/src2html1.4a/src2html.1 b/doc/tools/src2html1.4a/src2html.1 deleted file mode 100644 index 7401859ca8..0000000000 --- a/doc/tools/src2html1.4a/src2html.1 +++ /dev/null @@ -1,244 +0,0 @@ -.TH src2html 1L "June 1994" -.SH NAME -src2html \- Hyperlink a C source code tree using HTML, Version 1.3-alpha - -.SH SYNOPSIS -.B src2html -[ -.I \-na -] [ -.I \-nl -] [ -.I \-d debug_level -] -.I configuration_file - -.SH DESCRIPTION - -.B src2html -is a program which takes a C source tree and creates a set of -HTML hypertext documents that allows the most important symbols in the -source tree to be found easily. As well, a HTML version of the source -tree is created, with the symbols given in bold font where they are defined -in the source. - -.B src2html -finds and hyperlinks the following C symbols: Preprocessor defines -and macros, C functions, global variables, structs, unions, enums and typedefs. -If defined in the -.I configuration file, -a query document is used so that symbols can be located by an index query -as well as following the hyperlinks. - -.SH OPTIONS -The -.I debug level -was used when debugging the program, and its only use is -to assure the user that something is actually happening, especially for large -source trees. The highest debug level of 3 is not particularly verbose. -.PP -By default, -.B src2html -produces html pages for each category of C symbols. If there are more than -50 in each category, -.B src2html -then further subdivides the symbols on a first-letter basis, making HTML -documents for each letter. -.PP -If the -.I -nl -flag is set, no first-letter HTML documents will ever be produced. -Similarly, -.B src2html -creates a top-level document with category links. If the -.I -na -flag is set, no top-level category links will be produced. - -.SH CONFIGURATION FILE - -.B src2html -takes as an argument a -.I configuration file -which describes the directories in a source tree to process, and -where to place the resulting HTML documents. Lines beginning with a # -sign are ignored, as are blank lines. The following lines have special meaning: -.P -.IP "set Srctree source_tree" -Set the root of the tree where the original source is kept, e.g -/usr/src/sys. Do not leave a trailing slash on the tree name. -This line must appear in the configuration file. -.P -.IP "set Htmlroot html_tree" -Set the root of the tree where HTML documents are normally kept. -This is the same as DocumentRoot in the httpd(1L) configuration. -Again, do not leave a trailing slash on the tree name. -This line must appear in the configuration file. -.P -.IP "set Htmldir html_dir" -Set the directory within Htmlroot where the HTML documents for this -tree will be placed. -Again, do not leave a trailing slash on the tree name. -This line must appear in the configuration file. -.P -.IP "set Newsrctree new_source_tree" -Set the directory within the Htmltree where the marked up source code -is placed, e.g src. This allows the source to be kept separate from the -`pointer' documents which point at the source; see the next section for -more details. This line is optional, and the default value of -Newsrctree is `newsrc'. -.P -.IP "set Headers header_dir" -.B src2html -allows information to be placed at the beginning of the HTML -documents created, e.g to describe the contents of a particular -subdirectory. Files containing this information are kept in this -directory. This line is optional, and the default value of -Headers is `.'. -.P -.IP "set Formdir form_dir" -If set, this tells -.B src2html -that the active HTML document which can -perform index lookups for the source tree is located in this -directory. If not set, -.B src2html -will not put query boxes in the -HTML documents created. This line is optional, and there is no -default value. -.P -.IP "dir directory comments_about_the_dir" -This line may appear may times, and tells -.B src2html -to process -source files in the directory Srctree/dir. This allows only particular -sections of the source tree to be marked up. The comments after the -directory are placed in the top-level HTML document to explain -what that directory contains. - -.SH DIRECTORY STRUCTURE - -.B src2html -expects to be given a source tree to process, and it produces -a new tree with HTML documents. The configuration file should have a suffix -of `.s2h', although this is strictly not needed. - -As an example, consider the following configuration file named BSD.s2h: -.PP -.nf -# Comments -set Srctree /usr/src/sys -set Htmltree /usr/local/WWW -set Htmldir sys -set Newsrctree newsrc # Comments here too -set Headers /home/staff/warren/sys_headers -set Formdir /cgi -dir kern The core OS routines: processes, scheduling, syscalls -dir sys Widely used C-language include files -dir i386/isa Device drivers for peripherals on the ISA bus -.fi -.PP -Three directories containing C source will be processed, -.nf - /usr/src/sys/kern, - /usr/src/sys/sys and - /usr/src/sys/i386/isa -.fi - -The resulting marked up source code will be placed in -.nf - /usr/local/WWW/sys/newsrc/kern, - /usr/local/WWW/sys/newsrc/sys and - /usr/local/WWW/sys/newsrc/i386/isa -.fi -respectivey. -.PP -The directory /usr/local/WWW/sys will itself contain a set of pointer -documents which point to the source code documents on a per-directory, -per-symbol-type and per-first-letter basis (and combinations of the -above). One file, BSD.html (named from the configuration file name), is the -root of the hyperlinks, and the entire source tree can be browsed from this -one document. - -.SH HEADER FILES - -.B src2html -creates a root HTML document, and HTML documents for each directory -named in the configuration file. Textual information can be placed in the -head of these documents to describe the contents of the tree/directory, -give references etc. The files that hold this information are kept in the -Headers directory. Taking the above configuration file as an example, - - /home/staff/warren/sys_headers/BSD.hdr - /home/staff/warren/sys_headers/kern.hdr - /home/staff/warren/sys_headers/sys.hdr - /home/staff/warren/sys_headers/i386.isa.hdr - -can hold the information to be placed in the head of the appropriate -documents. Note that if a directory name has a slash as given in the -configuration file, the name of the header file has a dot instead. -.PP -Header files are placed `as is' into the head of the document, and thus -can contain HTML markup commands. Any and all header files are optional; -if the file does not exist, nothing will be placed in the head of the -appropriate HTML document. -.PP -Once -.B src2html -has completed, the header files may be removed. However, -you may wish to keep them in case you ever need to re-run -.B src2html -on the same source tree. - -.SH SEARCH SCRIPT - -During execution, -.B src2html -builds a ctags directory in Htmltree and places -the output of ctags-new(1L) on the source tree directories in this place. -This information is needed if a search script is also requested. -.PP -If the Formdir is set in the configuration file, -.B src2html -will configure the HTML code produced to use the search script -.I src2html.cgi -to search for symbols in the source tree. This script -conforms to the cgi query format as used by httpd(1). You must move the -supplied -.I src2html.cgi -file into the Formdir in the httpd hierachy before the query functionality -can be used. -.PP -Again, from the example configuration file above, -/usr/local/httpd/cgi/src2html.cgi is where to place the script, if the -httpd hierachy is kept in /usr/local/httpd. - -.SH EXAMPLE SOURCE TREE - -The output from -.B src2html -for the full FreeBSD 2.0.5 kernel source directory can be browsed -from the Web page http://minnie.cs.adfa.oz.au/FreeBSD-srctree/FreeBSD.html. - -.SH BUGS AND SHORTCOMINGS - -.B src2html -uses the ctags-new(1L) program, which does not correctly parse C variable -declarations and function pointer usage. Someone should rewrite this in Perl. -.PP -Ideally, -.B src2html -should include hyperlinks within each source file, -but this is difficult given C's scoping rules, and would need a more -sophisticated parser than ctags(1L). -.PP -.B src2html -looks at all files in the named source directories, including -files that don't end in .c and .h. This may be construed as a feature. - -.SH SEE ALSO -.PD -ctags-new(1L), httpd(1L), perl(1L) - -.SH AUTHOR -.PD -Warren Toomey wkt@cs.adfa.oz.au diff --git a/doc/tools/src2html1.4a/src2html.cgi b/doc/tools/src2html1.4a/src2html.cgi deleted file mode 100644 index cfc93d4134..0000000000 --- a/doc/tools/src2html1.4a/src2html.cgi +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/local/bin/perl -# -# src2html.cgi -- A search script to file symbols in a src2html tree. -# You need to install this in your httpd script directory AND set the -# httpd web root below. -# -# We need the cgi-lib.pl package to be available to Perl -require 'cgi-lib.pl'; -# -## We MUST know the root of the httpd server, so we can find the ctags -## -# -$Http_root= "/usr/pub/pub/www"; - - # Parse input -> %in -&ReadParse; # and print first 2 lines - -@keys= keys(%in); # We only expect one name/val pair -if ($#keys != 0) { # Otherwise, return an error document - print <<"query_error"; -Content-type: text/html - - <header><title>Query Error</title></header><body> - <h1>Query Error</h1> - The document you used to query this source tree has an error in it. - You should email the maintainer of the source tree with a copy of the - document with the query form in it. - </body> -query_error - exit(1); -} - # Given the name, determine which tree -$Htmltree= "$Http_root/$keys[0]"; -$Htmltree=~ s/\/[^\/]*$//; # Location of the Html tree root -$Srctree= "/$keys[0]"; # URL of the actual source -$Ctags= "$Htmltree/ctags"; # Location of the ctags files - -@symbol= split(/\s+/, $in{$keys[0]}); # Get one symbol to search for - -if ($#symbol != 0) { # Hmm, <> 1 symbol, return an error - print <<"symbol_error"; -Content-type: text/html - - <header><title>$Htmltree Search Error</title></header><body> - <h1>$Htmltree Search Error</h1> - Hmm, you either sent in no symbols to me to search, or a number of - symbols to find, separated by whitespace.<p> - The search function can only handle regexp expressions with no - whitespace. Try resubmitting your query. - </body> -symbol_error - exit(1); -} - # Let's go to work, egrep the ctags - -# Naftali Schwartz (nschwart@SLINKY.CS.NYU.EDU) reports that using the ^ -# on the following line stops the script from working under SunOS 4.1.3. -# Sounds like ctags-new doesn't start the symbol in the 1st column. -open(IN, "cat $Ctags/* | egrep ^$symbol[0] |") || die "$0: egrep failed\n"; -$cnt=0; -while(<IN>) { - ($sym, $line, $file, $com)= split(/\s+/); - $Sym[$cnt]=$sym; $Line[$cnt]= $line; $File[$cnt]= $file; $cnt++; -} -close(IN); - # How many did we get? Zero, no symbol -if ($cnt == 0) { - print <<"symbol_missing"; -Content-type: text/html - - <header><title>$Htmltree Search Error</title></header><body> - <h1>$Htmltree Search Error</h1> - The symbol $symbol[0] does not appear in the source tree. - </body> -symbol_missing - exit(1); -} - -if ($cnt == 1) { # Exactly one, return ptr to that doc - print "Location: $Srctree/$File[0]"; - -# I used to use the commented out line under NCSA httpd because the other -# line didn't work. You may need to try things out on your server. - print ".html\#$Sym[0]\n\n"; -# print ".html\n\n"; - exit(0); -} - # Else return a list of choices -print <<"many_found"; -Content-type: text/html - -<header><title>$Htmltree Search</title></header><body> -<h1>$Htmltree Search</h1><ul> -many_found -for ($i = 0; $i < $cnt; $i++) { - print "<li><a href= \"$Srctree/$File[$i]"; - print ".html#$Sym[$i]\">$Sym[$i]</a> $File[$i]:$Line[$i]\n"; -} -print "</ul></body>\n"; -exit(0); |