To write the Innards element (In) in the index.

§1. Describing the current VM.

void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
    inter_tree *I = InterpretIndex::get_tree();
    tree_inventory *inv = Synoptic::inv(I);
    TreeLists::sort(inv->use_option_nodes, Synoptic::module_order);

    Show the virtual machine compiled for1.1;
    Show the use options1.2;

    HTML_OPEN("p");
    Index::extra_link(OUT, 3);
    WRITE("See some technicalities for Inform maintainers only");
    HTML_CLOSE("p");
    Index::extra_div_open(OUT, 3, 2, "e0e0e0");
    HTML_OPEN("p");
    Index::anchor(OUT, I"CONFIG");
    Show the language elements used1.3;
    Add some paste buttons for the debugging log1.4;
    Index::extra_div_close(OUT, "e0e0e0");
}

§1.1. Show the virtual machine compiled for1.1 =

    Index::anchor(OUT, I"STORYFILE");
    HTML_OPEN("p"); WRITE("Story file format: ");
    inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics");
    text_stream *VM = Metadata::read_optional_textual(pack, I"^virtual_machine");
    text_stream *VM_icon = Metadata::read_optional_textual(pack, I"^virtual_machine_icon");
    if (Str::len(VM_icon) > 0) {
        HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/%S", VM_icon);
        WRITE(" ");
    }
    if (Str::len(VM) > 0) WRITE("%S", VM);
    HTML_CLOSE("p");

§1.2. Show the use options1.2 =

    HTML_OPEN("p"); WRITE("The following use options are in force:"); HTML_CLOSE("p");
    InnardsElement::index_options_in_force_from(OUT, inv, MAIN_TEXT_UO_ORIGIN, NULL);
    InnardsElement::index_options_in_force_from(OUT, inv, OPTIONS_FILE_UO_ORIGIN, NULL);
    for (int i=0; i<TreeLists::len(inv->module_nodes); i++) {
        inter_package *E = Inter::Package::defined_by_frame(inv->module_nodes->list[i].node);
        InnardsElement::index_options_in_force_from(OUT, inv, EXTENSION_UO_ORIGIN, E);
    }
    int c = 0;
    HTML_OPEN("p"); WRITE("Whereas these are not in force:"); HTML_CLOSE("p");
    HTML::open_indented_p(OUT, 2, "tight");
    for (int i=0; i<TreeLists::len(inv->use_option_nodes); i++) {
        inter_package *pack = Inter::Package::defined_by_frame(inv->use_option_nodes->list[i].node);
        inter_ti set = Metadata::read_numeric(pack, I"^active");
        inter_ti sfs = Metadata::read_numeric(pack, I"^source_file_scoped");
        if ((set == FALSE) && (sfs == FALSE)) {
            Write in the index line for a use option not taken1.2.1;
            if (c++ > 0) WRITE(", ");
        }
    }
    if (c == 0) WRITE("None.");  in practice, this will never happen
    HTML_CLOSE("p");

§1.2.1. Write in the index line for a use option not taken1.2.1 =

    HTML_OPEN_WITH("span", "style=\"white-space:nowrap\";");
    TEMPORARY_TEXT(TEMP)
    WRITE_TO(TEMP, "Use %S.", Metadata::read_textual(pack, I"^name"));
    PasteButtons::paste_text(OUT, TEMP);
    DISCARD_TEXT(TEMP)
    WRITE("&nbsp;%S", Metadata::read_textual(pack, I"^name"));
    HTML_CLOSE("span");

§1.3. Show the language elements used1.3 =

    WRITE("Inform language definition:\n");
    inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics");
    text_stream *used = Metadata::read_optional_textual(pack, I"^language_elements_used");
    text_stream *not_used = Metadata::read_optional_textual(pack, I"^language_elements_not_used");
    if (Str::len(used) > 0) WRITE("Included: %S", used);
    if (Str::len(not_used) > 0) WRITE("<br>Excluded: %S", not_used);
    HTML_CLOSE("p");

§1.4. Add some paste buttons for the debugging log1.4 =

    HTML_OPEN("p");
    WRITE("Debugging log:");
    HTML_CLOSE("p");
    HTML_OPEN("p");
    inter_symbol *wanted = PackageTypes::get(I, I"_debugging_aspect");
    inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics");
    inter_tree_node *D = Inter::Packages::definition(pack);
    LOOP_THROUGH_INTER_CHILDREN(C, D) {
        if (C->W.data[ID_IFLD] == PACKAGE_IST) {
            inter_package *entry = Inter::Package::defined_by_frame(C);
            if (Inter::Packages::type(entry) == wanted) {
                TEMPORARY_TEXT(is)
                WRITE_TO(is, "Include %S in the debugging log.",
                    Metadata::read_textual(entry, I"^name"));
                PasteButtons::paste_text(OUT, is);
                WRITE("&nbsp;%S&nbsp;", is);
                DISCARD_TEXT(is)
                if (Metadata::read_optional_numeric(entry, I"^used")) {
                    HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/tick.png");
                } else {
                    HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/cross.png");
                }
                HTML_TAG("br");
            }
        }
    }
    HTML_CLOSE("p");

§2. Now for indexing, where there's nothing much to see.

define MAIN_TEXT_UO_ORIGIN 1
define OPTIONS_FILE_UO_ORIGIN 2
define EXTENSION_UO_ORIGIN 3
void InnardsElement::index_options_in_force_from(OUTPUT_STREAM, tree_inventory *inv, int category, inter_package *E) {
    int N = 0;
    for (int i=0; i<TreeLists::len(inv->use_option_nodes); i++) {
        inter_package *pack = Inter::Package::defined_by_frame(inv->use_option_nodes->list[i].node);
        inter_ti set = Metadata::read_numeric(pack, I"^active");
        inter_ti sfs = Metadata::read_numeric(pack, I"^source_file_scoped");
        if ((set) && (sfs == FALSE)) {
            if (InnardsElement::uo_set_from(pack, category, E)) {
                if (N++ == 0) Write in the use option subheading2.2;
                Write in the index line for a use option taken2.3;
            }
        }
    }
}

§2.1. And this is what the rest of Inform calls to find out whether a particular pragma is set:

int InnardsElement::uo_set_from(inter_package *pack, int category, inter_package *E) {
    switch (category) {
        case MAIN_TEXT_UO_ORIGIN: if (Metadata::read_optional_numeric(pack, I"^used_in_source_text")) return TRUE; break;
        case OPTIONS_FILE_UO_ORIGIN: if (Metadata::read_optional_numeric(pack, I"^used_in_options")) return TRUE; break;
        case EXTENSION_UO_ORIGIN: {
            inter_symbol *id = Metadata::read_optional_symbol(pack, I"^used_in_extension");
            if (id) {
                inter_package *used_in_E = Inter::Packages::container(id->definition);
                if ((used_in_E) && (used_in_E == E)) return TRUE;
            }
            break;
        }
    }
    return FALSE;
}

§2.2. Write in the use option subheading2.2 =

    HTML::open_indented_p(OUT, 2, "tight");
    HTML::begin_colour(OUT, I"808080");
    WRITE("Set from ");
    switch (category) {
        case MAIN_TEXT_UO_ORIGIN:
            WRITE("the source text"); break;
        case OPTIONS_FILE_UO_ORIGIN:
            WRITE("the Options.txt configuration file, or automatically");
            Index::DocReferences::link(OUT, I"OPTIONSFILE"); break;
        case EXTENSION_UO_ORIGIN:
            WRITE("%S", Metadata::read_optional_textual(E, I"^credit"));
            break;
    }
    WRITE(":");
    HTML::end_colour(OUT);
    HTML_CLOSE("p");

§2.3. Write in the index line for a use option taken2.3 =

    HTML::open_indented_p(OUT, 3, "tight");
    WRITE("Use %S", Metadata::read_optional_textual(pack, I"^name"));
    int msv = (int) Metadata::read_optional_numeric(pack, I"^minimum");
    if (msv > 0) WRITE(" of at least %d", msv);
    int at = (int) Metadata::read_optional_numeric(pack, I"^used_at");
    if (at > 0) Index::link(OUT, at);
    if (msv > 0) {
        WRITE("&nbsp;");
        TEMPORARY_TEXT(TEMP)
        WRITE_TO(TEMP, "Use %S of at least %d.",
            Metadata::read_optional_textual(pack, I"^name"), 2*msv);
        PasteButtons::paste_text(OUT, TEMP);
        DISCARD_TEXT(TEMP)
        WRITE("&nbsp;<i>Double this</i>");
    }
    HTML_CLOSE("p");