From: Kevin Day Date: Sat, 4 Mar 2023 06:12:11 +0000 (-0600) Subject: Progress: Continue program related work, focusing on X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=a5d1a1542039aaa1c2bfdf99668dc80202b671fa;p=fll Progress: Continue program related work, focusing on The interrupt function behavior changed and the ampersand should not be passed now. This is causing a double reference bug. Explicitly allocate a small amount of memory for console parameters for the default allocation step. Rename fll_program_standard_signal_state() to fll_program_standard_signal_handle(). Update fll_program_standard_signal_handle() to follow the new handle structure. Reduce the first and last line functions and function calls. I've decided to make some more initial assumptions to simplify the code. Always print the first and last line to message. This is a behavioral change. I do not think the first and last line should be printed to error anymore. This change simplifies the logic significantly. Add the first printed check flag. Update print functions. Update file structure. Update file documentation comments. The iki_read and fss_write have more work to do. Once that is done I need to resume working on Featureless Make. --- diff --git a/level_0/f_iki/c/iki/common.h b/level_0/f_iki/c/iki/common.h index 35b62d7..15f4a0a 100644 --- a/level_0/f_iki/c/iki/common.h +++ b/level_0/f_iki/c/iki/common.h @@ -22,12 +22,14 @@ extern "C" { * For a UTF-8 friendly allocation step, set to at least 4. * * F_iki_default_allocation_*: - * - large: The large allocation size. - * - small: The small allocation size, in particular used for allocation iki strings. + * - console: An allocation step used for small buffers specifically for console parameter. + * - large: The large allocation size. + * - small: The small allocation size, in particular used for allocation iki strings. */ #ifndef _di_f_iki_default_d_ - #define F_iki_default_allocation_large_d F_memory_default_allocation_large_d - #define F_iki_default_allocation_small_d 8 + #define F_iki_default_allocation_console_d 8 + #define F_iki_default_allocation_large_d F_memory_default_allocation_large_d + #define F_iki_default_allocation_small_d 8 #endif // _di_f_iki_default_d_ /** diff --git a/level_1/fl_fss/c/fss/basic.c b/level_1/fl_fss/c/fss/basic.c index b5821f9..cdcfd3c 100644 --- a/level_1/fl_fss/c/fss/basic.c +++ b/level_1/fl_fss/c/fss/basic.c @@ -47,7 +47,7 @@ extern "C" { for (;; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -106,7 +106,7 @@ extern "C" { for (; range->start <= range->stop && range->start < content.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 8246829..17d720d 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -56,7 +56,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -82,7 +82,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -101,7 +101,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -177,7 +177,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -341,7 +341,7 @@ extern "C" { while (range->start <= range->stop && range->start < content.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -361,7 +361,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -614,7 +614,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -625,7 +625,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -660,7 +660,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -760,7 +760,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -892,7 +892,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -956,7 +956,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -966,7 +966,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index 5705908..817e8ad 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -82,7 +82,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -139,7 +139,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0])) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -218,7 +218,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -372,7 +372,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -480,7 +480,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -535,7 +535,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -661,7 +661,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -848,7 +848,7 @@ extern "C" { while (range->start <= range->stop && range->start < content.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -870,7 +870,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = destination_used; @@ -1175,7 +1175,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1189,7 +1189,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0])) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1223,7 +1223,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1319,7 +1319,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1385,7 +1385,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1485,7 +1485,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1549,7 +1549,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1559,7 +1559,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = destination_used; diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index 77302ea..f02e7b9 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -53,7 +53,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -75,7 +75,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -96,7 +96,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -142,7 +142,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -285,7 +285,7 @@ extern "C" { while (range->start <= range->stop && range->start < content.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -311,7 +311,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = destination_used; @@ -615,7 +615,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -629,7 +629,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0])) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -663,7 +663,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -758,7 +758,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -824,7 +824,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -925,7 +925,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -989,7 +989,7 @@ extern "C" { while (range->start <= range->stop && range->start < object.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -999,7 +999,7 @@ extern "C" { for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = destination_used; diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 5061d4c..64e9ba1 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -13,7 +13,7 @@ extern "C" { for (; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -40,7 +40,7 @@ extern "C" { for (; destination_range.start < destination->used; ++destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -66,7 +66,7 @@ extern "C" { for (destination_range.start = destination->used - 1; destination_range.start > 0; --destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -147,7 +147,7 @@ extern "C" { while (buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -192,7 +192,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -283,7 +283,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -297,7 +297,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -396,7 +396,7 @@ extern "C" { while (buffer.string[range->start] == f_fss_placeholder_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -421,7 +421,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -545,7 +545,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -574,7 +574,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } @@ -656,7 +656,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -762,7 +762,7 @@ extern "C" { for (; range->start <= range->stop && range->start < object.used; ) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -773,7 +773,7 @@ extern "C" { for (; range->start <= range->stop && range->start < object.used; ++range->start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) break; } @@ -1053,7 +1053,7 @@ extern "C" { for (i = input_start + 1; i <= range->stop && i < object.used; ++i) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = used_start; @@ -1114,7 +1114,7 @@ extern "C" { for (; destination_range.start < destination->used; ++destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = used_start; @@ -1132,7 +1132,7 @@ extern "C" { for (++destination_range.start; destination_range.start < destination->used; ++destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = used_start; @@ -1164,7 +1164,7 @@ extern "C" { for (destination_range.start = destination->used - 1; destination_range.start > front; --destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = used_start; @@ -1185,7 +1185,7 @@ extern "C" { for (; destination_range.start > front; --destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = used_start; @@ -1221,7 +1221,7 @@ extern "C" { for (destination_range.start = front; destination_range.start < rear; ++destination_range.start) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) { destination->used = used_start; diff --git a/level_2/fll_fss/c/fss/payload.c b/level_2/fll_fss/c/fss/payload.c index c74738a..0f11149 100644 --- a/level_2/fll_fss/c/fss/payload.c +++ b/level_2/fll_fss/c/fss/payload.c @@ -242,7 +242,7 @@ extern "C" { for (; i < content.used && i + F_fss_default_block_size_normal_d < content.used; i += F_fss_default_block_size_normal_d) { if (state->interrupt) { - state->interrupt((void *) &state, 0); + state->interrupt((void *) state, 0); if (F_status_set_fine(state->status) == F_interrupt) return; } diff --git a/level_2/fll_program/c/private-program.c b/level_2/fll_program/c/private-program.c index 0744432..df4e53b 100644 --- a/level_2/fll_program/c/private-program.c +++ b/level_2/fll_program/c/private-program.c @@ -15,7 +15,7 @@ extern "C" { } #endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_) -#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_) +#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const main) { if (!main || main->signal.id == -1) return 0; @@ -40,7 +40,7 @@ extern "C" { return 0; } -#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_) +#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) #if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_) void private_fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) { diff --git a/level_2/fll_program/c/private-program.h b/level_2/fll_program/c/private-program.h index b433bfb..3026984 100644 --- a/level_2/fll_program/c/private-program.h +++ b/level_2/fll_program/c/private-program.h @@ -61,11 +61,11 @@ extern "C" { * @see f_signal_read() * * @see fll_program_standard_signal_received() - * @see fll_program_standard_signal_state() + * @see fll_program_standard_signal_handle() */ -#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_) +#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_) +#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_) /** * Private implementation of fll_program_parameter_process_empty(). diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index 856e5cb..f62b0c1 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -541,25 +541,32 @@ extern "C" { } #endif // _di_fll_program_standard_signal_received_ -#ifndef _di_fll_program_standard_signal_state_ - f_status_t fll_program_standard_signal_state(void * const state, void * const internal) { +#ifndef _di_fll_program_standard_signal_handle_ + void fll_program_standard_signal_handle(void * const void_state, void * const internal) { + #ifndef _di_level_2_parameter_checking_ + if (!void_state) return; + #endif // _di_level_2_parameter_checking_ - if (!state) return F_interrupt_not; + f_state_t * const state = (f_state_t *) void_state; - f_state_t *state_ptr = (f_state_t *) state; - if (!state_ptr->custom) return F_interrupt_not; + if (!state->custom) { + state->status = F_interrupt_not; - fll_program_data_t *custom = (fll_program_data_t *) state_ptr->custom; + return; + } - custom->signal_received = private_fll_program_standard_signal_received(custom); + fll_program_data_t * const main = (fll_program_data_t *) state->custom; - if (custom->signal_received == F_signal_abort || custom->signal_received == F_signal_broken_pipe || custom->signal_received == F_signal_hangup || custom->signal_received == F_signal_interrupt || custom->signal_received == F_signal_quit || custom->signal_received == F_signal_termination) { - return F_status_set_error(F_interrupt); - } + main->signal_received = private_fll_program_standard_signal_received(main); - return F_interrupt_not; + if (main->signal_received == F_signal_abort || main->signal_received == F_signal_broken_pipe || main->signal_received == F_signal_hangup || main->signal_received == F_signal_interrupt || main->signal_received == F_signal_quit || main->signal_received == F_signal_termination) { + state->status = F_status_set_error(F_interrupt); + } + else { + state->status = F_interrupt_not; + } } -#endif // _di_fll_program_standard_signal_state_ +#endif // _di_fll_program_standard_signal_handle_ #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index c53f57a..38f6f9b 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -349,19 +349,20 @@ extern "C" { * * When constructing the f_state_t variable, a fll_program_data_t pointer must be passed into the f_state_t.custom variable. * This requires the state.custom variable to be of type (fll_program_data_t *). - * @param internal - * Not used. + * This must not be NULL. * - * @return - * F_interrupt_not if not interrupted. + * This alters state.status: + * F_interrupt_not if not interrupted. * - * F_interrupt (with error bit) if interrupted. + * F_interrupt (with error bit) if interrupted. + * @param internal + * Not used. * * @see fll_program_standard_signal_received() */ -#ifndef _di_fll_program_standard_signal_state_ - extern f_status_t fll_program_standard_signal_state(void * const state, void * const internal); -#endif // _di_fll_program_standard_signal_state_ +#ifndef _di_fll_program_standard_signal_handle_ + extern void fll_program_standard_signal_handle(void * const state, void * const internal); +#endif // _di_fll_program_standard_signal_handle_ #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index 945a2ed..da0f720 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -42,7 +42,7 @@ extern "C" { #ifndef _di_fll_program_print_error_missing_file_ f_status_t fll_program_print_error_missing_file(const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -57,7 +57,7 @@ extern "C" { #ifndef _di_fll_program_print_error_missing_variable_not_zero_ f_status_t fll_program_print_error_missing_variable_not_zero(const fl_print_t print, const f_string_static_t variable) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -76,7 +76,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -95,7 +95,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -116,7 +116,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_cannot_use_with_ f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t name_1, const f_string_static_t name_2) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -135,7 +135,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_cannot_use_with_without_ f_status_t fll_program_print_error_parameter_cannot_use_with_without(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -156,7 +156,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_cannot_use_with_pipe_ f_status_t fll_program_print_error_parameter_cannot_use_with_pipe(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -173,7 +173,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_cannot_use_with_xor_ f_status_t fll_program_print_error_parameter_cannot_use_with_xor(const fl_print_t print, const f_string_static_t symbol_1, const f_string_static_t symbol_2, const f_string_static_t symbol_3, const f_string_static_t name_1, const f_string_static_t name_2, const f_string_static_t name_3) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -194,7 +194,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_integer_not_ f_status_t fll_program_print_error_parameter_integer_not(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -213,7 +213,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_integer_not_negative_ f_status_t fll_program_print_error_parameter_integer_not_negative(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -232,7 +232,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_integer_not_positive_ f_status_t fll_program_print_error_parameter_integer_not_positive(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -251,7 +251,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_missing_value_ f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -268,7 +268,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_missing_value_requires_amount_ f_status_t fll_program_print_error_parameter_missing_value_requires_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t amount) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -287,7 +287,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_must_specify_once_ f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -304,7 +304,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_must_specify_once_value_ f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -323,7 +323,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_process_ f_status_t fll_program_print_error_parameter_process(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -340,7 +340,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value_start, const f_string_static_t value_stop) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -361,7 +361,7 @@ extern "C" { #ifndef _di_fll_program_print_error_parameter_value_too_long_ f_status_t fll_program_print_error_parameter_value_too_long(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -378,7 +378,7 @@ extern "C" { #ifndef _di_fll_program_print_error_pipe_invalid_form_feed_ f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -393,7 +393,7 @@ extern "C" { #ifndef _di_fll_program_print_error_pipe_missing_content_ f_status_t fll_program_print_error_pipe_missing_content(const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); @@ -408,7 +408,7 @@ extern "C" { #ifndef _di_fll_program_print_error_pipe_object_without_content_ f_status_t fll_program_print_error_pipe_object_without_content(const fl_print_t print) { - if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print.to); diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index e0cdc1c..12fe1bc 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -11,7 +11,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = byte_dump_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = byte_dump_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/byte_dump/c/common.c b/level_3/byte_dump/c/common.c index bacafe1..2b5b254 100644 --- a/level_3/byte_dump/c/common.c +++ b/level_3/byte_dump/c/common.c @@ -81,10 +81,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = byte_dump_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = byte_dump_allocation_small_d; + if (F_status_is_error(setting->state.status)) { byte_dump_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/byte_dump/c/common.h b/level_3/byte_dump/c/common.h index 2022ea0..24170e8 100644 --- a/level_3/byte_dump/c/common.h +++ b/level_3/byte_dump/c/common.h @@ -60,6 +60,22 @@ extern "C" { #endif // _di_byte_dump_program_name_s_ /** + * The program defines. + * + * byte_dump_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. + */ +#ifndef _di_byte_dump_d_ + #define byte_dump_allocation_console_d 4 + #define byte_dump_allocation_large_d 256 + #define byte_dump_allocation_small_d 16 + #define byte_dump_signal_check_d 20000 +#endif // _di_byte_dump_d_ + +/** * The program strings for printing. */ #ifndef _di_byte_dump_print_s_ diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index 60fdcee..b945668 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -184,10 +184,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = control_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = control_write_allocation_small_d; + if (F_status_is_error(setting->state.status)) { control_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/control/c/common.h b/level_3/control/c/common.h index 4bd5d64..7656bdb 100644 --- a/level_3/control/c/common.h +++ b/level_3/control/c/common.h @@ -60,6 +60,22 @@ extern "C" { #endif // _di_control_program_name_s_ /** + * The program defines. + * + * control_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. + */ +#ifndef _di_control_d_ + #define control_allocation_console_d 4 + #define control_allocation_large_d 256 + #define control_allocation_small_d 16 + #define control_signal_check_d 20000 +#endif // _di_control_d_ + +/** * The main program parameters. */ #ifndef _di_control_parameter_d_ diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index 2f30e3a..24acb06 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = control_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = control_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 89a83f1..4cb5bce 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -167,7 +167,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - const f_state_t state = macro_f_state_t_initialize(control_allocation_large_d, control_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + const f_state_t state = macro_f_state_t_initialize_1(control_allocation_large_d, control_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_static_t contents_array[main->parameters.remaining.used]; f_string_statics_t contents = macro_f_string_statics_t_initialize(contents_array, 0, main->parameters.remaining.used); @@ -318,7 +318,7 @@ extern "C" { } { - f_state_t state = macro_f_state_t_initialize(control_allocation_large_d, control_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + f_state_t state = macro_f_state_t_initialize_1(control_allocation_large_d, control_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_range_t range_packet = macro_f_string_range_t_initialize2(data->cache.large.used); status = fll_fss_basic_list_read(data->cache.large, state, &range_packet, &data->cache.packet_objects, &data->cache.packet_contents, &data->cache.delimits, 0, 0); diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index 3553ee1..865c2c0 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -616,10 +616,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = controller_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = controller_allocation_small_d; + if (F_status_is_error(setting->state.status)) { controller_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/controller/c/common.h b/level_3/controller/c/common.h index 86df47a..79dc8fd 100644 --- a/level_3/controller/c/common.h +++ b/level_3/controller/c/common.h @@ -46,6 +46,22 @@ extern "C" { #endif // _di_controller_program_version_s_ /** + * The program defines. + * + * controller_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. + */ +#ifndef _di_controller_d_ + #define controller_allocation_console_d 4 + #define controller_allocation_large_d 256 + #define controller_allocation_small_d 16 + #define controller_signal_check_d 20000 +#endif // _di_controller_d_ + +/** * The main program parameters. */ #ifndef _di_controller_parameter_d_ diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index cf3db5e..2858a83 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -17,7 +17,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = controller_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = controller_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 8fb55c9..47be22d 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -95,7 +95,7 @@ extern "C" { { controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_entry, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_string_range_t range = content_range; status = fll_fss_extended_read(cache->buffer_file, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); @@ -1577,7 +1577,7 @@ extern "C" { if (F_status_is_error_not(status)) { if (cache->buffer_file.used) { controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_entry, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_file.used); status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments); @@ -1876,7 +1876,7 @@ extern "C" { { controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_entry, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_string_range_t range = content_range; status = fll_fss_extended_read(cache->buffer_file, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 0194fd3..04481f5 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -222,7 +222,7 @@ extern "C" { f_status_t status = F_none; controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_array_length_t i = 0; @@ -2360,7 +2360,7 @@ extern "C" { f_status_t status = F_none; controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_item.used); f_array_length_t last = 0; @@ -3785,7 +3785,7 @@ extern "C" { if (cache->buffer_file.used) { controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_file.used); status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments); @@ -3951,7 +3951,7 @@ extern "C" { f_string_range_t range2 = f_string_range_t_initialize; controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread); - f_state_t state = macro_f_state_t_initialize(controller_common_allocation_large_d, controller_common_allocation_small_d, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); + f_state_t state = macro_f_state_t_initialize_1(controller_common_allocation_large_d, controller_common_allocation_small_d, F_none, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0); status = fll_fss_extended_read(cache->buffer_item, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); diff --git a/level_3/fake/c/main/build/load.c b/level_3/fake/c/main/build/load.c index e16da25..0a72664 100644 --- a/level_3/fake/c/main/build/load.c +++ b/level_3/fake/c/main/build/load.c @@ -146,7 +146,7 @@ extern "C" { if (F_status_is_error_not(*status)) { f_string_range_t range = macro_f_string_range_t_initialize2(buffer.used); f_fss_delimits_t delimits = f_fss_delimits_t_initialize; - f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0); + f_state_t state = macro_f_state_t_initialize_1(fake_common_allocation_large_d, fake_common_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data->main, 0); *status = fll_fss_extended_read(buffer, state, &range, &objects, &contents, 0, 0, &delimits, 0); diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index bb9a99f..82b77fd 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -42,7 +42,7 @@ extern "C" { data.main = main; data.setting = setting; - f_console_parameter_process(arguments, &main->parameters, &setting->state, (void *) &data); + f_console_parameter_process(arguments, &main->parameters, &setting->state.status, (void *) &data); } if (F_status_is_error(setting->state.status)) { diff --git a/level_3/fake/c/main/common/define.h b/level_3/fake/c/main/common/define.h index f308b45..e27f346 100644 --- a/level_3/fake/c/main/common/define.h +++ b/level_3/fake/c/main/common/define.h @@ -16,21 +16,23 @@ extern "C" { #endif -/*** - * Default allocations. - * - * Set to at least 4 to provide a UTF-8 friendly allocation step. +/** + * The program defines. * - * fake_default_allocation_*_d: - * - large: A buffer size used for large allocations. - * - pipe: A buffer size used for processing piped data. - * - small: A buffer size used for small allocations. + * fake_*_d: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_pipe: A buffer size used for processing piped data. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ -#ifndef _di_fake_default_d_ - #define fake_default_allocation_large_d 64 - #define fake_default_allocation_pipe_d 16384 - #define fake_default_allocation_small_d 8 -#endif // _di_fake_default_d_ +#ifndef _di_fake_d_ + #define fake_allocation_console_d 4 + #define fake_allocation_large_d 256 + #define fake_allocation_pipe_d 16384 + #define fake_allocation_small_d 16 + #define fake_signal_check_d 20000 +#endif // _di_fake_d_ /** * The program defines. diff --git a/level_3/fake/c/main/main.c b/level_3/fake/c/main/main.c index 358c1bd..9525042 100644 --- a/level_3/fake/c/main/main.c +++ b/level_3/fake/c/main/main.c @@ -40,5 +40,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { exit(data.child); } - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fake/c/main/make/load_fakefile.c b/level_3/fake/c/main/make/load_fakefile.c index 61d5e4a..e60b380 100644 --- a/level_3/fake/c/main/make/load_fakefile.c +++ b/level_3/fake/c/main/make/load_fakefile.c @@ -54,7 +54,7 @@ extern "C" { { f_string_range_t range = macro_f_string_range_t_initialize2(data_make->buffer.used); f_fss_comments_t comments = f_fss_comments_t_initialize; - f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->main, 0); + f_state_t state = macro_f_state_t_initialize_1(fake_common_allocation_large_d, fake_common_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data_make->main, 0); *status = fll_fss_basic_list_read(data_make->buffer, state, &range, &list_objects, &list_contents, &delimits, 0, &comments); @@ -87,7 +87,7 @@ extern "C" { bool missing_settings = F_true; f_fss_set_t settings = f_fss_set_t_initialize; - f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->main, 0); + f_state_t state = macro_f_state_t_initialize_1(fake_common_allocation_large_d, fake_common_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data_make->main, 0); if (list_objects.used > data_make->fakefile.size) { macro_f_fss_nameds_t_resize((*status), data_make->fakefile, list_objects.used); diff --git a/level_3/fake/c/main/make/operate.c b/level_3/fake/c/main/make/operate.c index b310f11..25b78e4 100644 --- a/level_3/fake/c/main/make/operate.c +++ b/level_3/fake/c/main/make/operate.c @@ -231,7 +231,7 @@ extern "C" { f_iki_data_t *iki_data = &data_make->cache_iki; - f_state_t state = macro_f_state_t_initialize(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data_make->main, 0); + f_state_t state = macro_f_state_t_initialize_1(fake_common_allocation_large_d, fake_common_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data_make->main, 0); f_string_range_t range = f_string_range_t_initialize; f_string_map_multis_t *parameter = &data_make->setting_make.parameter; diff --git a/level_3/fake/c/main/print-error.h b/level_3/fake/c/main/print-error.h index fdd22e8..e12966b 100644 --- a/level_3/fake/c/main/print-error.h +++ b/level_3/fake/c/main/print-error.h @@ -78,7 +78,7 @@ extern "C" { * Designates the how and where to print. * @param status * The status to use. - * This is provided, ignoring data.setting->status, for thread-safety reasons. + * This is provided, ignoring setting->state.status, for thread-safety reasons. * @param function * The name of the function where the error happened. * @param operation diff --git a/level_3/fake/c/main/print.c b/level_3/fake/c/main/print.c index f0d10b1..54ebd14 100644 --- a/level_3/fake/c/main/print.c +++ b/level_3/fake/c/main/print.c @@ -141,7 +141,7 @@ extern "C" { #ifndef _di_fake_print_help_ f_status_t fake_print_help(fake_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); f_file_stream_lock(print.to); @@ -230,7 +230,7 @@ extern "C" { #ifndef _di_fake_print_line_first_locked_ f_status_t fake_print_line_first_locked(fake_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); if (setting->flag & fake_main_flag_print_first_e) { fll_print_dynamic_raw(setting->line_first, print.to); @@ -248,7 +248,7 @@ extern "C" { #ifndef _di_fake_print_line_first_unlocked_ f_status_t fake_print_line_first_unlocked(fake_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); if (setting->flag & fake_main_flag_print_first_e) { fll_print_dynamic_raw(setting->line_first, print.to); @@ -266,7 +266,7 @@ extern "C" { #ifndef _di_fake_print_line_last_locked_ f_status_t fake_print_line_last_locked(fake_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); fll_print_dynamic_raw(setting->line_last, print.to); @@ -277,7 +277,7 @@ extern "C" { #ifndef _di_fake_print_line_last_unlocked_ f_status_t fake_print_line_last_unlocked(fake_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); f_print_dynamic_raw(setting->line_last, print.to); diff --git a/level_3/fake/c/main/print.h b/level_3/fake/c/main/print.h index c82cb5d..fcaa42c 100644 --- a/level_3/fake/c/main/print.h +++ b/level_3/fake/c/main/print.h @@ -307,6 +307,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_help_ extern f_status_t fake_print_help(fake_setting_t * const setting, const fl_print_t print); @@ -353,6 +355,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_line_first_locked_ extern f_status_t fake_print_line_first_locked(fake_setting_t * const setting, const fl_print_t print); @@ -377,6 +381,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_line_first_unlocked_ extern f_status_t fake_print_line_first_unlocked(fake_setting_t * const setting, const fl_print_t print); @@ -399,6 +405,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_line_last_locked_ extern f_status_t fake_print_line_last_locked(fake_setting_t * const setting, const fl_print_t print); @@ -421,6 +429,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_line_last_unlocked_ extern f_status_t fake_print_line_last_unlocked(fake_setting_t * const setting, const fl_print_t print); @@ -439,6 +449,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_operation_all_complete_ extern f_status_t fake_print_operation_all_complete(fake_setting_t * const setting, const fl_print_t print); @@ -459,6 +471,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fake_print_operation_cancelled_ extern f_status_t fake_print_operation_cancelled(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation); diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h index e7e351b..0f01382 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -99,17 +99,19 @@ extern "C" { #endif // _di_firewall_path_s_ /** - * Default allocations. - */ -#ifndef _di_firewall_default_d_ - #define firewall_default_allocation_step_d F_memory_default_allocation_small_d -#endif // _di_firewall_default_d_ - -/** * The program defines. + * + * firewall_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_firewall_d_ - #define firewall_signal_check_d 20000 + #define firewall_allocation_console_d 4 + #define firewall_allocation_large_d 256 + #define firewall_allocation_small_d 16 + #define firewall_signal_check_d 20000 #endif // _di_firewall_d_ /** diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 916da21..7539695 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -17,9 +17,12 @@ extern "C" { f_status_t status = F_none; - main->child = 0; + setting->state.step_small = firewall_allocation_console_d; status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = firewall_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_basic_list_read/c/common.c b/level_3/fss_basic_list_read/c/common.c index fbb4899..c7afffc 100644 --- a/level_3/fss_basic_list_read/c/common.c +++ b/level_3/fss_basic_list_read/c/common.c @@ -75,10 +75,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_basic_list_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_basic_list_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_basic_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_basic_list_read/c/common.h b/level_3/fss_basic_list_read/c/common.h index dfb9ade..72b985a 100644 --- a/level_3/fss_basic_list_read/c/common.h +++ b/level_3/fss_basic_list_read/c/common.h @@ -60,10 +60,19 @@ extern "C" { #endif // _di_fss_basic_list_read_program_name_s_ /** - * The program signal defines. + * The program defines. + * + * fss_basic_list_read_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_fss_basic_list_read_d_ - #define fss_basic_list_read_signal_check_d 20000 + #define fss_basic_list_read_allocation_console_d 4 + #define fss_basic_list_read_allocation_large_d 256 + #define fss_basic_list_read_allocation_small_d 16 + #define fss_basic_list_read_signal_check_d 20000 #endif // _di_fss_basic_list_read_d_ /** diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 901ae71..0e188ee 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_basic_list_read_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_basic_list_read_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_basic_list_read/c/private-read.c b/level_3/fss_basic_list_read/c/private-read.c index 2a0cd42..eda3849 100644 --- a/level_3/fss_basic_list_read/c/private-read.c +++ b/level_3/fss_basic_list_read/c/private-read.c @@ -246,7 +246,7 @@ extern "C" { #ifndef _di_fss_basic_list_read_load_ f_status_t fss_basic_list_read_load(fll_program_data_t * const main, fss_basic_list_read_data_t * const data) { - f_state_t state = macro_f_state_t_initialize(fss_basic_list_read_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + f_state_t state = macro_f_state_t_initialize_1(fss_basic_list_read_common_allocation_large_d, fss_basic_list_read_common_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used); data->delimits_object.used = 0; diff --git a/level_3/fss_basic_read/c/common.c b/level_3/fss_basic_read/c/common.c index aacee28..c59e8f5 100644 --- a/level_3/fss_basic_read/c/common.c +++ b/level_3/fss_basic_read/c/common.c @@ -74,10 +74,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_basic_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_basic_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_basic_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_basic_read/c/common.h b/level_3/fss_basic_read/c/common.h index f74d5ec..e2ce16b 100644 --- a/level_3/fss_basic_read/c/common.h +++ b/level_3/fss_basic_read/c/common.h @@ -61,9 +61,18 @@ extern "C" { /** * The program defines. + * + * fss_basic_read_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_fss_basic_read_d_ - #define fss_basic_read_signal_check_d 20000 + #define fss_basic_read_allocation_console_d 4 + #define fss_basic_read_allocation_large_d 256 + #define fss_basic_read_allocation_small_d 16 + #define fss_basic_read_signal_check_d 20000 #endif // _di_fss_basic_read_d_ /** diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index ce5c222..a29afdc 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_basic_read_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_basic_read_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_basic_read/c/private-read.c b/level_3/fss_basic_read/c/private-read.c index 7768c96..e4f29c7 100644 --- a/level_3/fss_basic_read/c/private-read.c +++ b/level_3/fss_basic_read/c/private-read.c @@ -223,7 +223,7 @@ extern "C" { #ifndef _di_fss_basic_read_load_ f_status_t fss_basic_read_load(fll_program_data_t * const main, fss_basic_read_data_t * const data) { - f_state_t state = macro_f_state_t_initialize(fss_basic_read_common_allocation_large_d, fss_basic_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + f_state_t state = macro_f_state_t_initialize_1(fss_basic_read_common_allocation_large_d, fss_basic_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used); data->delimits.used = 0; diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 0fc4351..77f89e8 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -73,10 +73,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_embedded_list_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_embedded_list_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_embedded_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h index 4784a6e..2a05bf6 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -61,9 +61,18 @@ extern "C" { /** * The program defines. + * + * fss_embedded_list_read_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_fss_embedded_list_read_d_ - #define fss_embedded_list_read_signal_check_d 20000 + #define fss_embedded_list_read_allocation_console_d 4 + #define fss_embedded_list_read_allocation_large_d 256 + #define fss_embedded_list_read_allocation_small_d 16 + #define fss_embedded_list_read_signal_check_d 20000 #endif // _di_fss_embedded_list_read_d_ /** diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index f7015aa..0b4fb0c 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_embedded_list_read_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_embedded_list_read_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_embedded_list_read/c/private-read.c b/level_3/fss_embedded_list_read/c/private-read.c index 17b95a1..922c602 100644 --- a/level_3/fss_embedded_list_read/c/private-read.c +++ b/level_3/fss_embedded_list_read/c/private-read.c @@ -245,7 +245,7 @@ extern "C" { f_status_t status = F_none; { - f_state_t state = macro_f_state_t_initialize(fss_embedded_list_read_common_allocation_large_d, fss_embedded_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0); + f_state_t state = macro_f_state_t_initialize_1(fss_embedded_list_read_common_allocation_large_d, fss_embedded_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_handle, 0, (void *) data->main, 0); f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used); objects_delimits->used = 0; diff --git a/level_3/fss_extended_list_read/c/common.c b/level_3/fss_extended_list_read/c/common.c index 1daf721..d381418 100644 --- a/level_3/fss_extended_list_read/c/common.c +++ b/level_3/fss_extended_list_read/c/common.c @@ -81,10 +81,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_extended_list_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_extended_list_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_extended_list_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_extended_list_read/c/common.h b/level_3/fss_extended_list_read/c/common.h index 2a237d9..92a2a5c 100644 --- a/level_3/fss_extended_list_read/c/common.h +++ b/level_3/fss_extended_list_read/c/common.h @@ -67,9 +67,18 @@ extern "C" { /** * The program defines. + * + * fss_extended_list_read_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_fss_extended_list_read_d_ - #define fss_extended_list_read_signal_check_d 20000 + #define fss_extended_list_read_allocation_console_d 4 + #define fss_extended_list_read_allocation_large_d 256 + #define fss_extended_list_read_allocation_small_d 16 + #define fss_extended_list_read_signal_check_d 20000 #endif // _di_fss_extended_list_read_d_ /** diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 777871f..0360b15 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_extended_list_read_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_extended_list_read_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_extended_list_read/c/private-read.c b/level_3/fss_extended_list_read/c/private-read.c index 8b89c9a..50c7184 100644 --- a/level_3/fss_extended_list_read/c/private-read.c +++ b/level_3/fss_extended_list_read/c/private-read.c @@ -245,7 +245,7 @@ extern "C" { #ifndef _di_fss_extended_list_read_load_ f_status_t fss_extended_list_read_load(fll_program_data_t * const main, fss_extended_list_read_data_t * const data) { - f_state_t state = macro_f_state_t_initialize(fss_extended_list_read_common_allocation_large_d, fss_extended_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + f_state_t state = macro_f_state_t_initialize_1(fss_extended_list_read_common_allocation_large_d, fss_extended_list_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used); data->delimits_object.used = 0; diff --git a/level_3/fss_extended_read/c/common.c b/level_3/fss_extended_read/c/common.c index 82679db..eb9e466 100644 --- a/level_3/fss_extended_read/c/common.c +++ b/level_3/fss_extended_read/c/common.c @@ -74,10 +74,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_extended_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_extended_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_extended_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_extended_read/c/common.h b/level_3/fss_extended_read/c/common.h index 7ed7d35..23becfa 100644 --- a/level_3/fss_extended_read/c/common.h +++ b/level_3/fss_extended_read/c/common.h @@ -61,9 +61,18 @@ extern "C" { /** * The program defines. + * + * fss_extended_read_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_fss_extended_read_d_ - #define fss_extended_read_signal_check_d 20000 + #define fss_extended_read_allocation_console_d 4 + #define fss_extended_read_allocation_large_d 256 + #define fss_extended_read_allocation_small_d 16 + #define fss_extended_read_signal_check_d 20000 #endif // _di_fss_extended_read_d_ /** diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 356e26f..65a4d24 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_extended_read_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_extended_read_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index 0575072..557bf74 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -249,7 +249,7 @@ extern "C" { #ifndef _di_fss_extended_read_load_ f_status_t fss_extended_read_load(fll_program_data_t * const main, fss_extended_read_data_t * const data) { - f_state_t state = macro_f_state_t_initialize(fss_extended_read_common_allocation_large_d, fss_extended_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + f_state_t state = macro_f_state_t_initialize_1(fss_extended_read_common_allocation_large_d, fss_extended_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used); data->delimits_object.used = 0; diff --git a/level_3/fss_identify/c/common.c b/level_3/fss_identify/c/common.c index 6578bb8..b4a66b5 100644 --- a/level_3/fss_identify/c/common.c +++ b/level_3/fss_identify/c/common.c @@ -41,10 +41,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_identify_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_identify_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_identify_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_identify/c/common.h b/level_3/fss_identify/c/common.h index 599739a..b2db552 100644 --- a/level_3/fss_identify/c/common.h +++ b/level_3/fss_identify/c/common.h @@ -61,9 +61,18 @@ extern "C" { /** * The program defines. + * + * fss_identify_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_fss_identify_d_ - #define fss_identify_signal_check_d 20000 + #define fss_identify_allocation_console_d 4 + #define fss_identify_allocation_large_d 256 + #define fss_identify_allocation_small_d 16 + #define fss_identify_signal_check_d 20000 #endif // _di_fss_identify_d_ /** diff --git a/level_3/fss_identify/c/fss_identify.c b/level_3/fss_identify/c/fss_identify.c index 051b14a..c731f7e 100644 --- a/level_3/fss_identify/c/fss_identify.c +++ b/level_3/fss_identify/c/fss_identify.c @@ -11,7 +11,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_identify_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_identify_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_payload_read/c/common.c b/level_3/fss_payload_read/c/common.c index 753d519..1d5af67 100644 --- a/level_3/fss_payload_read/c/common.c +++ b/level_3/fss_payload_read/c/common.c @@ -75,10 +75,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = fss_payload_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_payload_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_payload_read_print_line_first_locked(setting, main->error); fll_error_print(main->error, F_status_set_fine(setting->state.status), "f_console_parameter_process", fll_error_file_flag_fallback_e); diff --git a/level_3/fss_payload_read/c/fss_payload_read.c b/level_3/fss_payload_read/c/fss_payload_read.c index 9fac941..45b3801 100644 --- a/level_3/fss_payload_read/c/fss_payload_read.c +++ b/level_3/fss_payload_read/c/fss_payload_read.c @@ -12,7 +12,12 @@ extern "C" { f_status_t status = F_none; + setting->state.step_small = fss_payload_read_allocation_console_d; + status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + + setting->state.step_small = fss_payload_read_allocation_small_d; + if (F_status_is_error(status)) return; { diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index 401289b..8b7b4d3 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -239,7 +239,7 @@ extern "C" { #ifndef _di_fss_payload_read_load_ f_status_t fss_payload_read_load(fll_program_data_t * const main, fss_payload_read_data_t * const data) { - f_state_t state = macro_f_state_t_initialize(fss_payload_read_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); + f_state_t state = macro_f_state_t_initialize_1(fss_payload_read_common_allocation_large_d, fss_payload_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_handle, 0, (void *) main, 0); f_string_range_t input = macro_f_string_range_t_initialize2(data->buffer.used); data->delimits_object.used = 0; diff --git a/level_3/fss_write/c/basic/fss_write.c b/level_3/fss_write/c/basic/fss_write.c index e60e627..3502557 100644 --- a/level_3/fss_write/c/basic/fss_write.c +++ b/level_3/fss_write/c/basic/fss_write.c @@ -12,21 +12,24 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_first(setting, main->message); + } + if (setting->content) { - setting->state.status = fl_fss_basic_content_write( + fl_fss_basic_content_write( *setting->content, - (setting->flag & fss_write_flag_partial_e) + (setting->flag & fss_write_main_flag_partial_e) ? f_fss_complete_partial_e : f_fss_complete_full_e, &setting->range, &setting->buffer, - setting->state + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -39,8 +42,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_content_end_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_object_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_content_end_e) { setting->state.status = f_string_dynamic_append(f_fss_basic_close_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { @@ -48,6 +51,10 @@ extern "C" { } } } + + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_last(setting, main->message); + } } #endif // _di_fss_write_basic_process_content_ @@ -68,27 +75,26 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); if (setting->object) { - setting->state.status = fl_fss_basic_object_write( + fl_fss_basic_object_write( *setting->object, setting->quote.used ? setting->quote.string[0] : f_fss_quote_double_s.string[0], - (setting->flag & fss_write_flag_partial_e) - ? (setting->flag & fss_write_flag_trim_e) + (setting->flag & fss_write_main_flag_partial_e) + ? (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_trim_e : f_fss_complete_none_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -101,8 +107,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_object_open_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_content_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_object_open_e) { setting->state.status = f_string_dynamic_append(f_fss_basic_open_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index 362b7d5..1dbaaac 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -5,7 +5,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_basic_standard_s; setting.process_content = &fss_write_basic_process_content; setting.process_help = &fss_write_basic_process_help; @@ -40,5 +40,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fss_write/c/basic/print.c b/level_3/fss_write/c/basic/print.c index aea1076..e7dd562 100644 --- a/level_3/fss_write/c/basic/print.c +++ b/level_3/fss_write/c/basic/print.c @@ -7,6 +7,8 @@ extern "C" { #ifndef _di_fss_write_basic_print_help_ f_status_t fss_write_basic_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/basic/print.h b/level_3/fss_write/c/basic/print.h index cd80df2..611e19d 100644 --- a/level_3/fss_write/c/basic/print.h +++ b/level_3/fss_write/c/basic/print.h @@ -25,6 +25,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fss_write_basic_print_help_ extern f_status_t fss_write_basic_print_help(fss_write_setting_t * const setting, const fl_print_t print); diff --git a/level_3/fss_write/c/basic_list/fss_write.c b/level_3/fss_write/c/basic_list/fss_write.c index 44fb415..976ce18 100644 --- a/level_3/fss_write/c/basic_list/fss_write.c +++ b/level_3/fss_write/c/basic_list/fss_write.c @@ -12,24 +12,27 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_first(setting, main->message); + } + if (setting->content) { - setting->state.status = fl_fss_basic_list_content_write( + fl_fss_basic_list_content_write( *setting->content, - (setting->flag & fss_write_flag_partial_e) + (setting->flag & fss_write_main_flag_partial_e) ? f_fss_complete_partial_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, &setting->prepend, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -42,8 +45,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_content_end_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_object_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_content_end_e) { setting->state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { @@ -51,6 +54,10 @@ extern "C" { } } } + + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_last(setting, main->message); + } } #endif // _di_fss_write_basic_list_process_content_ @@ -71,24 +78,23 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); if (setting->object) { - setting->state.status = fl_fss_basic_list_object_write( + fl_fss_basic_list_object_write( *setting->object, - (setting->flag & fss_write_flag_partial_e) - ? (setting->flag & fss_write_flag_trim_e) + (setting->flag & fss_write_main_flag_partial_e) + ? (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_trim_e : f_fss_complete_none_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -101,8 +107,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_object_open_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_content_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_object_open_e) { setting->state.status = f_string_dynamic_append(f_fss_basic_list_open_s, &setting->buffer); if (F_status_is_error_not(setting->state.status)) { diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index 9b44e60..dea594b 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -5,7 +5,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_basic_list_standard_s; setting.process_content = &fss_write_basic_list_process_content; setting.process_help = &fss_write_basic_list_process_help; @@ -29,7 +29,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fss_write_setting_load(arguments, state, &data, &setting, 0); + fss_write_setting_load(arguments, &data, &setting, 0); } fss_write_main(&data, &setting); @@ -40,5 +40,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fss_write/c/basic_list/print.c b/level_3/fss_write/c/basic_list/print.c index 3baec35..c77d009 100644 --- a/level_3/fss_write/c/basic_list/print.c +++ b/level_3/fss_write/c/basic_list/print.c @@ -7,6 +7,8 @@ extern "C" { #ifndef _di_fss_write_basic_list_print_help_ f_status_t fss_write_basic_list_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/basic_list/print.h b/level_3/fss_write/c/basic_list/print.h index 7d7c5d3..30538c1 100644 --- a/level_3/fss_write/c/basic_list/print.h +++ b/level_3/fss_write/c/basic_list/print.h @@ -25,6 +25,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fss_write_basic_list_print_help_ extern f_status_t fss_write_basic_list_print_help(fss_write_setting_t * const setting, const fl_print_t print); diff --git a/level_3/fss_write/c/embedded_list/fss_write.c b/level_3/fss_write/c/embedded_list/fss_write.c index 81dc2ba..1d884fc 100644 --- a/level_3/fss_write/c/embedded_list/fss_write.c +++ b/level_3/fss_write/c/embedded_list/fss_write.c @@ -12,25 +12,28 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_first(setting, main->message); + } + if (setting->content) { - setting->state.status = fl_fss_embedded_list_content_write( + fl_fss_embedded_list_content_write( *setting->content, - (setting->flag & fss_write_flag_partial_e) + (setting->flag & fss_write_main_flag_partial_e) ? f_fss_complete_partial_e : last ? f_fss_complete_end_e : f_fss_complete_next_e, &setting->prepend, setting->ignores, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -43,8 +46,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_content_end_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_object_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_content_end_e) { setting->state.status = f_string_dynamic_append(f_fss_embedded_list_close_s, &setting->buffer); if (F_status_is_error_not(setting->state.status)) { @@ -56,6 +59,10 @@ extern "C" { } } } + + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_last(setting, main->message); + } } #endif // _di_fss_write_embedded_list_process_content_ @@ -76,24 +83,23 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); if (setting->object) { - setting->state.status = fl_fss_embedded_list_object_write( + fl_fss_embedded_list_object_write( *setting->object, - (setting->flag & fss_write_flag_partial_e) - ? (setting->flag & fss_write_flag_trim_e) + (setting->flag & fss_write_main_flag_partial_e) + ? (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_trim_e : f_fss_complete_none_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -106,8 +112,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_object_open_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_content_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_object_open_e) { setting->state.status = f_string_dynamic_append(f_fss_embedded_list_open_s, &setting->buffer); if (F_status_is_error_not(setting->state.status)) { diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index 7e5733b..04181a6 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -5,7 +5,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_embedded_list_standard_s; setting.process_content = &fss_write_embedded_list_process_content; setting.process_help = &fss_write_embedded_list_process_help; @@ -13,8 +13,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting.process_object = &fss_write_embedded_list_process_object; setting.process_pipe = &fss_write_process_pipe; setting.process_set = &fss_write_process_set; - setting.flag |= fss_write_flag_ignore_e; - setting.flag |= fss_write_flag_content_multiple_e; + setting.flag |= fss_write_main_flag_ignore_e; + setting.flag |= fss_write_main_flag_content_multiple_e; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -31,7 +31,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fss_write_setting_load(arguments, state, &data, &setting, 0); + fss_write_setting_load(arguments, &data, &setting, 0); } fss_write_main(&data, &setting); @@ -42,5 +42,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fss_write/c/embedded_list/print.c b/level_3/fss_write/c/embedded_list/print.c index 752add9..c5c3a27 100644 --- a/level_3/fss_write/c/embedded_list/print.c +++ b/level_3/fss_write/c/embedded_list/print.c @@ -7,6 +7,8 @@ extern "C" { #ifndef _di_fss_write_embedded_list_print_help_ f_status_t fss_write_embedded_list_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/embedded_list/print.h b/level_3/fss_write/c/embedded_list/print.h index 955e24e..292849d 100644 --- a/level_3/fss_write/c/embedded_list/print.h +++ b/level_3/fss_write/c/embedded_list/print.h @@ -25,6 +25,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fss_write_embedded_list_print_help_ extern f_status_t fss_write_embedded_list_print_help(fss_write_setting_t * const setting, const fl_print_t print); diff --git a/level_3/fss_write/c/extended/fss_write.c b/level_3/fss_write/c/extended/fss_write.c index 3ef64f7..bef2e2d 100644 --- a/level_3/fss_write/c/extended/fss_write.c +++ b/level_3/fss_write/c/extended/fss_write.c @@ -12,26 +12,29 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_first(setting, main->message); + } + if (setting->content) { - setting->state.status = fl_fss_extended_content_write( + fl_fss_extended_content_write( *setting->content, setting->quote.used ? setting->quote.string[0] : f_fss_quote_double_s.string[0], - (setting->flag & fss_write_flag_partial_e) + (setting->flag & fss_write_main_flag_partial_e) ? f_fss_complete_partial_e : last ? f_fss_complete_end_e : f_fss_complete_next_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -44,15 +47,15 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_content_end_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_object_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_content_end_e) { setting->state.status = f_string_dynamic_append(f_fss_extended_close_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append)); } } - else if (setting->flag & fss_write_flag_content_next_e) { + else if (setting->flag & fss_write_main_flag_content_next_e) { setting->state.status = f_string_dynamic_append(f_fss_extended_next_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { @@ -60,6 +63,10 @@ extern "C" { } } } + + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_last(setting, main->message); + } } #endif // _di_fss_write_extended_process_content_ @@ -80,27 +87,26 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); if (setting->object) { - setting->state.status = fl_fss_extended_object_write( + fl_fss_extended_object_write( *setting->object, setting->quote.used ? setting->quote.string[0] : f_fss_quote_double_s.string[0], - (setting->flag & fss_write_flag_partial_e) - ? (setting->flag & fss_write_flag_trim_e) + (setting->flag & fss_write_main_flag_partial_e) + ? (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_trim_e : f_fss_complete_none_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -113,8 +119,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_object_open_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_content_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_object_open_e) { setting->state.status = f_string_dynamic_append(f_fss_extended_open_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { fss_write_print_error(setting, main->error, macro_fss_write_f(f_string_dynamic_append)); diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index 34ded57..22080f3 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -5,7 +5,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_extended_standard_s; setting.process_content = &fss_write_extended_process_content; setting.process_help = &fss_write_extended_process_help; @@ -13,7 +13,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting.process_object = &fss_write_extended_process_object; setting.process_pipe = &fss_write_process_pipe; setting.process_set = &fss_write_process_set; - setting.flag |= fss_write_flag_content_multiple_e; + setting.flag |= fss_write_main_flag_content_multiple_e; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -30,7 +30,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fss_write_setting_load(arguments, state, &data, &setting, 0); + fss_write_setting_load(arguments, &data, &setting, 0); } fss_write_main(&data, &setting); @@ -41,5 +41,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fss_write/c/extended/print.c b/level_3/fss_write/c/extended/print.c index c202009..b16339e 100644 --- a/level_3/fss_write/c/extended/print.c +++ b/level_3/fss_write/c/extended/print.c @@ -7,6 +7,8 @@ extern "C" { #ifndef _di_fss_write_extended_print_help_ f_status_t fss_write_extended_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/extended/print.h b/level_3/fss_write/c/extended/print.h index 5af54d9..195d03c 100644 --- a/level_3/fss_write/c/extended/print.h +++ b/level_3/fss_write/c/extended/print.h @@ -25,6 +25,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fss_write_extended_print_help_ extern f_status_t fss_write_extended_print_help(fss_write_setting_t * const setting, const fl_print_t print); diff --git a/level_3/fss_write/c/extended_list/fss_write.c b/level_3/fss_write/c/extended_list/fss_write.c index 983f42a..6171036 100644 --- a/level_3/fss_write/c/extended_list/fss_write.c +++ b/level_3/fss_write/c/extended_list/fss_write.c @@ -12,25 +12,28 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_first(setting, main->message); + } + if (setting->content) { - setting->state.status = fl_fss_extended_list_content_write( + fl_fss_extended_list_content_write( *setting->content, - (setting->flag & fss_write_flag_partial_e) + (setting->flag & fss_write_main_flag_partial_e) ? last ? f_fss_complete_none_e : f_fss_complete_partial_e : f_fss_complete_full_e, &setting->prepend, setting->ignores, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -43,8 +46,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_content_end_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_object_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_content_end_e) { setting->state.status = f_string_dynamic_append(f_fss_extended_list_close_s, &setting->buffer); if (F_status_is_error_not(setting->state.status)) { @@ -56,6 +59,10 @@ extern "C" { } } } + + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_last(setting, main->message); + } } #endif // _di_fss_write_extended_list_process_content_ @@ -76,38 +83,37 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); if (setting->object) { - setting->state.status = fl_fss_extended_list_object_write( + fl_fss_extended_list_object_write( *setting->object, - (setting->flag & fss_write_flag_partial_e) - ? (setting->flag & fss_write_flag_trim_e) + (setting->flag & fss_write_main_flag_partial_e) + ? (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_trim_e : f_fss_complete_none_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); - if (F_status_set_fine(macro_fss_write_setting(setting)->status) == F_none_eol) { - macro_fss_write_setting(setting)->status = F_status_set_error(F_support_not); + if (F_status_set_fine(macro_fss_write_setting(setting)->state.status) == F_none_eol) { + macro_fss_write_setting(setting)->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(macro_fss_write_setting(setting), main->error); fss_write_print_error_unsupported_eol(macro_fss_write_setting(setting), main->error); return; } - if (F_status_is_error(macro_fss_write_setting(setting)->status)) { + if (F_status_is_error(macro_fss_write_setting(setting)->state.status)) { fss_write_print_error(macro_fss_write_setting(setting), main->error, macro_fss_write_f(fl_fss_extended_list_object_write)); return; } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_object_open_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_content_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_object_open_e) { setting->state.status = f_string_dynamic_append(f_fss_extended_list_open_s, &setting->buffer); if (F_status_is_error_not(setting->state.status)) { diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index a88557d..a268d12 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -5,7 +5,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_extended_list_standard_s; setting.process_content = &fss_write_extended_list_process_content; setting.process_help = &fss_write_extended_list_process_help; @@ -13,7 +13,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting.process_object = &fss_write_extended_list_process_object; setting.process_pipe = &fss_write_process_pipe; setting.process_set = &fss_write_process_set; - setting.flag |= fss_write_flag_ignore_e; + setting.flag |= fss_write_main_flag_ignore_e; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -30,7 +30,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fss_write_setting_load(arguments, state, &data, &setting, 0); + fss_write_setting_load(arguments, &data, &setting, 0); } fss_write_main(&data, &setting); @@ -41,5 +41,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fss_write/c/extended_list/print.c b/level_3/fss_write/c/extended_list/print.c index 3a6d26a..be6b9f1 100644 --- a/level_3/fss_write/c/extended_list/print.c +++ b/level_3/fss_write/c/extended_list/print.c @@ -7,6 +7,8 @@ extern "C" { #ifndef _di_fss_write_extended_list_print_help_ f_status_t fss_write_extended_list_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/extended_list/print.h b/level_3/fss_write/c/extended_list/print.h index 824636f..009c449 100644 --- a/level_3/fss_write/c/extended_list/print.h +++ b/level_3/fss_write/c/extended_list/print.h @@ -25,6 +25,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fss_write_extended_list_print_help_ extern f_status_t fss_write_extended_list_print_help(fss_write_setting_t * const setting, const fl_print_t print); diff --git a/level_3/fss_write/c/main/common-type.h b/level_3/fss_write/c/main/common-type.h index 64f6cc5..db77ecf 100644 --- a/level_3/fss_write/c/main/common-type.h +++ b/level_3/fss_write/c/main/common-type.h @@ -19,14 +19,18 @@ extern "C" { /** * The program default defines. * - * fss_write_default_allocation_*: - * - large: An allocation step used for buffers that are anticipated to have large buffers. - * - small: An allocation step used for buffers that are anticipated to have small buffers. + * fss_write_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ -#ifndef _di_fss_write_default_d_ - #define fss_write_default_allocation_large_d 2048 - #define fss_write_default_allocation_small_d 128 -#endif // _di_fss_write_default_d_ +#ifndef _di_fss_write_d_ + #define fss_write_allocation_console_d 4 + #define fss_write_allocation_large_d 2048 + #define fss_write_allocation_small_d 128 + #define iki_write_signal_check_d 20000 +#endif // _di_fss_write_d_ /** * The program defines. @@ -45,7 +49,7 @@ extern "C" { /** * Flags passed to the main function or program. * - * fss_write_flag_*_e: + * fss_write_main_flag_*_e: * - none: No flags set. * - content: The Content being written is specified. * - content_end: The Content end characters are to be printed. @@ -58,29 +62,30 @@ extern "C" { * - object: The Object being written is specified. * - object_open: The Object open characters are to be printed. * - partial: Do not write end of Object/Content character. - * - prepend: Prepend the given white space characters to the start of each multi-line Content. + * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). * - trim: Trim Object names. * - version: Print version. */ -#ifndef _di_fss_write_flag_e_ +#ifndef _di_fss_write_main_flag_e_ enum { - fss_write_flag_none_e = 0x0, - fss_write_flag_content_e = 0x1, - fss_write_flag_content_end_e = 0x2, - fss_write_flag_content_multiple_e = 0x4, - fss_write_flag_content_next_e = 0x8, - fss_write_flag_copyright_e = 0x10, - fss_write_flag_file_to_e = 0x20, - fss_write_flag_help_e = 0x40, - fss_write_flag_ignore_e = 0x80, - fss_write_flag_object_e = 0x100, - fss_write_flag_object_open_e = 0x200, - fss_write_flag_partial_e = 0x400, - fss_write_flag_prepend_e = 0x800, - fss_write_flag_trim_e = 0x1000, - fss_write_flag_version_e = 0x2000, + fss_write_main_flag_none_e = 0x0, + fss_write_main_flag_content_e = 0x1, + fss_write_main_flag_content_end_e = 0x2, + fss_write_main_flag_content_multiple_e = 0x4, + fss_write_main_flag_content_next_e = 0x8, + fss_write_main_flag_copyright_e = 0x10, + fss_write_main_flag_file_to_e = 0x20, + fss_write_main_flag_help_e = 0x40, + fss_write_main_flag_ignore_e = 0x80, + fss_write_main_flag_object_e = 0x100, + fss_write_main_flag_object_open_e = 0x200, + fss_write_main_flag_partial_e = 0x400, + fss_write_main_flag_prepend_e = 0x800, + fss_write_main_flag_print_first_e = 0x1000, + fss_write_main_flag_trim_e = 0x2000, + fss_write_main_flag_version_e = 0x4000, }; // enum -#endif // _di_fss_write_flag_e_ +#endif // _di_fss_write_main_flag_e_ /** * The main program parameters. @@ -226,8 +231,8 @@ extern "C" { #define fss_write_setting_t_initialize \ { \ - fss_write_flag_none_e, \ - macro_f_state_t_initialize(fss_write_default_allocation_large_d, fss_write_default_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, 0, 0), \ + fss_write_main_flag_none_e, \ + macro_f_state_t_initialize_1(fss_write_allocation_large_d, fss_write_allocation_small_d, F_none, 0, 0, &fll_program_standard_signal_handle, 0, 0, 0), \ f_string_range_t_initialize, \ f_string_static_t_initialize, \ f_string_static_t_initialize, \ diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index 21316a8..3b42aa3 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -27,8 +27,12 @@ extern "C" { if (!main || !setting) return; + setting->state.step_small = fss_write_allocation_console_d; + f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = fss_write_allocation_small_d; + if (F_status_is_error(setting->state.status)) { fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process)); @@ -92,15 +96,15 @@ extern "C" { main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d; if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) { - setting->flag |= fss_write_flag_help_e; + setting->flag |= fss_write_main_flag_help_e; } if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) { - setting->flag |= fss_write_flag_version_e; + setting->flag |= fss_write_main_flag_version_e; } if (main->parameters.array[fss_write_parameter_copyright_e].result & f_console_result_found_e) { - setting->flag |= fss_write_flag_copyright_e; + setting->flag |= fss_write_main_flag_copyright_e; } if (callback) { @@ -121,7 +125,7 @@ extern "C" { if (main->parameters.array[fss_write_parameter_file_e].values.used > 1) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); return; @@ -140,12 +144,12 @@ extern "C" { return; } - setting->flag |= fss_write_flag_file_to_e; + setting->flag |= fss_write_main_flag_file_to_e; } else if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s); return; @@ -174,12 +178,12 @@ extern "C" { setting->objects.array[setting->objects.used++].size = 0; } // for - setting->flag |= fss_write_flag_object_e; + setting->flag |= fss_write_main_flag_object_e; } else if (main->parameters.array[fss_write_parameter_object_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s); return; @@ -187,11 +191,12 @@ extern "C" { if ((main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) && main->parameters.array[fss_write_parameter_content_e].values.used) { - if (setting->flag & fss_write_flag_object_e) { - if (!(setting->flag & fss_write_flag_content_multiple_e)) { + if (setting->flag & fss_write_main_flag_object_e) { + if (!(setting->flag & fss_write_main_flag_content_multiple_e)) { if (main->parameters.array[fss_write_parameter_content_e].values.used > main->parameters.array[fss_write_parameter_object_e].values.used) { setting->state.status = F_status_set_error(F_support_not); + fss_write_print_line_first(setting, main->message); fss_write_print_error_one_content_only(setting, main->error); return; @@ -262,12 +267,12 @@ extern "C" { ++setting->contentss.used; } - setting->flag |= fss_write_flag_content_e; + setting->flag |= fss_write_main_flag_content_e; } else if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s); return; @@ -288,34 +293,30 @@ extern "C" { if (main->parameters.arguments.array[index].used) { f_string_range_t range = macro_f_string_range_t_initialize2(main->parameters.arguments.array[index].used); - f_state_t state = f_state_t_initialize; for (; range.start < main->parameters.arguments.array[index].used; range.start++) { - setting->state.status = f_fss_is_space(main->parameters.arguments.array[index], range, state); - - if (F_status_is_error(setting->state.status)) { - fss_write_print_error(setting, main->error, macro_fss_write_f(f_fss_is_space)); - - return; - } - - if (setting->state.status == F_false) { - setting->state.status = F_status_set_error(F_parameter); + if (f_fss_is_space(main->parameters.arguments.array[index], range, &setting->state) == F_false) { + if (F_status_is_error(setting->state.status)) { + fss_write_print_error(setting, main->error, macro_fss_write_f(f_fss_is_space)); + } + else { + setting->state.status = F_status_set_error(F_parameter); - fss_write_print_error_prepend_only_whitespace(setting, main->error); + fss_write_print_error_prepend_only_whitespace(setting, main->error); + } return; } } // for } - setting->flag |= fss_write_flag_prepend_e; + setting->flag |= fss_write_main_flag_prepend_e; } else if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s); return; @@ -325,14 +326,14 @@ extern "C" { if (main->parameters.array[fss_write_parameter_ignore_e].values.used % 2 != 0) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s); return; } // Only process if the standard designates that the ingore is supported. - if (setting->flag & fss_write_flag_ignore_e) { + if (setting->flag & fss_write_main_flag_ignore_e) { f_array_length_t stub_data_array[1] = { 0 }; f_array_lengths_t stub_data = macro_f_array_lengths_t_initialize(stub_data_array, 0, 1); @@ -390,7 +391,7 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].start); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -401,7 +402,7 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -410,7 +411,7 @@ extern "C" { if (setting->ignoress.array[j].array[setting->ignoress.array[j].used].stop > setting->ignoress.array[j].array[setting->ignoress.array[j].used].start) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_range_start_before_stop( main->error, f_console_symbol_long_normal_s, @@ -444,7 +445,7 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.start); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -455,7 +456,7 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &number.stop); if (F_status_is_error(setting->state.status)) { - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]); return; @@ -464,7 +465,7 @@ extern "C" { if (number.start > number.stop) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_range_start_before_stop( main->error, f_console_symbol_long_normal_s, @@ -481,7 +482,7 @@ extern "C" { else if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s); return; @@ -489,13 +490,13 @@ extern "C" { else { // There is no Object or Content, so remove ignores if set. - if (setting->flag & fss_write_flag_ignore_e) { - setting->flag -= fss_write_flag_ignore_e; + if (setting->flag & fss_write_main_flag_ignore_e) { + setting->flag -= fss_write_main_flag_ignore_e; } } if (main->parameters.array[fss_write_parameter_partial_e].result & f_console_result_found_e) { - setting->flag |= fss_write_flag_partial_e; + setting->flag |= fss_write_main_flag_partial_e; } { @@ -506,9 +507,9 @@ extern "C" { }; const uint16_t has_flag[] = { - fss_write_flag_content_end_e, - fss_write_flag_content_next_e, - fss_write_flag_object_open_e, + fss_write_main_flag_content_end_e, + fss_write_main_flag_content_next_e, + fss_write_main_flag_object_open_e, }; const f_string_static_t has_string[] = { @@ -532,11 +533,11 @@ extern "C" { for (uint8_t i = 0; i < 3; ++i) { if (main->parameters.array[has[i]].result & f_console_result_found_e) { - if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e)) { - if (!(setting->flag & fss_write_flag_partial_e)) { + if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e)) { + if (!(setting->flag & fss_write_main_flag_partial_e)) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_cannot_use_with_without( main->error, @@ -544,7 +545,7 @@ extern "C" { f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], - (setting->flag & fss_write_flag_object_e) + (setting->flag & fss_write_main_flag_object_e) ? fss_write_long_object_s : fss_write_long_content_s, fss_write_long_partial_s @@ -557,7 +558,7 @@ extern "C" { if (main->parameters.array[has_cannots[i][0]].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][0]); return; @@ -566,7 +567,7 @@ extern "C" { if (main->parameters.array[has_cannots[i][1]].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, has_string[i], has_cannots_string[i][1]); return; @@ -577,23 +578,24 @@ extern "C" { } // for } - if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e)) { - if (setting->flag & fss_write_flag_object_e) { - if (setting->flag & fss_write_flag_content_multiple_e) { - if (main->parameters.array[fss_write_parameter_object_e].locations_sub.used > main->parameters.array[fss_write_parameter_content_e].locations_sub.used && !(setting->flag & fss_write_flag_partial_e)) { + if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e)) { + if (setting->flag & fss_write_main_flag_object_e) { + if (setting->flag & fss_write_main_flag_content_multiple_e) { + if (main->parameters.array[fss_write_parameter_object_e].locations_sub.used > main->parameters.array[fss_write_parameter_content_e].locations_sub.used && !(setting->flag & fss_write_main_flag_partial_e)) { setting->state.status = F_status_set_error(F_parameter); + fss_write_print_line_first(setting, main->message); fss_write_print_error_parameter_same_times_at_least(setting, main->error); return; } } - if ((setting->flag & fss_write_flag_content_e) && (setting->flag & fss_write_flag_partial_e)) { + if ((setting->flag & fss_write_main_flag_content_e) && (setting->flag & fss_write_main_flag_partial_e)) { if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) { setting->state.status = F_status_set_error(F_parameter); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_cannot_use_with_xor(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s); return; @@ -641,10 +643,10 @@ extern "C" { } if (main->parameters.array[fss_write_parameter_trim_e].result & f_console_result_found_e) { - setting->flag |= fss_write_flag_trim_e; + setting->flag |= fss_write_main_flag_trim_e; } - if (!(setting->flag & (fll_program_data_pipe_input_e | fss_write_flag_content_e | fss_write_parameter_object_e))) { + if (!(setting->flag & (fll_program_data_pipe_input_e | fss_write_main_flag_content_e | fss_write_parameter_object_e))) { setting->state.status = F_data_not; } } diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c index 7188d29..89deacd 100644 --- a/level_3/fss_write/c/main/fss_write.c +++ b/level_3/fss_write/c/main/fss_write.c @@ -10,14 +10,14 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - fss_write_print_line_last_locked(setting, main->error); + fss_write_print_line_last(setting, main->error); return; } setting->state.status = F_none; - if (setting->flag & fss_write_flag_help_e) { + if (setting->flag & fss_write_main_flag_help_e) { if (setting->process_help) { setting->process_help(main, (void *) setting); } @@ -25,13 +25,13 @@ extern "C" { return; } - if (setting->flag & fss_write_flag_version_e) { + if (setting->flag & fss_write_main_flag_version_e) { fll_program_print_version(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0), fss_write_program_version_s); return; } - if (setting->flag & fss_write_flag_copyright_e) { + if (setting->flag & fss_write_main_flag_copyright_e) { fll_program_print_copyright(main->message, (setting->line_first.used ? 0x1 : 0x0) | (setting->line_last.used ? 0x2 : 0x0)); return; @@ -46,26 +46,24 @@ extern "C" { } if (F_status_is_error_not(setting->state.status)) { - if (setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e | fss_write_flag_object_open_e | fss_write_flag_content_next_e | fss_write_flag_content_end_e)) { + if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e | fss_write_main_flag_object_open_e | fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e)) { if (setting->process_normal) { setting->process_normal(main, (void *) setting); } } } - - if (F_status_is_error(setting->state.status)) { - fss_write_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error); - } } #endif // _di_fss_write_main_ #ifndef _di_fss_write_process_normal_ void fss_write_process_normal(fll_program_data_t * const main, void * const void_setting) { + if (!main || !void_setting) return; + fss_write_process_normal_data( main, macro_fss_write_setting(void_setting), - (macro_fss_write_setting(void_setting)->flag & fss_write_flag_object_e) + (macro_fss_write_setting(void_setting)->flag & fss_write_main_flag_object_e) ? macro_fss_write_setting(void_setting)->objects.used : macro_fss_write_setting(void_setting)->contentss.used ); @@ -75,7 +73,7 @@ extern "C" { #ifndef _di_fss_write_process_normal_data_ void fss_write_process_normal_data(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_array_length_t length) { - if (!setting->process_set) return; + if (!main || !setting || !setting->process_set) return; setting->ignores = 0; setting->object = 0; @@ -113,7 +111,7 @@ extern "C" { } // for } else { - if (setting->flag & (fss_write_flag_object_open_e | fss_write_flag_content_next_e | fss_write_flag_content_end_e)) { + if (setting->flag & (fss_write_main_flag_object_open_e | fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e)) { setting->object = 0; setting->contents = 0; setting->ignores = 0; @@ -127,18 +125,15 @@ extern "C" { #ifndef _di_fss_write_process_pipe_ void fss_write_process_pipe(fll_program_data_t * const main, void * const void_setting) { + if (!main || !void_setting) return; + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); if (!setting->process_set) return; - f_status_t status_pipe = F_none; - f_file_t input = f_file_t_initialize; - input.id = F_type_descriptor_input_d; - input.size_read = setting->state.step_large; - - f_array_length_t total = 0; - f_array_length_t ignore = 0; - f_string_range_t range = f_string_range_t_initialize; + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_first(setting, main->message); + } const f_array_length_t used_objects = setting->objects.used; const f_array_length_t used_contentss = setting->contentss.used; @@ -189,6 +184,16 @@ extern "C" { return; } + f_status_t status_pipe = F_none; + + f_file_t input = f_file_t_initialize; + input.id = F_type_descriptor_input_d; + input.size_read = setting->state.step_large; + + f_array_length_t total = 0; + f_array_length_t ignore = 0; + f_string_range_t range = f_string_range_t_initialize; + // Reset all of the used data before starting the loop. setting->object->used = 0; setting->contents->used = 0; @@ -299,7 +304,7 @@ extern "C" { // Check to see if the Content supports multiple Content per Object. if (flag & 0x4) { - if (!(setting->flag & fss_write_flag_content_multiple_e)) { + if (!(setting->flag & fss_write_main_flag_content_multiple_e)) { setting->state.status = F_status_set_error(F_support_not); fss_write_print_error_one_content_only(setting, main->error); @@ -337,7 +342,7 @@ extern "C" { // Do not handle start/end while inside an ignore set. if (!(flag & 0x2)) { if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { - if (!(setting->flag & fss_write_flag_content_multiple_e)) { + if (!(setting->flag & fss_write_main_flag_content_multiple_e)) { setting->state.status = F_status_set_error(F_support_not); fss_write_print_error_one_content_only(setting, main->error); @@ -429,17 +434,28 @@ extern "C" { if (F_status_is_error_not(setting->state.status)) { setting->state.status = (flag & 0x1) ? F_none : F_data_not; } + + if (F_status_is_error(setting->state.status)) { + fss_write_print_line_last(setting, main->message); + } + else if (!(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e | fss_write_main_flag_object_open_e | fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e))) { + if (main->message.verbosity > f_console_verbosity_error_e) { + fss_write_print_line_last(setting, main->message); + } + } } #endif // _di_fss_write_process_pipe_ #ifndef _di_fss_write_process_set_ void fss_write_process_set(fll_program_data_t * const main, void * const void_setting) { + if (!main || !void_setting) return; + fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); setting->buffer.used = 0; - if ((!(setting->flag & fss_write_flag_partial_e) || (setting->flag & fss_write_flag_partial_e) && (setting->flag & fss_write_flag_object_e)) && setting->object || (setting->flag & fss_write_flag_object_open_e)) { + if ((!(setting->flag & fss_write_main_flag_partial_e) || (setting->flag & fss_write_main_flag_partial_e) && (setting->flag & fss_write_main_flag_object_e)) && setting->object || (setting->flag & fss_write_main_flag_object_open_e)) { if (setting->object) { if (setting->object->used) { @@ -458,7 +474,7 @@ extern "C" { } } - if ((!(setting->flag & fss_write_flag_partial_e) || (setting->flag & fss_write_flag_partial_e) && (setting->flag & fss_write_flag_content_e)) && setting->contents || (setting->flag & (fss_write_flag_content_next_e | fss_write_flag_content_end_e))) { + if ((!(setting->flag & fss_write_main_flag_partial_e) || (setting->flag & fss_write_main_flag_partial_e) && (setting->flag & fss_write_main_flag_content_e)) && setting->contents || (setting->flag & (fss_write_main_flag_content_next_e | fss_write_main_flag_content_end_e))) { if (setting->process_content) { if (setting->contents && setting->contents->used) { diff --git a/level_3/fss_write/c/main/main-print.c b/level_3/fss_write/c/main/main-print.c index 29e94d7..bbf94f7 100644 --- a/level_3/fss_write/c/main/main-print.c +++ b/level_3/fss_write/c/main/main-print.c @@ -33,6 +33,8 @@ extern "C" { #ifndef _di_fss_write_main_print_help_ f_status_t fss_write_main_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index bc4cad8..389bcb4 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -12,7 +12,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -28,7 +28,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fss_write_setting_load(arguments, state, &data, &setting, &fss_write_main_setting_load_as); + fss_write_setting_load(arguments, &data, &setting, &fss_write_main_setting_load_as); } fss_write_main(&data, &setting); @@ -39,7 +39,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } #ifndef _di_fss_write_main_process_help_ @@ -52,9 +52,9 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { #endif // _di_fss_write_main_process_help_ #ifndef _di_fss_write_main_setting_load_as_ - void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, f_state_t * const state) { + void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) { - if (!main || !setting || F_status_is_error(setting->state.status) || (setting->flag & fss_write_flag_version_e)) return; + if (!main || !setting || F_status_is_error(setting->state.status) || (setting->flag & fss_write_main_flag_version_e)) return; setting->standard = fss_write_basic_standard_s; setting->process_content = &fss_write_basic_process_content; @@ -84,8 +84,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_pipe = &fss_write_process_pipe; setting->process_normal = &fss_write_process_normal; setting->process_set = &fss_write_process_set; - setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by basic. - setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by basic. + setting->flag -= setting->flag & fss_write_main_flag_ignore_e; // Not supported by basic. + setting->flag -= setting->flag & fss_write_main_flag_content_multiple_e; // Not supported by basic. } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0001_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0001_s) == F_equal_to || @@ -98,8 +98,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_pipe = &fss_write_process_pipe; setting->process_normal = &fss_write_process_normal; setting->process_set = &fss_write_process_set; - setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by extended. - setting->flag |= fss_write_flag_content_multiple_e; + setting->flag -= setting->flag & fss_write_main_flag_ignore_e; // Not supported by extended. + setting->flag |= fss_write_main_flag_content_multiple_e; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0002_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0002_s) == F_equal_to || @@ -112,8 +112,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_pipe = &fss_write_process_pipe; setting->process_normal = &fss_write_process_normal; setting->process_set = &fss_write_process_set; - setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by basic list. - setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by basic list. + setting->flag -= setting->flag & fss_write_main_flag_ignore_e; // Not supported by basic list. + setting->flag -= setting->flag & fss_write_main_flag_content_multiple_e; // Not supported by basic list. } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0003_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0003_s) == F_equal_to || @@ -126,8 +126,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_pipe = &fss_write_process_pipe; setting->process_normal = &fss_write_process_normal; setting->process_set = &fss_write_process_set; - setting->flag |= fss_write_flag_ignore_e; - setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by extended list. + setting->flag |= fss_write_main_flag_ignore_e; + setting->flag -= setting->flag & fss_write_main_flag_content_multiple_e; // Not supported by extended list. } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_0008_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_0008_s) == F_equal_to || @@ -140,8 +140,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_pipe = &fss_write_process_pipe; setting->process_normal = &fss_write_process_normal; setting->process_set = &fss_write_process_set; - setting->flag |= fss_write_flag_ignore_e; - setting->flag |= fss_write_flag_content_multiple_e; + setting->flag |= fss_write_main_flag_ignore_e; + setting->flag |= fss_write_main_flag_content_multiple_e; } else if (fl_string_dynamic_compare(argv[index], fss_write_format_code_short_000e_s) == F_equal_to || fl_string_dynamic_compare(argv[index], fss_write_format_code_long_000e_s) == F_equal_to || @@ -154,18 +154,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { setting->process_object = 0; // Not used by payload. setting->process_pipe = &fss_write_payload_process_pipe; setting->process_set = &fss_write_payload_process_set; - setting->flag -= setting->flag & fss_write_flag_ignore_e; // Not supported by payload. - setting->flag -= setting->flag & fss_write_flag_content_multiple_e; // Not supported by payload. + setting->flag -= setting->flag & fss_write_main_flag_ignore_e; // Not supported by payload. + setting->flag -= setting->flag & fss_write_main_flag_content_multiple_e; // Not supported by payload. } else { - if (setting->flag & fss_write_flag_help_e) { + if (setting->flag & fss_write_main_flag_help_e) { setting->state.status = F_status_set_error(F_parameter); break; } if (setting->state.status != F_status_set_error(F_parameter)) { - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); } setting->state.status = F_status_set_error(F_parameter); @@ -175,7 +175,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { } // for if (F_status_is_error(setting->state.status)) { - if (setting->flag & fss_write_flag_help_e) { + if (setting->flag & fss_write_main_flag_help_e) { fss_write_main_process_help(main, setting); } @@ -185,13 +185,13 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { else if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - if (setting->flag & fss_write_flag_help_e) { + if (setting->flag & fss_write_main_flag_help_e) { fss_write_main_process_help(main, setting); return; } - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_as_s); return; diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c index 4895822..7446815 100644 --- a/level_3/fss_write/c/main/print.c +++ b/level_3/fss_write/c/main/print.c @@ -7,9 +7,9 @@ extern "C" { #ifndef _di_fss_write_print_error_ f_status_t fss_write_print_error(fss_write_setting_t * const setting, const fl_print_t print, const f_string_t function) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - fss_write_print_line_first_locked(setting, print); fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); return F_none; @@ -19,9 +19,9 @@ extern "C" { #ifndef _di_fss_write_print_error_file_ f_status_t fss_write_print_error_file(fss_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; - fss_write_print_line_first_locked(setting, print); fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); return F_none; @@ -31,11 +31,11 @@ extern "C" { #ifndef _di_fss_write_print_error_parameter_same_times_at_least_ f_status_t fss_write_print_error_parameter_same_times_at_least(fss_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); - fss_write_print_line_first_unlocked(setting, print); fl_print_format("%[%QMust specify the '%]", print.to, print.context, print.prefix, print.context); fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.notable); fl_print_format("%[' parameter at least the same number of times as the '%]", print.to, print.context, print.context); @@ -53,11 +53,11 @@ extern "C" { #ifndef _di_fss_write_print_error_one_content_only_ f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); - fss_write_print_line_first_unlocked(setting, print); fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context); fl_print_format("%[%r%]", print.to, print.notable, setting->standard, print.notable); fl_print_format(" %[standard only supports one Content per Object.%]%r", print.to, print.context, print.context, f_string_eol_s); @@ -71,7 +71,8 @@ extern "C" { #ifndef _fss_write_print_error_prepend_only_whitespace_ f_status_t fss_write_print_error_prepend_only_whitespace(fss_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); @@ -88,11 +89,11 @@ extern "C" { #ifndef _di_fss_write_print_error_unsupported_eol_ f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); - fss_write_print_line_first_unlocked(setting, print); fl_print_format("%[%QThe%] ", print.to, print.context, print.prefix, print.context); fl_print_format("%[%r%]", print.to, print.notable, setting->standard, print.notable); fl_print_format(" %[standard does not support end of line character '%]", print.to, print.context, print.context); @@ -110,6 +111,8 @@ extern "C" { #ifndef _di_fss_write_print_help_ void fss_write_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return; + fll_program_print_help_option_standard(print); f_print_dynamic_raw(f_string_eol_s, print.to); @@ -135,6 +138,8 @@ extern "C" { #ifndef _di_fss_write_print_help_end_next_ void fss_write_print_help_end_next(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting); + fl_print_format("%r The '%[%r%r%]',", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_object_open_s, print.set->notable); fl_print_format(" '%[%r%r%]', and", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_next_s, print.set->notable); fl_print_format(" '%[%r%r%]' help facilitate writing the designated data for when using", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_end_s, print.set->notable); @@ -148,6 +153,8 @@ extern "C" { #ifndef _di_fss_write_print_help_pipe_ void fss_write_print_help_pipe(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return; + fl_print_format("%r The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); fl_print_format(" The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); fl_print_format(" The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range (use this both before and after the range).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s); @@ -157,69 +164,43 @@ extern "C" { } #endif // _di_fss_write_print_help_pipe_ -#ifndef _di_fss_write_print_line_first_locked_ - f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print) { +#ifndef _di_fss_write_print_line_first_ + f_status_t fss_write_print_line_first(fss_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; if (F_status_is_error_not(setting->state.status)) { if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fss_write_flag_file_to_e) return F_output_not; + if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not; } - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_fss_write_print_line_first_locked_ + if (setting->flag & fss_write_main_flag_print_first_e) { + fll_print_dynamic_raw(setting->line_first, print.to); -#ifndef _di_fss_write_print_line_first_unlocked_ - f_status_t fss_write_print_line_first_unlocked(fss_write_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fss_write_flag_file_to_e) return F_output_not; + setting->flag -= fss_write_main_flag_print_first_e; } - fll_print_dynamic_raw(setting->line_first, print.to); - return F_none; } -#endif // _di_fss_write_print_line_first_unlocked_ +#endif // _di_fss_write_print_line_first_ -#ifndef _di_fss_write_print_line_last_locked_ - f_status_t fss_write_print_line_last_locked(fss_write_setting_t * const setting, const fl_print_t print) { +#ifndef _di_fss_write_print_line_last_ + f_status_t fss_write_print_line_last(fss_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; if (F_status_is_error_not(setting->state.status)) { if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fss_write_flag_file_to_e) return F_output_not; + if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not; } fll_print_dynamic_raw(setting->line_last, print.to); return F_none; } -#endif // _di_fss_write_print_line_last_locked_ - -#ifndef _di_fss_write_print_line_last_unlocked_ - f_status_t fss_write_print_line_last_unlocked(fss_write_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - if (setting->flag & fss_write_flag_file_to_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_fss_write_print_line_last_unlocked_ +#endif // _di_fss_write_print_line_last_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_write/c/main/print.h b/level_3/fss_write/c/main/print.h index 3ab0bd1..75bdfae 100644 --- a/level_3/fss_write/c/main/print.h +++ b/level_3/fss_write/c/main/print.h @@ -201,31 +201,9 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_write_print_line_first_locked_ - extern f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_write_print_line_first_unlocked_ - extern f_status_t fss_write_print_line_first_unlocked(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_line_first_unlocked_ +#ifndef _di_fss_write_print_line_first_ + extern f_status_t fss_write_print_line_first(fss_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_write_print_line_first_ /** * Print last new line when the main is complete, unless verbosity says otherwise. @@ -245,31 +223,9 @@ extern "C" { * F_none on success. * F_output_not on success, but no printing is performed. */ -#ifndef _di_fss_write_print_line_last_locked_ - extern f_status_t fss_write_print_line_last_locked(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_fss_write_print_line_last_unlocked_ - extern f_status_t fss_write_print_line_last_unlocked(fss_write_setting_t * const setting, const fl_print_t print); -#endif // _di_fss_write_print_line_last_unlocked_ +#ifndef _di_fss_write_print_line_last_ + extern f_status_t fss_write_print_line_last(fss_write_setting_t * const setting, const fl_print_t print); +#endif // _di_fss_write_print_line_last_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fss_write/c/payload/fss_write.c b/level_3/fss_write/c/payload/fss_write.c index 4f93986..3b85788 100644 --- a/level_3/fss_write/c/payload/fss_write.c +++ b/level_3/fss_write/c/payload/fss_write.c @@ -22,7 +22,7 @@ extern "C" { f_status_t status_pipe = F_none; f_file_t input = f_file_t_initialize; input.id = F_type_descriptor_input_d; - input.size_read = fss_write_default_allocation_large_d; + input.size_read = fss_write_allocation_large_d; fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); @@ -190,9 +190,10 @@ extern "C" { // Check to see if the Content supports multiple Content per Object. if (flag & 0x4) { - if (!(setting->flag & fss_write_flag_content_multiple_e)) { + if (!(setting->flag & fss_write_main_flag_content_multiple_e)) { setting->state.status = F_status_set_error(F_support_not); + fss_write_print_line_first(setting, main->message); fss_write_print_error_one_content_only(setting, main->error); break; @@ -256,6 +257,7 @@ extern "C" { if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) { setting->state.status = F_status_set_error(F_support_not); + fss_write_print_line_first(setting, main->message); fss_write_print_error_one_content_only(setting, main->error); break; @@ -385,8 +387,8 @@ extern "C" { fss_write_setting_t * const setting = macro_fss_write_setting(void_setting); - if ((!(setting->flag & fss_write_flag_partial_e) || (setting->flag & fss_write_flag_partial_e) && (setting->flag & fss_write_flag_object_e))) { - if (setting->object && !(setting->flag & fss_write_flag_partial_e) && setting->contents && setting->contents->used) { + if ((!(setting->flag & fss_write_main_flag_partial_e) || (setting->flag & fss_write_main_flag_partial_e) && (setting->flag & fss_write_main_flag_object_e))) { + if (setting->object && !(setting->flag & fss_write_main_flag_partial_e) && setting->contents && setting->contents->used) { if (setting->object->used) { setting->range.start = 0; setting->range.stop = setting->object->used - 1; @@ -396,21 +398,21 @@ extern "C" { setting->range.stop = 0; } - setting->state.status = fll_fss_payload_write( + fll_fss_payload_write( *setting->object, setting->contents->array[0], - (setting->flag & fss_write_flag_trim_e), - (setting->flag & fss_write_flag_prepend_e) + (setting->flag & fss_write_main_flag_trim_e), + (setting->flag & fss_write_main_flag_prepend_e) ? &setting->prepend : 0, - setting->state, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -433,24 +435,24 @@ extern "C" { setting->range.stop = 0; } - setting->state.status = fl_fss_basic_list_object_write( + fl_fss_basic_list_object_write( *setting->object, - (setting->flag & fss_write_flag_partial_e) - ? (setting->flag & fss_write_flag_trim_e) + (setting->flag & fss_write_main_flag_partial_e) + ? (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_trim_e : f_fss_complete_none_e - : (setting->flag & fss_write_flag_trim_e) + : (setting->flag & fss_write_main_flag_trim_e) ? f_fss_complete_full_trim_e : f_fss_complete_full_e, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_set_fine(setting->state.status) == F_none_eol) { setting->state.status = F_status_set_error(F_support_not); - fss_write_print_line_first_locked(setting, main->error); + fss_write_print_line_first(setting, main->message); fss_write_print_error_unsupported_eol(setting, main->error); return; @@ -463,8 +465,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_content_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_object_open_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_content_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_object_open_e) { setting->state.status = f_string_dynamic_append(f_fss_basic_list_open_s, &setting->buffer); if (F_status_is_error_not(setting->state.status)) { @@ -487,21 +489,21 @@ extern "C" { const f_string_static_t *prepend = 0; - if (setting->flag & fss_write_flag_prepend_e) { + if (setting->flag & fss_write_main_flag_prepend_e) { const f_array_length_t index = main->parameters.array[fss_write_parameter_prepend_e].values.array[main->parameters.array[fss_write_parameter_prepend_e].values.used - 1]; prepend = &main->parameters.arguments.array[index]; } - setting->state.status = fl_fss_basic_list_content_write( + fl_fss_basic_list_content_write( setting->contents->array[0], setting->object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, - setting->state, &setting->range, - &setting->buffer + &setting->buffer, + &setting->state ); if (F_status_is_error(setting->state.status)) { @@ -511,8 +513,8 @@ extern "C" { } } - if ((setting->flag & fss_write_flag_partial_e) && !(setting->flag & fss_write_flag_object_e) || !(setting->flag & (fss_write_flag_object_e | fss_write_flag_content_e))) { - if (setting->flag & fss_write_flag_content_end_e) { + if ((setting->flag & fss_write_main_flag_partial_e) && !(setting->flag & fss_write_main_flag_object_e) || !(setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e))) { + if (setting->flag & fss_write_main_flag_content_end_e) { setting->state.status = f_string_dynamic_append(f_fss_basic_list_close_s, &setting->buffer); if (F_status_is_error(setting->state.status)) { @@ -542,7 +544,7 @@ extern "C" { #endif // _di_fss_write_payload_process_set_ #ifndef _di_fss_write_payload_setting_load_ - void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, f_state_t * const state) { + void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) { if (!main || !setting) return; @@ -556,6 +558,7 @@ extern "C" { if (fl_string_dynamic_compare(argv[values->array[i]], fss_write_payload_s) == F_equal_to && i + 1 < values->used) { setting->state.status = F_status_set_error(F_parameter); + fss_write_print_line_first(setting, main->message); fss_write_payload_print_error_payload_not_last(setting, main->error); return; diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index 153ddb7..2ce46c5 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -5,7 +5,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; - setting.state.data = (void *) &data; + setting.state.custom = (void *) &data; setting.standard = fss_write_payload_standard_s; setting.process_content = 0; // Not used by payload. setting.process_help = &fss_write_payload_process_help; @@ -29,7 +29,7 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); - fss_write_setting_load(arguments, state, &data, &setting, &fss_write_payload_setting_load); + fss_write_setting_load(arguments, &data, &setting, &fss_write_payload_setting_load); } fss_write_main(&data, &setting); @@ -40,5 +40,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/fss_write/c/payload/print.c b/level_3/fss_write/c/payload/print.c index 6a62739..f1b3d65 100644 --- a/level_3/fss_write/c/payload/print.c +++ b/level_3/fss_write/c/payload/print.c @@ -11,7 +11,6 @@ extern "C" { f_file_stream_lock(print.to); - fss_write_print_line_first_unlocked(setting, print); fl_print_format("%[%QThe payload may only be specified last.%]%r", print.to, print.set->error, print.prefix, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -23,6 +22,8 @@ extern "C" { #ifndef _di_fss_write_payload_print_help_ f_status_t fss_write_payload_print_help(fss_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/fss_write/c/payload/print.h b/level_3/fss_write/c/payload/print.h index a54ab96..1d00341 100644 --- a/level_3/fss_write/c/payload/print.h +++ b/level_3/fss_write/c/payload/print.h @@ -45,6 +45,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_fss_write_payload_print_help_ extern f_status_t fss_write_payload_print_help(fss_write_setting_t * const setting, const fl_print_t print); diff --git a/level_3/iki_read/c/main/common-type.h b/level_3/iki_read/c/main/common-type.h index 419b107..4f6e7e7 100644 --- a/level_3/iki_read/c/main/common-type.h +++ b/level_3/iki_read/c/main/common-type.h @@ -18,9 +18,18 @@ extern "C" { /** * The program defines. + * + * iki_read_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_iki_read_d_ - #define iki_read_signal_check_d 20000 + #define iki_read_allocation_console_d 4 + #define iki_read_allocation_large_d 256 + #define iki_read_allocation_small_d 16 + #define iki_read_signal_check_d 20000 #endif // _di_iki_read_d_ /** @@ -191,7 +200,7 @@ extern "C" { #define iki_read_setting_t_initialize \ { \ iki_read_main_flag_none_e, \ - f_state_t_initialize, \ + macro_f_state_t_initialize_1(iki_read_allocation_large_d, iki_read_allocation_small_d, F_none, 0, 0, 0, 0, 0, 0), \ 0, \ 0, \ f_string_static_t_initialize, \ diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index 9bc426e..dfe2b3e 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -29,10 +29,12 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = iki_read_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = iki_read_allocation_small_d; + if (F_status_is_error(setting->state.status)) { iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process)); diff --git a/level_3/iki_read/c/main/main.c b/level_3/iki_read/c/main/main.c index 36132a1..4345220 100644 --- a/level_3/iki_read/c/main/main.c +++ b/level_3/iki_read/c/main/main.c @@ -4,6 +4,8 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; iki_read_setting_t setting = iki_read_setting_t_initialize; + setting.state.custom = (void *) &data; + setting.state.handle = &fll_program_standard_signal_handle; f_console_parameter_t parameters[] = iki_read_console_parameter_t_initialize; data.parameters.array = parameters; @@ -30,5 +32,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/iki_read/c/main/private-read.c b/level_3/iki_read/c/main/private-read.c index 29145c7..59e38d1 100644 --- a/level_3/iki_read/c/main/private-read.c +++ b/level_3/iki_read/c/main/private-read.c @@ -162,11 +162,7 @@ extern "C" { #ifndef _di_iki_read_process_buffer_ranges_ void iki_read_process_buffer_ranges(fll_program_data_t * const main, iki_read_setting_t * const setting, f_string_range_t *buffer_range) { - { - const f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - - setting->state.status = fl_iki_read(&setting->buffer, buffer_range, &setting->data, state); - } + fl_iki_read(&setting->buffer, buffer_range, &setting->data, &setting->state); if (F_status_is_error(setting->state.status)) { iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read)); @@ -275,11 +271,7 @@ extern "C" { f_string_range_t range = buffer_range; - { - const f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - - setting->state.status = fl_iki_read(&setting->buffer, &range, &setting->data, state); - } + fl_iki_read(&setting->buffer, &range, &setting->data, &setting->state); if (F_status_is_error(setting->state.status)) { iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read)); @@ -389,11 +381,7 @@ extern "C" { return; } - { - f_state_t state = macro_f_state_t_initialize(iki_read_common_allocation_large_d, iki_read_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) main, 0); - - setting->state.status = fl_iki_read(&setting->buffer, &range, &setting->data, state); - } + fl_iki_read(&setting->buffer, &range, &setting->data, &setting->state); if (F_status_is_error(setting->state.status)) { iki_read_print_error(setting, main->error, macro_iki_read_f(fl_iki_read)); diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index b3d9a4d..5facea5 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -26,11 +26,14 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; + setting->state.step_small = iki_write_allocation_console_d; f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = iki_write_allocation_small_d; + if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process)); return; @@ -50,6 +53,7 @@ extern "C" { setting->state.status = fll_program_parameter_process_context(choices, modes, F_true, main); if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_context)); return; @@ -81,6 +85,7 @@ extern "C" { setting->state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main); if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(fll_program_parameter_process_verbosity)); return; @@ -114,7 +119,7 @@ extern "C" { if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); + iki_write_print_line_first(setting, main->message); fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); return; @@ -128,7 +133,7 @@ extern "C" { setting->state.status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to); if (F_status_is_error(setting->state.status)) { - iki_write_print_line_first_locked(setting, main->error); + iki_write_print_line_first(setting, main->message); fll_error_file_print(main->error, F_status_set_fine(setting->state.status), "f_file_stream_open", fll_error_file_flag_fallback_e, main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e); return; @@ -139,7 +144,7 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_file_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); + iki_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_file_s); return; @@ -153,6 +158,7 @@ extern "C" { setting->state.status = f_string_dynamics_resize(values->used, &setting->objects); if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize)); return; @@ -173,7 +179,7 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_object_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); + iki_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_object_s); return; @@ -187,6 +193,7 @@ extern "C" { setting->state.status = f_string_dynamics_resize(values->used, &setting->contents); if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(f_string_dynamics_resize)); return; @@ -207,7 +214,7 @@ extern "C" { else if (main->parameters.array[iki_write_parameter_content_e].result & f_console_result_found_e) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); + iki_write_print_line_first(setting, main->message); fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, iki_write_long_content_s); return; @@ -216,7 +223,7 @@ extern "C" { if (!(main->pipe & fll_program_data_pipe_input_e) && !(setting->flag & (iki_write_main_flag_content_e | iki_write_parameter_object_e))) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); + iki_write_print_line_first(setting, main->message); iki_write_print_error_main_missing(setting, main->error); return; diff --git a/level_3/iki_write/c/main/common-print.c b/level_3/iki_write/c/main/common/print.c similarity index 95% rename from level_3/iki_write/c/main/common-print.c rename to level_3/iki_write/c/main/common/print.c index 1c97f36..1a7d323 100644 --- a/level_3/iki_write/c/main/common-print.c +++ b/level_3/iki_write/c/main/common/print.c @@ -1,4 +1,4 @@ -#include "iki_write.h" +#include "../iki_write.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/iki_write/c/main/common-print.h b/level_3/iki_write/c/main/common/print.h similarity index 100% rename from level_3/iki_write/c/main/common-print.h rename to level_3/iki_write/c/main/common/print.h diff --git a/level_3/iki_write/c/main/common-string.c b/level_3/iki_write/c/main/common/string.c similarity index 99% rename from level_3/iki_write/c/main/common-string.c rename to level_3/iki_write/c/main/common/string.c index f728f05..28d8e0a 100644 --- a/level_3/iki_write/c/main/common-string.c +++ b/level_3/iki_write/c/main/common/string.c @@ -1,4 +1,4 @@ -#include "iki_write.h" +#include "../iki_write.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/iki_write/c/main/common-string.h b/level_3/iki_write/c/main/common/string.h similarity index 100% rename from level_3/iki_write/c/main/common-string.h rename to level_3/iki_write/c/main/common/string.h diff --git a/level_3/iki_write/c/main/common-type.c b/level_3/iki_write/c/main/common/type.c similarity index 76% rename from level_3/iki_write/c/main/common-type.c rename to level_3/iki_write/c/main/common/type.c index 4bd708c..192b528 100644 --- a/level_3/iki_write/c/main/common-type.c +++ b/level_3/iki_write/c/main/common/type.c @@ -1,4 +1,4 @@ -#include "iki_write.h" +#include "../iki_write.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/iki_write/c/main/common-type.h b/level_3/iki_write/c/main/common/type.h similarity index 81% rename from level_3/iki_write/c/main/common-type.h rename to level_3/iki_write/c/main/common/type.h index 7bcac47..03efbb0 100644 --- a/level_3/iki_write/c/main/common-type.h +++ b/level_3/iki_write/c/main/common/type.h @@ -18,33 +18,44 @@ extern "C" { /** * The program defines. + * + * iki_write_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_iki_write_d_ - #define iki_write_signal_check_d 20000 + #define iki_write_allocation_console_d 4 + #define iki_write_allocation_large_d 256 + #define iki_write_allocation_small_d 16 + #define iki_write_signal_check_d 20000 #endif // _di_iki_write_d_ /** * Flags passed to the main function or program. * * iki_write_main_flag_*_e: - * - none: No flags set. - * - content: The Content being written is specified. - * - copyright: Print copyright. - * - file_to: Using a specified destination file. - * - help: Print help. - * - object: The Object being written is specified. - * - version: Print version. + * - none: No flags set. + * - content: The Content being written is specified. + * - copyright: Print copyright. + * - file_to: Using a specified destination file. + * - help: Print help. + * - object: The Object being written is specified. + * - print_first: When set, the first character printing logic is to be processed (this is usually automatic). + * - version: Print version. */ #ifndef _di_iki_write_main_flag_e_ enum { - iki_write_main_flag_none_e = 0x0, - iki_write_main_flag_content_e = 0x1, - iki_write_main_flag_copyright_e = 0x2, - iki_write_main_flag_file_to_e = 0x4, - iki_write_main_flag_help_e = 0x8, - iki_write_main_flag_object_e = 0x10, - iki_write_main_flag_version_e = 0x20, - }; + iki_write_main_flag_none_e = 0x0, + iki_write_main_flag_content_e = 0x1, + iki_write_main_flag_copyright_e = 0x2, + iki_write_main_flag_file_to_e = 0x4, + iki_write_main_flag_help_e = 0x8, + iki_write_main_flag_object_e = 0x10, + iki_write_main_flag_print_first_e = 0x20, + iki_write_main_flag_version_e = 0x40, + }; // enum #endif // _di_iki_write_main_flag_e_ /** @@ -146,7 +157,7 @@ extern "C" { #define iki_write_setting_t_initialize \ { \ - iki_write_main_flag_none_e, \ + iki_write_main_flag_print_first_e, \ f_state_t_initialize, \ f_string_static_t_initialize, \ f_string_static_t_initialize, \ diff --git a/level_3/iki_write/c/main/iki_write.c b/level_3/iki_write/c/main/iki_write.c index 77fc5a4..7db81cf 100644 --- a/level_3/iki_write/c/main/iki_write.c +++ b/level_3/iki_write/c/main/iki_write.c @@ -1,6 +1,4 @@ #include "iki_write.h" -#include "private-common.h" -#include "private-write.h" #ifdef __cplusplus extern "C" { @@ -12,7 +10,7 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - iki_write_print_line_last_locked(setting, main->error); + iki_write_print_line_last(setting, main->message); return; } @@ -37,6 +35,10 @@ extern "C" { return; } + if (main->message.verbosity > f_console_verbosity_error_e) { + iki_write_print_line_first(setting, main->message); + } + setting->escaped.used = 0; if (main->pipe & fll_program_data_pipe_input_e) { @@ -74,6 +76,7 @@ extern "C" { setting->state.status = F_status_set_error(F_pipe); iki_write_print_error_file(setting, main->error, macro_iki_write_f(f_file_read), f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e); + iki_write_print_line_last(setting, main->message); return; } @@ -81,9 +84,8 @@ extern "C" { if (!setting->buffer.used) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_pipe_missing_content(main->error); - iki_write_print_line_last_locked(setting, main->error); + iki_write_print_line_last(setting, main->message); return; } @@ -107,9 +109,8 @@ extern "C" { if (object_ended && previous == range.start) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_pipe_invalid_form_feed(main->error); - iki_write_print_line_last_locked(setting, main->error); + iki_write_print_line_last(setting, main->message); return; } @@ -166,9 +167,8 @@ extern "C" { if (object_ended) { setting->state.status = F_status_set_error(F_parameter); - iki_write_print_line_first_locked(setting, main->error); fll_program_print_error_pipe_object_without_content(main->error); - iki_write_print_line_last_locked(setting, main->error); + iki_write_print_line_last(setting, main->message); return; } @@ -192,8 +192,8 @@ extern "C" { fll_print_dynamic_raw(f_string_eol_s, main->output.to); } // for - if (F_status_is_error(setting->state.status)) { - iki_write_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error); + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + iki_write_print_line_last(setting, main->message); } } #endif // _di_iki_write_main_ diff --git a/level_3/iki_write/c/main/iki_write.h b/level_3/iki_write/c/main/iki_write.h index 68e4f63..c92613a 100644 --- a/level_3/iki_write/c/main/iki_write.h +++ b/level_3/iki_write/c/main/iki_write.h @@ -51,11 +51,13 @@ #include // IKI Write includes. -#include -#include -#include +#include +#include +#include #include #include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/iki_write/c/main/main.c b/level_3/iki_write/c/main/main.c index b4dfcf8..bb00457 100644 --- a/level_3/iki_write/c/main/main.c +++ b/level_3/iki_write/c/main/main.c @@ -30,5 +30,5 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_standard_set_down(&data); - return F_status_is_error(setting.status) ? 1 : 0; + return F_status_is_error(setting.state.status) ? 1 : 0; } diff --git a/level_3/iki_write/c/main/print-error.c b/level_3/iki_write/c/main/print-error.c new file mode 100644 index 0000000..9df61bf --- /dev/null +++ b/level_3/iki_write/c/main/print-error.c @@ -0,0 +1,72 @@ +#include "iki_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_iki_write_print_error_ + f_status_t iki_write_print_error(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + + return F_none; + } +#endif // _di_iki_write_print_error_ + +#ifndef _di_iki_write_print_error_file_ + f_status_t iki_write_print_error_file(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + iki_write_print_line_first(setting, print); + fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); + + return F_none; + } +#endif // _di_iki_write_print_error_file_ + +#ifndef _di_iki_write_print_error_main_missing_ + f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QNo main provided, either pipe the main data or use the '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_write_long_object_s, print.set->notable); + fl_print_format("%[' and the '%]", print.to, print.set->error, print.set->error); + fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_write_long_content_s, print.set->notable); + fl_print_format("%[' parameters.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_iki_write_print_error_main_missing_ + +#ifndef _di_iki_write_print_error_object_not_valid_ + f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QThe object '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%Q%]", print.to, print.set->notable, object, print.set->notable); + fl_print_format("%[' is not a valid IKI Object.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_iki_write_print_error_object_not_valid_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/iki_write/c/main/print-error.h b/level_3/iki_write/c/main/print-error.h new file mode 100644 index 0000000..1cf70b1 --- /dev/null +++ b/level_3/iki_write/c/main/print-error.h @@ -0,0 +1,118 @@ +/** + * FLL - Level 3 + * + * Project: UTF8 + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print error functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _iki_write_print_error_h +#define _iki_write_print_error_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print generic error message regarding a function failing in some way. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fll_error_print() + */ +#ifndef _di_iki_write_print_error_ + extern f_status_t iki_write_print_error(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function); +#endif // _di_iki_write_print_error_ + +/** + * Print file related error or warning messages. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates how printing is to be performed. + * @param function + * The name of the function where the error happened. + * Set to 0 to disable. + * @param name + * The name of the file or directory. + * @param operation + * The operation that fails, such as 'create' or 'access'. + * @param type + * A valid file type code from the fll_error_file_type enum. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fll_error_file_print() + */ +#ifndef _di_iki_write_print_error_file_ + extern f_status_t iki_write_print_error_file(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); +#endif // _di_iki_write_print_error_file_ + +/** + * Print error message about "main" Object being missing. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + */ +#ifndef _di_iki_write_print_error_main_missing_ + extern f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_error_main_missing_ + +/** + * Print error message about an Object not being valid. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * @param object + * The a string representing the object that is missing. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + */ +#ifndef _di_iki_write_print_error_object_not_valid_ + extern f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object); +#endif // _di_iki_write_print_error_object_not_valid_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _iki_write_print_error_h diff --git a/level_3/iki_write/c/main/print.c b/level_3/iki_write/c/main/print.c index 6cfc8ea..3af6e4d 100644 --- a/level_3/iki_write/c/main/print.c +++ b/level_3/iki_write/c/main/print.c @@ -1,75 +1,14 @@ #include "iki_write.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_iki_write_print_error_ - f_status_t iki_write_print_error(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - iki_write_print_line_first_locked(setting, print); - fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); - - return F_none; - } -#endif // _di_iki_write_print_error_ - -#ifndef _di_iki_write_print_error_file_ - f_status_t iki_write_print_error_file(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - iki_write_print_line_first_locked(setting, print); - fll_error_file_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e, name, operation, type); - - return F_none; - } -#endif // _di_iki_write_print_error_file_ - -#ifndef _di_iki_write_print_error_main_missing_ - f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - f_file_stream_lock(print.to); - - fl_print_format("%[%QNo main provided, either pipe the main data or use the '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_write_long_object_s, print.set->notable); - fl_print_format("%[' and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, iki_write_long_content_s, print.set->notable); - fl_print_format("%[' parameters.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_iki_write_print_error_main_missing_ - -#ifndef _di_iki_write_print_error_object_not_valid_ - f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object) { - - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - f_file_stream_lock(print.to); - - iki_write_print_line_first_unlocked(setting, print); - - fl_print_format("%[%QThe object '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%]", print.to, print.set->notable, object, print.set->notable); - fl_print_format("%[' is not a valid IKI Object.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_iki_write_print_error_object_not_valid_ - #ifndef _di_iki_write_print_help_ f_status_t iki_write_print_help(iki_write_setting_t * const setting, const fl_print_t print) { + if (!setting) return F_status_set_error(F_output_not); + f_file_stream_lock(print.to); f_print_dynamic_raw(setting->line_first, print.to); @@ -120,40 +59,31 @@ extern "C" { } #endif // _di_iki_write_print_help_ -#ifndef _di_iki_write_print_line_first_locked_ - f_status_t iki_write_print_line_first_locked(iki_write_setting_t * const setting, const fl_print_t print) { +#ifndef _di_iki_write_print_line_first_ + f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; if (F_status_is_error_not(setting->state.status)) { if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; } - f_print_dynamic_raw(setting->line_first, print.to); - - return F_none; - } -#endif // _di_iki_write_print_line_first_locked_ - -#ifndef _di_iki_write_print_line_first_unlocked_ - f_status_t iki_write_print_line_first_unlocked(iki_write_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (setting->flag & iki_write_main_flag_print_first_e) { + fll_print_dynamic_raw(setting->line_first, print.to); - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + setting->flag -= iki_write_main_flag_print_first_e; } - fll_print_dynamic_raw(setting->line_first, print.to); - return F_none; } -#endif // _di_iki_write_print_line_first_unlocked_ +#endif // _di_iki_write_print_line_first_ -#ifndef _di_iki_write_print_line_last_locked_ - f_status_t iki_write_print_line_last_locked(iki_write_setting_t * const setting, const fl_print_t print) { +#ifndef _di_iki_write_print_line_last_ + f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print) { - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; if (F_status_is_error_not(setting->state.status)) { if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; @@ -163,22 +93,7 @@ extern "C" { return F_none; } -#endif // _di_iki_write_print_line_last_locked_ - -#ifndef _di_iki_write_print_line_last_unlocked_ - f_status_t iki_write_print_line_last_unlocked(iki_write_setting_t * const setting, const fl_print_t print) { - - if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not; - - if (F_status_is_error_not(setting->state.status)) { - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - } - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_iki_write_print_line_last_unlocked_ +#endif // _di_iki_write_print_line_last_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_write/c/main/print.h b/level_3/iki_write/c/main/print.h index 2793706..2b1c3c3 100644 --- a/level_3/iki_write/c/main/print.h +++ b/level_3/iki_write/c/main/print.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _iki_write_print_h #define _iki_write_print_h @@ -13,93 +17,6 @@ extern "C" { #endif /** - * Print generic error message regarding a function failing in some way. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_error_print() - */ -#ifndef _di_iki_write_print_error_ - extern f_status_t iki_write_print_error(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function); -#endif // _di_iki_write_print_error_ - -/** - * Print file related error or warning messages. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates how printing is to be performed. - * @param function - * The name of the function where the error happened. - * Set to 0 to disable. - * @param name - * The name of the file or directory. - * @param operation - * The operation that fails, such as 'create' or 'access'. - * @param type - * A valid file type code from the fll_error_file_type enum. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * @see fll_error_file_print() - */ -#ifndef _di_iki_write_print_error_file_ - extern f_status_t iki_write_print_error_file(iki_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type); -#endif // _di_iki_write_print_error_file_ - -/** - * Print error message about "main" Object being missing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_iki_write_print_error_main_missing_ - extern f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_error_main_missing_ - -/** - * Print error message about an Object not being valid. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * @param object - * The a string representing the object that is missing. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - */ -#ifndef _di_iki_write_print_error_object_not_valid_ - extern f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object); -#endif // _di_iki_write_print_error_object_not_valid_ - -/** * Print help. * * @param setting @@ -112,6 +29,8 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. */ #ifndef _di_iki_write_print_help_ extern f_status_t iki_write_print_help(iki_write_setting_t * const setting, const fl_print_t print); @@ -134,32 +53,12 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. - */ -#ifndef _di_iki_write_print_line_first_locked_ - extern f_status_t iki_write_print_line_first_locked(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. + * F_output_not (with error bit) if setting is NULL. */ -#ifndef _di_iki_write_print_line_first_unlocked_ - extern f_status_t iki_write_print_line_first_unlocked(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_line_first_unlocked_ +#ifndef _di_iki_write_print_line_first_ + extern f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_line_first_ /** * Print last new line when the main is complete, unless verbosity says otherwise. @@ -178,32 +77,12 @@ extern "C" { * @return * F_none on success. * F_output_not on success, but no printing is performed. - */ -#ifndef _di_iki_write_print_line_last_locked_ - extern f_status_t iki_write_print_line_last_locked(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. + * F_output_not (with error bit) if setting is NULL. */ -#ifndef _di_iki_write_print_line_last_unlocked_ - extern f_status_t iki_write_print_line_last_unlocked(iki_write_setting_t * const setting, const fl_print_t print); -#endif // _di_iki_write_print_line_last_unlocked_ +#ifndef _di_iki_write_print_line_last_ + extern f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print); +#endif // _di_iki_write_print_line_last_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/iki_write/c/main/private-common.c b/level_3/iki_write/c/main/private-common.c deleted file mode 100644 index f860d81..0000000 --- a/level_3/iki_write/c/main/private-common.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "iki_write.h" -#include "private-common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/iki_write/c/main/private-common.h b/level_3/iki_write/c/main/private-common.h deleted file mode 100644 index b84006a..0000000 --- a/level_3/iki_write/c/main/private-common.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: IKI Write - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_common_h -#define _PRIVATE_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Provide common/generic definitions. - * - * iki_write_common_allocation_*: - * - large: An allocation step used for buffers that are anticipated to have large buffers. - * - small: An allocation step used for buffers that are anticipated to have small buffers. - */ -#ifndef _di_iki_write_common_ - #define iki_write_common_allocation_large_d 256 - #define iki_write_common_allocation_small_d 16 -#endif // _di_iki_write_common_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/iki_write/c/main/private-write.c b/level_3/iki_write/c/main/process.c similarity index 81% rename from level_3/iki_write/c/main/private-write.c rename to level_3/iki_write/c/main/process.c index 9c77471..ef7d6b8 100644 --- a/level_3/iki_write/c/main/private-write.c +++ b/level_3/iki_write/c/main/process.c @@ -1,6 +1,4 @@ #include "iki_write.h" -#include "private-common.h" -#include "private-write.h" #ifdef __cplusplus extern "C" { @@ -12,10 +10,7 @@ extern "C" { if (!object.used) { setting->state.status = F_status_set_error(F_failure); - if (main->error.verbosity != f_console_verbosity_quiet_e) { - iki_write_print_line_first_locked(setting, main->error); - fll_program_print_error_missing_variable_not_zero(main->error, iki_write_object_s); - } + fll_program_print_error_missing_variable_not_zero(main->error, iki_write_object_s); return; } @@ -25,12 +20,14 @@ extern "C" { if (setting->state.status == F_false) { setting->state.status = F_status_set_error(F_failure); + iki_write_print_line_first(setting, main->message); iki_write_print_error_object_not_valid(setting, main->error, object); return; } if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(f_iki_object_is)); return; @@ -41,6 +38,7 @@ extern "C" { setting->state.status = fll_iki_content_escape(content, setting->quote, &setting->escaped); if (F_status_is_error(setting->state.status)) { + iki_write_print_line_first(setting, main->message); iki_write_print_error(setting, main->error, macro_iki_write_f(fll_iki_content_escape)); return; diff --git a/level_3/iki_write/c/main/private-write.h b/level_3/iki_write/c/main/process.h similarity index 82% rename from level_3/iki_write/c/main/private-write.h rename to level_3/iki_write/c/main/process.h index ee23ec1..0c04d4b 100644 --- a/level_3/iki_write/c/main/private-write.h +++ b/level_3/iki_write/c/main/process.h @@ -4,9 +4,13 @@ * Project: IKI * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the process functionality. + * + * This is auto-included and should not need to be explicitly included. */ -#ifndef _PRIVATE_write_h -#define _PRIVATE_write_h +#ifndef _PRIVATE_write_process_h +#define _PRIVATE_write_process_h #ifdef __cplusplus extern "C" { @@ -43,4 +47,4 @@ extern "C" { } // extern "C" #endif -#endif // _PRIVATE_write_h +#endif // _PRIVATE_write_process_h diff --git a/level_3/iki_write/data/build/settings b/level_3/iki_write/data/build/settings index 9e31df8..785ea5d 100644 --- a/level_3/iki_write/data/build/settings +++ b/level_3/iki_write/data/build/settings @@ -21,11 +21,11 @@ build_libraries-individual -lfll_error -lfll_iki -lfll_print -lfll_program -lfl_ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/iki_write.c main/common.c main/common-print.c main/common-string.c main/common-type.c main/print.c main/private-common.c main/private-write.c +build_sources_library main/iki_write.c main/common.c main/common/print.c main/common/string.c main/common/type.c main/print.c main/print-error.c main/process.c build_sources_program main/main.c -build_sources_headers main/iki_write.h main/common.h main/common-print.h main/common-string.h main/common-type.h main/print.h +build_sources_headers main/iki_write.h main/common.h main/common/print.h main/common/string.h main/common/type.h main/print.h main/print-error.h main/process.h build_sources_documentation man diff --git a/level_3/status_code/c/fss/print.h b/level_3/status_code/c/fss/print.h index e017c11..8f52550 100644 --- a/level_3/status_code/c/fss/print.h +++ b/level_3/status_code/c/fss/print.h @@ -4,6 +4,10 @@ * Project: Status Code * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _status_code_fss_print_h #define _status_code_fss_print_h diff --git a/level_3/status_code/c/fss/status_code.h b/level_3/status_code/c/fss/status_code.h index d49be4e..48ae7f0 100644 --- a/level_3/status_code/c/fss/status_code.h +++ b/level_3/status_code/c/fss/status_code.h @@ -49,6 +49,7 @@ #include #include #include +#include #include #include diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index 6fcb6ee..151417d 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -18,8 +18,12 @@ extern "C" { if (!main || !setting) return; + setting->state.step_small = status_code_allocation_console_d; + f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = status_code_allocation_small_d; + if (F_status_is_error(setting->state.status)) { status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process)); @@ -117,7 +121,7 @@ extern "C" { if (!(setting->flag & status_code_main_flag_number_e)) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first_locked(setting, main->error); + status_code_print_line_first(setting, main->message); status_code_print_error_cannot_error_warning_number(setting, main->error); return; @@ -127,7 +131,7 @@ extern "C" { if (setting->flag & status_code_main_flag_fine_e) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first_locked(setting, main->error); + status_code_print_line_first(setting, main->message); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_error_s, status_code_long_fine_s); return; @@ -136,7 +140,7 @@ extern "C" { else if (setting->flag & status_code_main_flag_warning_e && setting->flag & status_code_main_flag_fine_e) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first_locked(setting, main->error); + status_code_print_line_first(setting, main->message); fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, status_code_long_warning_s, status_code_long_fine_s); return; @@ -145,7 +149,7 @@ extern "C" { if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) { setting->state.status = F_status_set_error(F_parameter); - status_code_print_line_first_locked(setting, main->error); + status_code_print_line_first(setting, main->message); status_code_print_error_no_status_codes(setting, main->error); return; diff --git a/level_3/status_code/c/main/common/type.h b/level_3/status_code/c/main/common/type.h index 5f7778d..cae4619 100644 --- a/level_3/status_code/c/main/common/type.h +++ b/level_3/status_code/c/main/common/type.h @@ -19,13 +19,22 @@ extern "C" { /** * The program defines. * + * status_code_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. + * * macro_status_code_setting: * - Used to represent a cast to ((status_code_setting_t *) setting). * - Simplifies the number of parenthesis used to make code slightly cleaner. * - Is wrapped in a parenthesis and not a block. */ #ifndef _di_status_code_d_ - #define status_code_signal_check_d 20000 + #define status_code_allocation_console_d 4 + #define status_code_allocation_large_d 256 + #define status_code_allocation_small_d 16 + #define status_code_signal_check_d 20000 #define macro_status_code_setting(setting) ((status_code_setting_t *) setting) #endif // _di_status_code_d_ diff --git a/level_3/status_code/c/main/convert.c b/level_3/status_code/c/main/convert.c index 0706086..2a45068 100644 --- a/level_3/status_code/c/main/convert.c +++ b/level_3/status_code/c/main/convert.c @@ -12,9 +12,7 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, number); if (*number > F_status_size_max_with_bits_d) { - status_code_print_line_first_data(setting, main->message); - - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_out_of_range_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_out_of_range_s); setting->state.status = F_status_set_error(F_number_overflow); @@ -22,13 +20,11 @@ extern "C" { } if (F_status_is_error(setting->state.status)) { - status_code_print_line_first_data(setting, main->message); - if (F_status_set_fine(setting->state.status) == F_number_negative) { - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_out_of_range_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_out_of_range_s); } else { - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_invalid_number_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_invalid_number_s); } } else { diff --git a/level_3/status_code/c/main/convert.h b/level_3/status_code/c/main/convert.h index b11219b..51a1428 100644 --- a/level_3/status_code/c/main/convert.h +++ b/level_3/status_code/c/main/convert.h @@ -4,6 +4,10 @@ * Project: Status Code * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the convert functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _PRIVATE_status_code_convert_h #define _PRIVATE_status_code_convert_h diff --git a/level_3/status_code/c/main/print-data.c b/level_3/status_code/c/main/print-data.c new file mode 100644 index 0000000..1e95f30 --- /dev/null +++ b/level_3/status_code/c/main/print-data.c @@ -0,0 +1,33 @@ +#include "status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_status_code_print_data_code_ + f_status_t status_code_print_data_code(status_code_setting_t * const setting, const fl_print_t print, const uint16_t code) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + + fll_print_format("%ui%r", print.to, code, f_string_eol_s); + + return F_none; + } +#endif // _di_status_code_print_data_code_ + +#ifndef _di_status_code_print_data_context_value_ + f_status_t status_code_print_data_context_value(status_code_setting_t * const setting, const fl_print_t print, const f_color_set_t context, const f_string_static_t value) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + + fll_print_format("%[%Q%]%r", print.to, context, value, context, f_string_eol_s); + + return F_none; + } +#endif // _di_status_code_print_data_context_value_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/status_code/c/main/print-data.h b/level_3/status_code/c/main/print-data.h new file mode 100644 index 0000000..4f3cae3 --- /dev/null +++ b/level_3/status_code/c/main/print-data.h @@ -0,0 +1,73 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print data functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _status_code_print_data_h +#define _status_code_print_data_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print generic code. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * @param code + * The code to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fll_print_format() + */ +#ifndef _di_status_code_print_data_code_ + extern f_status_t status_code_print_data_code(status_code_setting_t * const setting, const fl_print_t print, const uint16_t code); +#endif // _di_status_code_print_data_code_ + +/** + * Print generic context wrapped value. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * @param context + * The context string to wrap the variable with. + * @param value + * The value string. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fll_print_format() + */ +#ifndef _di_status_code_print_data_context_value_ + extern f_status_t status_code_print_data_context_value(status_code_setting_t * const setting, const fl_print_t print, const f_color_set_t context, const f_string_static_t value); +#endif // _di_status_code_print_data_context_value_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_print_data_h diff --git a/level_3/status_code/c/main/print-error.c b/level_3/status_code/c/main/print-error.c index e69de29..8421d78 100644 --- a/level_3/status_code/c/main/print-error.c +++ b/level_3/status_code/c/main/print-error.c @@ -0,0 +1,74 @@ +#include "status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_status_code_print_error_ + f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + status_code_print_line_first(setting, print); + fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); + + return F_none; + } +#endif // _di_status_code_print_error_ + +#ifndef _di_status_code_print_error_cannot_error_warning_number_ + f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QCannot specify the '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_error_s, print.notable); + fl_print_format("%[' parameter with the '%]", print.to, print.context, print.context); + fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_warning_s, print.notable); + fl_print_format("%[' parameter when not also specifying the '%]", print.to, print.context, print.context); + fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_number_s, print.notable); + fl_print_format("%[' parameter.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_status_code_print_error_cannot_error_warning_number_ + +#ifndef _di_status_code_print_error_no_status_codes_ + f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + fll_print_format("%[No status code is specified.%]%r", print.to, print.context, print.context, f_string_eol_s); + + return F_none; + } +#endif // _di_status_code_print_error_no_status_codes_ + +#ifndef _di_status_code_print_error_invalid_callback_ + f_status_t status_code_print_error_invalid_callback(status_code_setting_t * const setting, const fl_print_t print, const f_string_t name) { + + if (!setting) return F_status_set_error(F_output_not); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QInvalid callback specified for '%]", print.to, print.context, print.prefix, print.context); + fl_print_format("%[%s%]", print.to, print.notable, name, print.notable); + fl_print_format("%[' internal setting.%]%r", print.to, print.context, print.context, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_status_code_print_error_invalid_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/status_code/c/main/print-error.h b/level_3/status_code/c/main/print-error.h index e69de29..b3af5a5 100644 --- a/level_3/status_code/c/main/print-error.h +++ b/level_3/status_code/c/main/print-error.h @@ -0,0 +1,120 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the print error functionality. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _status_code_print_error_h +#define _status_code_print_error_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print generic error message regarding a function failing in some way. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fll_error_print() + * + * @see status_code_print_line_first() + */ +#ifndef _di_status_code_print_error_ + extern f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function); +#endif // _di_status_code_print_error_ + +/** + * Print an error message when error parameter and warning parameter are specified without number parameter. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + */ +#ifndef _di_status_code_print_error_cannot_error_warning_number_ + extern f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_error_cannot_error_warning_number_ + +/** + * Print an error message when no status codes are provided. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see fll_print_format() + */ +#ifndef _di_status_code_print_error_no_status_codes_ + extern f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_error_no_status_codes_ + +/** + * Print an error message when a callback from status_code_setting_t is invalid. + * + * @param setting + * The main program settings. + * + * This does not alter setting.state.status. + * @param print + * Designates the how and where to print. + * @param name + * The name of the callback setting that is invalid. + * This should either be 'status_string_from' or 'status_string_to'. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + * + * F_output_not (with error bit) if setting is NULL. + * + * @see f_file_stream_lock() + * @see f_file_stream_unlock() + * @see fl_print_format() + */ +#ifndef _di_status_code_print_error_invalid_callback_ + extern f_status_t status_code_print_error_invalid_callback(status_code_setting_t * const setting, const fl_print_t print, const f_string_t name); +#endif // _di_status_code_print_error_invalid_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_print_error_h diff --git a/level_3/status_code/c/main/print.c b/level_3/status_code/c/main/print.c index abf1ce0..828f248 100644 --- a/level_3/status_code/c/main/print.c +++ b/level_3/status_code/c/main/print.c @@ -4,95 +4,6 @@ extern "C" { #endif -#ifndef _di_status_code_print_code_ - f_status_t status_code_print_code(status_code_setting_t * const setting, const fl_print_t print, const uint16_t code) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - - fll_print_format("%ui%r", print.to, code, f_string_eol_s); - - return F_none; - } -#endif // _di_status_code_print_code_ - -#ifndef _di_status_code_print_context_value_ - f_status_t status_code_print_context_value(status_code_setting_t * const setting, const fl_print_t print, const f_color_set_t context, const f_string_static_t value) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - - fll_print_format("%[%Q%]%r", print.to, context, value, context, f_string_eol_s); - - return F_none; - } -#endif // _di_status_code_print_context_value_ - -#ifndef _di_status_code_print_error_ - f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - status_code_print_line_first_locked(setting, print); - fll_error_print(print, F_status_set_fine(setting->state.status), function, fll_error_file_flag_fallback_e); - - return F_none; - } -#endif // _di_status_code_print_error_ - -#ifndef _di_status_code_print_error_cannot_error_warning_number_ - f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - f_file_stream_lock(print.to); - - fl_print_format("%[%QCannot specify the '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_error_s, print.notable); - fl_print_format("%[' parameter with the '%]", print.to, print.context, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_warning_s, print.notable); - fl_print_format("%[' parameter when not also specifying the '%]", print.to, print.context, print.context); - fl_print_format("%[%r%r%]", print.to, print.notable, f_console_symbol_long_normal_s, status_code_long_number_s, print.notable); - fl_print_format("%[' parameter.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_status_code_print_error_cannot_error_warning_number_ - -#ifndef _di_status_code_print_error_no_status_codes_ - f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - fll_print_format("%[No status code is specified.%]%r", print.to, print.context, print.context, f_string_eol_s); - - return F_none; - } -#endif // _di_status_code_print_error_no_status_codes_ - -#ifndef _di_status_code_print_error_invalid_callback_ - f_status_t status_code_print_error_invalid_callback(status_code_setting_t * const setting, const fl_print_t print, const f_string_t name) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - f_file_stream_lock(print.to); - - fl_print_format("%[%QInvalid callback specified for '%]", print.to, print.context, print.prefix, print.context); - fl_print_format("%[%s%]", print.to, print.notable, name, print.notable); - fl_print_format("%[' internal setting.%]%r", print.to, print.context, print.context, f_string_eol_s); - - f_file_stream_unlock(print.to); - - return F_none; - } -#endif // _di_status_code_print_error_invalid_callback_ - #ifndef _di_status_code_print_help_ f_status_t status_code_print_help(status_code_setting_t * const setting, const fl_print_t print) { @@ -166,83 +77,41 @@ extern "C" { } #endif // _di_status_code_print_help_detail_ -#ifndef _di_status_code_print_line_first_data_ - f_status_t status_code_print_line_first_data(status_code_setting_t * const setting, const fl_print_t print) { +#ifndef _di_status_code_print_line_first_ + f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print) { if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; - - if (setting->flag & status_code_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); + if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - setting->flag -= status_code_main_flag_print_first_e; + if (F_status_is_error_not(setting->state.status)) { + if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; } - return F_none; - } -#endif // _di_status_code_print_line_first_data_ - -#ifndef _di_status_code_print_line_first_locked_ - f_status_t status_code_print_line_first_locked(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & status_code_main_flag_print_first_e) { fll_print_dynamic_raw(setting->line_first, print.to); setting->flag -= status_code_main_flag_print_first_e; } - else { - fll_print_dynamic_raw(f_string_eol_s, print.to); - } return F_none; } -#endif // _di_status_code_print_line_first_locked_ +#endif // _di_status_code_print_line_first_ -#ifndef _di_status_code_print_line_first_unlocked_ - f_status_t status_code_print_line_first_unlocked(status_code_setting_t * const setting, const fl_print_t print) { +#ifndef _di_status_code_print_line_last_ + f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print) { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - if (setting->flag & status_code_main_flag_print_first_e) { - fll_print_dynamic_raw(setting->line_first, print.to); - - setting->flag -= status_code_main_flag_print_first_e; - } - else { - fll_print_dynamic_raw(f_string_eol_s, print.to); + if (F_status_is_error_not(setting->state.status)) { + if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; } - return F_none; - } -#endif // _di_status_code_print_line_first_unlocked_ - -#ifndef _di_status_code_print_line_last_locked_ - f_status_t status_code_print_line_last_locked(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - fll_print_dynamic_raw(setting->line_last, print.to); return F_none; } -#endif // _di_status_code_print_line_last_locked_ - -#ifndef _di_status_code_print_line_last_unlocked_ - f_status_t status_code_print_line_last_unlocked(status_code_setting_t * const setting, const fl_print_t print) { - - if (!setting) return F_status_set_error(F_output_not); - if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - - f_print_dynamic_raw(setting->line_last, print.to); - - return F_none; - } -#endif // _di_status_code_print_line_last_unlocked_ +#endif // _di_status_code_print_line_last_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/status_code/c/main/print.h b/level_3/status_code/c/main/print.h index a746aa8..5a5a728 100644 --- a/level_3/status_code/c/main/print.h +++ b/level_3/status_code/c/main/print.h @@ -4,6 +4,10 @@ * Project: Status Code * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _status_code_print_h #define _status_code_print_h @@ -13,153 +17,6 @@ extern "C" { #endif /** - * Print generic code. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * @param code - * The code to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_format() - */ -#ifndef _di_status_code_print_code_ - f_status_t status_code_print_code(status_code_setting_t * const setting, const fl_print_t print, const uint16_t code); -#endif // _di_status_code_print_code_ - -/** - * Print generic context wrapped value. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * @param context - * The context string to wrap the variable with. - * @param value - * The value string. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_format() - */ -#ifndef _di_status_code_print_context_value_ - f_status_t status_code_print_context_value(status_code_setting_t * const setting, const fl_print_t print, const f_color_set_t context, const f_string_static_t value); -#endif // _di_status_code_print_context_value_ - -/** - * Print generic error message regarding a function failing in some way. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_error_print() - * - * @see status_code_print_line_first_locked() - */ -#ifndef _di_status_code_print_error_ - extern f_status_t status_code_print_error(status_code_setting_t * const setting, const fl_print_t print, const f_string_t function); -#endif // _di_status_code_print_error_ - -/** - * Print an error message when error parameter and warning parameter are specified without number parameter. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see fl_print_format() - */ -#ifndef _di_status_code_print_error_cannot_error_warning_number_ - extern f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_error_cannot_error_warning_number_ - -/** - * Print an error message when no status codes are provided. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_format() - */ -#ifndef _di_status_code_print_error_no_status_codes_ - extern f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_error_no_status_codes_ - -/** - * Print an error message when a callback from status_code_setting_t is invalid. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * @param name - * The name of the callback setting that is invalid. - * This should either be 'status_string_from' or 'status_string_to'. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see f_file_stream_lock() - * @see f_file_stream_unlock() - * @see fl_print_format() - */ -#ifndef _di_status_code_print_error_invalid_callback_ - extern f_status_t status_code_print_error_invalid_callback(status_code_setting_t * const setting, const fl_print_t print, const f_string_t name); -#endif // _di_status_code_print_error_invalid_callback_ - -/** * Print help. * * @param setting @@ -222,7 +79,6 @@ extern "C" { * Print first new line, if applicable, otherwise nothing. * * This is generally intended to be used before data prints. - * This should probably be printed to setting.message while data goes to setting.output. * * This ensures a first line is printed if the data is the first output to be performed. * @@ -241,61 +97,9 @@ extern "C" { * * @see fll_print_dynamic_raw() */ -#ifndef _di_status_code_print_line_first_data_ - extern f_status_t status_code_print_line_first_data(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_first_data_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function locks and then unlocks the input stream when printing. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_status_code_print_line_first_locked_ - extern f_status_t status_code_print_line_first_locked(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_first_locked_ - -/** - * Print first new line, unless verbosity says otherwise. - * - * This is generally either the first line in the program or the first line printed before an error message. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see fll_print_dynamic_raw() - */ -#ifndef _di_status_code_print_line_first_unlocked_ - extern f_status_t status_code_print_line_first_unlocked(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_first_unlocked_ +#ifndef _di_status_code_print_line_first_ + extern f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_line_first_ /** * Print last new line when the main is complete, unless verbosity says otherwise. @@ -319,34 +123,9 @@ extern "C" { * * @see fll_print_dynamic_raw() */ -#ifndef _di_status_code_print_line_last_locked_ - extern f_status_t status_code_print_line_last_locked(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_last_locked_ - -/** - * Print last new line when the main is complete, unless verbosity says otherwise. - * - * This is generally the very last line printed in the program. - * - * This function neither locks nor unlocks the input stream. - * - * @param setting - * The main program settings. - * This does not alter setting.state.status. - * @param print - * Designates the how and where to print. - * - * @return - * F_none on success. - * F_output_not on success, but no printing is performed. - * - * F_output_not (with error bit) if setting is NULL. - * - * @see f_print_dynamic_raw() - */ -#ifndef _di_status_code_print_line_last_unlocked_ - extern f_status_t status_code_print_line_last_unlocked(status_code_setting_t * const setting, const fl_print_t print); -#endif // _di_status_code_print_line_last_unlocked_ +#ifndef _di_status_code_print_line_last_ + extern f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print); +#endif // _di_status_code_print_line_last_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/status_code/c/main/process.c b/level_3/status_code/c/main/process.c index 1ee810e..9ec3269 100644 --- a/level_3/status_code/c/main/process.c +++ b/level_3/status_code/c/main/process.c @@ -18,8 +18,6 @@ extern "C" { f_file_stream_lock(main->output.to); - status_code_print_line_first_unlocked(setting, main->output); - if ((setting->flag & status_code_main_flag_error_e) && F_status_is_error(number) || (setting->flag & status_code_main_flag_warning_e) && F_status_is_warning(number) || (setting->flag & status_code_main_flag_fine_e) && F_status_is_fine(number)) { f_print_dynamic_raw(f_status_true_s, main->output.to); } @@ -46,9 +44,7 @@ extern "C" { setting->state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, value, &number); if (setting->state.status == F_none) { - status_code_print_line_first_data(setting, main->message); - - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_invalid_name_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_invalid_name_s); setting->state.status = F_status_set_error(F_parameter); @@ -56,9 +52,7 @@ extern "C" { } if (setting->state.status == F_data_not || F_status_set_fine(setting->state.status) == F_parameter) { - status_code_print_line_first_data(setting, main->message); - - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_invalid_main_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_invalid_main_s); return; } @@ -69,22 +63,18 @@ extern "C" { setting->state.status = setting->status_string_from(value, &code); if (F_status_is_error(setting->state.status)) { - status_code_print_line_first_data(setting, main->message); - if (F_status_set_fine(setting->state.status) == F_data) { - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_unknown_name_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_unknown_name_s); } else { - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_failed_to_convert_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_failed_to_convert_s); } return; } if (setting->state.status == F_data) { - status_code_print_line_first_data(setting, main->message); - - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_unknown_code_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_unknown_code_s); setting->state.status = F_none; @@ -99,9 +89,7 @@ extern "C" { code = F_status_set_warning(code); } - status_code_print_line_first_data(setting, main->message); - - status_code_print_code(setting, main->output, code); + status_code_print_data_code(setting, main->output, code); setting->state.status = F_none; } @@ -123,20 +111,18 @@ extern "C" { setting->state.status = setting->status_string_to((f_status_t) number, &name); } - status_code_print_line_first_data(setting, main->message); - if (F_status_is_error(setting->state.status)) { if (F_status_set_fine(setting->state.status) == F_data) { - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_unknown_code_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_unknown_code_s); } else { - status_code_print_context_value(setting, main->output, main->context.set.error, status_code_failed_to_convert_s); + status_code_print_data_context_value(setting, main->output, main->context.set.error, status_code_failed_to_convert_s); } return; } - status_code_print_context_value(setting, main->output, f_color_set_empty_s, name); + status_code_print_data_context_value(setting, main->output, f_color_set_empty_s, name); setting->state.status = F_none; } diff --git a/level_3/status_code/c/main/process.h b/level_3/status_code/c/main/process.h index daf2f9e..170895f 100644 --- a/level_3/status_code/c/main/process.h +++ b/level_3/status_code/c/main/process.h @@ -4,6 +4,10 @@ * Project: Status Code * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the process functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _PRIVATE_status_code_process_h #define _PRIVATE_status_code_process_h diff --git a/level_3/status_code/c/main/status_code.c b/level_3/status_code/c/main/status_code.c index e49f984..8a37857 100644 --- a/level_3/status_code/c/main/status_code.c +++ b/level_3/status_code/c/main/status_code.c @@ -10,7 +10,7 @@ extern "C" { if (!main || !setting) return; if (F_status_is_error(setting->state.status)) { - status_code_print_line_last_locked(setting, main->error); + status_code_print_line_last(setting, main->message); return; } @@ -50,6 +50,10 @@ extern "C" { return; } + if (main->message.verbosity > f_console_verbosity_error_e) { + status_code_print_line_first(setting, main->message); + } + f_status_t status = F_none; if (setting->flag & status_code_main_flag_number_e) { @@ -161,8 +165,8 @@ extern "C" { } } - if (F_status_is_error(setting->state.status)) { - status_code_print_line_last_locked(setting, F_status_set_fine(setting->state.status) == F_interrupt ? main->message : main->error); + if (F_status_is_error(setting->state.status) || main->message.verbosity > f_console_verbosity_error_e) { + status_code_print_line_last(setting, main->message); } } #endif // _di_status_code_main_ diff --git a/level_3/status_code/c/main/status_code.h b/level_3/status_code/c/main/status_code.h index 4271006..c5fb7d1 100644 --- a/level_3/status_code/c/main/status_code.h +++ b/level_3/status_code/c/main/status_code.h @@ -48,6 +48,7 @@ #include #include #include +#include #include #include diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index 784ee63..a661c6c 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -25,10 +25,10 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status_st build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library main/status_code.c main/common.c main/common/print.c main/common/string.c main/common/type.c main/convert.c main/print.c main/print-error.c main/process.c +build_sources_library main/status_code.c main/common.c main/common/print.c main/common/string.c main/common/type.c main/convert.c main/print.c main/print-data.c main/print-error.c main/process.c build_sources_library fss/status_code.c fss/common.c -build_sources_headers main/status_code.h main/common.h main/common/print.h main/common/string.h main/common/type.h main/convert.h main/print.h main/print-error.h main/process.h +build_sources_headers main/status_code.h main/common.h main/common/print.h main/common/string.h main/common/type.h main/convert.h main/print.h main/print-data.h main/print-error.h main/process.h build_sources_headers fss/status_code.h fss/common.h build_sources_documentation man diff --git a/level_3/utf8/c/main/bytesequence.h b/level_3/utf8/c/main/bytesequence.h index 194ded0..7e48f9d 100644 --- a/level_3/utf8/c/main/bytesequence.h +++ b/level_3/utf8/c/main/bytesequence.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the bytesequence functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _PRIVATE_utf8_bytesequence_h #define _PRIVATE_utf8_bytesequence_h diff --git a/level_3/utf8/c/main/codepoint.h b/level_3/utf8/c/main/codepoint.h index 45fa9fe..38fceb7 100644 --- a/level_3/utf8/c/main/codepoint.h +++ b/level_3/utf8/c/main/codepoint.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the codepoint functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _PRIVATE_utf8_codepoint_h #define _PRIVATE_utf8_codepoint_h diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index 5e55a3f..b8431b6 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -25,8 +25,12 @@ extern "C" { if (!main || !setting) return; + setting->state.step_small = utf8_allocation_console_d; + f_console_parameter_process(arguments, &main->parameters, &setting->state, 0); + setting->state.step_small = utf8_allocation_small_d; + if (F_status_is_error(setting->state.status)) { utf8_print_line_first(setting, main->message); utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process)); @@ -190,6 +194,7 @@ extern "C" { if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) { setting->state.status = F_status_set_error(F_parameter); + utf8_print_line_first(setting, main->message); utf8_print_error_parameter_file_to_too_many(setting, main->error); return; diff --git a/level_3/utf8/c/main/common/type.h b/level_3/utf8/c/main/common/type.h index 72297ed..4a2878e 100644 --- a/level_3/utf8/c/main/common/type.h +++ b/level_3/utf8/c/main/common/type.h @@ -25,9 +25,18 @@ extern "C" { /** * The program defines. + * + * utf8_*: + * - allocation_console: An allocation step used for small buffers specifically for console parameter. + * - allocation_large: An allocation step used for buffers that are anticipated to have large buffers. + * - allocation_small: An allocation step used for buffers that are anticipated to have small buffers. + * - signal_check: Number of iterations before performing signal check in non-threaded signal handling. */ #ifndef _di_utf8_d_ - #define utf8_signal_check_d 20000 + #define utf8_allocation_console_d 4 + #define utf8_allocation_large_d 256 + #define utf8_allocation_small_d 16 + #define utf8_signal_check_d 20000 #endif // _di_utf8_d_ /** diff --git a/level_3/utf8/c/main/print-data.c b/level_3/utf8/c/main/print-data.c index 13de283..ab7e2ce 100644 --- a/level_3/utf8/c/main/print-data.c +++ b/level_3/utf8/c/main/print-data.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_utf8_print_data_bytesequence_ f_status_t utf8_print_data_bytesequence(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); fl_print_format("%r%r%r", print.to, setting->prepend, sequence, setting->append); @@ -18,7 +18,7 @@ extern "C" { #ifndef _di_utf8_print_data_character_invalid_ f_status_t utf8_print_data_character_invalid(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t invalid) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; if (!invalid.used) return F_output_not; @@ -48,7 +48,7 @@ extern "C" { #ifndef _di_utf8_print_data_codepoint_ f_status_t utf8_print_data_codepoint(utf8_setting_t * const setting, const fl_print_t print, const uint32_t codepoint) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); if (codepoint < 0x10000) { fl_print_format("%rU+%04_U%r", print.to, setting->prepend, codepoint, setting->append); @@ -67,7 +67,7 @@ extern "C" { #ifndef _di_utf8_print_data_combining_or_width_ f_status_t utf8_print_data_combining_or_width(utf8_setting_t * const setting, const fl_print_t print, const f_string_static_t sequence) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); if (setting->mode & utf8_mode_to_combining_e) { f_status_t status = f_utf_is_combining(sequence.string, sequence.used); @@ -103,7 +103,7 @@ extern "C" { #ifndef _di_utf8_print_data_combining_or_width_invalid_ f_status_t utf8_print_data_combining_or_width_invalid(utf8_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not; fl_print_format("%r%[%r%]%r", print.to, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append); diff --git a/level_3/utf8/c/main/print-data.h b/level_3/utf8/c/main/print-data.h index c8e0663..1cab732 100644 --- a/level_3/utf8/c/main/print-data.h +++ b/level_3/utf8/c/main/print-data.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print data functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _utf8_print_data_h #define _utf8_print_data_h diff --git a/level_3/utf8/c/main/print-error.c b/level_3/utf8/c/main/print-error.c index 17fd254..bf1a341 100644 --- a/level_3/utf8/c/main/print-error.c +++ b/level_3/utf8/c/main/print-error.c @@ -143,8 +143,6 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; - utf8_print_line_first(setting, print); - fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", print.to, print.set->error, print.prefix, utf8_string_to_s, utf8_string_to_s, print.set->error, f_string_eol_s); return F_none; diff --git a/level_3/utf8/c/main/print-error.h b/level_3/utf8/c/main/print-error.h index 34ac5dc..293263a 100644 --- a/level_3/utf8/c/main/print-error.h +++ b/level_3/utf8/c/main/print-error.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print error functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _utf8_print_error_h #define _utf8_print_error_h @@ -207,8 +211,6 @@ extern "C" { * F_output_not (with error bit) if setting is NULL. * * @see fll_print_format() - * - * @see utf8_print_line_first() */ #ifndef _di_utf8_print_error_parameter_file_to_too_many_ extern f_status_t utf8_print_error_parameter_file_to_too_many(utf8_setting_t * const setting, const fl_print_t print); diff --git a/level_3/utf8/c/main/print.c b/level_3/utf8/c/main/print.c index e6c2e13..c007f3c 100644 --- a/level_3/utf8/c/main/print.c +++ b/level_3/utf8/c/main/print.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_utf8_print_help_ f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print) { - if (!setting) return F_output_not; + if (!setting) return F_status_set_error(F_output_not); f_file_stream_lock(print.to); @@ -69,6 +69,10 @@ extern "C" { if (!setting) return F_status_set_error(F_output_not); if (print.verbosity < f_console_verbosity_error_e) return F_output_not; + if (F_status_is_error_not(setting->state.status)) { + if (print.verbosity < f_console_verbosity_normal_e) return F_output_not; + } + if (setting->flag & utf8_main_flag_print_first_e) { fll_print_dynamic_raw(setting->line_first, print.to); diff --git a/level_3/utf8/c/main/print.h b/level_3/utf8/c/main/print.h index b0af6e3..95f4c9c 100644 --- a/level_3/utf8/c/main/print.h +++ b/level_3/utf8/c/main/print.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the print functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _utf8_print_h #define _utf8_print_h diff --git a/level_3/utf8/c/main/process.h b/level_3/utf8/c/main/process.h index 81db317..4918fe5 100644 --- a/level_3/utf8/c/main/process.h +++ b/level_3/utf8/c/main/process.h @@ -4,6 +4,10 @@ * Project: UTF8 * API Version: 0.7 * Licenses: lgpl-2.1-or-later + * + * Provides the process functionality. + * + * This is auto-included and should not need to be explicitly included. */ #ifndef _utf8_process_h #define _utf8_process_h diff --git a/level_3/utf8/c/main/utf8.c b/level_3/utf8/c/main/utf8.c index a6cb03f..31dca55 100644 --- a/level_3/utf8/c/main/utf8.c +++ b/level_3/utf8/c/main/utf8.c @@ -35,7 +35,9 @@ extern "C" { return; } - utf8_print_line_first(setting, main->message); + if (main->message.verbosity > f_console_verbosity_error_e) { + utf8_print_line_first(setting, main->message); + } f_status_t valid = F_true;