CmDoc Documentation Generator

cmdoc is a tool for generating HTML documentation with hyperlinked source code for a Cmajor solution. The source code can be linked with the system library documentation.

Table of contents

1 Tutorial
2 Reference
   2.1 Input File Format
   2.2 Documentation File Format
   2.3 Usage

1 Tutorial

In this tutorial we go through creating a simple example program and some documentation for it. The documentation can be created with any text editor that can save the text with UTF-8 encoding. In this tutorial we use Windows notepad.

2 Reference

The cmdoc program processes two XML files: an input XML file SOLUTION.cmdoc.xml and a documentation XML file (for example docs.xml).

2.1 Input File Format

The format of the SOLUTION.cmdoc.xml file, where SOLUTION is the solution to be documented is as follows:

        <cmdoc>
          <solution filePath="SOLUTION_FILE_PATH.cms"/>
          <doc filePath="DOCUMENTATION_FILE_PATH.xml"/>
          <target dir="TARGET_DIRECTORY_PATH"/>
          <libraries>
            <library dir="EXTERNAL_DIRECTORY_PATH"/>
            <library dir="EXTERNAL_DIRECTORY_PATH"/>
            ...
          </libraries>
        </cmdoc>
    

where

The doc, libraries and library elements may be missing.

2.2 Documentation File Format

The format of the documentation file (for example docs.xml) that contains the documentation for a solution is as follows:

        <docs>
            <doc id="ID">
                <desc>
                  DESCRIPTION
                </desc>
                <details>
                  DETAILS paragraph 1
                </details>
                <details>
                  DETAILS paragraph 2
                </details>
                ...
            </doc>
            <doc id="ID">
                <desc>
                  DESCRIPTION
                </desc>
            </doc>
            ...
        </docs>
    

Each documented program entity has a single desc element that is obligatory. The desc contains the description text of an entity. The documented entity may have zero or more details elements that represent detail text paragraphs. Only a namespace, class, concept and enumeration may have details elements.

The ID is the documentation identifier of the program entity to be documented.

Each documented program entity has an URL. The URL of an entity can be found out by clicking a link of it in the documentation source code or in other generated documentation. The URL will be shown in the address line of the browser. When you got an URL of an entity, the ID of it can be derived from it as follows:

entity example URL ID
namespace .../ns_System.html ns_System
class .../class_Console_41891B146EC51CAB04451732257B28BD18CAE52B.html class_Console_41891B146EC51CAB04451732257B28BD18CAE52B
concept .../concept_Container_0A128B13B9494DFD21086D34DFB070EAA26D473A.html concept_Container_0A128B13B9494DFD21086D34DFB070EAA26D473A
enumeration .../enumerated_type_Month_7829D8A209CD9954EC457E7406A5269E99C4AA48.html enumerated_type_Month_7829D8A209CD9954EC457E7406A5269E99C4AA48
function .../ns_System.html#function_Min_CBFBA4BF1C9AFF4708FC71F4031C929A1A8AE1FB function_Min_CBFBA4BF1C9AFF4708FC71F4031C929A1A8AE1FB
typedef .../ns_System.html#typedef_string_B6DB6B2DEFC437FBF697A2E84F7B7771FC1DDEE3 typedef_string_B6DB6B2DEFC437FBF697A2E84F7B7771FC1DDEE3
constant .../ns_System.html#constant_insertionSortThreshold_56F85BEA8266D9529E96B6415FF32EC6B8AB62C5 constant_insertionSortThreshold_56F85BEA8266D9529E96B6415FF32EC6B8AB62C5
delegate .../ns_System.Threading.html#delegate_ThreadStartFunction_56B97B5DFF5ED9F3C1C29C2C8655A9ED8753032F delegate_ThreadStartFunction_56B97B5DFF5ED9F3C1C29C2C8655A9ED8753032F
class delegate .../ns_System.Threading.html#class_delegate_ThreadStartMethod_3044EADA25CA797E0DE0095ECAC529EAFE935B55 class_delegate_ThreadStartMethod_3044EADA25CA797E0DE0095ECAC529EAFE935B55
enumeration constant .../enumerated_type_CharClass_825BD0E92E069CC6BC59D5D117AD06076A653B4D.html#enumeration_constant_space_F27E532B5A11148A0B68171CCD38C1A2C0B6FBAD enumeration_constant_space_F27E532B5A11148A0B68171CCD38C1A2C0B6FBAD

DESCRIPTION and DETAILS texts can contain a <ref>ID</ref> elements, where ID is the documentation identifier of a program entity. Each ref element will be substituted by a HTML link to the documentation of referenced entity.

DESCRIPTION and DETAILS texts can also contain other HTML elements that are preserved in the generated documentation.

A details element may have a title attribute with a value that will become a section title in the generated documentation.

2.3 Usage

Usage: cmdoc [options] { INPUT_FILE.cmdoc.xml }

Generate documentation for a solution in input file INPUT_FILE.cmdoc.xml.

Options:

Long option Short option Description
--verbose -v Be verbose.
--help -h Print help.
--optimize -o Do not compile the solution and generate documentation source code and symbol table XML files for those projects that are up-to-date.
--build-threads=N -bt=N Use N build threads.