From 632cd8b2b477eb732dad44b79ef39ce6e62c4a16 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 8 Dec 2024 13:52:41 -0600 Subject: [PATCH] Progress: Begin fixing iki_read (and eki_read). I noticed a lot of issues and fixed the problems on the 0.6 branch first. This caused me to jump around back and forth a lot for the 0.7 branch. This disoriented me. I decided that I am going to commit this current state as a progress commit. I will write the runtime tests for the 0.6 branch. Then I will port those over to this. Then I will use the runtime tests to help identify where I last was and what I need to change or finish changing. The `--select` settings also need to be updated with regards to this. --- level_3/iki_read/c/eki/process.c | 214 ++++++++++++++++++-------------- level_3/iki_read/c/iki/process.c | 210 +++++++++++++++++-------------- level_3/iki_read/c/main/common.c | 45 ++----- level_3/iki_read/c/main/iki_read.c | 4 +- level_3/iki_read/c/main/print/message.c | 13 ++ level_3/iki_read/c/main/process.c | 24 ++-- 6 files changed, 274 insertions(+), 236 deletions(-) diff --git a/level_3/iki_read/c/eki/process.c b/level_3/iki_read/c/eki/process.c index 22eb0b1..216b31f 100644 --- a/level_3/iki_read/c/eki/process.c +++ b/level_3/iki_read/c/eki/process.c @@ -177,62 +177,86 @@ extern "C" { } f_number_unsigned_t i = 0; + f_number_unsigned_t j = 0; + f_number_unsigned_t k = 0; + f_number_unsigned_t l = 0; + f_number_unsigned_t at = 0; + f_number_unsigned_t stop = data->variable.used; - { - f_number_unsigned_t j = 0; - f_number_unsigned_t k = 0; - f_number_unsigned_t stop = data->variable.used; + i = range_original.start; + *range_buffer = range_original; - i = range_original.start; - *range_buffer = range_original; + f_file_stream_lock(main->program.output.to); - f_file_stream_lock(main->program.output.to); + while (i <= range_buffer->stop && j < stop) { - while (i <= range_buffer->stop && j < stop) { + if (iki_read_signal_check(main)) return; - if (iki_read_signal_check(main)) return; + if (i < data->variable.array[j].start) { + range_buffer->start = i; + range_buffer->stop = data->variable.array[j].start - 1; - if (i < data->variable.array[j].start) { - range_buffer->start = i; - range_buffer->stop = data->variable.array[j].start - 1; + f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); - f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); + range_buffer->start = data->variable.array[j].stop + 1; + range_buffer->stop = range_original.stop; - range_buffer->start = data->variable.array[j].stop + 1; - range_buffer->stop = range_original.stop; + i = data->variable.array[j].start; + } - i = data->variable.array[j].start; - } + if (main->setting.names.used) { + for (k = 0; k < main->setting.names.used; ++k) { - if (main->setting.names.used) { - for (k = 0; k < main->setting.names.used; ++k) { - if (f_compare_dynamic_partial_string(main->setting.names.array[k].string, main->cache.buffer, main->setting.names.array[k].used, data->vocabularys.array[j].array[0]) == F_equal_to) break; - } // for + for (l = 0; l < data->vocabularys.array[j].used; ++l) { + if (f_compare_dynamic_partial_string(main->setting.names.array[k].string, main->cache.buffer, main->setting.names.array[k].used, data->vocabularys.array[j].array[l]) == F_equal_to) break; + } - if (k < main->setting.names.used) { - if (main->callback.print_data) { - main->callback.print_data(&main->program.output, j); + if (l < data->vocabularys.array[j].used) break; + } // for + + if (k < main->setting.names.used) { + if (main->setting.flag & iki_read_main_flag_at_d) { + if (at++ == main->setting.at) { + if (main->callback.print_data) { + main->callback.print_data(&main->program.output, j); + } + } + else { + f_print_dynamic_partial(main->cache.buffer, data->variable.array[j], main->program.output.to); } } + else if (main->callback.print_data) { + main->callback.print_data(&main->program.output, j); + } } - else { + } + else if (main->setting.flag & iki_read_main_flag_at_d) { + if (at++ == main->setting.at) { if (main->callback.print_data) { main->callback.print_data(&main->program.output, j); } } - - i = data->variable.array[j].stop + 1; - ++j; - } // while - - if (i <= range_original.stop) { - range_buffer->start = i; - f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); + else { + f_print_dynamic_partial(main->cache.buffer, data->variable.array[j], main->program.output.to); + } + } + else { + if (main->callback.print_data) { + main->callback.print_data(&main->program.output, j); + } } - f_file_stream_unlock(main->program.output.to); + i = data->variable.array[j].stop + 1; + ++j; + } // while + + if (i <= range_original.stop) { + range_buffer->start = i; + f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); } + f_file_stream_unlock(main->program.output.to); + main->setting.state.status = F_okay; } #endif // _di_iki_read_eki_process_buffer_ranges_whole_ @@ -242,92 +266,94 @@ extern "C" { if (!main || !main->data) return; - f_iki_eki_t * const data = (f_iki_eki_t *) main->data; - - f_range_t range = macro_f_range_t_initialize_2(main->cache.buffer.used); - - iki_read_process_line(main, &range); + f_number_unsigned_t total = 0; + f_number_unsigned_t i = 0; - if (main->setting.state.status == F_true) { - if (range.start > main->cache.buffer.used) { - fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s); + if ((main->setting.flag & iki_read_main_flag_whole_d) && !(main->setting.flag & iki_read_main_flag_line_d)) { + for (; i < main->cache.buffer.used; ++i) { + if (main->cache.buffer.string[i] == f_string_eol_s.string[0]) ++total; + } // for + } + else { + f_iki_eki_t * const data = (f_iki_eki_t *) main->data; - main->setting.state.status = F_okay; + f_range_t range = macro_f_range_t_initialize_2(main->cache.buffer.used); - return; - } - } - else if (main->setting.state.status == F_data_not) { - fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s); + iki_read_process_line(main, &range); - main->setting.state.status = F_okay; + if (main->setting.state.status == F_true || main->setting.state.status == F_data_not) { + if (main->setting.state.status == F_data_not || range.start > main->cache.buffer.used) { + fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s); - return; - } + main->setting.state.status = F_okay; - fl_iki_eki_read(&main->cache.buffer, &range, data, &main->setting.state); + return; + } + } - if (F_status_is_error(main->setting.state.status)) { - iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_eki_read)); + fl_iki_eki_read(&main->cache.buffer, &range, data, &main->setting.state); - return; - } + if (F_status_is_error(main->setting.state.status)) { + iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_eki_read)); - f_number_unsigned_t i = 0; - f_number_unsigned_t total = 0; + return; + } - for (; i < data->delimits.used; ++i) { - main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0]; - } // for + if (!(main->setting.flag & iki_read_main_flag_name_d)) { + total = (main->setting.flag & iki_read_main_flag_at_d) + ? main->setting.at < data->vocabularys.used ? 1 : 0 + : data->vocabularys.used; + } + else { + for (; i < data->delimits.used; ++i) { + main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0]; + } // for - if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) { - f_string_dynamic_t name = f_string_dynamic_t_initialize; + if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) { + f_string_dynamic_t name = f_string_dynamic_t_initialize; - f_number_unsigned_t index = 0; - f_number_unsigned_t j = 0; + f_number_unsigned_t index = 0; + f_number_unsigned_t j = 0; - range.start = 0; + range.start = 0; - for (i = 0; i < main->program.parameters.array[iki_read_parameter_name_e].values.used; ++i) { + for (i = 0; i < main->program.parameters.array[iki_read_parameter_name_e].values.used; ++i) { - if (iki_read_signal_check(main)) return; + if (iki_read_signal_check(main)) return; - index = main->program.parameters.array[iki_read_parameter_name_e].values.array[i]; - name.used = 0; + index = main->program.parameters.array[iki_read_parameter_name_e].values.array[i]; + name.used = 0; - main->setting.state.status = f_string_dynamic_append_nulless(main->program.parameters.arguments.array[index], &name); + main->setting.state.status = f_string_dynamic_append_nulless(main->program.parameters.arguments.array[index], &name); - if (F_status_is_error(main->setting.state.status)) { - iki_read_print_error(&main->program.error, macro_iki_read_f(f_string_dynamic_append_nulless)); + if (F_status_is_error(main->setting.state.status)) { + iki_read_print_error(&main->program.error, macro_iki_read_f(f_string_dynamic_append_nulless)); - f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); - return; - } + return; + } - range.stop = name.used - 1; + range.stop = name.used - 1; - for (j = 0; j < data->vocabularys.used; ++j) { + for (j = 0; j < data->vocabularys.used; ++j) { - main->setting.state.status = f_compare_dynamic_partial(name, main->cache.buffer, range, data->vocabularys.array[j].array[0]); + main->setting.state.status = f_compare_dynamic_partial(name, main->cache.buffer, range, data->vocabularys.array[j].array[0]); - if (main->setting.state.status == F_equal_to) ++total; - } // for - } // for + if (main->setting.state.status == F_equal_to) ++total; + } // for + } // for - f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); - } - else { - total = data->variable.used; - } + f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); + } + else { + total = data->variable.used; + } - // If the "at" position is within the actual total, then the total at the given position is 1, otherwise is 0. - if (main->program.parameters.array[iki_read_parameter_at_e].result & f_console_result_value_e) { - if (main->setting.at < total) { - total = 1; - } - else { - total = 0; + // If the "at" position is within the actual total, then the total at the given position is 1, otherwise is 0. + if (main->setting.flag & iki_read_main_flag_at_d) { + total = main->setting.at < total ? 1 : 0; + } } } diff --git a/level_3/iki_read/c/iki/process.c b/level_3/iki_read/c/iki/process.c index e4f9eac..d323780 100644 --- a/level_3/iki_read/c/iki/process.c +++ b/level_3/iki_read/c/iki/process.c @@ -177,62 +177,80 @@ extern "C" { } f_number_unsigned_t i = 0; + f_number_unsigned_t j = 0; + f_number_unsigned_t k = 0; + f_number_unsigned_t at = 0; + f_number_unsigned_t stop = data->variable.used; - { - f_number_unsigned_t j = 0; - f_number_unsigned_t k = 0; - f_number_unsigned_t stop = data->variable.used; - - i = range_original.start; - *range_buffer = range_original; + i = range_original.start; + *range_buffer = range_original; - f_file_stream_lock(main->program.output.to); + f_file_stream_lock(main->program.output.to); - while (i <= range_buffer->stop && j < stop) { + while (i <= range_buffer->stop && j < stop) { - if (iki_read_signal_check(main)) return; + if (iki_read_signal_check(main)) return; - if (i < data->variable.array[j].start) { - range_buffer->start = i; - range_buffer->stop = data->variable.array[j].start - 1; + if (i < data->variable.array[j].start) { + range_buffer->start = i; + range_buffer->stop = data->variable.array[j].start - 1; - f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); + f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); - range_buffer->start = data->variable.array[j].stop + 1; - range_buffer->stop = range_original.stop; + range_buffer->start = data->variable.array[j].stop + 1; + range_buffer->stop = range_original.stop; - i = data->variable.array[j].start; - } + i = data->variable.array[j].start; + } - if (main->setting.names.used) { - for (k = 0; k < main->setting.names.used; ++k) { - if (f_compare_dynamic_partial_string(main->setting.names.array[k].string, main->cache.buffer, main->setting.names.array[k].used, data->vocabulary.array[j]) == F_equal_to) break; - } // for + if (main->setting.names.used) { + for (k = 0; k < main->setting.names.used; ++k) { + if (f_compare_dynamic_partial_string(main->setting.names.array[k].string, main->cache.buffer, main->setting.names.array[k].used, data->vocabulary.array[j]) == F_equal_to) break; + } // for - if (k < main->setting.names.used) { - if (main->callback.print_data) { - main->callback.print_data(&main->program.output, j); + if (k < main->setting.names.used) { + if (main->setting.flag & iki_read_main_flag_at_d) { + if (at++ == main->setting.at) { + if (main->callback.print_data) { + main->callback.print_data(&main->program.output, j); + } + } + else { + f_print_dynamic_partial(main->cache.buffer, data->variable.array[j], main->program.output.to); } } + else if (main->callback.print_data) { + main->callback.print_data(&main->program.output, j); + } } - else { + } + else if (main->setting.flag & iki_read_main_flag_at_d) { + if (at++ == main->setting.at) { if (main->callback.print_data) { main->callback.print_data(&main->program.output, j); } } - - i = data->variable.array[j].stop + 1; - ++j; - } // while - - if (i <= range_original.stop) { - range_buffer->start = i; - f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); + else { + f_print_dynamic_partial(main->cache.buffer, data->variable.array[j], main->program.output.to); + } + } + else { + if (main->callback.print_data) { + main->callback.print_data(&main->program.output, j); + } } - f_file_stream_unlock(main->program.output.to); + i = data->variable.array[j].stop + 1; + ++j; + } // while + + if (i <= range_original.stop) { + range_buffer->start = i; + f_print_dynamic_partial(main->cache.buffer, *range_buffer, main->program.output.to); } + f_file_stream_unlock(main->program.output.to); + main->setting.state.status = F_okay; } #endif // _di_iki_read_iki_process_buffer_ranges_whole_ @@ -242,92 +260,94 @@ extern "C" { if (!main || !main->data) return; - f_iki_data_t * const data = (f_iki_data_t *) main->data; - - f_range_t range = macro_f_range_t_initialize_2(main->cache.buffer.used); - - iki_read_process_line(main, &range); + f_number_unsigned_t total = 0; + f_number_unsigned_t i = 0; - if (main->setting.state.status == F_true) { - if (range.start > main->cache.buffer.used) { - fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s); + if ((main->setting.flag & iki_read_main_flag_whole_d) && !(main->setting.flag & iki_read_main_flag_line_d)) { + for (; i < main->cache.buffer.used; ++i) { + if (main->cache.buffer.string[i] == f_string_eol_s.string[0]) ++total; + } // for + } + else { + f_iki_data_t * const data = (f_iki_data_t *) main->data; - main->setting.state.status = F_okay; + f_range_t range = macro_f_range_t_initialize_2(main->cache.buffer.used); - return; - } - } - else if (main->setting.state.status == F_data_not) { - fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s); + iki_read_process_line(main, &range); - main->setting.state.status = F_okay; + if (main->setting.state.status == F_true || main->setting.state.status == F_data_not) { + if (main->setting.state.status == F_data_not || range.start > main->cache.buffer.used) { + fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s); - return; - } + main->setting.state.status = F_okay; - fl_iki_read(&main->cache.buffer, &range, data, &main->setting.state); + return; + } + } - if (F_status_is_error(main->setting.state.status)) { - iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_read)); + fl_iki_read(&main->cache.buffer, &range, data, &main->setting.state); - return; - } + if (F_status_is_error(main->setting.state.status)) { + iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_read)); - f_number_unsigned_t i = 0; - f_number_unsigned_t total = 0; + return; + } - for (; i < data->delimits.used; ++i) { - main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0]; - } // for + if (!(main->setting.flag & iki_read_main_flag_name_d)) { + total = (main->setting.flag & iki_read_main_flag_at_d) + ? main->setting.at < data->vocabulary.used ? 1 : 0 + : data->vocabulary.used; + } + else { + for (; i < data->delimits.used; ++i) { + main->cache.buffer.string[data->delimits.array[i]] = f_iki_syntax_placeholder_s.string[0]; + } // for - if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) { - f_string_dynamic_t name = f_string_dynamic_t_initialize; + if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) { + f_string_dynamic_t name = f_string_dynamic_t_initialize; - f_number_unsigned_t index = 0; - f_number_unsigned_t j = 0; + f_number_unsigned_t index = 0; + f_number_unsigned_t j = 0; - range.start = 0; + range.start = 0; - for (i = 0; i < main->program.parameters.array[iki_read_parameter_name_e].values.used; ++i) { + for (i = 0; i < main->program.parameters.array[iki_read_parameter_name_e].values.used; ++i) { - if (iki_read_signal_check(main)) return; + if (iki_read_signal_check(main)) return; - index = main->program.parameters.array[iki_read_parameter_name_e].values.array[i]; - name.used = 0; + index = main->program.parameters.array[iki_read_parameter_name_e].values.array[i]; + name.used = 0; - main->setting.state.status = f_string_dynamic_append_nulless(main->program.parameters.arguments.array[index], &name); + main->setting.state.status = f_string_dynamic_append_nulless(main->program.parameters.arguments.array[index], &name); - if (F_status_is_error(main->setting.state.status)) { - iki_read_print_error(&main->program.error, macro_iki_read_f(f_string_dynamic_append_nulless)); + if (F_status_is_error(main->setting.state.status)) { + iki_read_print_error(&main->program.error, macro_iki_read_f(f_string_dynamic_append_nulless)); - f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); - return; - } + return; + } - range.stop = name.used - 1; + range.stop = name.used - 1; - for (j = 0; j < data->vocabulary.used; ++j) { + for (j = 0; j < data->vocabulary.used; ++j) { - main->setting.state.status = f_compare_dynamic_partial(name, main->cache.buffer, range, data->vocabulary.array[j]); + main->setting.state.status = f_compare_dynamic_partial(name, main->cache.buffer, range, data->vocabulary.array[j]); - if (main->setting.state.status == F_equal_to) ++total; - } // for - } // for + if (main->setting.state.status == F_equal_to) ++total; + } // for + } // for - f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); - } - else { - total = data->variable.used; - } + f_memory_array_resize(0, sizeof(f_char_t), (void **) &name.string, &name.used, &name.size); + } + else { + total = data->variable.used; + } - // If the "at" position is within the actual total, then the total at the given position is 1, otherwise is 0. - if (main->program.parameters.array[iki_read_parameter_at_e].result & f_console_result_value_e) { - if (main->setting.at < total) { - total = 1; - } - else { - total = 0; + // If the "at" position is within the actual total, then the total at the given position is 1, otherwise is 0. + if (main->setting.flag & iki_read_main_flag_at_d) { + total = main->setting.at < total ? 1 : 0; + } } } diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index 8c01f13..033f074 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -93,14 +93,6 @@ extern "C" { f_number_unsigned_t j = 0; if (parameters->array[iki_read_parameter_at_e].result & f_console_result_value_e) { - if (parameters->array[iki_read_parameter_whole_e].result & f_console_result_found_e) { - main->setting.state.status = F_status_set_error(F_parameter); - - fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s); - - return; - } - index = parameters->array[iki_read_parameter_at_e].values.array[parameters->array[iki_read_parameter_at_e].values.used - 1]; main->setting.at = 0; @@ -401,7 +393,6 @@ extern "C" { const uint8_t ids[3] = { iki_read_parameter_object_e, iki_read_parameter_content_e, - iki_read_parameter_total_e, }; const f_string_static_t names[3] = { @@ -426,15 +417,13 @@ extern "C" { else if (parameters->array[iki_read_parameter_object_e].result & f_console_result_found_e) { const uint8_t ids[2] = { iki_read_parameter_content_e, - iki_read_parameter_total_e, }; const f_string_static_t names[2] = { iki_read_long_content_s, - iki_read_long_total_s, }; - for (uint8_t k = 0; k < 2; ++k) { + for (uint8_t k = 0; k < 1; ++k) { if (parameters->array[ids[k]].result & f_console_result_found_e) { main->setting.state.status = F_status_set_error(F_parameter); @@ -447,28 +436,6 @@ extern "C" { main->setting.flag |= iki_read_main_flag_object_d; } - else if (parameters->array[iki_read_parameter_content_e].result & f_console_result_found_e) { - if (parameters->array[iki_read_parameter_total_e].result & f_console_result_found_e) { - main->setting.state.status = F_status_set_error(F_parameter); - - fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s); - - return; - } - - main->setting.flag |= iki_read_main_flag_content_d; - } - else if (parameters->array[iki_read_parameter_total_e].result & f_console_result_found_e) { - if (parameters->array[iki_read_parameter_whole_e].result & f_console_result_found_e) { - main->setting.state.status = F_status_set_error(F_parameter); - - fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s); - - return; - } - - main->setting.flag |= iki_read_main_flag_total_d; - } else { // This is the default behavior. @@ -478,6 +445,16 @@ extern "C" { if (parameters->array[iki_read_parameter_whole_e].result & f_console_result_found_e) { main->setting.flag |= iki_read_main_flag_whole_d; } + else { + main->setting.flag &= ~iki_read_main_flag_whole_d; + } + + if (parameters->array[iki_read_parameter_total_e].result & f_console_result_found_e) { + main->setting.flag |= iki_read_main_flag_total_d; + } + else { + main->setting.flag &= ~iki_read_main_flag_total_d; + } if (parameters->remaining.used) { main->setting.files.used = 0; diff --git a/level_3/iki_read/c/main/iki_read.c b/level_3/iki_read/c/main/iki_read.c index 8dbaca4..08d81de 100644 --- a/level_3/iki_read/c/main/iki_read.c +++ b/level_3/iki_read/c/main/iki_read.c @@ -13,7 +13,9 @@ extern "C" { if (main->setting.flag & iki_read_main_flag_version_copyright_help_d) { if (main->setting.flag & iki_read_main_flag_help_d) { - iki_read_print_message_help(&main->program.message); + if (main->callback.print_help) { + main->callback.print_help(&main->program.message); + } } else if (main->setting.flag & iki_read_main_flag_version_d) { fll_program_print_version(&main->program.message, iki_read_program_version_s); diff --git a/level_3/iki_read/c/main/print/message.c b/level_3/iki_read/c/main/print/message.c index eb7dc0c..db24c1b 100644 --- a/level_3/iki_read/c/main/print/message.c +++ b/level_3/iki_read/c/main/print/message.c @@ -91,6 +91,19 @@ extern "C" { fl_print_format(" The %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_substitute_s, print->set->notable); fl_print_format(" option takes priority over the %[%r%r%] option when matching the same Variable.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print->set->notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Using both %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_total_s, print->set->notable); + fl_print_format(" and %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_whole_s, print->set->notable); + fl_print_format(" will result in a total representing the number of lines rather than number of Variables.%r", print->to, f_string_eol_s); + + fl_print_format(" Using all three of %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_total_s, print->set->notable); + fl_print_format(", %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_whole_s, print->set->notable); + fl_print_format(", and %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_line_s, print->set->notable); + fl_print_format(" will result in a total number of Variables at the given line in the whole file.%r", print->to, f_string_eol_s); + + fl_print_format(" Using %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_total_s, print->set->notable); + fl_print_format(" with %[%r%r%]", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_name_s, print->set->notable); + fl_print_format(" will result in a total number of Variables matching the Vocabulary name.%r%r", print->to, f_string_eol_s, f_string_eol_s); + fl_print_format(" The default behavior is to only display Content portion of the IKI Variable.%r", print->to, f_string_eol_s); } #endif // _di_iki_read_print_message_help_note_ diff --git a/level_3/iki_read/c/main/process.c b/level_3/iki_read/c/main/process.c index 5332db0..7a222ed 100644 --- a/level_3/iki_read/c/main/process.c +++ b/level_3/iki_read/c/main/process.c @@ -40,18 +40,6 @@ extern "C" { #ifndef _di_iki_read_process_buffer_ void iki_read_process_buffer(iki_read_main_t * const main) { - if (main->setting.flag & iki_read_main_flag_total_d) { - if (main->callback.process_buffer_total) { - main->callback.process_buffer_total(main); - - if (F_status_is_error_not(main->setting.state.status)) { - main->setting.state.status = F_okay; - } - } - - return; - } - f_range_t buffer_range = macro_f_range_t_initialize_2(main->cache.buffer.used); iki_read_process_line(main, &buffer_range); @@ -69,6 +57,18 @@ extern "C" { return; } + if (main->setting.flag & iki_read_main_flag_total_d) { + if (main->callback.process_buffer_total) { + main->callback.process_buffer_total(main); + + if (F_status_is_error_not(main->setting.state.status)) { + main->setting.state.status = F_okay; + } + } + + return; + } + if (main->setting.flag & iki_read_main_flag_whole_d) { if (main->callback.process_buffer_ranges_whole) { main->callback.process_buffer_ranges_whole(main, &buffer_range); -- 1.8.3.1