From b2a3cbcd5bf72c5a7627e68cc6d75a439f0c2991 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 23 Oct 2022 16:22:30 -0500 Subject: [PATCH] Progress: Fix additional problems in iki_read. This is a follow up to bcaeef117bede5037b0404ebf299446dd1be3fcc. The substitute is not completely updated to also process the --literal parameter. Should be using f_console_symbol_long_enable_s instead of f_console_symbol_short_enable_s when printing errors. --- level_3/iki_read/c/common.c | 8 ++++---- level_3/iki_read/c/private-print.c | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/common.c index a2249f5..7234fe2 100644 --- a/level_3/iki_read/c/common.c +++ b/level_3/iki_read/c/common.c @@ -279,7 +279,7 @@ extern "C" { setting->status = F_status_set_error(F_parameter); iki_read_print_line_first_locked(setting, main->error); - fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_short_enable_s, iki_read_long_name_s); + fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_read_long_name_s); iki_read_print_line_last_locked(setting, main->error); return; @@ -290,7 +290,7 @@ extern "C" { setting->status = F_status_set_error(F_parameter); iki_read_print_line_first_locked(setting, main->error); - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_short_enable_s, iki_read_long_replace_s, iki_read_string_two_s); + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_enable_s, iki_read_long_replace_s, iki_read_string_two_s); iki_read_print_line_last_locked(setting, main->error); return; @@ -367,7 +367,7 @@ extern "C" { setting->status = F_status_set_error(F_parameter); iki_read_print_line_first_locked(setting, main->error); - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_short_enable_s, iki_read_long_substitute_s, iki_read_string_three_s); + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_enable_s, iki_read_long_substitute_s, iki_read_string_three_s); iki_read_print_line_last_locked(setting, main->error); return; @@ -456,7 +456,7 @@ extern "C" { setting->status = F_status_set_error(F_parameter); iki_read_print_line_first_locked(setting, main->error); - fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_short_enable_s, iki_read_long_wrap_s, iki_read_string_three_s); + fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_enable_s, iki_read_long_wrap_s, iki_read_string_three_s); iki_read_print_line_last_locked(setting, main->error); return; diff --git a/level_3/iki_read/c/private-print.c b/level_3/iki_read/c/private-print.c index 7fb1dfa..96a95e0 100644 --- a/level_3/iki_read/c/private-print.c +++ b/level_3/iki_read/c/private-print.c @@ -17,15 +17,29 @@ extern "C" { } if (at < setting->substitute.used) { - if (!(setting->flag & iki_read_main_flag_content_e)) { - f_print_dynamic(setting->substitute.array[at].a, main->output.to); + if (setting->flag & iki_read_main_flag_content_e) { + iki_read_print_wrap_prepend(main, setting, index); + + f_print_dynamic(setting->substitute.array[at].c, main->output.to); + + iki_read_print_wrap_append(main, setting, index); } + else { + f_string_range_t range = macro_f_string_range_t_initialize(setting->data.variable.array[index].start, setting->data.content.array[index].start - 1); - iki_read_print_wrap_prepend(main, setting, index); + f_print_dynamic_partial(setting->buffer, range, main->output.to); - f_print_dynamic(setting->substitute.array[at].c, main->output.to); + iki_read_print_wrap_prepend(main, setting, index); - iki_read_print_wrap_append(main, setting, index); + f_print_dynamic(setting->substitute.array[at].c, main->output.to); + + iki_read_print_wrap_append(main, setting, index); + + range.start = setting->data.content.array[index].stop + 1; + range.stop = setting->data.variable.array[index].stop; + + f_print_dynamic_partial(setting->buffer, range, main->output.to); + } } else if (setting->replace.used && setting->map_replaces[index] < setting->replace.used) { if (setting->flag & iki_read_main_flag_content_e) { -- 1.8.3.1