For C:
For C++:
The first line is the XML header, and is simple boilerplate:
The second line is a comment, using the usual XML syntax for comments, which are of course optional:<?xml version="1.0"?>
The rest of the document is enclosed within the opening and closing tags of the root element, which must be named "Spec":<!-- Sample specs for parsing command line -->
Within the Spec element there are seven other elements: Argcount, Structure, Header, Module, Function, Remarks, and Options. They may appear in any order, but none may occur more than once.<Spec> ... </Spec>
Six of them are optional, and serve mainly to override various defaults. The Options element, however, is required, because it specifies what kinds of options the generated code will support. It encloses one element for each option.
The overall XML hierarchy is shown below. Follow the links for more details.
<Spec>
<Argcount/> Limits number of non-option arguments</Spec><Structure/> Names the struct or class to be used
<Header/> Names the generated header file
<Module/> Names the generated implementation file
<Function/> Names the function to parse command line
<Remarks/> Customizes the comment block at the top of each generated file
<Text> Inserts literal text</Remarks><File> Inserts text from an external file
<Copyright> Generates a copyright notice
<Options> (required)
<BoolOpt/> Option taking no argument</Options><IntOpt/> Option taking integer argument
<StringOpt/> Option taking character string argument