Some fundamental definitions.


§1. Who we are. This is a command-line tool built on top of the Foundation module. The first definition we need to make is:

define PROGRAM_NAME "indoc"
void Basics::start(int argc, char **argv) {
    Foundation::start(argc, argv);
    Declare the debugging log aspects1.2;
}

void Basics::end(void) {
    Foundation::end();
}

§1.1. Just two logging aspects to add to the usual Foundation stock:

enum SYMBOLS_DA
enum INSTRUCTIONS_DA

§1.2. Declare the debugging log aspects1.2 =

    Log::declare_aspect(SYMBOLS_DA, U"symbols", FALSE, FALSE);
    Log::declare_aspect(INSTRUCTIONS_DA, U"instructions", FALSE, FALSE);

§2. Setting up the memory manager. We need to itemise the structures we'll want to allocate:

enum settings_block_CLASS
enum volume_CLASS
enum chapter_CLASS
enum section_CLASS
enum formatted_file_CLASS
enum indexing_category_CLASS
enum index_lemma_CLASS
enum example_index_data_CLASS
enum image_source_CLASS
enum image_usage_CLASS
enum example_CLASS
enum CSS_tweak_data_CLASS
enum span_notation_CLASS
enum dc_metadatum_CLASS
enum navigation_design_CLASS

§3. And then expand:

DECLARE_CLASS(settings_block)
DECLARE_CLASS(volume)
DECLARE_CLASS(chapter)
DECLARE_CLASS(section)
DECLARE_CLASS(formatted_file)
DECLARE_CLASS(indexing_category)
DECLARE_CLASS(index_lemma)
DECLARE_CLASS(example_index_data)
DECLARE_CLASS(image_source)
DECLARE_CLASS(image_usage)
DECLARE_CLASS(example)
DECLARE_CLASS(CSS_tweak_data)
DECLARE_CLASS(span_notation)
DECLARE_CLASS(dc_metadatum)
DECLARE_CLASS(navigation_design)

§4. The Unicode for section. Since this doesn't lie in the ASCII character range, I'll refer to it by its Unicode number rather than placing the character in question in the source code directly.

define SECTION_SYMBOL 167  Unicode for a section symbol