From: Kevin Day Date: Tue, 27 Oct 2026 01:56:31 +0000 (-0500) Subject: Progress: Continue working on write and related. X-Git-Url: https://www.git.kevux.org/?a=commitdiff_plain;h=74c646eeee49511dfd7b55b6b671aeace785a3e5;p=fll Progress: Continue working on write and related. --- diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index 3d31ba25f..a0e5029c5 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -159,7 +159,9 @@ extern "C" { return; } - while (range->start <= range->stop && range->start < buffer.used) { + const f_number_unsigned_t initial = *count; + + for (; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { state->interrupt((void *) state, 0); @@ -167,16 +169,17 @@ extern "C" { } if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) { - ++range->start; - - continue; + // Do nothing. } - - if (buffer.string[range->start] == f_fss_slash_s.string[0]) { + else if (buffer.string[range->start] == f_fss_slash_s.string[0]) { ++(*count); } else { if (private_f_fss_is_combining_joiner(buffer, *range, state) == F_true) { + + // A combining joiner invalidates as slash immediately before it and there is only a preceding slash if count > initial. + if (*count > initial) --(*count); + const f_status_t status = state->status; private_f_fss_skip_past_combining_joiner(buffer, range, state); @@ -187,10 +190,7 @@ extern "C" { return; } - - state->status = f_utf_buffer_increment(buffer, range, 1); - if (F_status_is_error(state->status)) return; - } // while + } // for if (range->start > range->stop) { state->status = F_okay_stop; diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index f167c2e12..bd811b9c5 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -206,8 +206,6 @@ extern "C" { * * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from f_utf_buffer_increment(). */ #ifndef _di_f_fss_count_slash_ extern void f_fss_count_slash(const f_string_static_t buffer, f_range_t * const range, f_number_unsigned_t * const count, f_state_t * const state); diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index 34457cff6..304e6b785 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -209,15 +209,18 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_fss_slash_count(). * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 5b7c715d2..55186915f 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -105,35 +105,13 @@ extern "C" { slash_count = 1; flag_fl |= ___fl_flag_do_escape___; - for (; range->start <= range->stop && range->start < buffer.used; ++range->start) { + f_fss_count_slash(buffer, range, &slash_count, state); + if (F_status_is_error(state->status)) return; - if (state->interrupt) { - state->interrupt((void *) state, 0); - if (F_status_set_fine(state->status) == F_interrupt) break; - } - - if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) continue; - - // If any slash has a combining/joiner following it, then there is no escaping at all for that slash and therefore it is not considered an escaping character. - if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) { - flag_fl &= ~___fl_flag_has_graph_first_do_escape___; - - f_fss_skip_past_combining_joiner(buffer, range, state); - - break; - } - - if (F_status_is_error(state->status)) break; - if (buffer.string[range->start] != f_fss_slash_s.string[0]) break; - - ++slash_count; - } // for + flag_fl &= ~___fl_flag_do_escape___; - if (F_status_is_error(state->status)) break; 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 (state->status == F_combarudoo || state->status == F_bound) continue; if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) { flag_fl &= ~___fl_flag_has_graph_first___; @@ -895,24 +873,11 @@ extern "C" { if (object.string[range->start] == f_fss_slash_s.string[0]) { slash_count = 1; - for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { - - if (state->interrupt) { - state->interrupt((void *) state, 0); - if (F_status_set_fine(state->status) == F_interrupt) break; - } - - if (object.string[range->start] == f_fss_placeholder_s.string[0]) continue; - if (object.string[range->start] != f_fss_slash_s.string[0]) break; - - ++slash_count; - } // for - + f_fss_count_slash(object, range, &slash_count, state); if (F_status_is_error(state->status)) break; + // Slashes at the end of the object must be delimited to avoid delimiting the object close character. if (range->start > range->stop || range->start >= object.used) { - - // Slashes at the end of the object must be delimited to avoid delimiting the object close character. slash_count *= 2; } diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index b6d7165b6..a3c858400 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -240,6 +240,7 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -249,6 +250,7 @@ extern "C" { * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index 49c990a4a..ef9773630 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -1130,23 +1130,8 @@ extern "C" { if (object.string[range->start] == f_fss_slash_s.string[0]) { slash_count = 1; - for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { - - if (state->interrupt) { - state->interrupt((void *) state, 0); - - if (F_status_set_fine(state->status) == F_interrupt) { - destination->used = destination_used; - - return; - } - } - - if (object.string[range->start] == f_fss_placeholder_s.string[0]) continue; - if (object.string[range->start] != f_fss_slash_s.string[0]) break; - - ++slash_count; - } // for + f_fss_count_slash(object, range, &slash_count, state); + if (F_status_is_error(state->status)) return; if (range->start > range->stop || range->start >= object.used) { diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index 58d42d897..d366e0365 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -285,6 +285,7 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -294,6 +295,7 @@ extern "C" { * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index 86d5621c9..b53cc2c42 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -87,6 +87,7 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -94,6 +95,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() @@ -235,6 +237,7 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -243,6 +246,7 @@ extern "C" { * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index 5babafe95..4b84b46d4 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -871,23 +871,8 @@ extern "C" { if (object.string[range->start] == f_fss_slash_s.string[0]) { slash_count = 1; - for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { - - if (state->interrupt) { - state->interrupt((void *) state, 0); - - if (F_status_set_fine(state->status) == F_interrupt) { - destination->used = destination_used; - - return; - } - } - - if (object.string[range->start] == f_fss_placeholder_s.string[0]) continue; - if (object.string[range->start] != f_fss_slash_s.string[0]) break; - - ++slash_count; - } // for + f_fss_count_slash(object, range, &slash_count, state); + if (F_status_is_error(state->status)) return; if (range->start > range->stop || range->start >= object.used) { diff --git a/level_1/fl_fss/c/fss/extended_list.h b/level_1/fl_fss/c/fss/extended_list.h index 41017ab67..5a67368e5 100644 --- a/level_1/fl_fss/c/fss/extended_list.h +++ b/level_1/fl_fss/c/fss/extended_list.h @@ -245,6 +245,7 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -254,6 +255,7 @@ extern "C" { * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_1/fl_fss/c/private-fss-list.c b/level_1/fl_fss/c/private-fss-list.c index 353b2d0bd..f8c5c928f 100644 --- a/level_1/fl_fss/c/private-fss-list.c +++ b/level_1/fl_fss/c/private-fss-list.c @@ -100,38 +100,8 @@ extern "C" { line_start = slash_first; } - // If any slash has a combining/joiner following it, then there is no escaping at all but this is not a valid escaping slash. - while (F_status_is_error_not(state->status) && range->start <= range->stop && range->start < buffer.used) { - - if (state->interrupt) { - state->interrupt((void *) state, 0); - if (F_status_is_error(state->status)) break; - } - - if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) { - // Do nothing. - } - else if (buffer.string[range->start] == f_fss_slash_s.string[0]) { - ++slash_count; - } - else if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) { - flag_fl &= ~___fl_flag_do_escape___; - - f_fss_skip_past_combining_joiner(buffer, range, state); - - break; - } - else { - break; - } - - if (F_status_is_error_not(state->status)) { - state->status = f_utf_buffer_increment(buffer, range, 1); - } - } // while - - if (F_status_is_error(state->status)) break; - if (!(flag_fl & ___fl_flag_do_escape___)) continue; + f_fss_count_slash(buffer, range, &slash_count, state); + if (F_status_is_error(state->status)) return; flag_fl &= ~___fl_flag_do_escape___; @@ -150,6 +120,8 @@ extern "C" { return; } + if (state->status == F_combarudoo || state->status == F_bound) continue; + if (buffer.string[range->start] == list_open.string[0]) { flag_fl &= ~___fl_flag_has_graph_first___; line_stop = range->start++; diff --git a/level_1/fl_fss/c/private-fss-list.h b/level_1/fl_fss/c/private-fss-list.h index 480e7ea78..2dee2d5bc 100644 --- a/level_1/fl_fss/c/private-fss-list.h +++ b/level_1/fl_fss/c/private-fss-list.h @@ -66,6 +66,7 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -75,6 +76,7 @@ extern "C" { * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * + * @see f_fss_count_slash() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index cc89b1e1a..d6ec550d9 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -242,43 +242,10 @@ extern "C" { flag_fl &= ~___fl_flag_has_joiner_combining___; - while (range->start <= range->stop && range->start < buffer.used) { + f_fss_count_slash(buffer, range, &slash_count, state); - if (state->interrupt) { - state->interrupt((void *) state, 0); - if (F_status_set_fine(state->status) == F_interrupt) return; - } - - if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) { - ++range->start; - - continue; - } - - if (buffer.string[range->start] == f_fss_slash_s.string[0]) { - ++slash_count; - } - else { - if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) { - f_fss_skip_past_combining_joiner(buffer, range, state); - - flag_fl |= ___fl_flag_has_joiner_combining___; - } - - if (F_status_is_error(state->status)) return; - - break; - } - - state->status = f_utf_buffer_increment(buffer, range, 1); - if (F_status_is_error(state->status)) return; - } // while - - if (flag_fl & ___fl_flag_has_joiner_combining___) { - flag_fl &= ~___fl_flag_has_joiner_combining___; - - continue; - } + if (F_status_is_error(state->status)) return; + if (state->status == F_combarudoo || state->status == F_bound) continue; if (range->start >= buffer.used) { found->stop = buffer.used - 1; @@ -394,8 +361,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_slash_s.string[0]) { if (slash_count % 2 == 1) { - delimits->array[delimits->used] = range->start; - ++delimits->used; + delimits->array[delimits->used++] = range->start; } --slash_count; @@ -916,20 +882,8 @@ extern "C" { item_first = partial.start = range->start++; item_total = 1; - for (; range->start <= range->stop && range->start < object.used; ++range->start) { - - if (state->interrupt) { - state->interrupt((void *) state, internal); - if (F_status_set_fine(state->status) == F_interrupt) break; - } - - if (object.string[range->start] == f_fss_slash_s.string[0]) { // TODO: Verify no combining joiners following. Also, skip past slashes? Or count slashes function? - ++item_total; - } - else if (object.string[range->start] != f_fss_placeholder_s.string[0]) { - break; - } - } // for + f_fss_count_slash(object, range, &item_total, state); + if (F_status_is_error(state->status)) return; if (range->start > range->stop || range->start >= object.used) { diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 39813228f..c1cf9173c 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -76,6 +76,7 @@ extern "C" { * * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_fss_count_slash(). * Errors (with error bit) from: f_fss_is_combining_joiner(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). @@ -89,6 +90,7 @@ extern "C" { * * @see f_memory_array_increase() * @see f_memory_array_increase_by() + * @see f_fss_count_slash() * @see f_fss_is_combining_joiner() * @see f_fss_is_graph() * @see f_fss_is_space()