User and Programmers’ Guide to the X Ray-Tracing Package McXtrace, version 3.8.6

6.7  MxDoc, the McXtrace library documentation tool

McXtrace includes a facility called MxDoc to help maintain documentation of components and instruments. In the source code, comments may be written that follow a particular format understood by MxDoc. The MxDoc facility will read these comments and automatically produce output documentation in various forms. By using the source code itself as the source of documentation, the documentation is much more likely to be a faithful and up-to-date description of how the component/instrument actually works.

Two forms of documentation can be generated. One is the component entry dialog in the mxgui front-end, see section 5.4.1. The other is a collection of web pages documenting the components and instruments, handled via the mxdoc front-end (see section 5.4.6), and the complete documentation for all available McXtrace components and instruments may be found at the McXtrace webpage [Mcx], as well as in the McXtrace library (see 7.1). All available McXtrace documentation is accessible from the mxgui ’Help’ menu.

Note that MxDoc-compliant comments in the source code are no substitute for a good reference manual entry. The mathematical equations describing the physics and algorithms of the component should still be written up carefully for inclusion in the component manual. The MxDoc comments are useful for describing the general behaviour of the component, the meaning and units of the input parameters, etc.

The format of the comments in the library source code

The format of the comments understood by MxDoc is mostly straight-forward, and is designed to be easily readable both by humans and by automatic tools. MxDoc has been written to be quite tolerant in terms of how the comments may be formatted and broken across lines. A good way to get a feeling for the format is to study some of the examples in the existing components and instruments. Below, a few notes are listed on the requirements for the comment headers:

The comment syntax uses %IDENTIFICATION, %DESCRIPTION, %PARAMETERS, %EXAMPLE:, %LINKS, and %END keywords to mark different sections of the documentation. Keywords may be abbreviated (except for %EXAMPLE:), e.g. as %IDENT or %I.

Additionally, optional keys %VALIDATION and %BUGS may be found to list validation status and possible bugs in the component.