From: Kevin Day Date: Wed, 11 May 2022 05:38:37 +0000 (-0500) Subject: Update: Utilize the state.flag to allow for fss read to not fail out on invalid UTF... X-Git-Tag: 0.5.10~152 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=bdcbec45d5bec3fd926fdbf81ee02cc6c755dadc;p=fll Update: Utilize the state.flag to allow for fss read to not fail out on invalid UTF-8 code sequence and fix naming problems. One of the original goals of the FLL project is to achieve fail-through functionality. Knowing that this is a lot of work, I have ignored a lot of situations where I can implement fail-through and simply performed fail-out or fail-over. With the upcoming stable release, I believe that this must handle bad data files. This adds the option to conditionally change the behavior between fail-through and fail-out for the fss read functions and related for invalid UTF-8 code sequences. The default behavior is now changed from fail-out to fail-through. This took longer than I hoped. I will need to do additional reviewing of this code before the stable release is ready. I also realized that I need to support raw printing of data in the fss read functions as well (and that means changing the existing -r/--raw parameter). This also fixes the following naming problems: - fl_fss_apply_delimit() should be f_fss_apply_delimit(). - fl_fss_apply_delimit_between() should be fl_fss_apply_delimit_between(). --- diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index cf0dbcc..d66289c 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_fl_fss_apply_delimit_ - f_status_t fl_fss_apply_delimit(const f_fss_delimits_t delimits, f_string_static_t * const buffer) { +#ifndef _di_f_fss_apply_delimit_ + f_status_t f_fss_apply_delimit(f_state_t state, const f_fss_delimits_t delimits, f_string_static_t * const buffer) { #ifndef _di_level_0_parameter_checking_ if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -20,10 +20,10 @@ extern "C" { return F_none; } -#endif // _di_fl_fss_apply_delimit_ +#endif // _di_f_fss_apply_delimit_ -#ifndef _di_fl_fss_apply_delimit_between_ - f_status_t fl_fss_apply_delimit_between(const f_fss_delimits_t delimits, const f_string_range_t range, f_string_static_t * const buffer) { +#ifndef _di_f_fss_apply_delimit_between_ + f_status_t f_fss_apply_delimit_between(f_state_t state, const f_fss_delimits_t delimits, const f_string_range_t range, f_string_static_t * const buffer) { #ifndef _di_level_0_parameter_checking_ if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -37,10 +37,10 @@ extern "C" { return F_none; } -#endif // _di_fl_fss_apply_delimit_between_ +#endif // _di_f_fss_apply_delimit_between_ #ifndef _di_f_fss_count_lines_ - f_status_t f_fss_count_lines(const f_string_static_t buffer, const f_array_length_t before, f_array_length_t * const line) { + f_status_t f_fss_count_lines(f_state_t state, const f_string_static_t buffer, const f_array_length_t before, f_array_length_t * const line) { #ifndef _di_level_0_parameter_checking_ if (!line) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -65,7 +65,7 @@ extern "C" { #endif // _di_f_fss_count_lines_ #ifndef _di_f_fss_count_lines_range_ - f_status_t f_fss_count_lines_range(const f_string_static_t buffer, const f_string_range_t range, const f_array_length_t before, f_array_length_t * const line) { + f_status_t f_fss_count_lines_range(f_state_t state, const f_string_static_t buffer, const f_string_range_t range, const f_array_length_t before, f_array_length_t * const line) { #ifndef _di_level_0_parameter_checking_ if (!line) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -89,8 +89,38 @@ extern "C" { } #endif // _di_f_fss_count_lines_range_ +#ifndef _di_f_fss_do_fail_utf_ + f_status_t f_fss_fail_utf(f_state_t state, const f_status_t status) { + + if (F_status_is_error(status)) { + if (F_status_set_fine(status) == F_utf_fragment || F_status_set_fine(status) == F_complete_not_utf || F_status_set_fine(status) == F_utf) { + if (!(state.flag & f_fss_state_flag_utf_fail_on_valid_not_e)) { + return F_status_set_fine(status); + } + } + } + + return status; + } +#endif // _di_f_fss_fail_utf_ + +#ifndef _di_f_fss_do_fail_to_false_utf_ + f_status_t f_fss_fail_utf_to_false(f_state_t state, const f_status_t status) { + + if (F_status_is_error(status)) { + if (F_status_set_fine(status) == F_utf_fragment || F_status_set_fine(status) == F_complete_not_utf || F_status_set_fine(status) == F_utf) { + if (!(state.flag & f_fss_state_flag_utf_fail_on_valid_not_e)) { + return F_false; + } + } + } + + return status; + } +#endif // _di_f_fss_fail_utf_to_false_ + #ifndef _di_f_fss_is_graph_ - f_status_t f_fss_is_graph(const f_string_static_t buffer, const f_string_range_t range) { + f_status_t f_fss_is_graph(f_state_t state, const f_string_static_t buffer, const f_string_range_t range) { if (range.stop < range.start || range.start >= buffer.used || !buffer.used) { return F_false; @@ -102,12 +132,12 @@ extern "C" { width_max = buffer.used - range.start; } - return f_utf_is_graph(buffer.string + range.start, width_max); + return f_fss_fail_utf_to_false(state, f_utf_is_graph(buffer.string + range.start, width_max)); } #endif // _di_f_fss_is_graph_ #ifndef _di_f_fss_is_space_ - f_status_t f_fss_is_space(const f_string_static_t buffer, const f_string_range_t range) { + f_status_t f_fss_is_space(f_state_t state, const f_string_static_t buffer, const f_string_range_t range) { if (range.stop < range.start || range.start >= buffer.used || !buffer.used) { return F_false; @@ -119,7 +149,7 @@ extern "C" { width_max = buffer.used - range.start; } - f_status_t status = f_utf_is_zero_width(buffer.string + range.start, width_max); + f_status_t status = f_fss_fail_utf_to_false(state, f_utf_is_zero_width(buffer.string + range.start, width_max)); if (status != F_false) { if (status == F_true) { @@ -129,10 +159,10 @@ extern "C" { return status; } - status = f_utf_is_whitespace(buffer.string + range.start, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_whitespace(buffer.string + range.start, width_max)); if (status == F_false) { - return f_utf_is_control(buffer.string + range.start, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_control(buffer.string + range.start, width_max)); } return status; @@ -140,7 +170,7 @@ extern "C" { #endif // _di_f_fss_is_space_ #ifndef _di_f_fss_is_zero_width_ - f_status_t f_fss_is_zero_width(const f_string_static_t buffer, const f_string_range_t range) { + f_status_t f_fss_is_zero_width(f_state_t state, const f_string_static_t buffer, const f_string_range_t range) { if (range.stop < range.start || range.start >= buffer.used || !buffer.used) { return F_false; @@ -152,12 +182,12 @@ extern "C" { width_max = buffer.used - range.start; } - return f_utf_is_zero_width(buffer.string + range.start, width_max); + return f_fss_fail_utf_to_false(state, f_utf_is_zero_width(buffer.string + range.start, width_max)); } #endif // _di_f_fss_is_zero_width_ #ifndef _di_f_fss_seek_to_eol_ - f_status_t f_fss_seek_to_eol(const f_string_dynamic_t buffer, f_string_range_t * const range) { + f_status_t f_fss_seek_to_eol(f_state_t state, const f_string_dynamic_t buffer, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -174,7 +204,7 @@ extern "C" { #endif // _di_f_fss_seek_to_eol_ #ifndef _di_f_fss_shift_delimit_ - f_status_t f_fss_shift_delimit(const f_string_range_t range, f_string_dynamic_t * const buffer) { + f_status_t f_fss_shift_delimit(f_state_t state, const f_string_range_t range, f_string_dynamic_t * const buffer) { #ifndef _di_level_0_parameter_checking_ if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -196,7 +226,7 @@ extern "C" { ++distance; } - // do not waste time trying to process what is only going to be replaced with a delimit placeholder. + // Do not waste time trying to process what is only going to be replaced with a delimit placeholder. if (position + distance >= buffer->used || position + distance > range.stop) { break; } @@ -205,9 +235,9 @@ extern "C" { if (utf_width > 1) { - // not enough space in buffer or in range range to process UTF-8 character. + // Not enough space in buffer or in range range to process UTF-8 character. if (position + utf_width >= buffer->used || position + utf_width > range.stop) { - return F_status_set_error(F_utf); + return f_fss_fail_utf(state, F_status_set_error(F_utf)); } if (distance > 0) { @@ -221,7 +251,7 @@ extern "C" { } else { - // shift everything down one for each delimit placeholder found. + // Shift everything down one for each delimit placeholder found. if (distance > 0) { buffer->string[position] = buffer->string[position + distance]; } @@ -243,7 +273,7 @@ extern "C" { #endif // _di_f_fss_shift_delimit_ #ifndef _di_f_fss_skip_past_delimit_ - f_status_t f_fss_skip_past_delimit(const f_string_static_t buffer, f_string_range_t * const range) { + f_status_t f_fss_skip_past_delimit(f_state_t state, const f_string_static_t buffer, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -260,7 +290,7 @@ extern "C" { #endif // _di_f_fss_skip_past_delimit_ #ifndef _di_f_fss_skip_past_space_ - f_status_t f_fss_skip_past_space(const f_string_static_t buffer, f_string_range_t * const range) { + f_status_t f_fss_skip_past_space(f_state_t state, const f_string_static_t buffer, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -302,11 +332,11 @@ extern "C" { continue; } - status = f_utf_is_whitespace(buffer.string + range->start, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_whitespace(buffer.string + range->start, width_max)); if (F_status_is_error(status)) return status; if (status == F_false) { - status = f_utf_is_zero_width(buffer.string + range->start, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_zero_width(buffer.string + range->start, width_max)); if (F_status_is_error(status)) return status; if (status == F_false) { @@ -322,15 +352,15 @@ extern "C" { else if (width == 1) { // Do not operate on UTF-8 fragments that are not the first byte of the character. - return F_status_set_error(F_complete_not_utf); + return f_fss_fail_utf(state, F_status_set_error(F_complete_not_utf)); } else { if (range->start + width >= buffer.used) { - return F_status_set_error(F_complete_not_utf_eos); + return f_fss_fail_utf(state, F_status_set_error(F_complete_not_utf_eos)); } if (range->start + width > range->stop) { - return F_status_set_error(F_complete_not_utf_stop); + return f_fss_fail_utf(state, F_status_set_error(F_complete_not_utf_stop)); } } @@ -356,7 +386,7 @@ extern "C" { #endif // _di_f_fss_skip_past_space_ #ifndef _di_f_fss_skip_past_non_graph_ - f_status_t f_fss_skip_past_non_graph(const f_string_static_t buffer, f_string_range_t * const range) { + f_status_t f_fss_skip_past_non_graph(f_state_t state, const f_string_static_t buffer, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -382,44 +412,39 @@ extern "C" { for (;;) { if (buffer.string[range->start] != f_fss_delimit_placeholder_s.string[0]) { - status = f_utf_is_graph(buffer.string + range->start, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_graph(buffer.string + range->start, width_max)); if (status == F_true) { - // stop at a graph. + // Stop at a graph. break; } else if (status == F_false) { - status = f_utf_is_zero_width(buffer.string + range->start, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_zero_width(buffer.string + range->start, width_max)); if (status == F_true) { next = range->start + 1; for (; next < buffer.used && next <= range->stop; next += macro_f_utf_byte_width_is(buffer.string[next])) { - status = f_utf_is_graph(buffer.string + next, width_max); + status = f_fss_fail_utf_to_false(state, f_utf_is_graph(buffer.string + next, width_max)); if (status == F_true) { - // treat zero-width as a graph when preceding a graph. + // Treat zero-width as a graph when preceding a graph. return F_none; } - else if (status == F_false) { + + if (status == F_false) { status = f_utf_is_zero_width(buffer.string + next, width_max); - if (status == F_true) { + // Seek until a non-zero-width is reached. + if (status == F_true) continue; - // seek until a non-zero-width is reached. - continue; - } - else if (status == F_false) { + // Treat zero-width as a non-graph when preceding a non-graph (that is not a zero-width). + if (status == F_false) break; - // treat zero-width as a non-graph when preceding a non-graph (that is not a zero-width). - break; - } - else if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } else if (F_status_is_error(status)) { return status; @@ -428,7 +453,7 @@ extern "C" { } else if (status == F_false) { - // continue on when non-graph and non-zero-width. + // Continue on when non-graph and non-zero-width. break; } else if (F_status_is_error(status)) { @@ -448,15 +473,15 @@ extern "C" { else if (width == 1) { // Do not operate on UTF-8 fragments that are not the first byte of the character. - return F_status_set_error(F_complete_not_utf); + return f_fss_fail_utf(state, F_status_set_error(F_complete_not_utf)); } else { if (range->start + width >= buffer.used) { - return F_status_set_error(F_complete_not_utf_eos); + return f_fss_fail_utf(state, F_status_set_error(F_complete_not_utf_eos)); } if (range->start + width > range->stop) { - return F_status_set_error(F_complete_not_utf_stop); + return f_fss_fail_utf(state, F_status_set_error(F_complete_not_utf_stop)); } } diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index a95f446..ca2ab49 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -9,8 +9,6 @@ * * The purpose of compression is not to compression the entire file's contents but only and individual objects content, so the file is still partially readable. * NOTE: all start/stop locations must be defined as a (start < stop) and not (start <= stop), therefore if (start == stop) then stop. - * - * @todo identify all special UTF-8 characters that would violate the FSS design concepts, such as "Ogham space mark ( )" is not valid as whitespace in FSS because it is a visible non-whitespace character. */ #ifndef _F_fss_h #define _F_fss_h @@ -41,6 +39,8 @@ extern "C" { * * Any delimits out of range (beyond the buffer.used) are ignored. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param delimits * An array of locations containing the delimits to apply within the buffer. * @param buffer @@ -51,15 +51,17 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_fss_apply_delimit_ - extern f_status_t fl_fss_apply_delimit(const f_fss_delimits_t delimits, f_string_static_t * const buffer); -#endif // _di_fl_fss_apply_delimit_ +#ifndef _di_f_fss_apply_delimit_ + extern f_status_t f_fss_apply_delimit(f_state_t state, const f_fss_delimits_t delimits, f_string_static_t * const buffer); +#endif // _di_f_fss_apply_delimit_ /** * Replace all 1-byte character locations specified by the delimits within the given buffer by a delimit placeholder if within the given range. * * If the delimits are found to be (inclusively) within the range specified by range, then those delimits are applied. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param delimits * An array of locations containing the delimits to apply within the buffer. * @param range @@ -72,9 +74,9 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_fl_fss_apply_delimit_between_ - extern f_status_t fl_fss_apply_delimit_between(const f_fss_delimits_t delimits, const f_string_range_t range, f_string_static_t * const buffer); -#endif // _di_fl_fss_apply_delimit_between_ +#ifndef _di_f_fss_apply_delimit_between_ + extern f_status_t f_fss_apply_delimit_between(f_state_t state, const f_fss_delimits_t delimits, const f_string_range_t range, f_string_static_t * const buffer); +#endif // _di_f_fss_apply_delimit_between_ /** * Count the number of new lines from the buffer before the given location. @@ -83,6 +85,8 @@ extern "C" { * * This does not initialize line, instead it only performs addition to line. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param before @@ -96,7 +100,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_count_lines_ - extern f_status_t f_fss_count_lines(const f_string_static_t buffer, const f_array_length_t before, f_array_length_t * const line); + extern f_status_t f_fss_count_lines(f_state_t state, const f_string_static_t buffer, const f_array_length_t before, f_array_length_t * const line); #endif // _di_f_fss_count_lines_ /** @@ -106,6 +110,8 @@ extern "C" { * * This does not initialize line, instead it only performs addition to line. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -121,12 +127,58 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_count_lines_range_ - extern f_status_t f_fss_count_lines_range(const f_string_static_t buffer, const f_string_range_t range, const f_array_length_t before, f_array_length_t * const line); + extern f_status_t f_fss_count_lines_range(f_state_t state, const f_string_static_t buffer, const f_string_range_t range, const f_array_length_t before, f_array_length_t * const line); #endif // _di_f_fss_count_lines_range_ /** + * Using the state, check that the status should return an error or not on invalid UTF-8. + * + * When f_fss_state_flag_utf_fail_on_valid_not_e is set, UTF-8 failures are returned as is. + * When f_fss_state_flag_utf_fail_on_valid_not_e is unset, UTF-8 failures are returned with the error bit removed. + * + * @param state + * A state for providing flags and handling interrupts during long running operations. + * @param status + * The status code to check. + * This handles status codes (with error bit set): + * - F_complete_not_utf + * - F_utf + * - F_utf_fragment + * + * @return + * Status is either directly passed through or the error bit is removed depending on state.flag. + */ +#ifndef _di_f_fss_do_fail_utf_ + extern f_status_t f_fss_fail_utf(f_state_t state, const f_status_t status); +#endif // _di_f_fss_fail_utf_ + +/** + * Using the state, check that the status should return an error or not on invalid UTF-8. + * + * When f_fss_state_flag_utf_fail_on_valid_not_e is set, UTF-8 failures are returned as is. + * When f_fss_state_flag_utf_fail_on_valid_not_e is unset, UTF-8 failures are replaced with F_false. + * + * @param state + * A state for providing flags and handling interrupts during long running operations. + * @param status + * The status code to check. + * This handles status codes (with error bit set): + * - F_complete_not_utf + * - F_utf + * - F_utf_fragment + * + * @return + * Status is either directly passed through or F_false is returned depending on state.flag. + */ +#ifndef _di_f_fss_do_fail_to_false_utf_ + extern f_status_t f_fss_fail_utf_to_false(f_state_t state, const f_status_t status); +#endif // _di_f_fss_fail_utf_to_false_ + +/** * Identify whether or not a character in the buffer is a graph (ASCII or UTF-8) character. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -145,12 +197,14 @@ extern "C" { * @see f_utf_is_graph() */ #ifndef _di_f_fss_is_graph_ - extern f_status_t f_fss_is_graph(const f_string_static_t buffer, const f_string_range_t range); + extern f_status_t f_fss_is_graph(f_state_t state, const f_string_static_t buffer, const f_string_range_t range); #endif // _di_f_fss_is_graph_ /** * Identify whether or not a character in the buffer is a non-zero-width whitespace or control (ASCII or UTF-8) character. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -171,12 +225,14 @@ extern "C" { * @see f_utf_is_whitespace() */ #ifndef _di_f_fss_is_space_ - extern f_status_t f_fss_is_space(const f_string_static_t buffer, const f_string_range_t range); + extern f_status_t f_fss_is_space(f_state_t state, const f_string_static_t buffer, const f_string_range_t range); #endif // _di_f_fss_is_space_ /** * Identify whether or not a character in the buffer is a non-zero-width whitespace or control (ASCII or UTF-8) character. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -196,12 +252,14 @@ extern "C" { * @see f_utf_is_zero_width() */ #ifndef _di_f_fss_is_zero_width_ - extern f_status_t f_fss_is_zero_width(const f_string_static_t buffer, const f_string_range_t range); + extern f_status_t f_fss_is_zero_width(f_state_t state, const f_string_static_t buffer, const f_string_range_t range); #endif // _di_f_fss_is_zero_width_ /** * Seek until an EOL character is reached. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -216,7 +274,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_seek_to_eol_ - extern f_status_t f_fss_seek_to_eol(const f_string_dynamic_t buffer, f_string_range_t * const range); + extern f_status_t f_fss_seek_to_eol(f_state_t state, const f_string_dynamic_t buffer, f_string_range_t * const range); #endif // _di_f_fss_seek_to_eol_ /** @@ -225,6 +283,8 @@ extern "C" { * This allows one to do a printf on the dynamic string without the delimiters arbitrarily stopping the output. * No reallocations are performed, this will only shift characters. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param range * A restriction on where within the buffer the shifting happens. * @param buffer @@ -240,12 +300,14 @@ extern "C" { * F_utf (with error bit) if UTF-8 cannot be fully processed (buffer or range range not long enough). */ #ifndef _di_f_fss_shift_delimit_ - extern f_status_t f_fss_shift_delimit(const f_string_range_t range, f_string_dynamic_t * const buffer); + extern f_status_t f_fss_shift_delimit(f_state_t state, const f_string_range_t range, f_string_dynamic_t * const buffer); #endif // _di_f_fss_shift_delimit_ /** * Skip past all delimit placeholders until a non-delimit placeholder is reached. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -260,15 +322,16 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_skip_past_delimit_ - extern f_status_t f_fss_skip_past_delimit(const f_string_static_t buffer, f_string_range_t * const range); + extern f_status_t f_fss_skip_past_delimit(f_state_t state, const f_string_static_t buffer, f_string_range_t * const range); #endif // _di_f_fss_skip_past_delimit_ /** * Skip past all whitespace and control characters, except newline. * * Zero-width characters are not skipped because they might be part of a graph character, such as combining characters. - * @todo needs consideration on how to handle zero-width before space/control vs zero-width before graph. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -295,15 +358,16 @@ extern "C" { * @see f_utf_is_zero_width() */ #ifndef _di_f_fss_skip_past_space_ - extern f_status_t f_fss_skip_past_space(const f_string_static_t buffer, f_string_range_t * const range); + extern f_status_t f_fss_skip_past_space(f_state_t state, const f_string_static_t buffer, f_string_range_t * const range); #endif // _di_f_fss_skip_past_space_ /** * Skip past all non-graph and non-zero-width characters (whitespace and control characters). * * Zero-width characters are not skipped because they might be part of a graph character, such as combining characters. - * @todo needs consideration on how to handle zero-width before space/control vs zero-width before graph. * + * @param state + * A state for providing flags and handling interrupts during long running operations. * @param buffer * The string to process. * @param range @@ -328,7 +392,7 @@ extern "C" { * @see f_utf_is_zero_width() */ #ifndef _di_f_fss_skip_past_non_graph_ - extern f_status_t f_fss_skip_past_non_graph(const f_string_static_t buffer, f_string_range_t * const range); + extern f_status_t f_fss_skip_past_non_graph(f_state_t state, const f_string_static_t buffer, f_string_range_t * const range); #endif // _di_f_fss_skip_past_non_graph_ #ifdef __cplusplus diff --git a/level_0/f_fss/c/fss/common.h b/level_0/f_fss/c/fss/common.h index c3be49f..5f8d9e9 100644 --- a/level_0/f_fss/c/fss/common.h +++ b/level_0/f_fss/c/fss/common.h @@ -362,6 +362,24 @@ enum { #define macro_f_fss_contents_t_decimate_by(status, contents, amount) macro_f_string_rangess_t_decimate_by(status, contents, amount) #endif // _di_f_fss_contents_t_ +/** + * State flags associated with FSS functions. + * + * These flags are meant to be bitwise for the 32-bit f_state_t flag property. + * + * The f_fss_state_flag_none_e is expected to be 0, therefore it must be safe to use 0 directly. + * + * f_fss_state_flag_*: + * - none: No flags are set. + * - utf_fail_on_valid_not: Immediately fail on invalid UTF-8 character (including incomplete). + */ +#ifndef _di_f_fss_state_flags_ + enum { + f_fss_state_flag_none_e = 0, + f_fss_state_flag_utf_fail_on_valid_not_e = 0x1, + }; // enum +#endif // _di_f_fss_state_flags_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_fss/c/fss/basic.c b/level_1/fl_fss/c/fss/basic.c index b547f24..961131a 100644 --- a/level_1/fl_fss/c/fss/basic.c +++ b/level_1/fl_fss/c/fss/basic.c @@ -34,7 +34,7 @@ extern "C" { if (!delimits) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_space(buffer, range); + f_status_t status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -68,7 +68,7 @@ extern "C" { } } - status = f_fss_skip_past_delimit(buffer, range); + status = f_fss_skip_past_delimit(state, buffer, range); if (F_status_is_error(status)) break; if (status == F_none_eos || status == F_none_stop) { @@ -160,7 +160,7 @@ extern "C" { f_status_t status = F_none; - status = f_fss_skip_past_delimit(content, range); + status = f_fss_skip_past_delimit(state, content, range); if (F_status_is_error(status)) return status; if (range->start > range->stop || range->start >= content.used) { diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index a592707..39dbe87 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -37,10 +37,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -92,10 +92,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -152,10 +152,10 @@ extern "C" { * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this object. * If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object (inside the quotes). * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -204,10 +204,10 @@ extern "C" { * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this content, except for the final newline. * If f_fss_complete_full_e, this will write any appropriate open and close aspects of this content, including the final newline. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 3b99a4d..9c8f202 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -16,7 +16,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = f_fss_skip_past_space(buffer, range); + f_status_t status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -41,7 +41,7 @@ extern "C" { // Ignore all comment lines. if (buffer.string[range->start] == f_fss_comment_s.string[0]) { - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -126,7 +126,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -214,7 +214,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -237,7 +237,7 @@ extern "C" { continue; } else if (graph_first) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -264,7 +264,7 @@ extern "C" { } // seek to the end of the line when no valid object is found. - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); // move the start position to after the EOL. ++range->start; @@ -285,7 +285,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; const f_array_length_t comments_used = comments->used; - f_status_t status = f_fss_skip_past_delimit(buffer, range); + f_status_t status = f_fss_skip_past_delimit(state, buffer, range); if (F_status_is_error(status)) return status; private_macro_fl_fss_content_with_comments_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop); @@ -373,7 +373,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -452,7 +452,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -499,7 +499,7 @@ extern "C" { if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment_s.string[0]) { start = newline_last + 1; - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; macro_f_fss_comments_t_increase(status, state.step_small, (*comments)) @@ -519,7 +519,7 @@ extern "C" { } if (graph_first == 0x1) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -562,7 +562,7 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(object, range); + f_status_t status = f_fss_skip_past_delimit(state, object, range); if (F_status_is_error(status)) return status; if (status == F_none_stop || status == F_none_eos) { @@ -619,7 +619,7 @@ extern "C" { break; } - status = f_fss_is_graph(object, *range); + status = f_fss_is_graph(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) break; @@ -632,7 +632,7 @@ extern "C" { break; } - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -780,7 +780,7 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(content, range); + f_status_t status = f_fss_skip_past_delimit(state, content, range); if (F_status_is_error(status)) return status; if (status == F_none_stop || status == F_none_eos) { @@ -861,7 +861,7 @@ extern "C" { if (content.string[range->start] == f_fss_basic_list_open_s.string[0]) { start = range->start++; - status = f_fss_skip_past_space(content, range); + status = f_fss_skip_past_space(state, content, range); if (F_status_is_error(status)) break; if (content.string[range->start] == f_fss_eol_s.string[0] || range->start >= content.used || range->start > range->stop) { @@ -906,7 +906,7 @@ extern "C" { has_graph = F_true; - status = f_fss_skip_past_space(content, range); + status = f_fss_skip_past_space(state, content, range); if (F_status_is_error(status)) break; if (content.string[range->start] == f_fss_eol_s.string[0] || range->start >= content.used || range->start > range->stop) { @@ -942,7 +942,7 @@ extern "C" { is_comment = F_false; } else { - status = f_fss_is_graph(content, *range); + status = f_fss_is_graph(state, content, *range); if (status == F_true) { has_graph = F_true; diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index 7c421e1..e259915 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -38,10 +38,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -93,10 +93,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -162,10 +162,10 @@ extern "C" { * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this object. * If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -216,10 +216,10 @@ extern "C" { * This should only be whitespace, anything else could produce invalid content. * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index 4d25f49..91b9721 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -16,7 +16,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = f_fss_skip_past_space(buffer, range); + f_status_t status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -49,7 +49,7 @@ extern "C" { // Ignore all comment lines. if (buffer.string[range->start] == f_fss_comment_s.string[0]) { - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -138,7 +138,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_graph(buffer, *range); + status = f_fss_is_graph(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_true) break; @@ -221,7 +221,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -246,7 +246,7 @@ extern "C" { continue; } else if (graph_first) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -309,7 +309,7 @@ extern "C" { if (!comments) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(buffer, range); + f_status_t status = f_fss_skip_past_delimit(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eos || status == F_none_stop) { @@ -507,7 +507,7 @@ extern "C" { } if (buffer.string[range->start] != f_fss_delimit_placeholder_s.string[0]) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -630,7 +630,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; if (buffer.string[range->start] != f_fss_delimit_placeholder_s.string[0]) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -691,7 +691,7 @@ extern "C" { else { // No valid object close found, seek until EOL. - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; if (graph_first == 0x2) { @@ -763,7 +763,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; if (buffer.string[range->start] != f_fss_delimit_placeholder_s.string[0]) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -890,7 +890,7 @@ extern "C" { else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment_s.string[0]) { position = newline_last + 1; - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; macro_f_fss_comments_t_increase(status, state.step_small, (*comments)) @@ -920,7 +920,7 @@ extern "C" { position_previous = range->start; if (graph_first == 0x1) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -975,7 +975,7 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(object, range); + f_status_t status = f_fss_skip_past_delimit(state, object, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -1037,7 +1037,7 @@ extern "C" { break; } - status = f_fss_is_graph(object, *range); + status = f_fss_is_graph(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) break; @@ -1050,7 +1050,7 @@ extern "C" { break; } - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -1137,7 +1137,7 @@ extern "C" { break; } - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; ends_on_space = status == F_true; @@ -1214,7 +1214,7 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(content, range); + f_status_t status = f_fss_skip_past_delimit(state, content, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -1301,7 +1301,7 @@ extern "C" { if (content.string[range->start] == f_fss_embedded_list_open_s.string[0] || content.string[range->start] == f_fss_embedded_list_close_s.string[0]) { start = range->start++; - status = f_fss_skip_past_space(content, range); + status = f_fss_skip_past_space(state, content, range); if (F_status_is_error(status)) break; if (range->start >= content.used || range->start > range->stop || content.string[range->start] == f_fss_eol_s.string[0]) { @@ -1361,7 +1361,7 @@ extern "C" { has_graph = F_true; - status = f_fss_skip_past_space(content, range); + status = f_fss_skip_past_space(state, content, range); if (F_status_is_error(status)) break; if (range->start >= content.used || range->start > range->stop || content.string[range->start] == f_fss_eol_s.string[0]) { @@ -1419,7 +1419,7 @@ extern "C" { has_graph = F_false; is_comment = F_false; } - else if ((status = f_fss_is_graph(content, *range)) == F_true) { + else if ((status = f_fss_is_graph(state, content, *range)) == F_true) { has_graph = F_true; } else if (F_status_is_error(status)) { diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index f336a7c..56f046a 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -38,10 +38,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -97,10 +97,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -165,10 +165,10 @@ extern "C" { * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this object. * If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -224,10 +224,10 @@ extern "C" { * Any valid nested object open or valid nested object close inside an ingore range will not be escaped. * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_1/fl_fss/c/fss/extended.c b/level_1/fl_fss/c/fss/extended.c index ffc15e1..18b89f8 100644 --- a/level_1/fl_fss/c/fss/extended.c +++ b/level_1/fl_fss/c/fss/extended.c @@ -45,7 +45,7 @@ extern "C" { f_status_t status = F_none; f_status_t status_allocate = F_none; - status = f_fss_skip_past_space(buffer, range); + status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index c76b1e4..e9a5ecc 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -37,10 +37,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -92,10 +92,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -156,10 +156,10 @@ extern "C" { * If f_fss_complete_full_e, this will write any appropriate open and close aspects of this object. * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this object. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -211,10 +211,10 @@ extern "C" { * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this content, except for the final newline. * If f_fss_complete_full_e, this will write any appropriate open and close aspects of this content, including the final newline. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index 7c05ff1..200752e 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -16,7 +16,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = f_fss_skip_past_space(buffer, range); + f_status_t status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -49,7 +49,7 @@ extern "C" { // Ignore all comment lines. if (buffer.string[range->start] == f_fss_comment_s.string[0]) { - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -138,7 +138,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_graph(buffer, *range); + status = f_fss_is_graph(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_true) break; @@ -221,7 +221,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -246,7 +246,7 @@ extern "C" { continue; } else if (graph_first) { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -312,7 +312,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; const f_array_length_t comments_used = comments->used; - f_status_t status = f_fss_skip_past_delimit(buffer, range); + f_status_t status = f_fss_skip_past_delimit(state, buffer, range); if (F_status_is_error(status)) return status; private_macro_fl_fss_content_with_comments_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop); @@ -340,7 +340,7 @@ extern "C" { } } - status = f_fss_skip_past_space(buffer, range); + status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) break; if (status == F_none_eol) { @@ -395,7 +395,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -422,7 +422,7 @@ extern "C" { delimits->array[delimits->used++] = slash_first; } - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; continue; @@ -445,7 +445,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -481,7 +481,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_comment_s.string[0]) { start = newline_last + 1; - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; macro_f_fss_comments_t_increase(status, state.step_small, (*comments)) @@ -501,7 +501,7 @@ extern "C" { } // There is no possibility of a valid content close, so seek until newline. - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; } // while @@ -522,7 +522,7 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(object, range); + f_status_t status = f_fss_skip_past_delimit(state, object, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -584,7 +584,7 @@ extern "C" { break; } - status = f_fss_is_graph(object, *range); + status = f_fss_is_graph(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) break; @@ -597,7 +597,7 @@ extern "C" { break; } - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -684,7 +684,7 @@ extern "C" { break; } - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; ends_on_space = status == F_true; @@ -761,7 +761,7 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - f_status_t status = f_fss_skip_past_delimit(content, range); + f_status_t status = f_fss_skip_past_delimit(state, content, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -848,7 +848,7 @@ extern "C" { if (content.string[range->start] == f_fss_extended_list_close_s.string[0]) { start = range->start++; - status = f_fss_skip_past_space(content, range); + status = f_fss_skip_past_space(state, content, range); if (F_status_is_error(status)) break; if (has_graph) { @@ -906,7 +906,7 @@ extern "C" { has_graph = F_true; - status = f_fss_skip_past_space(content, range); + status = f_fss_skip_past_space(state, content, range); if (F_status_is_error(status)) break; if (content.string[range->start] == f_fss_eol_s.string[0] || range->start >= content.used || range->start > range->stop) { @@ -966,7 +966,7 @@ extern "C" { has_graph = F_false; is_comment = F_false; } - else if ((status = f_fss_is_graph(content, *range)) == F_true) { + else if ((status = f_fss_is_graph(state, content, *range)) == F_true) { has_graph = F_true; } else if (F_status_is_error(status)) { diff --git a/level_1/fl_fss/c/fss/extended_list.h b/level_1/fl_fss/c/fss/extended_list.h index ee49d85..3d134ad 100644 --- a/level_1/fl_fss/c/fss/extended_list.h +++ b/level_1/fl_fss/c/fss/extended_list.h @@ -38,10 +38,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -95,10 +95,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -163,10 +163,10 @@ extern "C" { * If f_fss_complete_partial_e, this will write any appropriate open and close aspects of this object. * If f_fss_complete_partial_tim, this will write any appropriate open and close aspects of this object, but will omit whitespace before and after the object. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -222,10 +222,10 @@ extern "C" { * Any valid nested object open or valid nested object close inside an ingore range will not be escaped. * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 2cfcd44..976bc41 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -49,7 +49,7 @@ extern "C" { if (destination->string[destination_range.start] == f_fss_delimit_placeholder_s.string[0]) continue; - status = f_fss_is_space(*destination, destination_range); + status = f_fss_is_space(state, *destination, destination_range); if (F_status_is_error(status)) { destination->used = used_start; @@ -102,7 +102,7 @@ extern "C" { if (destination->string[destination_range.start] == f_fss_delimit_placeholder_s.string[0]) continue; - status = f_fss_is_space(*destination, destination_range); + status = f_fss_is_space(state, *destination, destination_range); // When going backwards, getting incomplete UTF-8 sequences is not an error. if (F_status_set_fine(status) == F_complete_not_utf) continue; @@ -135,7 +135,7 @@ extern "C" { } } - status = f_fss_is_space(*destination, destination_range); + status = f_fss_is_space(state, *destination, destination_range); if (F_status_is_error(status)) { destination->used = used_start; @@ -205,7 +205,7 @@ extern "C" { if (destination->string[destination_range.start] == f_fss_delimit_placeholder_s.string[0]) continue; - status = f_fss_is_space(*destination, destination_range); + status = f_fss_is_space(state, *destination, destination_range); if (F_status_is_error(status)) { destination->used = used_start; @@ -238,7 +238,7 @@ extern "C" { continue; } - status = f_fss_is_space(*destination, destination_range); + status = f_fss_is_space(state, *destination, destination_range); // When going backwards, getting incomplete UTF-8 sequences is not an error. if (F_status_set_fine(status) == F_complete_not_utf) continue; @@ -255,7 +255,7 @@ extern "C" { } // for if (destination_range.start == 0) { - status = f_fss_is_space(*destination, destination_range); + status = f_fss_is_space(state, *destination, destination_range); if (F_status_is_error(status)) { destination->used = used_start; @@ -275,7 +275,7 @@ extern "C" { #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) f_status_t private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_state_t state, f_string_range_t * const range, f_fss_object_t * const found, f_fss_quote_t *quoted, f_fss_delimits_t * const delimits) { - f_status_t status = f_fss_skip_past_space(buffer, range); + f_status_t status = f_fss_skip_past_space(state, buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -355,8 +355,8 @@ extern "C" { } } - status = f_fss_is_zero_width(buffer, *range); - if (F_status_is_error(status)) break; + status = f_fss_is_zero_width(state, buffer, *range); + if (F_status_is_error(status)) return status; if (status == F_true) { status = f_utf_buffer_increment(buffer, range, 1); @@ -366,8 +366,8 @@ extern "C" { } if (buffer.string[range->start] != f_fss_delimit_slash_s.string[0]) { - status = f_fss_is_space(buffer, *range); - if (F_status_is_error(status)) break; + status = f_fss_is_space(state, buffer, *range); + if (F_status_is_error(status)) return status; // Found the end of the object while processing the slash for potential delimits. if (status == F_true) { @@ -437,12 +437,13 @@ extern "C" { if (F_status_set_fine(status) == F_interrupt) { status = F_status_set_error(F_interrupt); + break; } } - status = f_fss_is_space(buffer, *range); - if (F_status_is_error(status)) break; + status = f_fss_is_space(state, buffer, *range); + if (F_status_is_error(status)) return status; if (status == F_true) break; @@ -534,7 +535,7 @@ extern "C" { if (range->start + 1 <= range->stop && range->start + 1 < buffer.used) { ++range->start; - status = f_fss_skip_past_delimit(buffer, range); + status = f_fss_skip_past_delimit(state, buffer, range); if (F_status_is_error(status)) return status; if (range->start > range->stop || range->start >= buffer.used) { @@ -544,7 +545,7 @@ extern "C" { status = F_true; } else { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) return status; } } @@ -602,7 +603,7 @@ extern "C" { if (range->start > range->stop) return F_none_stop; } // while - status = f_fss_is_graph(buffer, *range); + status = f_fss_is_graph(state, buffer, *range); if (F_status_is_error(status)) return status; if (status == F_true) { @@ -689,7 +690,7 @@ extern "C" { if (range->start + 1 <= range->stop && range->start + 1 < buffer.used) { ++range->start; - status = f_fss_skip_past_delimit(buffer, range); + status = f_fss_skip_past_delimit(state, buffer, range); if (F_status_is_error(status)) return status; if (range->start > range->stop || range->start >= buffer.used) { @@ -699,7 +700,7 @@ extern "C" { status = F_true; } else { - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) return status; } } @@ -745,7 +746,7 @@ extern "C" { return F_fss_found_object_content_not; } - status = f_fss_is_space(buffer, *range); + status = f_fss_is_space(state, buffer, *range); if (F_status_is_error(status)) return status; if (status == F_true) { @@ -831,7 +832,7 @@ extern "C" { } // Seek to the EOL when no valid object is found. - status = f_fss_seek_to_eol(buffer, range); + status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) return status; // Move the start position to after the EOL. @@ -844,7 +845,7 @@ extern "C" { #if !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_) || !defined(_di_fl_fss_extended_content_write_) f_status_t private_fl_fss_basic_write(const bool object_as, const f_string_static_t object, const f_fss_quote_t quoted, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) { - f_status_t status = f_fss_skip_past_space(object, range); + f_status_t status = f_fss_skip_past_space(state, object, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -962,7 +963,7 @@ extern "C" { if (object.string[range->start] == quote_char) { item_first = range->start++; - status = f_fss_skip_past_delimit(object, range); + status = f_fss_skip_past_delimit(state, object, range); if (F_status_is_error(status)) return status; if (range->start > range->stop || range->start >= object.used) { @@ -980,7 +981,7 @@ extern "C" { } // if any space is found after a quote after a slash, then this must be delimited and quoted. - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -1042,7 +1043,7 @@ extern "C" { else { // If any space is found, then this must be quoted. - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -1078,7 +1079,7 @@ extern "C" { destination->string[used_start + 1] = f_fss_delimit_slash_s.string[0]; } - status = f_fss_skip_past_delimit(object, range); + status = f_fss_skip_past_delimit(state, object, range); if (F_status_is_error(status)) return status; if (range->start > range->stop || range->start >= object.used) { @@ -1102,7 +1103,7 @@ extern "C" { } // If any space is found, then this must be quoted. - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -1134,7 +1135,7 @@ extern "C" { } else if (object.string[range->start] != f_fss_delimit_placeholder_s.string[0]) { if (!quoted_is) { - status = f_fss_is_space(object, *range); + status = f_fss_is_space(state, object, *range); if (F_status_is_error(status)) break; if (status == F_true) { @@ -1196,7 +1197,7 @@ extern "C" { range_i.start = i; - status = f_fss_is_space(object, range_i); + status = f_fss_is_space(state, object, range_i); if (F_status_is_error(status)) { destination->used = used_start; diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index cf36634..c81ddf0 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -24,8 +24,8 @@ extern "C" { * @param used_start * The destination.used value before any operations were perfomed. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. * There is no data structure passed to these functions. * @@ -55,8 +55,8 @@ extern "C" { * @param buffer * The buffer to seek through. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. * There is no data structure passed to these functions. * @@ -90,8 +90,8 @@ extern "C" { * @param used_start * The destination.used value before any operations were performed. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. * There is no data structure passed to these functions. * @@ -129,8 +129,8 @@ extern "C" { * As Object, this checks if the first graph character is a comment character '#', or an escaped comment character '#'. * As Content, this does nothing special in regards to a leading '#'. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. * There is no data structure passed to these functions. * @@ -204,8 +204,8 @@ extern "C" { * If 0, then double quotes are auto-inserted, if needed. * Otherwise, this is the type of quote to wrap the object in when writing. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + * A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. * There is no data structure passed to these functions. * diff --git a/level_2/fll_fss/c/fss/basic.h b/level_2/fll_fss/c/fss/basic.h index 9fdaf4f..17060ea 100644 --- a/level_2/fll_fss/c/fss/basic.h +++ b/level_2/fll_fss/c/fss/basic.h @@ -33,10 +33,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -94,10 +94,10 @@ extern "C" { * If 0, then double quotes are auto-inserted, when required. * Otherwise, this is the type of quote to wrap the object in when writing. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_2/fll_fss/c/fss/basic_list.h b/level_2/fll_fss/c/fss/basic_list.h index 605f23f..84483a9 100644 --- a/level_2/fll_fss/c/fss/basic_list.h +++ b/level_2/fll_fss/c/fss/basic_list.h @@ -33,10 +33,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -93,10 +93,10 @@ extern "C" { * A string to prepend at the start of each line in content, such as spaces. * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_2/fll_fss/c/fss/embedded_list.h b/level_2/fll_fss/c/fss/embedded_list.h index 2809f76..476e713 100644 --- a/level_2/fll_fss/c/fss/embedded_list.h +++ b/level_2/fll_fss/c/fss/embedded_list.h @@ -32,10 +32,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -100,10 +100,10 @@ extern "C" { * Any valid nested object open or valid nested object close inside an ingore range will not be escaped. * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_2/fll_fss/c/fss/extended.h b/level_2/fll_fss/c/fss/extended.h index d29b602..71a9572 100644 --- a/level_2/fll_fss/c/fss/extended.h +++ b/level_2/fll_fss/c/fss/extended.h @@ -32,10 +32,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -96,10 +96,10 @@ extern "C" { * If 0, then double quotes are auto-inserted, when required. * Otherwise, this is the type of quote to wrap the object in when writing. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_2/fll_fss/c/fss/extended_list.h b/level_2/fll_fss/c/fss/extended_list.h index e3b14a0..1e47627 100644 --- a/level_2/fll_fss/c/fss/extended_list.h +++ b/level_2/fll_fss/c/fss/extended_list.h @@ -34,10 +34,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -107,10 +107,10 @@ extern "C" { * Any valid nested object open or valid nested object close inside an ingore range will not be escaped. * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_2/fll_fss/c/fss/payload.h b/level_2/fll_fss/c/fss/payload.h index 9e288fd..1d5ed35 100644 --- a/level_2/fll_fss/c/fss/payload.h +++ b/level_2/fll_fss/c/fss/payload.h @@ -38,10 +38,10 @@ extern "C" { * @param buffer * The buffer to read from. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. @@ -113,10 +113,10 @@ extern "C" { * This will not be prepended for the Object "payload". * Set the pointer address to 0 to disable. * @param state - * A state for handling interrupts during long running operations. - * There is no print_error() usage at this time (@todo this should be implemented and supported). + A state for providing flags and handling interrupts during long running operations. + * There is no print_error(). * There is no functions structure. - * There is no data structure passed to these functions (@todo the additional parameters could be moved to a custom structure). + * There is no data structure passed to these functions. * * When interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. diff --git a/level_3/control/c/private-control.c b/level_3/control/c/private-control.c index 106daf9..f193476 100644 --- a/level_3/control/c/private-control.c +++ b/level_3/control/c/private-control.c @@ -335,7 +335,7 @@ extern "C" { return F_status_set_error(F_header); } - status = fl_fss_apply_delimit(data->cache.delimits, &data->cache.large); + status = f_fss_apply_delimit(state, data->cache.delimits, &data->cache.large); if (F_status_is_error(status)) { control_print_debug_packet_message(main, "Failure while processing delimits for the FSS Basic List in the response packet", 0, 0, &status); @@ -415,7 +415,7 @@ extern "C" { return F_status_set_error(F_header_not); } - status = fl_fss_apply_delimit(data->cache.delimits, &data->cache.large); + status = f_fss_apply_delimit(state, data->cache.delimits, &data->cache.large); if (F_status_is_error(status)) { control_print_debug_packet_message(main, "Failure while processing delimits for the FSS Basic List in the response packet", 0, 0, &status); @@ -665,10 +665,10 @@ extern "C" { fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, data->cache.small, f_file_operation_process_s, fll_error_file_type_file_e); } else { - status = fl_fss_apply_delimit(delimits, &data->cache.large); + status = f_fss_apply_delimit(state, delimits, &data->cache.large); if (F_status_is_error(status)) { - fll_error_file_print(main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, data->cache.small, f_file_operation_process_s, fll_error_file_type_file_e); + fll_error_file_print(main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true, data->cache.small, f_file_operation_process_s, fll_error_file_type_file_e); } } diff --git a/level_3/control/c/private-control.h b/level_3/control/c/private-control.h index 64429fb..75ce328 100644 --- a/level_3/control/c/private-control.h +++ b/level_3/control/c/private-control.h @@ -118,7 +118,7 @@ extern "C" { * @see f_socket_read() * @see f_string_dynamic_increase_by() * @see fl_conversion_dynamic_partial_to_number_unsigned() - * @see fl_fss_apply_delimit() + * @see f_fss_apply_delimit() * @see fll_fss_extended_read() * @see fll_fss_basic_list_read() * @see fll_status_string_from() @@ -195,7 +195,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_append_nulless(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * Errors (with error bit) from: f_string_dynamics_resize(). - * Errors (with error bit) from: fl_fss_apply_delimit(). + * Errors (with error bit) from: f_fss_apply_delimit(). * Errors (with error bit) from: fll_fss_extended_read(). * * @see f_file_exists() @@ -208,7 +208,7 @@ extern "C" { * @see f_string_dynamic_append_nulless() * @see f_string_dynamic_partial_append_nulless() * @see f_string_dynamics_resize() - * @see fl_fss_apply_delimit() + * @see f_fss_apply_delimit() * @see fll_fss_extended_read() */ #ifndef _di_control_settings_load_ diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 827e6a3..63a5676 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -107,10 +107,12 @@ extern "C" { return status; } - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); + f_state_t state = f_state_t_initialize; + + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); + controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_apply_delimit", F_true, global.thread); return status; } @@ -147,7 +149,7 @@ extern "C" { action->status = F_known_not; action->parameters.used = 0; - status = f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action); + status = f_fss_count_lines(state, cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action); if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); @@ -1577,10 +1579,10 @@ extern "C" { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true); } else { - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); + controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_apply_delimit", F_true, global.thread); } } } @@ -1614,6 +1616,8 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; + f_state_t state = f_state_t_initialize; + for (; i < cache->object_items.used && controller_thread_is_enabled(is_entry, global.thread); ++i) { if (code & 0x2) { @@ -1643,6 +1647,7 @@ extern "C" { if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_entry_items_increase_by", F_true, global.thread); + break; } @@ -1654,7 +1659,7 @@ extern "C" { break; } - status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item); + status = f_fss_count_lines(state, cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item); if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); @@ -1680,6 +1685,7 @@ extern "C" { } code |= 0x2; + break; } } // for @@ -1781,7 +1787,7 @@ extern "C" { action = &entry->items.array[i].actions.array[j]; - // only process actions that don't already have an error. + // Only process actions that don't already have an error. if (F_status_is_error(action->status)) continue; if (action->type == controller_entry_action_type_failsafe_e || action->type == controller_entry_action_type_item_e) { @@ -1875,10 +1881,14 @@ extern "C" { return status; } - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); + { + f_state_t state = f_state_t_initialize; + + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_file); + } if (F_status_is_error(status)) { - controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread); + controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_apply_delimit", F_true, global.thread); return status; } @@ -1890,10 +1900,11 @@ extern "C" { f_array_length_t line = 0; controller_entry_t *entry = is_entry ? &global.setting->entry : &global.setting->exit; + f_state_t state = f_state_t_initialize; for (; i < cache->object_actions.used; ++i) { - status = f_fss_count_lines(cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action); + status = f_fss_count_lines(state, cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action); if (F_status_is_error(status)) { controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread); diff --git a/level_3/controller/c/entry/private-entry.h b/level_3/controller/c/entry/private-entry.h index 3ce7ba0..31aff8c 100644 --- a/level_3/controller/c/entry/private-entry.h +++ b/level_3/controller/c/entry/private-entry.h @@ -60,7 +60,7 @@ extern "C" { * * Errors (with error bit) from: controller_entry_actions_increase_by(). * Errors (with error bit) from: f_fss_count_lines(). - * Errors (with error bit) from: fl_fss_apply_delimit(). + * Errors (with error bit) from: f_fss_apply_delimit(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * Errors (with error bit) from: fl_string_dynamic_partial_rip_nulless(). * Errors (with error bit) from: f_string_dynamics_increase_by(). @@ -70,7 +70,7 @@ extern "C" { * @see f_fss_count_lines() * @see f_string_dynamic_partial_append_nulless() * @see f_string_dynamics_increase_by() - * @see fl_fss_apply_delimit() + * @see f_fss_apply_delimit() * @see fl_string_dynamic_partial_rip_nulless() * @see fll_fss_extended_read() */ @@ -170,7 +170,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_partial_append(). * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * Errors (with error bit) from: f_string_dynamic_terminate(). - * Errors (with error bit) from: fl_fss_apply_delimit(). + * Errors (with error bit) from: f_fss_apply_delimit(). * Errors (with error bit) from: fll_fss_basic_list_read(). * * @see controller_entry_actions_read() @@ -184,7 +184,7 @@ extern "C" { * @see f_string_dynamic_partial_append() * @see f_string_dynamic_partial_append_nulless() * @see f_string_dynamic_terminate() - * @see fl_fss_apply_delimit() + * @see f_fss_apply_delimit() * @see fll_fss_basic_list_read() */ #ifndef _di_controller_entry_read_ diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index b93d36c..41a7159 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -253,10 +253,10 @@ extern "C" { } if (status == F_fss_found_content) { - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); return status; } @@ -330,10 +330,10 @@ extern "C" { return status; } - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); return status; } @@ -351,7 +351,7 @@ extern "C" { return status; } - status = f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line); + status = f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line); if (F_status_is_error(status)) { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true); @@ -390,10 +390,10 @@ extern "C" { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_extended_content_read", F_true); } else if (status == F_fss_found_content) { - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); } else if (type == controller_rule_action_type_pid_file_e) { item->pid_file.used = 0; @@ -628,7 +628,7 @@ extern "C" { actions->array[actions->used++].parameters.used = 1; } else { - status = f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line); + status = f_fss_count_lines(state, cache->buffer_item, range->start, &actions->array[actions->used].line); if (F_status_is_error(status)) { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true); @@ -2266,15 +2266,15 @@ extern "C" { if (status != F_fss_found_object) continue; } - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item); + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_item); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); break; } - status = f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action); + status = f_fss_count_lines(state, cache->buffer_item, cache->range_action.start, &cache->action.line_action); if (F_status_is_error(status)) { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true); @@ -3589,10 +3589,10 @@ extern "C" { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true); } else { - status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file); + status = f_fss_apply_delimit(state, cache->delimits, &cache->buffer_file); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); } } } @@ -3607,6 +3607,7 @@ extern "C" { else { f_array_length_t i = 0; f_array_length_t j = 0; + f_state_t state = f_state_t_initialize; for (; i < cache->object_items.used; ++i) { @@ -3636,7 +3637,7 @@ extern "C" { for_item = F_true; - status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item); + status = f_fss_count_lines(state, cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item); if (F_status_is_error(status)) { controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true); @@ -3744,12 +3745,10 @@ extern "C" { f_string_range_t range = macro_f_string_range_t_initialize2(cache->buffer_item.used); 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); + 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); - status = fll_fss_extended_read(cache->buffer_item, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); - } + status = fll_fss_extended_read(cache->buffer_item, state, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0); if (F_status_is_error(status)) { controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false); @@ -3802,7 +3801,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -3867,7 +3866,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -3896,7 +3895,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -3921,7 +3920,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4050,7 +4049,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4078,7 +4077,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4104,7 +4103,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4195,7 +4194,7 @@ extern "C" { // get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4275,7 +4274,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4304,7 +4303,7 @@ extern "C" { // get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4344,7 +4343,7 @@ extern "C" { // get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4458,7 +4457,7 @@ extern "C" { // get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4474,7 +4473,7 @@ extern "C" { // get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; } @@ -4535,7 +4534,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4619,7 +4618,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4698,7 +4697,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4746,7 +4745,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4815,7 +4814,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4845,7 +4844,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4895,7 +4894,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4940,7 +4939,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -4990,7 +4989,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5054,7 +5053,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5081,7 +5080,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5132,7 +5131,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5162,7 +5161,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5177,7 +5176,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5279,7 +5278,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5330,7 +5329,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5372,7 +5371,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -5397,7 +5396,7 @@ extern "C" { // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[i].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; diff --git a/level_3/controller/c/rule/private-rule.h b/level_3/controller/c/rule/private-rule.h index 9a54bc9..e6a5616 100644 --- a/level_3/controller/c/rule/private-rule.h +++ b/level_3/controller/c/rule/private-rule.h @@ -636,7 +636,7 @@ extern "C" { * @see controller_rule_items_increase_by(). * @see controller_rule_item_read(). * @see f_fss_count_lines(). - * @see fl_fss_apply_delimit(). + * @see f_fss_apply_delimit(). * @see f_string_dynamic_partial_append(). * @see f_string_dynamic_partial_append_nulless(). * @see fll_fss_basic_list_read(). diff --git a/level_3/controller/c/rule/private-rule_print.c b/level_3/controller/c/rule/private-rule_print.c index eb36a42..c275c6d 100644 --- a/level_3/controller/c/rule/private-rule_print.c +++ b/level_3/controller/c/rule/private-rule_print.c @@ -264,9 +264,11 @@ extern "C" { if (print.verbosity == f_console_verbosity_quiet_e) return; + f_state_t state = f_state_t_initialize; + // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[index].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[index].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; @@ -285,9 +287,11 @@ extern "C" { if (print.verbosity == f_console_verbosity_quiet_e) return; + f_state_t state = f_state_t_initialize; + // Get the current line number within the settings item. cache->action.line_item = line_item; - f_fss_count_lines(cache->buffer_item, cache->object_actions.array[index].start, &cache->action.line_item); + f_fss_count_lines(state, cache->buffer_item, cache->object_actions.array[index].start, &cache->action.line_item); cache->action.line_action = ++cache->action.line_item; diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 43047db..d94eda0 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -109,21 +109,18 @@ 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(fake_common_allocation_large_d, fake_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, (void *) data->main, 0); - - *status = fll_fss_extended_read(buffer, state, &range, &objects, &contents, 0, 0, &delimits, 0); - } + *status = fll_fss_extended_read(buffer, state, &range, &objects, &contents, 0, 0, &delimits, 0); if (F_status_is_error(*status)) { fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data->file_data_build_settings, range, F_true); } else { - *status = fl_fss_apply_delimit(delimits, &buffer); + *status = f_fss_apply_delimit(state, delimits, &buffer); if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(data->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true); } else { fake_build_load_setting_process(data, F_true, setting_file.used ? path_file : data->file_data_build_settings, buffer, objects, contents, setting, status); diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 646a4a6..d901523 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -53,21 +53,18 @@ extern "C" { f_string_range_t range = macro_f_string_range_t_initialize2(data_make->buffer.used); f_fss_delimits_t delimits = f_fss_delimits_t_initialize; 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->data, 0); - { - 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->data, 0); - - *status = fll_fss_basic_list_read(data_make->buffer, state, &range, &list_objects, &list_contents, &delimits, 0, &comments); - } + *status = fll_fss_basic_list_read(data_make->buffer, state, &range, &list_objects, &list_contents, &delimits, 0, &comments); if (F_status_is_error(*status)) { fake_print_error_fss(data_make->data, F_status_set_fine(*status), "fll_fss_basic_list_read", data_make->data->file_data_build_fakefile, range, F_true); } else { - *status = fl_fss_apply_delimit(delimits, &data_make->buffer); + *status = f_fss_apply_delimit(state, delimits, &data_make->buffer); if (F_status_is_error(*status)) { - fll_error_print(data_make->main->error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true); } } @@ -140,10 +137,10 @@ extern "C" { break; } - *status = fl_fss_apply_delimit(delimits, &data_make->buffer); + *status = f_fss_apply_delimit(state, delimits, &data_make->buffer); if (F_status_is_error(*status)) { - fll_error_print(data_make->main->error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true); break; } @@ -177,10 +174,10 @@ extern "C" { break; } - *status = fl_fss_apply_delimit(delimits, &data_make->buffer); + *status = f_fss_apply_delimit(state, delimits, &data_make->buffer); if (F_status_is_error(*status)) { - fll_error_print(data_make->main->error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true); + fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true); break; } diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index b895d4e..fc26031 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -358,8 +358,9 @@ extern "C" { if (data->main->error.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return; f_array_length_t line = 1; + f_state_t state = f_state_t_initialize; - f_fss_count_lines(buffer, operation_name.start, &line); + f_fss_count_lines(state, buffer, operation_name.start, &line); flockfile(data->main->error.to.stream); @@ -428,8 +429,9 @@ extern "C" { if (data->main->error.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return; f_array_length_t line = 1; + f_state_t state = f_state_t_initialize; - f_fss_count_lines(buffer, operation_name.start, &line); + f_fss_count_lines(state, buffer, operation_name.start, &line); flockfile(data->main->error.to.stream); @@ -453,8 +455,9 @@ extern "C" { if (data->main->error.verbosity == f_console_verbosity_quiet_e || !print.to.stream) return; f_array_length_t line = 1; + f_state_t state = f_state_t_initialize; - f_fss_count_lines(buffer, operation_name.start, &line); + f_fss_count_lines(state, buffer, operation_name.start, &line); flockfile(data->main->error.to.stream); diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index b80e8e0..bccfe59 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -644,10 +644,12 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca } if (F_status_is_error_not(status)) { - status = fl_fss_apply_delimit(delimits, &local_buffer); + f_state_t state = f_state_t_initialize; + + status = f_fss_apply_delimit(state, delimits, &local_buffer); if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + fll_error_print(data->main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); } } @@ -1198,9 +1200,9 @@ f_status_t firewall_buffer_rules(firewall_data_t * const data, const f_string_st f_fss_delimits_t delimits = f_fss_delimits_t_initialize; f_fss_comments_t comments = f_fss_comments_t_initialize; + f_state_t state = f_state_t_initialize; { - f_state_t state = f_state_t_initialize; f_string_range_t input = macro_f_string_range_t_initialize2(local->buffer.used); status = fll_fss_basic_list_read(local->buffer, state, &input, &local->chain_objects, &local->chain_contents, &delimits, 0, &comments); @@ -1225,10 +1227,10 @@ f_status_t firewall_buffer_rules(firewall_data_t * const data, const f_string_st } } else { - status = fl_fss_apply_delimit(delimits, &local->buffer); + status = f_fss_apply_delimit(state, delimits, &local->buffer); if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + fll_error_print(data->main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); } } @@ -1242,18 +1244,15 @@ f_status_t firewall_process_rules(firewall_data_t * const data, f_string_range_t f_status_t status = F_none; f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_state_t state = f_state_t_initialize; - { - f_state_t state = f_state_t_initialize; - - status = fll_fss_extended_read(local->buffer, state, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0); - } + status = fll_fss_extended_read(local->buffer, state, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0); if (F_status_is_error_not(status)) { - status = fl_fss_apply_delimit(delimits, &local->buffer); + status = f_fss_apply_delimit(state, delimits, &local->buffer); if (F_status_is_error(status)) { - fll_error_print(data->main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true); + fll_error_print(data->main->error, F_status_set_fine(status), "f_fss_apply_delimit", F_true); } } diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index efc04d0..3881e9d 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -309,11 +309,12 @@ extern "C" { const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.used - 1]; if (main->parameters.arguments.array[index].used) { + f_state_t state = f_state_t_initialize; f_string_range_t range = macro_f_string_range_t_initialize2(main->parameters.arguments.array[index].used); for (; range.start < main->parameters.arguments.array[index].used; ++range.start) { - status = f_fss_is_space(main->parameters.arguments.array[index], range); + status = f_fss_is_space(state, main->parameters.arguments.array[index], range); if (F_status_is_error(status)) break; if (status == F_false) { diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 0c69619..8bd0dcb 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -309,10 +309,11 @@ extern "C" { // Even though this standard does not utilize this parameter, provide the validation for consistency. if (argv[index].used) { f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); + f_state_t state = f_state_t_initialize; for (; range.start < argv[index].used; ++range.start) { - status = f_fss_is_space(argv[index], range); + status = f_fss_is_space(state, argv[index], range); if (F_status_is_error(status)) break; if (status == F_false) { diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c index 3561a65..b810a18 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c @@ -311,10 +311,11 @@ extern "C" { if (argv[index].used) { f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); + f_state_t state = f_state_t_initialize; for (; range.start < argv[index].used; ++range.start) { - status = f_fss_is_space(argv[index], range); + status = f_fss_is_space(state, argv[index], range); if (F_status_is_error(status)) break; if (status == F_false) { 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 46c9e41..d856fcd 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, &fll_program_standard_signal_state, 0, 0, (void *) main, 0); + 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_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_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c index f60ce26..46a90dd 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.c @@ -310,10 +310,11 @@ extern "C" { if (argv[index].used) { f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); + f_state_t state = f_state_t_initialize; for (; range.start < argv[index].used; ++range.start) { - status = f_fss_is_space(argv[index], range); + status = f_fss_is_space(state, argv[index], range); if (F_status_is_error(status)) break; if (status == F_false) { diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index cc3d7d8..c71bea2 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -322,10 +322,11 @@ extern "C" { // Even though this standard does not utilize this parameter, provide the validation for consistency. if (argv[index].used) { f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); + f_state_t state = f_state_t_initialize; for (; range.start < argv[index].used; ++range.start) { - status = f_fss_is_space(argv[index], range); + status = f_fss_is_space(state, argv[index], range); if (F_status_is_error(status)) break; if (status == F_false) { diff --git a/level_3/fss_payload_write/c/fss_payload_write.c b/level_3/fss_payload_write/c/fss_payload_write.c index 1109252..3b0f1d5 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -318,10 +318,11 @@ extern "C" { if (argv[index].used) { f_string_range_t range = macro_f_string_range_t_initialize2(argv[index].used); + f_state_t state = f_state_t_initialize; for (; range.start < argv[index].used; range.start++) { - status = f_fss_is_space(argv[index], range); + status = f_fss_is_space(state, argv[index], range); if (F_status_is_error(status)) break; if (status == F_false) {