const f_string_static_t iki_read_short_literal_s = macro_f_string_static_t_initialize(IKI_READ_short_literal_s, 0, IKI_READ_short_literal_s_length);
const f_string_static_t iki_read_short_name_s = macro_f_string_static_t_initialize(IKI_READ_short_name_s, 0, IKI_READ_short_name_s_length);
const f_string_static_t iki_read_short_object_s = macro_f_string_static_t_initialize(IKI_READ_short_object_s, 0, IKI_READ_short_object_s_length);
+ const f_string_static_t iki_read_short_reassign_s = macro_f_string_static_t_initialize(IKI_READ_short_reassign_s, 0, IKI_READ_short_reassign_s_length);
const f_string_static_t iki_read_short_replace_s = macro_f_string_static_t_initialize(IKI_READ_short_replace_s, 0, IKI_READ_short_replace_s_length);
const f_string_static_t iki_read_short_substitute_s = macro_f_string_static_t_initialize(IKI_READ_short_substitute_s, 0, IKI_READ_short_substitute_s_length);
const f_string_static_t iki_read_short_total_s = macro_f_string_static_t_initialize(IKI_READ_short_total_s, 0, IKI_READ_short_total_s_length);
const f_string_static_t iki_read_long_literal_s = macro_f_string_static_t_initialize(IKI_READ_long_literal_s, 0, IKI_READ_long_literal_s_length);
const f_string_static_t iki_read_long_name_s = macro_f_string_static_t_initialize(IKI_READ_long_name_s, 0, IKI_READ_long_name_s_length);
const f_string_static_t iki_read_long_object_s = macro_f_string_static_t_initialize(IKI_READ_long_object_s, 0, IKI_READ_long_object_s_length);
+ const f_string_static_t iki_read_long_reassign_s = macro_f_string_static_t_initialize(IKI_READ_long_reassign_s, 0, IKI_READ_long_reassign_s_length);
const f_string_static_t iki_read_long_replace_s = macro_f_string_static_t_initialize(IKI_READ_long_replace_s, 0, IKI_READ_long_replace_s_length);
const f_string_static_t iki_read_long_substitute_s = macro_f_string_static_t_initialize(IKI_READ_long_substitute_s, 0, IKI_READ_long_substitute_s_length);
const f_string_static_t iki_read_long_total_s = macro_f_string_static_t_initialize(IKI_READ_long_total_s, 0, IKI_READ_long_total_s_length);
#define IKI_READ_short_literal_s "L"
#define IKI_READ_short_name_s "n"
#define IKI_READ_short_object_s "o"
+ #define IKI_READ_short_reassign_s "R"
#define IKI_READ_short_replace_s "r"
#define IKI_READ_short_substitute_s "s"
#define IKI_READ_short_total_s "t"
#define IKI_READ_long_literal_s "literal"
#define IKI_READ_long_name_s "name"
#define IKI_READ_long_object_s "object"
+ #define IKI_READ_long_reassign_s "reassign"
#define IKI_READ_long_replace_s "replace"
#define IKI_READ_long_substitute_s "substitute"
#define IKI_READ_long_total_s "total"
#define IKI_READ_short_literal_s_length 1
#define IKI_READ_short_name_s_length 1
#define IKI_READ_short_object_s_length 1
+ #define IKI_READ_short_reassign_s_length 1
#define IKI_READ_short_replace_s_length 1
#define IKI_READ_short_substitute_s_length 1
#define IKI_READ_short_total_s_length 1
#define IKI_READ_long_literal_s_length 7
#define IKI_READ_long_name_s_length 4
#define IKI_READ_long_object_s_length 6
+ #define IKI_READ_long_reassign_s_length 8
#define IKI_READ_long_replace_s_length 7
#define IKI_READ_long_substitute_s_length 10
#define IKI_READ_long_total_s_length 5
extern const f_string_static_t iki_read_short_literal_s;
extern const f_string_static_t iki_read_short_name_s;
extern const f_string_static_t iki_read_short_object_s;
+ extern const f_string_static_t iki_read_short_reassign_s;
extern const f_string_static_t iki_read_short_replace_s;
extern const f_string_static_t iki_read_short_substitute_s;
extern const f_string_static_t iki_read_short_total_s;
extern const f_string_static_t iki_read_long_literal_s;
extern const f_string_static_t iki_read_long_name_s;
extern const f_string_static_t iki_read_long_object_s;
+ extern const f_string_static_t iki_read_long_reassign_s;
extern const f_string_static_t iki_read_long_replace_s;
extern const f_string_static_t iki_read_long_substitute_s;
extern const f_string_static_t iki_read_long_total_s;
iki_read_parameter_literal_e,
iki_read_parameter_name_e,
iki_read_parameter_object_e,
+ iki_read_parameter_reassign_e,
iki_read_parameter_replace_e,
iki_read_parameter_substitute_e,
iki_read_parameter_total_e,
macro_f_console_parameter_t_initialize(iki_read_short_literal_s.string, iki_read_long_literal_s.string, 0, 0, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize(iki_read_short_name_s.string, iki_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize(iki_read_short_object_s.string, iki_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+ macro_f_console_parameter_t_initialize(iki_read_short_reassign_s.string, iki_read_long_reassign_s.string, 0, 3, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize(iki_read_short_replace_s.string, iki_read_long_replace_s.string, 0, 2, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize(iki_read_short_substitute_s.string, iki_read_long_substitute_s.string, 0, 3, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize(iki_read_short_total_s.string, iki_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
macro_f_console_parameter_t_initialize(iki_read_short_wrap_s.string, iki_read_long_wrap_s.string, 0, 3, f_console_type_normal_e), \
}
- #define iki_read_total_parameters_d 21
+ #define iki_read_total_parameters_d 22
#endif // _di_iki_read_parameters_
#ifndef _di_iki_read_substitution_t_
f_print_dynamic_raw(f_string_eol_s, file.stream);
+ fll_program_print_help_option(file, context, iki_read_short_reassign_s, iki_read_long_reassign_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Re-assign the variable for the given name and matching content value with the given string.");
fll_program_print_help_option(file, context, iki_read_short_replace_s, iki_read_long_replace_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Simple substitution, replacing the variable for the given name with the given string.");
fll_program_print_help_option(file, context, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Substitute the variable for the given name and matching content value with the given string.");
fll_program_print_help_option(file, context, iki_read_short_wrap_s, iki_read_long_wrap_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Prepend and append strings for the given name.");
fl_print_format(" The vocabulary is case-sensitive and must exactly match.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
- fl_print_format(" The %[%r%r%] option requires 3 additional parameters:", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable);
+ fl_print_format(" The %[%r%r%] and the", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_reassign_s, context.set.notable);
+ fl_print_format(" %[%r%r%] options require 3 additional parameters:", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable);
fl_print_format(" %[<%]%r%[>%]", file.stream, context.set.notable, context.set.notable, iki_read_substitution_vocabulary_s, context.set.notable, context.set.notable);
fl_print_format(" %[<%]%r%[>%]", file.stream, context.set.notable, context.set.notable, iki_read_substitution_replace_s, context.set.notable, context.set.notable);
fl_print_format(" %[<%]%r%[>%].%r", file.stream, context.set.notable, context.set.notable, iki_read_substitution_with_s, context.set.notable, context.set.notable, f_string_eol_s);
fl_print_format(" %[%r%r%] option substitutes all matching vocabulary names and the", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_replace_s, context.set.notable);
fl_print_format(" %[%r%r%] option substitutes all matching vocabulary names that must also have the given matching content.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+ fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_reassign_s, context.set.notable);
+ fl_print_format(" option is identical to the %[%r%r%] option", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable);
+ fl_print_format(" except that the %[%r%r%] option is ignored (not applied).%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_wrap_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+
fl_print_format(" The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable);
fl_print_format(" option takes priority over the %[%r%r%] option when matching the same variable.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_replace_s, context.set.notable, f_string_eol_s, f_string_eol_s);
}
}
+ if (main->parameters.array[iki_read_parameter_reassign_e].result != f_console_result_none_e) {
+ if (main->parameters.array[iki_read_parameter_reassign_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_reassign_e].values.used % 3 != 0) {
+ if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_reassign_s, main->error.notable);
+ fl_print_format("%[' requires 3 strings.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+
+ funlockfile(main->error.to.stream);
+ }
+
+ status = F_status_set_error(F_parameter);
+ }
+
+ if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
+ if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_reassign_s, iki_read_long_total_s);
+ }
+
+ status = F_status_set_error(F_parameter);
+ }
+ }
+
if (main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_none_e) {
if (main->parameters.array[iki_read_parameter_substitute_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_substitute_e].values.used % 3 != 0) {
if (main->error.verbosity != f_console_verbosity_quiet_e) {
#endif
#ifndef _di_iki_read_substitutions_print_
- void iki_read_substitutions_print(iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) {
+ void iki_read_substitutions_print(iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const iki_read_substitutions_t reassignments, const f_array_length_t index, const bool content_only) {
- uint8_t matched = F_false;
+ uint8_t matched = 0x0; // 0x0 = no match, 0x1 = match re-assignment, 0x2 = match substitution.
f_array_length_t at = 0;
+ f_array_length_t i = 0;
// Grab the last (right-most) match.
- for (f_array_length_t i = 0; i < substitutions.used; ++i) {
+ for (; i < reassignments.used; ++i) {
- if (fl_string_dynamic_partial_compare_string(substitutions.array[i].replace.string, data->buffer, substitutions.array[i].replace.used, iki_data.content.array[index]) == F_equal_to) {
- matched = F_true;
+ if (fl_string_dynamic_partial_compare_string(reassignments.array[i].replace.string, data->buffer, reassignments.array[i].replace.used, iki_data.content.array[index]) == F_equal_to) {
+ matched = 0x1;
at = i;
}
} // for
+ // Grab the last (right-most) match.
+ if (!matched) {
+ for (i = 0; i < substitutions.used; ++i) {
+
+ if (fl_string_dynamic_partial_compare_string(substitutions.array[i].replace.string, data->buffer, substitutions.array[i].replace.used, iki_data.content.array[index]) == F_equal_to) {
+ matched = 0x2;
+ at = i;
+ }
+ } // for
+ }
+
if (matched) {
if (content_only) {
- f_print_dynamic(substitutions.array[at].with, data->main->output.to.stream);
+ if (matched == 0x1) {
+ f_print_dynamic(reassignments.array[at].with, data->main->output.to.stream);
+ }
+ else {
+ // The wraps.replace represents the "before", which is a string to prepend.
+ if (wraps.replace.used) {
+ f_print_dynamic(wraps.replace, data->main->output.to.stream);
+ }
+
+ f_print_dynamic(substitutions.array[at].with, data->main->output.to.stream);
+
+ // The wraps.replace represents the "after", which is a string to append.
+ if (wraps.with.used) {
+ f_print_dynamic(wraps.with, data->main->output.to.stream);
+ }
+ }
}
else {
f_string_range_t range = macro_f_string_range_t_initialize(iki_data.variable.array[index].start, iki_data.content.array[index].start - 1);
f_print_dynamic_partial(data->buffer, range, data->main->output.to.stream);
- // The wraps.replace represents the "before", which is a string to prepend.
- if (wraps.replace.used) {
- f_print_dynamic(wraps.replace, data->main->output.to.stream);
+ if (matched == 0x1) {
+ f_print_dynamic(reassignments.array[at].with, data->main->output.to.stream);
}
+ else {
- f_print_dynamic(substitutions.array[at].with, data->main->output.to.stream);
+ // The wraps.replace represents the "before", which is a string to prepend.
+ if (wraps.replace.used) {
+ f_print_dynamic(wraps.replace, data->main->output.to.stream);
+ }
- // The wraps.replace represents the "after", which is a string to append.
- if (wraps.with.used) {
- f_print_dynamic(wraps.with, data->main->output.to.stream);
+ f_print_dynamic(substitutions.array[at].with, data->main->output.to.stream);
+
+ // The wraps.replace represents the "after", which is a string to append.
+ if (wraps.with.used) {
+ f_print_dynamic(wraps.with, data->main->output.to.stream);
+ }
}
range.start = iki_data.content.array[index].stop + 1;
* This is only performed when substitutions has no match for the given range at the given index.
* @param substitutions
* The substitutions associated with the variable for the given range at the given index to use for potential printing.
+ * @param reassignments
+ * The reassignments associated with the variable for the given range at the given index to use for potential printing.
* @param index
* The index used to identify the desired range in variable, content, and ranges.
* @param content_only
* Set to FALSE to print the entire variable when printing substituted text.
*/
#ifndef _di_iki_read_substitutions_print_
- extern void iki_read_substitutions_print(iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) F_attribute_visibility_internal_d;
+ extern void iki_read_substitutions_print(iki_read_data_t * const data, const f_iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitution_t replacement, const iki_read_substitution_t wraps, const iki_read_substitutions_t substitutions, const iki_read_substitutions_t reassignments, const f_array_length_t index, const bool content_only) F_attribute_visibility_internal_d;
#endif // _di_iki_read_substitutions_print_
#ifdef __cplusplus
iki_read_substitution_t replacements[iki_data->variable.used];
iki_read_substitution_t wraps[iki_data->variable.used];
+ iki_read_substitutions_t reassignments[iki_data->variable.used];
iki_read_substitutions_t substitutionss[iki_data->variable.used];
memset(replacements, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
memset(wraps, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
+ memset(reassignments, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
if (data->mode == iki_read_mode_literal_e || data->mode == iki_read_mode_content_e) {
return status;
}
- status = iki_read_substitutions_identify(data, &iki_data->vocabulary, substitutionss);
+ status = iki_read_substitutions_identify(data, &data->main->parameters.array[iki_read_parameter_reassign_e], &iki_data->vocabulary, reassignments);
+
+ if (F_status_is_error_not(status)) {
+ status = iki_read_substitutions_identify(data, &data->main->parameters.array[iki_read_parameter_substitute_e], &iki_data->vocabulary, substitutionss);
+ }
if (F_status_is_error(status)) {
fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
+ f_array_length_t i = 0;
+
+ for (; i < iki_data->variable.used; ++i) {
+ macro_iki_read_substitutions_t_delete_simple(reassignments[i]);
+ } // for
+
+ for (i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
} // for
if (F_status_is_error(status)) {
fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
+ f_array_length_t i = 0;
+
+ for (; i < iki_data->variable.used; ++i) {
+ macro_iki_read_substitutions_t_delete_simple(reassignments[i]);
+ } // for
+
+ for (i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
} // for
f_string_dynamic_resize(0, &name);
+
return status;
}
if (matches++ != data->at) continue;
}
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], j, content_only);
+ if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used || reassignments[j].used) {
+ iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], reassignments[j], j, content_only);
}
else {
f_print_dynamic_partial(data->buffer, ranges->array[j], data->main->output.to.stream);
if (data->at < ranges->used) {
flockfile(data->main->output.to.stream);
- if (replacements[data->at].replace.used || wraps[data->at].replace.used || wraps[data->at].with.used || substitutionss[data->at].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[data->at], wraps[data->at], substitutionss[data->at], data->at, content_only);
+ if (replacements[data->at].replace.used || wraps[data->at].replace.used || wraps[data->at].with.used || substitutionss[data->at].used || reassignments[data->at].used) {
+ iki_read_substitutions_print(data, *iki_data, *ranges, replacements[data->at], wraps[data->at], substitutionss[data->at], reassignments[data->at], data->at, content_only);
}
else {
f_print_dynamic_partial(data->buffer, ranges->array[data->at], data->main->output.to.stream);
for (f_array_length_t i = 0; i < ranges->used; ++i) {
- if (replacements[i].replace.used || wraps[i].replace.used || wraps[i].with.used || substitutionss[i].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[i], wraps[i], substitutionss[i], i, content_only);
+ if (replacements[i].replace.used || wraps[i].replace.used || wraps[i].with.used || substitutionss[i].used || reassignments[i].used) {
+ iki_read_substitutions_print(data, *iki_data, *ranges, replacements[i], wraps[i], substitutionss[i], reassignments[i], i, content_only);
}
else {
f_print_dynamic_partial(data->buffer, ranges->array[i], data->main->output.to.stream);
status = F_data_not;
}
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
+ f_array_length_t i = 0;
+
+ for (; i < iki_data->variable.used; ++i) {
+ macro_iki_read_substitutions_t_delete_simple(reassignments[i]);
+ } // for
+
+ for (i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
} // for
iki_read_substitution_t replacements[iki_data->variable.used];
iki_read_substitution_t wraps[iki_data->variable.used];
+ iki_read_substitutions_t reassignments[iki_data->variable.used];
iki_read_substitutions_t substitutionss[iki_data->variable.used];
memset(replacements, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
memset(wraps, 0, sizeof(iki_read_substitution_t) * iki_data->variable.used);
+ memset(reassignments, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
if (data->mode == iki_read_mode_literal_e || data->mode == iki_read_mode_content_e) {
return status;
}
- status = iki_read_substitutions_identify(data, &iki_data->vocabulary, substitutionss);
+ status = iki_read_substitutions_identify(data, &data->main->parameters.array[iki_read_parameter_reassign_e], &iki_data->vocabulary, reassignments);
+
+ if (F_status_is_error_not(status)) {
+ status = iki_read_substitutions_identify(data, &data->main->parameters.array[iki_read_parameter_substitute_e], &iki_data->vocabulary, substitutionss);
+ }
if (F_status_is_error(status)) {
fll_error_print(data->main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
+ f_array_length_t i = 0;
+
+ for (; i < iki_data->variable.used; ++i) {
+ macro_iki_read_substitutions_t_delete_simple(reassignments[i]);
+ } // for
+
+ for (i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
} // for
} // for
if (F_status_is_error(status)) {
+ for (; i < iki_data->variable.used; ++i) {
+ macro_iki_read_substitutions_t_delete_simple(reassignments[i]);
+ } // for
+
for (i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
} // for
if (status == F_equal_to) {
name_missed = F_false;
+
break;
}
} // for
if (name_missed) {
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, iki_data->variable, replacements[j], wraps[j], substitutionss[j], j, F_false);
+ if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used || reassignments[j].used) {
+ iki_read_substitutions_print(data, *iki_data, iki_data->variable, replacements[j], wraps[j], substitutionss[j], reassignments[j], j, F_false);
}
else {
f_print_dynamic_partial(data->buffer, iki_data->variable.array[j], data->main->output.to.stream);
}
}
else {
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], j, content_only);
+ if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used || reassignments[j].used) {
+ iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], reassignments[j], j, content_only);
}
else {
f_print_dynamic_partial(data->buffer, ranges->array[j], data->main->output.to.stream);
}
}
else {
- if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used) {
- iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], j, content_only);
+ if (replacements[j].replace.used || wraps[j].replace.used || wraps[j].with.used || substitutionss[j].used || reassignments[j].used) {
+ iki_read_substitutions_print(data, *iki_data, *ranges, replacements[j], wraps[j], substitutionss[j], reassignments[j], j, content_only);
}
else {
f_print_dynamic_partial(data->buffer, ranges->array[j], data->main->output.to.stream);
funlockfile(data->main->output.to.stream);
}
- for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
+ f_array_length_t i = 0;
+
+ for (; i < iki_data->variable.used; ++i) {
+ macro_iki_read_substitutions_t_delete_simple(reassignments[i]);
+ } // for
+
+ for (i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
} // for
#endif // _di_iki_read_replacements_identify_
#ifndef _di_iki_read_substitutions_identify_
- f_status_t iki_read_substitutions_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) {
+ f_status_t iki_read_substitutions_identify(iki_read_data_t * const data, f_console_parameter_t * const parameter, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) {
- if (data->main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_additional_e) {
- return F_none;
- }
+ if (parameter->result != f_console_result_additional_e) return F_none;
f_status_t status = F_none;
f_array_length_t index = 0;
f_array_length_t index2 = 0;
- f_console_parameter_t *parameter = &data->main->parameters.array[iki_read_parameter_substitute_e];
-
for (; i < parameter->values.used; i += 3) {
index = parameter->values.array[i];
*
* @param data
* The program data.
+ * @param parameter
+ * The parameter data for the parameter being processed.
* @param vocabulary
* The ranges representing a vocabulary.
* @param substitutionss
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_substitutions_identify_
- extern f_status_t iki_read_substitutions_identify(iki_read_data_t * const data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_substitutions_identify(iki_read_data_t * const data, f_console_parameter_t * const parameter, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) F_attribute_visibility_internal_d;
#endif // _di_iki_read_substitutions_identify_
/**