Aargh

A Full Example

A full example of an XML file for aargh, demonstrating all the available features, is available in a separate window so that you can follow along. You can also examine the generated code:

For C:

For C++:

The first line is the XML header, and is simple boilerplate:

<?xml version="1.0"?>
The second line is a comment, using the usual XML syntax for comments, which are of course optional:
<!-- Sample specs for parsing command line -->
The rest of the document is enclosed within the opening and closing tags of the root element, which must be named "Spec":
<Spec>
	...
</Spec>
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.

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

<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

<File> Inserts text from an external file

<Copyright> Generates a copyright notice

</Remarks>

<Options> (required)

<BoolOpt/> Option taking no argument

<IntOpt/> Option taking integer argument

<StringOpt/> Option taking character string argument

</Options>
</Spec>

Home