HTMLRSF

Introduction

cs2html is used to insert HTML tags into C++ source code to enable viewing and navigating through C++ source code in a web browser.

The following command line arguments are supported:

 -h
displays a banner and a brief description of the command line options.
  -l
causes the source file(s) to be segmented. Every occurence of a bookmark triggers a new segment. If -l is followed by a number, maxLines, the maximum number of lines in a segment is limited to maxLines. When the maximum number of lines is reached, a new segment is created. The segments of each source file are connected together by Up and Down hyperlinks.
 -p
writes the HTML file using the preformatted HTML tag ("<pre>"). In this mode, the "<" characters are converted to "&lt;" to prevent them from being interpreted as HTML markups.

If -p is not specified, htmlrsf converts all spaces to "&nbsp;" and all "<" characters to "&lt;". Furthermore, each line is terminated by "<br>". In a browser, the non-preformated HTML text looks similar to the equivalent preformatted text.

 -t
writes each HTML file using the template file that is provided as an accompanying argument: -t templateFile. The template file may contain a header and a footer specified as follows:
header [=] { text }

footer [=] { text }

The header text (which may be multi-line) is written at the extreme top of each HTML file. The footer text is written at the extreme bottom of each HTML file. The left bracket, "{", may be embedded in the text if it is preceded by a backslash ("\").

A default template is provided by htmlrsf if either the -t argument is not specified or if either the header or footer is not given by the template file.

 -x
expands tab characters to spaces. If -x numSpaces is specified, the tab settings are set at intervals of numSpaces, otherwise the interval size defaults to four. If -x is not specified, there is no substitution of tab characters.

htmlrsf writes the HTML text to files in the current working directory. The file names are generated by appending "_nnnn.html" to the name of the original source file and by replacing all directory separators (forward/backward slashes and colons) by underline characters (i.e. /usr/include/stdio.h becomes _usr_include_stdio.h). The "nnnn" is the line number in the original source file that corresponds to the first line in the HTML text file. Thus, "example.c_0009.html" indicates that the first line of the HTML file corresponds to line nine of the source file "example.c".

Exceptions

The following are runtime warnings and errors that may be reported by htmlrsf to stderr.

Invalid argument <badArg>
One or more command line arguments have been incorrectly entered. <badArg> is the first in error argument that has been detected.
-l must be followed by a non-negative number of lines
The number following the -l command line argument must be non-negative.
-t must be followed by a template file name
If -t is specified it must be followed by the valid name of a template file. If a name was specified, then the command line syntax is in error.
-x expands tabs to a maximum of 10 spaces
The number following the -x command line argument must lie in the range [1..10].
Write error on <outputFile>
An error occurred while htmlrsf was writing to the designated file.
Read error on <inputFile>
An error occurred while htmlrsf was reading from the designated file.
Open error on <file>
An error occurred while htmlrsf was opening the designated file.
Unexpected end of file on <inputFile>
An RSF tuple addresses a position beyond the end of file for the designated input file.
Template file (<templateFile>) not found
The template file specified by the -t command line argument is missing.
Error opening template file <templateFile>
An error occurred while htmlrsf was opening the designated file for input.
Error reading template file <templateFile>
A error occurred which htmlrsf was reading from the designated template file.


11 February 1999    Maintainer: Johannes Martin jmartin@csr.uvic.ca