From 34fb50ad284fbb7a28dc1cbb9d58fd5587f009b4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 13 Oct 2026 20:40:18 -0500 Subject: [PATCH] Progress: Clean up and start fixing problems. Rename and restructure the fl_flags in basic list to be alphabetical. Ensure the `___fl_flag_has_delimit_comment___` flag gets reset. Ensure the `___fl_flag_do_escape___` flag gets reset. Remove unnecessary assignment of `slash_count` to 0. Remove unnecessary `> 0` check on while loop using `slash_count`. Ensure `F_okay_eos` and `F_okay_stop` are correctly handled in tests. --- level_1/fl_fss/c/fss/basic_list.c | 31 ++++++++----------- .../unit/c/test-fss-basic_list_content_read.c | 8 ++--- .../c/test-fss-embedded_list_content_read.c | 8 ++--- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 6b7171403..7c725b960 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -38,10 +38,10 @@ extern "C" { if (F_status_is_error(state->status)) return; #define ___fl_flag_do_escape___ 0x1 - #define ___fl_flag_has_graph_first___ 0x2 - #define ___fl_flag_has_graph_first_do_escape___ 0x3 - #define ___fl_flag_has_delimit_comment___ 0x4 - #define ___fl_flag_has_delimit_comment_graph_first___ 0x6 + #define ___fl_flag_has_delimit_comment___ 0x2 + #define ___fl_flag_has_graph_first___ 0x4 + #define ___fl_flag_has_graph_first_delimit_comment___ 0x6 + #define ___fl_flag_has_graph_first_do_escape___ 0x5 const f_number_unsigned_t delimits_used = delimits->used; const f_number_unsigned_t comments_used = comments->used; @@ -76,6 +76,7 @@ extern "C" { newline_last = range->start; flag_fl |= ___fl_flag_has_graph_first___; + flag_fl &= ~___fl_flag_has_delimit_comment___; ++range->start; continue; @@ -115,8 +116,10 @@ extern "C" { if (range->start > range->stop || range->start >= buffer.used) break; if (!(flag_fl & ___fl_flag_do_escape___)) continue; + flag_fl &= ~___fl_flag_do_escape___; + if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) { - flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___; + flag_fl &= ~___fl_flag_has_graph_first_delimit_comment___; ++range->start; f_fss_skip_past_space(buffer, range, state); @@ -124,7 +127,6 @@ extern "C" { // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. if (F_status_set_fine(state->status) == F_complete_not_utf_start) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; - slash_count = 0; f_fss_skip_past_combining_joiner(buffer, range, state); if (F_status_is_error(state->status)) break; @@ -151,7 +153,7 @@ extern "C" { state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; - while (slash_count > 0) { + while (slash_count) { if (buffer.string[range->start] == f_fss_slash_s.string[0]) { if (slash_count % 2 == 1) { @@ -177,10 +179,6 @@ extern "C" { flag_fl |= ___fl_flag_has_graph_first___; range->start = line_start + 1; } - else { - flag_fl &= ~___fl_flag_do_escape___; - slash_count = 0; - } } else if ((flag_fl & ___fl_flag_has_graph_first___) && buffer.string[range->start] == f_fss_comment_s.string[0]) { ++range->start; @@ -189,7 +187,6 @@ extern "C" { if (F_status_is_error_not(state->status) && f_fss_is_combining_joiner(buffer, *range, state) == F_true) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; - slash_count = 0; f_fss_skip_past_combining_joiner(buffer, range, state); if (F_status_is_error(state->status)) break; @@ -207,14 +204,13 @@ extern "C" { if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) { ++range->start; - flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___; + flag_fl &= ~___fl_flag_has_graph_first_delimit_comment___; f_fss_skip_past_space(buffer, range, state); // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. if (F_status_set_fine(state->status) == F_complete_not_utf_start) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; - slash_count = 0; f_fss_skip_past_combining_joiner(buffer, range, state); if (F_status_is_error(state->status)) break; @@ -252,7 +248,6 @@ extern "C" { if (F_status_is_error_not(state->status) && f_fss_is_combining_joiner(buffer, *range, state) == F_true) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; - slash_count = 0; f_fss_skip_past_combining_joiner(buffer, range, state); if (F_status_is_error(state->status)) break; @@ -294,7 +289,7 @@ extern "C" { if (f_fss_is_space(buffer, *range, state) == F_false) { if (F_status_is_error(state->status)) break; - flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___; + flag_fl &= ~___fl_flag_has_graph_first_delimit_comment___; } } @@ -335,9 +330,9 @@ extern "C" { } #undef ___fl_flag_do_escape___ - #undef ___fl_flag_has_graph_first___ #undef ___fl_flag_has_delimit_comment___ - #undef ___fl_flag_has_delimit_comment_graph_first___ + #undef ___fl_flag_has_graph_first___ + #undef ___fl_flag_has_graph_first_delimit_comment___ } #endif // _di_fl_fss_basic_list_content_read_ diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c index 183f6f296..0448bb61b 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c @@ -516,13 +516,13 @@ void test__fl_fss_basic_list_content_read__works_using_combining(void **void_sta fl_fss_basic_list_content_read(set_strings, &range, &found_content, &delimits, &comments, &state); - if (!(state.status == F_fss_found_content || state.status == F_data_not)) { - printf("[ -------> ] --- [11] Failure with fl_fss_basic_list_content_read(), with set %lu, status=%u, expected %u, or %u.\n", set, state.status, F_fss_found_content, F_data_not); + if (!(state.status == F_fss_found_content || state.status == F_okay_eos || state.status == F_okay_stop || state.status == F_data_not)) { + printf("[ -------> ] --- [11] Failure with fl_fss_basic_list_content_read(), with set %lu, status=%u, expected %u, %u, %u, or %u.\n", set, state.status, F_fss_found_content, F_okay_eos, F_okay_stop, F_data_not); } - assert_true(state.status == F_fss_found_content || state.status == F_data_not); + assert_true(state.status == F_fss_found_content || state.status == F_okay_eos || state.status == F_okay_stop || state.status == F_data_not); - if (state.status == F_fss_found_content) { + if (state.status == F_fss_found_content || state.status == F_okay_eos || state.status == F_okay_stop) { if (!found_content.used) { printf("[ -------> ] --- [12] Failure with fl_fss_basic_list_content_read(), with set %lu, expected found_content.used (%lu) <> 0.\n", set, found_content.used); } diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c index d5a6a1a64..946ff5b76 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c @@ -537,13 +537,13 @@ void test__fl_fss_embedded_list_content_read__works_using_combining(void **void_ fl_fss_embedded_list_content_read(set_strings, &range, &found_content, &delimits, &comments, &state); - if (!(state.status == F_fss_found_content || state.status == F_data_not)) { - printf("[ -------> ] --- [11] Failure with fl_fss_embedded_list_content_read(), with set %lu, status=%u, expected %u, or %u.\n", set, state.status, F_fss_found_content, F_data_not); + if (!(state.status == F_fss_found_content || state.status == F_okay_eos || state.status == F_okay_stop || state.status == F_data_not)) { + printf("[ -------> ] --- [11] Failure with fl_fss_embedded_list_content_read(), with set %lu, status=%u, expected %u, %u, %u, or %u.\n", set, state.status, F_fss_found_content, F_okay_eos, F_okay_stop, F_data_not); } - assert_true(state.status == F_fss_found_content || state.status == F_data_not); + assert_true(state.status == F_fss_found_content || state.status == F_okay_eos || state.status == F_okay_stop || state.status == F_data_not); - if (state.status == F_fss_found_content) { + if (state.status == F_fss_found_content || state.status == F_okay_eos || state.status == F_okay_stop) { if (!(found_content.used && found_content.depth[0].used && found_content.depth[0].array[0].content.used)) { printf( "[ -------> ] --- [12] Failure with fl_fss_embedded_list_content_read(), with set %lu, expected found_content.used (%lu) <> 0 or found_content.depth.used (%lu) <> 0 or found_content.depth[0].array[0].content.used (%lu) <> 0 <> 0.\n", -- 2.52.0