#!/usr/usc/bin/perl # # ctoohtml Version 1.3 # # A c/c++ to HTML filter. # # Copyright (C) 1995 Andrew H. Fagg (af0a@robotics.usc.edu) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # # # see http://www.usc.edu/dept/robotics/personal/af0a/tools/ctoohtml/ctoohtml.html # # # Usage: ctoohtml [-[]]* + # # Where is a 1 letter parameter name, and is an # arbitrary string. # + is an arbitary number of .c and .h files. # # # Legal Parameters are: # a Title/Header for the tag index (tags.all.html) # default = "All Tags Found in Source Files" # C Indicates that .c and .h files are C++ and not c # d Debug mask # default = 0 # f Title/Header for the tag index sorted by source file # (tags.file.html) # default = "Tags Sorted By Source File" # h Arbitrary string used for the hyperlink defined by 'p' # default = "Project Description" # p Arbitrary URL that points to a project description # This hyperlink is placed at the top of each # source file. # no default # n Activate support for NSL (Neural Simulation Language) # t Title/Header for the source file index (files.html) # default = "Source File Index" # z Destination directory for HTML files. # # Debug mask # 1 Display list of tags. # 2 NSL debugging flag. # 4 Reports the identity and type of tags that are found # in the TAGS file. # 8 Don't delete temporary TAGS file # $etags = "/usr/usc/bin/etags"; ######################################################################################## %parms = (); # Parameters # # sub interpret_parms # # Interpret the parameters and stuff them into the %parms # structure. # sub interpret_parms { local($i); foreach $i (@ARGV) # Loop through each parm { if($i =~ /-(\w)(.*)/) # Expect a - where is a single { # letter. $parms{$1} = $2; } # else # Not the right format. # { # print "Parameter Error: \"$i\"\n"; # exit; # }; }; }; ######################################################################################## print "ctoohtml version 1.3\n"; # any parameters or source files? if($#ARGV == -1) { print "Usage: ctoohtml [-[]]* +\n"; print " See: http://www.usc.edu/dept/robotics/personal/af0a/tools/ctoohtml/ctoohtml.html\n"; exit 1; }; # Interpret the parameters if there are # any (for use internally) &interpret_parms(); # Find the end of the parameters # (each is designated with a '-'). for($i = 0; $i <= $#ARGV && $ARGV[$i] =~ /^-/; ++$i) { }; # Are there any input files? if($#ARGV < $i) { # No - barf print "No input files specified...\n"; exit 1; }; print "Parsing source files ...\n"; # Create the command to execute etags $cmd = "$etags "; # If in C++ mode then tell etags if(defined $parms{"C"}) { $cmd .= "-C "; }; foreach $arg (@ARGV[$i .. $#ARGV]) # Assemble source files as parameters { $cmd .= $arg . " "; }; unless(fork) # Fork off the process to find the tags. { exec $cmd || die "exec error (etags): $!\n"; exit 0; } wait; # Create command to execute tag processing $cmd = "ctoohtml.pl "; foreach $arg (@ARGV[0 .. $i-1]) # Assemble parameters { $cmd .= "\"" . $arg . "\" "; }; # print $cmd . "\n"; unless(fork) # Fork off the process to process the tags. { exec $cmd || die "exec error (ctoohtml.pl): $!\n"; exit 0; } wait;