ROBODoc 3.2.2 Manual

Updated July 2000

ROBODoc is a documentation tool for C, C++, Java, Assembler, Basic, Fortran, LaTeX, Postscript, Tcl/Tk, LISP, Forth, Perl, Shell Scripts, Occam, COBOL, HTML and many other languages. Additional languages can be supported by a few modifications to the source code.

Copyright (C) 1994-2000 Frans Slothouber and Jacco van Weert.

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 (at your option) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

1 Credits

2 Table of Contents

01......... Credits
02......... Table of Contents
03......... Introduction
04......... Hardware and software requirements
05......... Goals and Limitations
06......... How to Format Your Code for use with ROBODoc
06.01.......... Header Names
06.02.......... Header Types
06.03.......... Begin Marker
06.04.......... Remark Marker
06.05.......... End Marker
06.06.......... Header Items
06.07.......... Item Name Limitations
06.08.......... Source Item
07......... Creating Cross Links
07.01.......... Limitations
08......... Master Index File
08.01.......... examples
09......... Automation with make
10......... What to do if You have Sources in Multiple Directories
11......... The ROBODoc Defaults File
12......... ROBODoc Command Line Options
13......... Adding New Languages
14......... Suggestions and Bugs

3 Introduction

ROBODoc is based on the AutoDocs program written some time ago by Commodore. The idea is to include for every function a standard header containing all sorts of information about that procedure/function. An AutoDocs program extracts these headers from the source file and puts them in an autodocs file. This allows you to include the program documentation in the source code and makes it unnecessary to maintain two documents.

ROBODoc is such a program, however ROBODoc has several additions. For one it can generate the documentation in different formats, ASCII, HTML, RTF, LaTeX, and AmigaGuide. Another feature is that it automatically creates links within the document, and to other documents. It is also possible to include parts of the source in you documentation, complete with links. For instance it is possible to include the complete source code of a function, and have the function names in the source point to their documentation. Besides documenting functions, you can also document classes, methods, structures, variables, and constants.

If you never have used AutoDoc or ROBODoc before you might take a look at the example in the Source/. Run the command:

  make xhtml
  make example

This creates the ROBODoc documentation for the ROBODoc program itself and then starts netscape to view the documentation. Also have a look at the source files, they illustrates the use of headers.

ROBODoc can generate documentation in five different formats:

4 Hardware and software requirements

ROBODoc was developed in 1994 on a standard Amiga 1200, a system with a 20MHz 68020 processor and 2 Mbyte of RAM. It should therefore be no problem to run it on any of the currently available systems :) The complete source code consists of a series of file that can be found in the Source directory. It is written according (hopefully) to the ANSI C standard and uses no special functions, so it should run on every system with an ANSI C-compiler.

5 Goals and Limitations

ROBODoc is intended for small to medium sized projects that have a relatively flat structure and especially projects that use a mix of different programming languages.

ROBODoc was designed to be easy to use and to work with a lot of different programming languages. It has no knowledge of the syntax of a programming languages. It just some knowledge about how remarks start and end in some programming languages. This means that you sometimes have to do a little more work compared to other tools that have detailed knowledge of the syntax of a particular language. They can use that knowledge to figure out some of the information automatically. This usually also means that they work only with one or two languages.

ROBODoc operates on one file at a time. It has no mechanism to process whole sets of source files. Makefiles should be used for this. How to do this is explained in this document with various example makefiles. Have a look at them.

ROBODoc can work with projects where the source code is located in different subdirectories. However the generated documentation is expected to go into one single directory.

6 How to Format Your Code for use with ROBODoc

ROBODoc allows you to mix the program documentation with the source code. It does require though that this documentation has a particular layout so ROBODoc can recognize it. The following header was taken from the original ROBODoc program (many versions back).

           ------------------------------- Header Name
          /                          \
  /****f* financial.library/StealMoney  <---- Begin Marker
  *    ^------- Header Type
  *
  *  <---- Remark Marker
  *  NAME
  *    StealMoney -- Steal money from the Federal Reserve Bank. (V77)
  *  SYNOPSIS  <---- Item Name
  *    error = StealMoney( userName,amount,destAccount,falseTrail )
  *    D0,Z                D0       D1.W    A0         [A1]
  *
  *    BYTE StealMoney
  *         ( STRPTR,UWORD,struct AccountSpec *,struct falseTrail *);
  *  FUNCTION
  *    Transfer money from the Federal Reserve Bank into the
  *    specified interest-earning checking account.  No records of
  *    the transaction will be retained.
  *  INPUTS
  *    userName    - name to make the transaction under.  Popular
  *                  favorites include "Ronald Reagan" and
  *                  "Mohamar Quadaffi".
  *    amount      - Number of dollars to transfer (in thousands).
  *    destAccount - A filled-in AccountSpec structure detailing the
  *                  destination account (see financial/accounts.h).
  *                  If NULL, a second Great Depression will be
  *                  triggered.
  *    falseTrail  - If the DA_FALSETRAIL bit is set in the
  *                  destAccount, a falseTrail structure must be
  *                  provided.
  *  RESULT
  *    error - zero for success, else an error code is returned
  *           (see financial/errors.h).  The Z condition code
  *           is guaranteed.
  *  EXAMPLE
  *    Federal regulations prohibit a demonstration of this function.
  *  NOTES
  *    Do not run on Tuesdays!
  *  BUGS
  *    Before V88, this function would occasionally print the
  *    address and home phone number of the caller on local police
  *    976 terminals.  We are confident that this problem has been
  *    resolved.
  *  SEE ALSO
  *    CreateAccountSpec(),security.device/SCMD_DESTROY_EVIDENCE,
  *    financial/misc.h
  *
  ******  <---- End Marker
  *
  * You can use this space for remarks that should not be included
  * in the documentation.
  *
  */

You would place this headers in front of functions, classes, methods, structure definitions, or any of the major components in your program. The header itself contains a number of items that provide structured information about the component.

There are a number of special markers in a header (indicated in red above). There are two special markers that mark the begin and end of a header. Each line in a header should start with a remark marker. The starts of each item is marked by an Item Name (in all capitals).

6.1 Header Names

ROBODoc makes some assumptions about the structure a project. It assumes that a project consists of a number of modules, and that each module consists of a number of components. These components can be anything that you care to document; functions, variables, structures, classes, methods etc.

Projects, modules, and components all have names. The names allow ROBODoc to structure the documentation and create cross-links. Names are defined in the header name. It is either of the form <project name>/<module name> for a module header, or of the form <module name>/<component name> for all other headers.

6.2 Header Types

You can provide ROBODoc with some additional information by specifying the header type. The header type tells ROBODoc what kind of component you are documenting. This information allows ROBODoc to create more useful index tables.

The type is identified by a single character, as listed in the following table

hHeader for a module in a project.
fHeader for a function.
sHeader for a structure.
cHeader for a class.
mHeader for a method.
vHeader for a variable.
dHeader for a constant (from define).
*Generic header for every thing else.
iInternal header.

Internal headers are special. They can be used to hide certain headers. They are only extracted if requested. You could use to document internal functions that you do now want clients to see.

6.3 Begin Marker

The beginning of a header is marked with a special marker. The above header is intended for a program in C. In other programming languages the marker looks slightly different, since each language has its own convention for starting remarks. ROBODoc recognizes the following begin markers:

"/****" C, C++
"//****" C++
";****" Assembler
"****" Assembler
"{****" Pascal
"REM ****" Basic (Rem, rem, or even rEM also works)
"C ****" Fortran (c **** also works)
"%****" LaTeX, TeX, Postscript.
"#****" Tcl/Tk, Perl, makefiles, gnuplot etc.
"(****" Pascal, Modula-2, LISP
"--****" Occam
"<!--****" HTML
"<!---****" HTML
"|****" GNU Assembler
"!!****" Fortran 90

After these initial four asterisks, there is the character to identify the kind of header, then another asterisks, and then header name. After this you can specify a version number surrounded by "[]". The version number is stored but not used for anything at the moment. All characters after that are ignored.

This might sound terribly complicated, it is not. Here are some examples:

A header for a module called analyser in a project called ChessMaster for C, is has version number 1.0

  /****h* ChessMaster/analyser [1.0] *

In Assembler, a function header, for the function init() in the module finance.library:

  ****f* finance.library/init *

In C++, a class header for class Puppet, for the module puppetmaster, version v2.12

  /****c* puppetMaster/Puppet [v2.12] ******

For the same class a method called Puppet::Talk

  /****m* puppetMaster/Puppet::Talk [v2.12] ******

A project header, in Fortran

  C     ****h* ChessMaster/analyser              C

In Basic

  REM ****h* ChessMaster/analyser

6.4 Remark Marker

Each line in the body of a header should start with a remark marker. This marker is stripped from the line and the remaining part is used to generated the documentation. The following markers are recognized by ROBODoc.

"*" C, C++, Pascal, Modula-2
"//" C++
" *" C, C++, M68K assembler, Pascal, Modula-2, HTML
";*" M68K assembler
";" M68K assembler
"C " Fortran
"REM " BASIC
"%" LaTeX, TeX, Postscript
"#" Tcl/Tk, shell scripts, makefiles
" *" COBOL
"--" Occam
"|" GNU Assembler
"!!" Fortan 90

6.5 End Marker

A header ends with an end marker. An end marker is a remark marker followed by three asterisks. ROBODoc recognizes following strings as end markers:

"/***" C, C++
"//***" C++
" ****" C, C++, Pascal, Modula-2
"{***" Pascal
"(***" Pascal, Modula-2, B52 LISP
";***" M68K assembler
"****" M68K assembler
"C ***" Fortran
"REM ***" BASIC
"%***" LaTeX, TeX, Postscript
"#***" Tcl/Tk, Perl, Makefiles, Shell scripts
" ****" COBOL
"--***" Occam
"<!--***" HTML
"<!---***" HTML
"|***" GNU Assembler
"!!***" Fortan 90

6.6 Header Items

When ROBODoc has found a header it will try to identify the items in this header. It does this by looking for the item name. The following item names are currently supported:

NAME Item name plus a short description.
COPYRIGHT Who own the copyright : "(c) <year>-<year> by <company/person>"
SYNOPSIS, USAGE How to use it.
FUNCTION, DESCRIPTION, PURPOSE What does it do.
AUTHOR Who wrote it.
CREATION DATE When did the work start.
MODIFICATION HISTORY, HISTORY Who has done which changes and when.
INPUTS, ARGUMENTS, OPTIONS, PARAMETERS, SWITCHES What can we feed into it.
OUTPUT, SIDE EFFECTS What output is made.
RESULT, RETURN VALUE What do we get returned.
EXAMPLE A clear example of the items use.
NOTES Any annotations
DIAGNOSTICS Diagnostical output
WARNINGS, ERRORS Warning & error-messages.
BUGS Known bugs.
TODO, IDEAS What to implement next & ideas.
PORTABILITY Where does it come from, where will it work.
SEE ALSO References to other functions, man pages, other documentation.
METHODS, NEW METHODS OOP methods.
ATTRIBUTES, NEW ATTRIBUTES OOP attributes
TAGS Tag-item description.
COMMANDS Command description.
DERIVED FROM OOP super class.
DERIVED BY OOP sub class.
USES, CHILDREN What modules are used by this one.
USED BY, PARENTS Which modules do use this one.
SOURCE Source code inclusion.

ROBODoc does this so that it can format each item with a different style (colour, font, etc.) if the user want it. These can be specified in the robodoc.defaults file, see the next section more information.

6.7 Item Name Limitations

If you happen to have a function which name is in all uppercase, this sometimes conflicts with where ROBODoc thinks an item name starts and where the item body starts. Bernhard Roessmann suggest the following workaround: Example header producing this error:

/***** basic.c/RETURN
* NAME
*  RETURN : Return from subroutine
* SYNOPSIS
*  RETURN
* FUNCTION
*  Return from subroutine
******/

Here the item name "FUNCTION" will be interpreted as ordinary text, not as an item name. Workaround: Add an empty line:

/***** basic.c/RETURN
* NAME
*  RETURN : Return from subroutine
* SYNOPSIS
*  RETURN
*
* FUNCTION
*  Return from subroutine
******/

6.8 Source Item

The source item allows you to include part of the source in the documentation as is demonstrated by the following example.

/****f* Robodoc/RB_Panic [2.0d]
 * NAME
 *   RB_Panic -- Shout panic, free resources, and shut down.
 * SYNOPSIS
 *   RB_Panic (cause, add_info)
 *   RB_Panic (char *, char *)
 * FUNCTION
 *   Prints an error message.
 *   Frees all resources used by robodoc.
 *   Terminates program.
 * INPUTS
 *   cause    - pointer to a string which describes the
 *              cause of the error.
 *   add_info - pointer to a string with additional information.
 * SEE ALSO
 *   RB_Close_The_Shop ()
 * SOURCE
 */

  void RB_Panic (char *cause, char *add_info)
  {
    printf ("Robodoc: Error, %s\n",cause) ;
    printf ("         %s\n", add_info) ;
    printf ("Robodoc: Panic Fatal error, closing down...\n") ;
    RB_Close_The_Shop () ; /* Free All Resources */
    exit(100) ;
  }

/*******/

This would create the following documentation

NAME
   RB_Panic -- Shout panic, free resources, and shut down.
SYNOPSIS
   RB_Panic (cause, add_info)
   RB_Panic (char *, char *)
FUNCTION
   Prints an error message.
   Frees all resources used by robodoc.
   Terminates program.
INPUTS
   cause    - pointer to a string which describes the
              cause of the error.
   add_info - pointer to a string with additional information.
SEE ALSO
   RB_Close_The_Shop ()
SOURCE
      void RB_Panic (char *cause, char *add_info)
      {
        printf ("Robodoc: Error, %s\n",cause) ;
        printf ("         %s\n", add_info) ;
        printf ("Robodoc: Panic Fatal error, closing down...\n") ;
        RB_Close_The_Shop () ; /* Free All Resources */
        exit(100) ;
      }    

7 Creating Cross Links

Creating hyper links within a document and across documents is the most interesting feature of ROBODoc. A document with such links is much more easier to read. If your source code consists of just one file, creating links is easy. Just tell ROBODoc that you want to have the output in HTML or AmigaGuide format, and it will automatically generate the links. That is, at the beginning of the document it will create a table of contents that consists of links to all your function headers.

ROBODoc will also search the complete text of you documentation for reference to function names, and it will create a link to the documentation of that function.

In most cases, however, your source code does not consists of a single file. It is also possible, however, to create links to other files. This does require the use of some additional files, called xref files. These files can be generated with ROBODoc. These files contain information about in which file and where in the file references can be found.

Lets assume your project is split up in five different source files, and you want to generate links between these five files. What you have to do to accomplish this is to create a xref file for each of those five files.

With the GENXREF option ROBODoc will generate such a xref file from the a source-file. When you use this option, only the xref file is created not the autodocs-file, however you still have to specify the name of the autodocs file because this name is needed for the creation of the xref file.

When all xref files are created you are ready to create the documentation. To do so you use ROBODOC with the XREF option. It needs a parameter which is the name of the file in which the names of all xref files are defined. Notice: this is a file with file names, it has to be created it by hand.

An example will make things more clear. In the ROBODoc archive, under examples/C there are two source files prog1.c and prog2.c. We can create documentation with hyper links from these two files as follows:

First create the xref files:

  robodoc prog1.c prog1.c.html GENXREF prog1.c.xref HTML INTERNAL
  robodoc prog2.c prog2.c.html GENXREF prog2.c.xref HTML INTERNAL

Now there are two xref files: prog1.c.xref and prog2.c.xref. Note that ROBODoc did not create any HTML files, just the xref files. The name prog1.c.html is needed to create the correct xref files. For prog1.c internal headers were also included.

Now create a file with the xref file names. This file will hold only two lines. You can give it any name, say xref_files.

  echo prog1.c.xref >  xref_files 
  echo prog2.c.xref >> xref_files

Now generate the final documentation:

  robodoc prog1.c prog1.c.html XREF xref_files HTML INTERNAL
  robodoc prog2.c prog2.c.html XREF xref_files HTML INTERNAL

Have a look the the documentation generated:

  1. prog1.c.html
  2. prog2.c.html

7.1 Limitations

ROBODoc knows very little about the grammar of programming languages. Links are created by looking up words in a table. This means that it sometimes creates links where there should be none. For instance if you have a function called usage(); every time you use the word usage in any of your documentation a link will show up. It also means that sometimes is does not create links where you would like it to create a link. Say you include the source code of a method using the source item. Your method uses other methods of the class. You would like to have links pointing to the documentation of these methods each time you use one. They will not appear though. Since to ROBODoc stores the whole name of a method, ie, someClass::MethodName. In the method source you will use just MethodName().

8 Master Index File

If your project consists of many source files you might want to create a master index file.

For HTML output this file contains links to the documentation generated from each of your source files as well as a list of all "objects" that you documented. All "objects" are listed according to header type, using the following order: Projects, Classes, Methods, Stuctures, Functions, Variables, Constants, Generic, Internal.

For LaTeX output this file is one big document that contains the documentation generated from all your source files. It also includes a table of contents and an index section. This index lists the page number of the page a function's documentation.

This index file is generated based on the information found in your xrefs file. That is the file with the names of all your xref files. So before you can create the master index file you have to create all your xref files.

To generate a master index file use:

   robodoc <xrefs file> <master index file> INDEX HTML TITLE "Master Index"

or

   robodoc <xrefs file> <master index file> INDEX LATEX TITLE "ROBODoc API Documentation"

The master index file can currently only be generated in HTML or LaTeX.

If you use if for LaTeX documentation you need to use the option SINGLEDOC when you generate the documentation from your various source files. This ensures that no document preambles are generated. The master index file contains command that includes all your documentation files and make it into one single document.

8.1 examples

Here are some examples of master index files

9 Automation with make

The whole process of creating documentation with ROBODoc is of course best automated with make. Have a look at the following makefile.

SHELL = /bin/sh
.SUFFIXES:

ROBODOC=robodoc
ROBOOPTS=C SORT 

# Your source files.
#
SOURCES=analyser.c generator.c items.c util.c \
  folds.c headers.c links.c robodoc.c \
  analyser.h generator.h items.h util.h \
  folds.h headers.h links.h robodoc.h

# The name of your Project
#
PROJECT=robodoc

# The various documentation files, derived from the source files.
# HTML
#
HTMLDOCS=$(SOURCES:=.html)
HTMLXREFS=$(HTMLDOCS:.html=.html.xref)
HTMLXREFSFILE=$(PROJECT)_html.xrefs
# LATEX
#
LATEXDOCS=$(SOURCES:=.tex)
LATEXXREFS=$(LATEXDOCS:.tex=.tex.xref)
LATEXXREFSFILE=$(PROJECT)_tex.xrefs
# ASCII
#
ASCIIDOCS=$(SOURCES:=.txt)
# RTF
#
RTFDOCS=$(SOURCES:=.rtf)
RTFXREFS=$(RTFDOCS:.rtf=.rtf.xref)
RTFXREFSFILE=$(PROJECT)_rtf.xrefs

# Some common targets
xrefall: xrefhtml xreftex xrefrtf
docall: html tex ascii rtf

# Create the xref files for the various formats.
xhtml: $(HTMLXREFSFILE) 
xtex: $(LATEXXREFSFILE) 
xrtf: $(RTFXREFSFILE)

# Create the documentation files for the various formats.
html: $(HTMLDOCS) $(PROJECT)_mi.html 
tex: $(LATEXDOCS) $(PROJECT)_mi.tex
rtf: $(RTFDOCS)
ascii: $(ASCIIDOCS)

# master index file, currently works only for html and latex documentation.
# Note that you can define the title of the document.
$(PROJECT)_mi.html: $(HTMLXREFSFILE) 
	$(ROBODOC) $< $@ INDEX HTML TITLE "$(PROJECT) Master Index"

$(PROJECT)_mi.tex: $(LATEXXREFSFILE)
	$(ROBODOC) $< $@ INDEX LATEX TITLE "$(PROJECT) API Reference"

# create xrefs file (file with the names of all .xref files).
$(HTMLXREFSFILE) : $(HTMLXREFS)
	/bin/ls $(HTMLXREFS) > $@
$(LATEXXREFSFILE) : $(LATEXXREFS)
	/bin/ls  $(LATEXXREFS) > $@
$(RTFXREFSFILE) : $(RTFXREFS)
	/bin/ls  $(RTFXREFS) > $@

# Rule to create an .xref file from a source file for the various formats.
%.html.xref : %
	$(ROBODOC) $< $(@:.xref=) $(ROBOOPTS) INTERNAL GENXREF $@
%.tex.xref : %
	$(ROBODOC) $< $(@:.xref=) $(ROBOOPTS) INTERNAL GENXREF $@
%.rtf.xref : %
	$(ROBODOC) $< $(@:.xref=) $(ROBOOPTS) INTERNAL GENXREF $@

# Rule to create html documentation from a source file.
%.html : %
	$(ROBODOC) $< $@ HTML $(ROBOOPTS) XREF $(HTMLXREFSFILE)

# Rule to create latex documentation from a source file.
# We do not include source items, and generate laxtex documents
# than can be included in a master document.
%.tex : %
	$(ROBODOC) $< $@ LATEX $(ROBOOPTS) NOSOURCE SINGLEDOC XREF $(LATEXXREFSFILE)

# Rule to create ascii documentation from a source file.
%.txt : %
	$(ROBODOC) $< $@ ASCII 

# Rule to create rtf documentation from a source file.
%.rtf : %
	$(ROBODOC) $< $@ RTF $(ROBOOPTS) XREF $(RTFXREFSFILE)

# Use netscape to view the master index file for our project.
htmlview: html
	netscape $(PROJECT)_mi.html

# Use the latex programs to generate a .dvi from the master index file
# for our prokect. View this .dvi file with xdvi
texview:  tex
	latex $(PROJECT)_mi
	makeindex $(PROJECT)_mi
	latex $(PROJECT)_mi
	latex $(PROJECT)_mi
	xdvi  $(PROJECT)_mi.dvi

# Clean-up the mess we made
#
clean:
	rm -f $(HTMLXREFS) 
	rm -f $(HTMLDOCS) 
	rm -f $(LATEXXREFS)
	rm -f $(LATEXDOCS) 
	rm -f $(PROJECT)_mi.* *.aux
	rm -f $(RTFXREFS)
	rm -f $(RTFDOCS)
	rm -f $(ASCIIDOCS)
	rm -f $(HTMLXREFSFILE) 
	rm -f $(LATEXXREFSFILE) 
	rm -f $(RTFXREFSFILE)

It includes all the necessary commands to generate and view the documentation for you project. You create documentation in any of the four formats. For instance to create documentation in html format use:

  make xhtml
  make html

To make documentation in LaTeX format use:

  make xtex
  make tex

To view your documentation use:

  make xhtml
  make texview

or

  make xtex
  make texview

To clean up all the documentation files use:

  make clean

To use this make file in project set the variable SOURCE to the names of your source files and set the variable PROJECT to the name of your project.

You can find a copy of the above makefile Docs/example_makefile. This should get you started in no time.

10 What to do if You have Sources in Multiple Directories

It is possible to have your sources in multiple subdirectories. However the generated documentation is expected to be in one single directory. If not the cross references will be wrong, at least in the HTML documentation.

Say you have the following directory structure:

  Project/
     Dir1/
        program1.c 
     Dir2/
        program2.c 

You can create the documentation for that as follows (assuming you are in Project):

  robodoc Dir1/prog1.c prog1.c.html HTML GENXREF Dir1/prog1.xref 
  robodoc Dir2/prog2.c prog2.c.html HTML GENXREF Dir2/prog2.xref 
  echo "Dir1/prog1.xref" > xreffiles 
  echo "Dir2/prog2.xref" >> xreffiles 
  robodoc Dir1/prog1.c prog1.c.html HTML XREF xreffiles 
  robodoc Dir2/prog2.c prog2.c.html HTML XREF xreffiles 
  robodoc xreffiles master_index.html INDEX HTML 

This generates the following files:

   prog1.c.html
   prog2.c.html
   master_index.html

With some version of make (for instance the gnu version) you can strip the directory part of a filename with $(notdir NAME) How this can be used is shown in the following example makefile. Here we have the sources for robodoc, the .c files are in the directory Sources/ and .h files are in the directory Headers/.

SHELL = /bin/sh
.SUFFIXES:

ROBODOC=./robodoc
ROBOOPTS=C SORT 

# Your source files.
#
SOURCES=Sources/analyser.c Sources/generator.c Sources/items.c Sources/util.c \
  Sources/folds.c Sources/headers.c Sources/links.c Sources/robodoc.c \
  Headers/analyser.h Headers/generator.h Headers/items.h Headers/util.h \
  Headers/folds.h Headers/headers.h Headers/links.h Headers/robodoc.h

# The name of your Project
#
PROJECT=ROBODoc

# The various documentation files, derived from the source files.
#
HTMLDOCS=$(SOURCES:=.html)
HTMLXREFS=$(HTMLDOCS:.html=.html.xref)
HTMLXREFSFILE=$(PROJECT)_html.xrefs

# Create the xref files for the various formats.
xhtml: $(HTMLXREFSFILE) 

# Create the documentation 
html: $(HTMLDOCS) $(PROJECT)_mi.html 

# Create master index file.
$(PROJECT)_mi.html: $(HTMLXREFSFILE) 
	$(ROBODOC) $< $@ INDEX HTML TITLE "$(PROJECT) Master Index"

# Create the file with the names of all xref files.
$(HTMLXREFSFILE) : $(HTMLXREFS)
	/bin/ls $(HTMLXREFS) > $@

# Rule to create an .xref file from a source file 
%.html.xref : %
	$(ROBODOC) $< $(notdir $(@:.xref=)) $(ROBOOPTS) INTERNAL GENXREF $@

# Rule to create html documentation from a source file.
%.html : %
	$(ROBODOC) $< $(notdir ${@}) HTML $(ROBOOPTS) XREF $(HTMLXREFSFILE)

11 The ROBODoc Defaults File

The robodoc.default file can be used to change the appearance of the documentation. For each item type you can define how the corresponding text should be rendered. Each line in the default file consists of two parts, the item type and the item attributes. For instance

AUTHOR                    LARGE ITALICS BOLD UNDERLINE

Specifies that the AUTHOR item has the attributes LARGE, ITALICS, BOLD, and UNDERLINE. The effect of each attribute is listed in the following table.

Item Attributes Effect in HTML
LARGE <FONT SIZE=5>,</FONT>
SMALL <FONT SIZE=-1>,</FONT>
ITALICS <I>,</I>
BOLD <B>,</B>
UNDERLINE <U>,</U>
HIGHLIGHT <EM>,</EM>

12 ROBODoc Command Line Options

When using ROBODoc you should provide at least two parameters

  robodoc <source file> <documentation file> [options]

Here sourcefile is the file with the program source from which the documentation is to be extracted. The documentation file is the file that will contain the extracted documentation.

In case you are creating a master index file you have to specify three parameters

  robodoc <xrefs file> <master index file> INDEX [options]

In addition to this you can specify one or more of the following options:

ASCII Generate documentation in ASCII format (default)
GUIDE Generate documentation in AmigaGuide format.
HTML Generate documentation in HTML format.
LATEX Generate documentation in LaTeX format. (Experimental)
RTF Generate documentation in RTF format.
C Use ANSI C grammar in source items (test, HTML only)
FOLD Enable folding. (Experimental)
GENXREF <xref file> Generate a xref file, which can be used to create cross links between documents.
XREF <xrefs file> Use a set of xref files to create references (links) to other documents or within the document. <xrefs file> is a file with xref file names.
INDEX Create a master index file.
INTERNAL Also include headers that are marked internal.
INTERNALONLY Only extract the headers marked internal.
NOSOURCE Do not include the source items in the documentation.
SORT Sort the headers alphabetically.
SINGLEDOC Do not create a document header and footer when creating documentation in LaTeX format. This allows you to include the generated documents into big document or master index file.
TITLE <title> Sets the title that is used for the master index file.
TOC Generate a table of contents. It is only useful when you select ASCII as output mode. With all other output modes the table of contents is generated anyway.
TABSIZE <n> Convert each tab into n spaces.
-v Verbose option, ROBODoc will tell you what it is doing.

If you wonder why all the odd ALL CAPS flags are used instead of for instance "-x"; this was how it was done on the Amiga.

The following abbreviations are also allowed:

-s SORT
-t TOC
-x XREF
-g GENXREF
-i INTERNAL
-ioINTERNALONLY
-tsTABSIZE

13 Adding New Languages

To add a new programming language to ROBODoc you have to edit headers.c. Here you find three variables: header_markers, remark_markers, and end_markers. There are all arrays, and you have to add an new entry to each of these three arrays.

Say your programming language uses the following type of remarks:

   $%% This is a remark with some text       
       and some more and some more  %%$

That is is starts with three spaces and then $%%, and has to end with %%$. Then you would add to header_markers

   "   $%%****",

To remark_markers you would add

   "   *",

And to end_markers you would add

   "   $%%***",

You can then use the following kind of headers in your program:

   $%%****f* Test/afunction ***** 
   * NAME  
   *   afunction
   * FUNCTION
   *   A test.
   * SOURCE
   *%%$
     afunction(test,test) [
       print hello world ;
     ]
   $%%***%%$

14 Suggestions and Bugs

If you find any bugs, catch them, put them in a jar, and send them to:

fslothouber@acm.org

Suggestions are also welcome at this address. Flames can be directed to the sun.