To index properties.
typedef struct property_indexing_data { int include_in_index; is this property shown in the indexes? int indexed_already; and has it been, thus far in index construction? } property_indexing_data; void IXProperties::initialise_pid(property *prn) { prn->indexing_data.indexed_already = FALSE; prn->indexing_data.include_in_index = TRUE; }
- The structure property_indexing_data is private to this section.
§2. A property might be missed out of the Index pages for clarity's sake:
int IXProperties::is_shown_in_index(property *prn) { return prn->indexing_data.include_in_index; } void IXProperties::dont_show_in_index(property *prn) { prn->indexing_data.include_in_index = FALSE; }
§3. During indexing we try to avoid mentioning properties more than once:
void IXProperties::set_indexed_already_flag(property *prn, int state) { prn->indexing_data.indexed_already = state; } int IXProperties::get_indexed_already_flag(property *prn) { return prn->indexing_data.indexed_already; }
void IXProperties::index_either_or(OUTPUT_STREAM, property *prn) { property *neg = EitherOrProperties::get_negation(prn); WRITE("either/or property"); if (Properties::get_permissions(prn)) { WRITE(" of "); IXProperties::index_permissions(OUT, prn); } else if ((neg) && (Properties::get_permissions(neg))) { WRITE(" of "); IXProperties::index_permissions(OUT, neg); } if (neg) WRITE(", opposite of </i>%+W<i>", neg->name); } void IXProperties::index_permissions(OUTPUT_STREAM, property *prn) { for (int ac = 0, s = 1; s <= 2; s++) { property_permission *pp; LOOP_OVER_PERMISSIONS_FOR_PROPERTY(pp, prn) { wording W = InferenceSubjects::get_name_text( PropertyPermissions::get_subject(pp)); if (Wordings::nonempty(W)) { if (s == 1) ac++; else { WRITE("</i>%+W<i>", W); ac--; if (ac == 1) WRITE(" or "); if (ac > 1) WRITE(", "); } } } } }