Coda2 comes in two versions: coda
which is the command-line version and wcoda
which provides a GUI on top of coda.
Coda reads specially formatted comments in the source code, and produces output in various formats. This version of Coda support output in HTML and LaTeX. Support for WinHelp and Unix man pages are on the wish list. Coda can also read comments from several programming languages. Coda is packaged with support for Tcl, Perl, C, C++, C#, Java, Pascal, Emacs Lisp and Visual Basic. Coda also support reading pure text files containing raw CodaText. However, Coda can be customized to support other formats as well.
The calling syntax of coda is as follows:
coda [-q] [-t format] [-d dir] [-r pattern] [-f file] pattern1 [pattern2 ...]
The parameters have the following meaning.
-t
html
index.html
file, along with a table of contents file (toc.html
), and one file for each doc-item. Those doc-items which are of type "item" (whichever is the default), will be included in the table of contents, the others not.latex
main.tex
file, and one file for each doc-item. Those doc-items which are of type "document" will generate standalone latex articles, the others will be included in the main file.html
.-d
doc
-r
-f
-q
The remaining arguments, pattern1, pattern2 and so forth, specifies the files to docify in the current directory.
The text format recognized by coda is called CodaText. It is a text format designed for documenting source code by writing the documentation as comments within the source files. The main purpose of designing this format is to provide a text format that is:
You may read the CodaText format specification about the CodaText format.
Coda has implemented two readers that extract comments from various file formats. These readers handle two distinct types of commenting syntax:
Coda has implemented three readers:
EmbraceReader
PrefixReader
PlainReader
Each of these readers needs some parameters to interpret the source file correctly. These parameters are
Coda has implemented the following comment styles:
comment comment coda line comment type reader prefix prefix suffix ------------------------------------------------------------- pascal EmbraceReader {** * } c EmbraceReader /** * /* script PrefixReader ## # lisp PrefixReader ;; ; basic PrefixReader '' ' coda PlainReader ------------------------------------------------------------
Coda has set up the following mapping between the comment type and the extensions of files.
Suppose that you want to add suport for PostScript files. PostScript uses prefix style comments, and "%" as the comment prefix. In order to distinguish comments written for coda from other comments (including DSC comments), we want to prefix all coda-comments with a triple percent ("%%%").
In your home directory (for windows users, that'l be "C:\" or the directory specified by your "HOME" environment variable), add a file named .codarc
. This is a tcl file that will be 'sourced' in by coda upon startup, if it exists. Note that coda will be sourced in within the coda
namespace, so you can only manipualte the variables within the coda
namespace, unless you use the global namespace qualifier.
First, we must define a new comment type. For this, coda maintains an array variable named formatMap
. Each entry in this array contains a two-element list where the first element is the name of the name space that implements the reader, and the second element is the intialization parameters to the reader. Hence we include following line in the .codarc
file:
set formatMap(postscript) {PrefixReader {"%%%" "%"}}
The next thing we do, is to provide a mapping between file extensions and our new postscript comment type. It is the array named extMap
which holds this mapping. The following lines will map files with extensions ".ps" and ".eps" to the postscript comment type:
set extMap(.ps) postscript set extMap{.eps) postscript
And that's all you have to do to make coda accept coda comments from postscript files.
For comprehensivenes, we also provide an example for reading html comments, just to show an example of embrace-style comments:
set formatMap(html) {EmbraceReader {"<!----" "-" "-->"}} set extMap(.html) html set extMap(.htm) html
Now, suppose that you'd like coda to provide a new output format, or a so called docifier. In the Design Specification you may read about the interface between coda and it's docifiers. Suppose that you have implemented an xml docifier, put in in a namespace called XmlOut
in the file XmlOut.tcl
. First, you need to 'source' in the file, which you can do by adding the following line in the .codarc
file in your root directory:
source "XmlOut.tcl"
You might want to provide the full path to the tcl file to make sure that it will be read in all situations.
Coda has an array variable named targetMap
which maps target formats to their corresponding docifiers. In order to make coda recognize the new output format, say, with the -t xml
option, you simply add the following line in the .codarc
.
set targetMap(xml) XmlOut
However, once you've implemented your docifier, and it works well, please submit it to the authors of coda, and they'd be happy to include the format in the next release.
manual.txt
"