for (i = 0; i < data->vocabularys.used; ++i) {
+ main->setting.map_replacess.array[i].used = 0;
+ main->setting.map_wrapss.array[i].used = 0;
+
for (j = 0; j < data->vocabularys.array[i].used; ++j) {
if (iki_read_signal_check(main)) return;
if (main->setting.replace.used) {
- main->setting.map_replacess.array[i].used = 0;
-
k = main->setting.replace.used - 1;
do {
}
if (main->setting.wrap.used) {
- main->setting.map_wrapss.array[i].used = 0;
-
k = main->setting.wrap.used - 1;
do {
iki_read_print_data_wrap_append(&main->program.output, index);
}
else if (main->setting.flag & iki_read_main_flag_object_d) {
- for (at = 0; at < main->setting.map_replacess.array[index].used; ++at) {
-
- if (main->setting.map_replacess.array[index].array[at] < main->setting.replace.used) {
- f_print_dynamic(main->setting.replace.array[main->setting.map_replacess.array[index].array[at]].key, main->program.output.to);
+ if (main->setting.flag & iki_read_main_flag_select_d) {
+ if (main->setting.select < main->setting.map_replacess.array[index].used) {
+ f_print_dynamic(main->setting.replace.array[main->setting.map_replacess.array[index].array[main->setting.select]].key, main->program.output.to);
}
- } // for
+ }
+ else {
+ for (at = 0; at < main->setting.map_replacess.array[index].used; ++at) {
+
+ if (main->setting.map_replacess.array[index].array[at] < main->setting.replace.used) {
+ f_print_dynamic(main->setting.replace.array[main->setting.map_replacess.array[index].array[at]].key, main->program.output.to);
+ }
+ } // for
+ }
}
else {
range.start = data->variable.array[index].start;
iki_read_print_data_wrap_append(&main->program.output, index);
}
else if (main->setting.flag & iki_read_main_flag_object_d) {
- for (at = 0; at < data->vocabularys.array[index].used; ) {
+ if (main->setting.flag & iki_read_main_flag_select_d) {
+ if (main->setting.select < data->vocabularys.array[index].used) {
+ f_print_dynamic_partial(main->cache.buffer, data->vocabularys.array[index].array[main->setting.select], main->program.output.to);
+ }
+ }
+ else {
+ for (at = 0; at < data->vocabularys.array[index].used; ) {
- f_print_dynamic_partial(main->cache.buffer, data->vocabularys.array[index].array[at], main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, data->vocabularys.array[index].array[at], main->program.output.to);
- if (++at < data->vocabularys.array[index].used) {
- f_print_dynamic_raw(f_string_space_s, print->to);
- }
- } // for
+ if (++at < data->vocabularys.array[index].used) {
+ f_print_dynamic_raw(f_string_space_s, print->to);
+ }
+ } // for
+ }
}
else {
range.start = data->variable.array[index].start;
return;
}
+ main->setting.map_wrapss.used = main->setting.map_replacess.used = data->vocabularys.used;
+
for (i = 0; i < data->delimits.used; ++i) {
main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
} // for
iki_read_print_data_wrap_append(&main->program.output, index);
}
else if (main->setting.flag & iki_read_main_flag_object_d) {
- if (main->setting.map_replacess.array[index].array[0] < main->setting.replace.used) {
- f_print_dynamic(main->setting.replace.array[main->setting.map_replacess.array[index].array[0]].key, main->program.output.to);
+ if (!(main->setting.flag & iki_read_main_flag_select_d) || !main->setting.select) {
+ if (main->setting.map_replacess.array[index].array[0] < main->setting.replace.used) {
+ f_print_dynamic(main->setting.replace.array[main->setting.map_replacess.array[index].array[0]].key, main->program.output.to);
+ }
}
}
else {
iki_read_print_data_wrap_append(&main->program.output, index);
}
else if (main->setting.flag & iki_read_main_flag_object_d) {
- f_print_dynamic_partial(main->cache.buffer, data->vocabulary.array[index], main->program.output.to);
+ if (!(main->setting.flag & iki_read_main_flag_select_d) || !main->setting.select) {
+ f_print_dynamic_partial(main->cache.buffer, data->vocabulary.array[index], main->program.output.to);
+ }
+ else if ((main->setting.flag & iki_read_main_flag_select_d) && main->setting.select) {
+ main->setting.state.status = F_data_not;
+ }
}
else {
range.start = data->variable.array[index].start;
return;
}
+ main->setting.map_wrapss.used = main->setting.map_replacess.used = data->vocabulary.used;
+
for (i = 0; i < data->delimits.used; ++i) {
main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
} // for
main->setting.flag |= iki_read_main_flag_replace_d;
}
+ if (parameters->array[iki_read_parameter_select_e].result & f_console_result_found_e) {
+ if (!(parameters->array[iki_read_parameter_select_e].result & f_console_result_value_e) || !parameters->array[iki_read_parameter_select_e].values.used) {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_select_s);
+
+ return;
+ }
+
+ index = parameters->array[iki_read_parameter_select_e].values.array[i];
+
+ main->setting.select = 0;
+
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[index], &main->setting.select);
+
+ // Negative numbers are not supported.
+ if (main->setting.state.status == F_number_negative) {
+ main->setting.state.status = F_status_set_error(F_number_negative);
+ }
+
+ if (F_status_is_error(main->setting.state.status)) {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ fll_program_print_error_parameter_integer_not(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_select_s, parameters->arguments.array[index]);
+
+ return;
+ }
+
+ main->setting.flag |= iki_read_main_flag_select_d;
+ }
+
if (iki_read_setting_load_parameter_substitution(main, parameters->array[iki_read_parameter_reassign_e], iki_read_long_reassign_s, &main->setting.reassign)) {
main->setting.flag |= iki_read_main_flag_reassign_d;
}
- if (F_status_is_error(main->setting.state.status)) return;
-
- if (iki_read_setting_load_parameter_substitution(main, parameters->array[iki_read_parameter_substitute_e], iki_read_long_substitute_s, &main->setting.substitute)) {
- main->setting.flag |= iki_read_main_flag_substitute_d;
+ if (F_status_is_error_not(main->setting.state.status)) {
+ if (iki_read_setting_load_parameter_substitution(main, parameters->array[iki_read_parameter_substitute_e], iki_read_long_substitute_s, &main->setting.substitute)) {
+ main->setting.flag |= iki_read_main_flag_substitute_d;
+ }
}
if (F_status_is_error(main->setting.state.status)) return;
#endif // _di_iki_read_setting_load_
#ifndef _di_iki_read_setting_load_parameter_substitution_
- f_status_t iki_read_setting_load_parameter_substitution(iki_read_main_t * const main, const f_console_parameter_t parameter, const f_string_static_t name, f_string_triples_t *triple) {
+ f_status_t iki_read_setting_load_parameter_substitution(iki_read_main_t * const main, const f_console_parameter_t parameter, const f_string_static_t name, f_string_triples_t * const triple) {
if (!(parameter.result & f_console_result_found_e)) return F_false;
- if ((parameter.result & f_console_result_found_e) || parameter.values.used % 3) {
+ if (parameter.values.used % 3) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, name, iki_read_string_three_s);
* @see f_memory_array_resize()
*/
#ifndef _di_iki_read_setting_load_parameter_substitution_
- extern f_status_t iki_read_setting_load_parameter_substitution(iki_read_main_t * const main, const f_console_parameter_t parameter, const f_string_static_t name, f_string_triples_t *triple);
+ extern f_status_t iki_read_setting_load_parameter_substitution(iki_read_main_t * const main, const f_console_parameter_t parameter, const f_string_static_t name, f_string_triples_t * const triple);
#endif // _di_iki_read_setting_load_parameter_substitution_
#ifdef __cplusplus
* - name: Selecting using a specific Vocabulary name.
* - object: Print Objects.
* - pipe: Use the input pipe.
- * - replace: Using re-assignments.
+ * - select: Using select.
+ * - reassign: Using re-assignments.
* - replace: Using replacements.
* - substitute: Using substitutions.
* - total: Enable printing of "total" count.
#define iki_read_main_flag_pipe_d 0x100
#define iki_read_main_flag_reassign_d 0x200
#define iki_read_main_flag_replace_d 0x400
- #define iki_read_main_flag_substitute_d 0x800
- #define iki_read_main_flag_total_d 0x1000
- #define iki_read_main_flag_version_d 0x2000
- #define iki_read_main_flag_version_copyright_help_d 0x200c
- #define iki_read_main_flag_whole_d 0x4000
- #define iki_read_main_flag_wrap_d 0x8000
+ #define iki_read_main_flag_select_d 0x800
+ #define iki_read_main_flag_substitute_d 0x1000
+ #define iki_read_main_flag_total_d 0x2000
+ #define iki_read_main_flag_version_d 0x4000
+ #define iki_read_main_flag_version_copyright_help_d 0x400c
+ #define iki_read_main_flag_whole_d 0x8000
+ #define iki_read_main_flag_wrap_d 0x10000
#endif // _di_iki_read_main_flag_d_
/**
iki_read_parameter_object_e,
iki_read_parameter_reassign_e,
iki_read_parameter_replace_e,
+ iki_read_parameter_select_e,
iki_read_parameter_substitute_e,
iki_read_parameter_total_e,
iki_read_parameter_whole_e,
macro_f_console_parameter_t_initialize_3(iki_read_short_object_s, iki_read_long_object_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(iki_read_short_reassign_s, iki_read_long_reassign_s, 3, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(iki_read_short_replace_s, iki_read_long_replace_s, 2, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_select_s, iki_read_long_select_s, 1, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(iki_read_short_total_s, iki_read_long_total_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(iki_read_short_whole_s, iki_read_long_whole_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(iki_read_short_wrap_s, iki_read_long_wrap_s, 3, f_console_flag_normal_e), \
}
- #define iki_read_parameter_total_d (f_console_parameter_state_type_total_d + 12)
+ #define iki_read_parameter_total_d (f_console_parameter_state_type_total_d + 13)
#endif // _di_iki_read_parameter_e_
#ifdef __cplusplus
const f_string_static_t iki_read_short_object_s = macro_f_string_static_t_initialize_1(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_1(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_1(IKI_READ_short_replace_s, 0, IKI_READ_short_replace_s_length);
+ const f_string_static_t iki_read_short_select_s = macro_f_string_static_t_initialize_1(IKI_READ_short_select_s, 0, IKI_READ_short_select_s_length);
const f_string_static_t iki_read_short_substitute_s = macro_f_string_static_t_initialize_1(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_1(IKI_READ_short_total_s, 0, IKI_READ_short_total_s_length);
const f_string_static_t iki_read_short_whole_s = macro_f_string_static_t_initialize_1(IKI_READ_short_whole_s, 0, IKI_READ_short_whole_s_length);
const f_string_static_t iki_read_long_object_s = macro_f_string_static_t_initialize_1(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_1(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_1(IKI_READ_long_replace_s, 0, IKI_READ_long_replace_s_length);
+ const f_string_static_t iki_read_long_select_s = macro_f_string_static_t_initialize_1(IKI_READ_long_select_s, 0, IKI_READ_long_select_s_length);
const f_string_static_t iki_read_long_substitute_s = macro_f_string_static_t_initialize_1(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_1(IKI_READ_long_total_s, 0, IKI_READ_long_total_s_length);
const f_string_static_t iki_read_long_whole_s = macro_f_string_static_t_initialize_1(IKI_READ_long_whole_s, 0, IKI_READ_long_whole_s_length);
#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_select_s "s"
+ #define IKI_READ_short_substitute_s "S"
#define IKI_READ_short_total_s "t"
#define IKI_READ_short_whole_s "w"
#define IKI_READ_short_wrap_s "W"
#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_select_s "select"
#define IKI_READ_long_substitute_s "substitute"
#define IKI_READ_long_total_s "total"
#define IKI_READ_long_whole_s "whole"
#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_select_s_length 1
#define IKI_READ_short_substitute_s_length 1
#define IKI_READ_short_total_s_length 1
#define IKI_READ_short_whole_s_length 1
#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_select_s_length 6
#define IKI_READ_long_substitute_s_length 10
#define IKI_READ_long_total_s_length 5
#define IKI_READ_long_whole_s_length 5
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_select_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_short_whole_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_select_s;
extern const f_string_static_t iki_read_long_substitute_s;
extern const f_string_static_t iki_read_long_total_s;
extern const f_string_static_t iki_read_long_whole_s;
* - status_signal: A status used eclusively by the threaded signal handler.
* - state: The state data used when processing the FSS data.
*
- * - at: The position representing the "at" index.
- * - line: The position representing the "line" index.
+ * - at: The position representing the "at" index.
+ * - line: The position representing the "line" index.
+ * - select: The position representing the "select" index.
*
* - name: A string representing the IKI vocabulary name being selected.
* - files: An array of all files to process (except for the input pipe).
*/
#ifndef _di_iki_read_setting_t_
typedef struct {
- uint16_t flag;
+ uint32_t flag;
f_status_t status_signal;
f_state_t state;
f_number_unsigned_t at;
f_number_unsigned_t line;
+ f_number_unsigned_t select;
f_string_dynamics_t names;
f_string_dynamics_t files;
macro_f_state_t_initialize_1(iki_read_allocation_large_d, iki_read_allocation_small_d, F_okay, 0, 0, 0, 0, 0, 0, 0), \
0, \
0, \
+ 0, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_maps_t_initialize, \
f_print_dynamic_raw(f_string_eol_s, print->to);
- fll_program_print_help_option(print, iki_read_short_at_s, iki_read_long_at_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Variable at this numeric index.");
- fll_program_print_help_option(print, iki_read_short_line_s, iki_read_long_line_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print only the Variables at the given line within the file.");
- fll_program_print_help_option(print, iki_read_short_name_s, iki_read_long_name_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Variables with this name.");
- fll_program_print_help_option(print, iki_read_short_whole_s, iki_read_long_whole_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print all of the data instead of just the IKI Variable data.");
+ fll_program_print_help_option(print, iki_read_short_at_s, iki_read_long_at_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Variable at this numeric index.");
+ fll_program_print_help_option(print, iki_read_short_name_s, iki_read_long_name_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Select Variables with this name.");
+ fll_program_print_help_option(print, iki_read_short_select_s, iki_read_long_select_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Select Vocabulay (aka: Object) at this index.");
f_print_dynamic_raw(f_string_eol_s, print->to);
- fll_program_print_help_option(print, iki_read_short_content_s, iki_read_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print the Variable value (aka: Content) (default)");
- fll_program_print_help_option(print, iki_read_short_literal_s, iki_read_long_literal_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print the entire Variable (aka: Object, Content, and syntax).");
- fll_program_print_help_option(print, iki_read_short_object_s, iki_read_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the Variable name (aka: Vocabulary) (aka: Object).");
+ fll_program_print_help_option(print, iki_read_short_content_s, iki_read_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print the Content (default)");
+ fll_program_print_help_option(print, iki_read_short_line_s, iki_read_long_line_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print only the Variables at the given line within the file.");
+ fll_program_print_help_option(print, iki_read_short_literal_s, iki_read_long_literal_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Print the entire Variable (Vocabulary, Content, and syntax).");
+ fll_program_print_help_option(print, iki_read_short_object_s, iki_read_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the Vocabulary (aka: Object).");
fll_program_print_help_option(print, iki_read_short_total_s, iki_read_long_total_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print the total number of Variables.");
+ fll_program_print_help_option(print, iki_read_short_whole_s, iki_read_long_whole_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Print all of the data instead of just the IKI Variable data.");
f_print_dynamic_raw(f_string_eol_s, print->to);
- fll_program_print_help_option(print, iki_read_short_reassign_s, iki_read_long_reassign_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Re-assign the Variable for the given name and matching Content value with the given string.");
- fll_program_print_help_option(print, iki_read_short_replace_s, iki_read_long_replace_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Simple substitution, replacing the Variable for the given name with the given string.");
- fll_program_print_help_option(print, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Substitute the Variable for the given name and matching Content value with the given string.");
- fll_program_print_help_option(print, iki_read_short_wrap_s, iki_read_long_wrap_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Prepend and append strings for the given name.");
+ fll_program_print_help_option(print, iki_read_short_reassign_s, iki_read_long_reassign_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Re-assign the Content with the given string for the Variable with the given Vocabulary name and matching Content.");
+ fll_program_print_help_option(print, iki_read_short_replace_s, iki_read_long_replace_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Simple substitution, replacing the Content with the given string for the Variable with the given Vocabulary name.");
+ fll_program_print_help_option(print, iki_read_short_substitute_s, iki_read_long_substitute_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Substitute the Content with the given string for the Variable with the given Vocabulary name and matching Content value.");
+ fll_program_print_help_option(print, iki_read_short_wrap_s, iki_read_long_wrap_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Prepend and append strings with the given Vocabulary name.");
f_print_dynamic_raw(f_string_eol_s, print->to);