http://localhost/~hussein Contents The docc utility The docc utility The docx utility Index

12.1 Examples

12.1.1 LaTeX

PTF comments are directly extracted from C/C++ sources files.

$ cd tmp
$ docc latex -dc article -dco a4paper \
-ti 'The PTF Format and Related Utilties' \
-o ptf.tex ptf.txt docc.cc docx.cc
$ ls
ptf.tex

12.1.2 troff -man

docc is run on docc.cc and then on docx.cc to generate two man pages with different headers.

$ cd tmp
$ docc man -c -ti docc -se 1 -he 'Text Utilities' -fo Pixware docc.cc
$ docc man -c -ti docx -se 1 -he 'Text Utilities' -fo Pixware docx.cc
$ ls
docc.man        docx.man

12.1.3 HTML

The hardest format to generate is HTML because in this case you must run docc twice, example:

First pass
Resolve all hypertext links and save them in a file called hrefs. To do this, you need to use the href pseudo-format.
$ cd tmp
$ docc href -o hrefs ptf.txt docc.cc docx.cc
$ ls
hrefs
Second pass
For each input file, generate an HTML file (the -c option). Load file hrefs (the -h hrefs option) to be able to resolve hypertext links.
$ docc html -br -h hrefs -c ptf.txt docc.cc docx.cc
$ ls
docc.html        hrefs           previous.gif
docx.html        next.gif        ptf.html

The -br option is used to chain the generated HTML files not only through hypertext links but also sequentially (i.e. like the pages of a book).

12.1.4 RTF

Always use -o when generating non-linear RTF format (WinHelp) to get a single .rtf file and a single .hpj (help project) file.

$ cd tmp
$ docc rtf -o docc.rtf ptf.txt docc.cc docx.cc
$ ls
docc.hpj        docc.rtf

Unlike the HTML format, the generation of WinHelp files does not require running docc twice. The hypertext links are resolved by the help compiler (example hc31.exe) that you must run under DOS on the generated .hpj file.

C> hc31 docc