From: Kevin Day Date: Thu, 19 Nov 2020 02:50:16 +0000 (-0600) Subject: Cleanup: the FSS read functions no longer need the buffer to be a pointer. X-Git-Tag: 0.5.2~68 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=82c7e051ade71590493b1b682ba99eedc3dadcbc;p=fll Cleanup: the FSS read functions no longer need the buffer to be a pointer. The delimits are no longer modified in place. Make the buffer a constant static dynamic string. Remove comment about updating the buffer, which is no longer correct. --- diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index 63a4569..28f73f2 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -6,9 +6,8 @@ extern "C" { #endif #ifndef _di_fl_fss_basic_object_read_ - f_return_status fl_fss_basic_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) { + f_return_status fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -16,7 +15,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = private_fl_fss_basic_read(F_true, buffer, range, found, quote, delimits); + f_status_t status = private_fl_fss_basic_read(buffer, F_true, range, found, quote, delimits); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -28,15 +27,14 @@ extern "C" { #endif // _di_fl_fss_basic_object_read_ #ifndef _di_fl_fss_basic_content_read_ - f_return_status fl_fss_basic_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits) { + f_return_status fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); 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(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -59,19 +57,19 @@ extern "C" { for (;; range->start++) { - status = f_fss_skip_past_delimit(*buffer, range); + status = f_fss_skip_past_delimit(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eos || status == F_none_stop) { return status; } - if (buffer->string[range->start] == f_fss_basic_close) break; + if (buffer.string[range->start] == f_fss_basic_close) break; } // for found->array[found->used++].stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_content; diff --git a/level_1/fl_fss/c/fss_basic.h b/level_1/fl_fss/c/fss_basic.h index 4070fd9..31fe6fe 100644 --- a/level_1/fl_fss/c/fss_basic.h +++ b/level_1/fl_fss/c/fss_basic.h @@ -38,7 +38,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -72,7 +71,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_object_read_ - extern f_return_status fl_fss_basic_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_basic_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits); #endif // _di_fl_fss_basic_object_read_ /** @@ -82,7 +81,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -109,7 +107,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_content_read_ - extern f_return_status fl_fss_basic_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_basic_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits); #endif // _di_fl_fss_basic_content_read_ /** diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 5156313..93cd652 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -6,9 +6,8 @@ extern "C" { #endif #ifndef _di_fl_fss_basic_list_object_read_ - f_return_status fl_fss_basic_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) { + f_return_status fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -16,7 +15,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(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -39,9 +38,9 @@ extern "C" { found->start = range->start; // ignore all comment lines. - if (buffer->string[range->start] == f_fss_comment) { + if (buffer.string[range->start] == f_fss_comment) { - status = f_fss_seek_to_eol(*buffer, range); + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eos) { @@ -66,48 +65,48 @@ extern "C" { bool graph_first = F_true; // identify where the object ends. - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_first = range->start; slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < buffer->used; range->start++) { + for (range->start++; range->start <= range->stop && range->start < buffer.used; range->start++) { - if (buffer->string[range->start] == f_fss_delimit_placeholder) { + if (buffer.string[range->start] == f_fss_delimit_placeholder) { continue; - } else if (buffer->string[range->start] != f_fss_delimit_slash) { + } else if (buffer.string[range->start] != f_fss_delimit_slash) { break; } slash_count++; } // for - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - if (buffer->string[range->start] == f_fss_basic_list_open) { + if (buffer.string[range->start] == f_fss_basic_list_open) { graph_first = F_false; stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { start = range->start; range->start = slash_first; @@ -118,7 +117,7 @@ extern "C" { if (slash_count % 2 == 0) { while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; delimits->used++; @@ -127,7 +126,7 @@ extern "C" { slash_count--; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -145,7 +144,7 @@ extern "C" { return FL_fss_found_object_not; } } - else if (graph_first && buffer->string[range->start] == f_fss_comment) { + else if (graph_first && buffer.string[range->start] == f_fss_comment) { graph_first = F_false; // comments may only have whitespace before the '#', therefore only the first slash needs to be delimited. @@ -161,32 +160,32 @@ extern "C" { continue; } - else if (buffer->string[range->start] == f_fss_basic_list_open) { + else if (buffer.string[range->start] == f_fss_basic_list_open) { graph_first = F_false; stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while - fl_macro_fss_object_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + fl_macro_fss_object_return_on_overflow_delimited((buffer), (*range), (*found), F_none_eos, F_none_stop); - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { found->stop = stop; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; return FL_fss_found_object; @@ -195,7 +194,7 @@ extern "C" { continue; } else if (graph_first) { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -203,7 +202,7 @@ extern "C" { } } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -221,7 +220,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(buffer, range); // move the start position to after the EOL. range->start++; @@ -231,9 +230,8 @@ extern "C" { #endif // _di_fl_fss_basic_list_object_read_ #ifndef _di_fl_fss_basic_list_content_read_ - f_return_status fl_fss_basic_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { + f_return_status fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -243,10 +241,10 @@ 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(buffer, range); if (F_status_is_error(status)) return status; - fl_macro_fss_content_with_comments_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop); + fl_macro_fss_content_with_comments_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop); status = private_fl_fss_ranges_increase(found); if (F_status_is_error(status)) return status; @@ -262,9 +260,9 @@ extern "C" { uint8_t graph_first = 0x1; // 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set. // identify where the content ends. - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { if (graph_first == 0x2) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -278,43 +276,43 @@ extern "C" { continue; } - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_first = range->start; slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < buffer->used; range->start++) { + for (range->start++; range->start <= range->stop && range->start < buffer.used; range->start++) { - if (buffer->string[range->start] == f_fss_delimit_placeholder) { + if (buffer.string[range->start] == f_fss_delimit_placeholder) { continue; - } else if (buffer->string[range->start] != f_fss_delimit_slash) { + } else if (buffer.string[range->start] != f_fss_delimit_slash) { break; } slash_count++; } // for - if (range->start > range->stop || range->start >= buffer->used) break; + if (range->start > range->stop || range->start >= buffer.used) break; - if (buffer->string[range->start] == f_fss_basic_list_open) { + if (buffer.string[range->start] == f_fss_basic_list_open) { graph_first = 0x0; range->start++; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while - if (range->start > range->stop || range->start >= buffer->used) break; + if (range->start > range->stop || range->start >= buffer.used) break; - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { start = range->start; range->start = slash_first; @@ -330,7 +328,7 @@ extern "C" { while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used++] = range->start; } @@ -338,7 +336,7 @@ extern "C" { slash_count--; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -355,7 +353,7 @@ extern "C" { range->start = start + 1; } } - else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment) { graph_first = 0x2; comment_delimit = slash_first; range->start++; @@ -364,31 +362,31 @@ extern "C" { continue; } - if (buffer->string[range->start] == f_fss_basic_list_open) { + if (buffer.string[range->start] == f_fss_basic_list_open) { range->start++; graph_first = 0x0; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; - if (range->start > range->stop || range->start >= buffer->used) break; + if (range->start > range->stop || range->start >= buffer.used) break; // found a valid object, set stop point to last newline. - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { - if (newline_last == found->array[found->used].start && buffer->string[found->array[found->used].start] != f_fss_eol) { + if (newline_last == found->array[found->used].start && buffer.string[found->array[found->used].start] != f_fss_eol) { range->start = newline_last; return FL_fss_found_content_not; } @@ -400,7 +398,7 @@ extern "C" { return FL_fss_found_content; } - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { if (graph_first == 0x2) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -415,16 +413,16 @@ extern "C" { continue; } - if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment) { start = range->start; - status = f_fss_seek_to_eol(*buffer, range); + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) break; status = private_fl_fss_ranges_increase(comments); if (F_status_is_error(status)) break; - if (range->start > range->stop || range->start >= buffer->used) { + if (range->start > range->stop || range->start >= buffer.used) { range->start--; } else { @@ -437,7 +435,7 @@ extern "C" { } if (graph_first == 0x1) { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -445,7 +443,7 @@ extern "C" { } } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -457,7 +455,7 @@ extern "C" { found->array[found->used++].stop = range->start - 1; - fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + fl_macro_fss_content_return_on_overflow_delimited((buffer), (*range), (*found), F_none_eos, F_none_stop); return FL_fss_found_content; } diff --git a/level_1/fl_fss/c/fss_basic_list.h b/level_1/fl_fss/c/fss_basic_list.h index 962711c..3a988e0 100644 --- a/level_1/fl_fss/c/fss_basic_list.h +++ b/level_1/fl_fss/c/fss_basic_list.h @@ -39,7 +39,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -74,7 +73,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_list_object_read_ - extern f_return_status fl_fss_basic_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_basic_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits); #endif // _di_fl_fss_basic_list_object_read_ /** @@ -84,7 +83,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -123,7 +121,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_list_content_read_ - extern f_return_status fl_fss_basic_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments); + extern f_return_status fl_fss_basic_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments); #endif // _di_fl_fss_basic_list_content_read_ /** diff --git a/level_1/fl_fss/c/fss_embedded_list.c b/level_1/fl_fss/c/fss_embedded_list.c index 24d2107..bbbe0ae 100644 --- a/level_1/fl_fss/c/fss_embedded_list.c +++ b/level_1/fl_fss/c/fss_embedded_list.c @@ -6,9 +6,8 @@ extern "C" { #endif #ifndef _di_fl_fss_embedded_list_object_read_ - f_return_status fl_fss_embedded_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) { + f_return_status fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -16,7 +15,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(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -36,7 +35,7 @@ extern "C" { } // return found nothing if this line only contains whitespace and delimit placeholders. - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. range->start++; @@ -48,8 +47,8 @@ extern "C" { found->start = range->start; // ignore all comment lines. - if (buffer->string[range->start] == f_fss_comment) { - status = f_fss_seek_to_eol(*buffer, range); + if (buffer.string[range->start] == f_fss_comment) { + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -78,48 +77,48 @@ extern "C" { bool graph_first = F_true; // identify where the object ends. - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_first = range->start; slash_count = 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { + while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) { - if (buffer->string[range->start] == f_fss_delimit_slash) slash_count++; + if (buffer.string[range->start] == f_fss_delimit_slash) slash_count++; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - if (buffer->string[range->start] == f_fss_embedded_list_open) { + if (buffer.string[range->start] == f_fss_embedded_list_open) { graph_first = F_false; stop = range->start - 1; range->start++; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_graph(*buffer, *range); + status = f_fss_is_graph(buffer, *range); if (F_status_is_error(status)) break; if (status == F_true) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { start = range->start; range->start = slash_first; @@ -130,7 +129,7 @@ extern "C" { if (slash_count % 2 == 0) { while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; delimits->used++; @@ -139,7 +138,7 @@ extern "C" { slash_count--; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -155,7 +154,7 @@ extern "C" { return FL_fss_found_object_not; } } - else if (graph_first && buffer->string[range->start] == f_fss_comment) { + else if (graph_first && buffer.string[range->start] == f_fss_comment) { graph_first = F_false; // comments may only have whitespace before the '#', therefore only the first slash needs to be delimited. @@ -171,31 +170,31 @@ extern "C" { continue; } - else if (buffer->string[range->start] == f_fss_embedded_list_open) { + else if (buffer.string[range->start] == f_fss_embedded_list_open) { graph_first = F_false; stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; - fl_macro_fss_object_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + fl_macro_fss_object_return_on_overflow_delimited((buffer), (*range), (*found), F_none_eos, F_none_stop); - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { found->stop = stop; // move the start position to after the EOL. @@ -207,7 +206,7 @@ extern "C" { continue; } else if (graph_first) { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -215,7 +214,7 @@ extern "C" { } } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -225,9 +224,9 @@ extern "C" { } // seek to the end of the line when no valid object is found. - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -235,9 +234,9 @@ extern "C" { } } // while - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -249,9 +248,8 @@ extern "C" { #endif // _di_fl_fss_embedded_list_object_read_ #ifndef _di_fl_fss_embedded_list_content_read_ - f_return_status fl_fss_embedded_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { + f_return_status fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -260,7 +258,7 @@ extern "C" { const f_array_length_t found_used = found->used; - f_status_t status = f_fss_skip_past_delimit(*buffer, range); + f_status_t status = f_fss_skip_past_delimit(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eos || status == F_none_stop) { @@ -311,9 +309,9 @@ extern "C" { positions_start.array[0] = range->start; positions_start.used = 1; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { if (graph_first == 0x2) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -326,44 +324,44 @@ extern "C" { graph_first = 0x1; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); } else { - fl_macro_fss_nest_return_on_overflow_delimited((*buffer), (*range), (*found), positions_start, objects, F_none_eos, F_none_stop); + fl_macro_fss_nest_return_on_overflow_delimited((buffer), (*range), (*found), positions_start, objects, F_none_eos, F_none_stop); } line_start = range->start; continue; } - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_first = range->start; slash_last = range->start; slash_count = 1; position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { + while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) { position_previous = range->start; - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_last = range->start++; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); } else { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); } // All slashes for an open are delimited (because it could represent a slash in the object name). @@ -371,7 +369,7 @@ extern "C" { // Only the first slash before a close is delimited, all others are maintained. // for example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on.. // When slash is odd and a (delimited) valid open/close is found, then save delimited positions and continue. - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { if (graph_first == 0x2) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -384,20 +382,20 @@ extern "C" { line_start = range->start; graph_first = 0x1; } - else if (buffer->string[range->start] == f_fss_embedded_list_open || buffer->string[range->start] == f_fss_embedded_list_close) { + else if (buffer.string[range->start] == f_fss_embedded_list_open || buffer.string[range->start] == f_fss_embedded_list_close) { before_list_open = position_previous; is_open = F_false; graph_first = 0x0; - if (buffer->string[range->start] == f_fss_embedded_list_open) { + if (buffer.string[range->start] == f_fss_embedded_list_open) { is_open = F_true; } position_previous = range->start++; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { if (graph_first == 0x2) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -411,8 +409,8 @@ extern "C" { break; } - if (buffer->string[range->start] != f_fss_delimit_placeholder) { - status = f_fss_is_space(*buffer, *range); + if (buffer.string[range->start] != f_fss_delimit_placeholder) { + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -420,21 +418,21 @@ extern "C" { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); } else { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); } // this is a valid object open/close that has been delimited, save the slash delimit positions. - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { newline_last = range->start; line_start = range->start + 1; graph_first = 0x1; @@ -454,7 +452,7 @@ extern "C" { // apply slash delimits, only slashes and placeholders should be present. while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used++] = range->start; } @@ -497,7 +495,7 @@ extern "C" { range->start = newline_last; } } - else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment) { graph_first = 0x2; comment_delimit = slash_first; } @@ -505,20 +503,20 @@ extern "C" { graph_first = 0x0; } } - else if (buffer->string[range->start] == f_fss_embedded_list_open) { + else if (buffer.string[range->start] == f_fss_embedded_list_open) { graph_first = 0x0; before_list_open = position_previous; position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - if (buffer->string[range->start] != f_fss_delimit_placeholder) { - status = f_fss_is_space(*buffer, *range); + if (buffer.string[range->start] != f_fss_delimit_placeholder) { + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; @@ -526,20 +524,20 @@ extern "C" { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); } else { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); } - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { depth++; if (depth >= positions_start.size) { @@ -573,7 +571,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(buffer, range); if (F_status_is_error(status)) break; if (graph_first == 0x2) { @@ -587,9 +585,9 @@ extern "C" { line_start = range->start + 1; graph_first = 0x1; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { newline_last = range->start; line_start = range->start + 1; break; @@ -597,36 +595,36 @@ extern "C" { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); } else { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); } } } - else if (buffer->string[range->start] == f_fss_embedded_list_close) { + else if (buffer.string[range->start] == f_fss_embedded_list_close) { graph_first = 0x0; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { break; } - if (buffer->string[range->start] != f_fss_delimit_placeholder) { - status = f_fss_is_space(*buffer, *range); + if (buffer.string[range->start] != f_fss_delimit_placeholder) { + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -638,13 +636,13 @@ extern "C" { if (F_status_is_error(status)) break; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop); } else { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop); } - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { status = private_fl_fss_nest_increase(found); if (F_status_is_error(status)) break; @@ -692,10 +690,10 @@ extern "C" { graph_first = 0x1; if (!depth) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - fl_macro_fss_nest_return_on_overflow_delimited((*buffer), (*range), (*found), positions_start, objects, F_none_eos, F_none_stop) + fl_macro_fss_nest_return_on_overflow_delimited((buffer), (*range), (*found), positions_start, objects, F_none_eos, F_none_stop) f_macro_string_lengths_t_delete_simple(positions_start); f_macro_fss_objects_t_delete_simple(objects); @@ -708,9 +706,9 @@ extern "C" { else { // No valid object close found, seek until EOL. - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { if (graph_first == 0x2) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -726,30 +724,30 @@ extern "C" { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop) + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_unterminated_nest_eos, F_unterminated_nest_stop) } else { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop) + fl_macro_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, F_data_not_eos, F_data_not_stop) } } } - else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment) { position = range->start; - status = f_fss_seek_to_eol(*buffer, range); + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) break; status = private_fl_fss_ranges_increase(comments); if (F_status_is_error(status)) break; - if (range->start > range->stop || range->start >= buffer->used) { + if (range->start > range->stop || range->start >= buffer.used) { range->start--; } else { @@ -768,11 +766,11 @@ extern "C" { comments->array[comments->used++].stop = range->start++; continue; } - else if (buffer->string[range->start] != f_fss_eol) { + else if (buffer.string[range->start] != f_fss_eol) { position_previous = range->start; if (graph_first == 0x1) { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -780,10 +778,10 @@ extern "C" { } } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - if (range->start >= buffer->used || range->start > range->stop) { + if (range->start >= buffer.used || range->start > range->stop) { break; } @@ -792,7 +790,7 @@ extern "C" { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while diff --git a/level_1/fl_fss/c/fss_embedded_list.h b/level_1/fl_fss/c/fss_embedded_list.h index b4507e6..9e67332 100644 --- a/level_1/fl_fss/c/fss_embedded_list.h +++ b/level_1/fl_fss/c/fss_embedded_list.h @@ -39,7 +39,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -74,7 +73,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_embedded_list_object_read_ - extern f_return_status fl_fss_embedded_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_embedded_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits); #endif // _di_fl_fss_embedded_list_object_read_ /** @@ -88,7 +87,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -126,7 +124,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_embedded_list_content_read_ - extern f_return_status fl_fss_embedded_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments); + extern f_return_status fl_fss_embedded_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments); #endif // _di_fl_fss_embedded_list_content_read_ /** diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index 75ea13d..2e239dc 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -6,9 +6,8 @@ extern "C" { #endif #ifndef _di_fl_fss_extended_object_read_ - f_return_status fl_fss_extended_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) { + f_return_status fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -16,7 +15,7 @@ extern "C" { const f_array_length_t delimits_used = delimits->used; - f_status_t status = private_fl_fss_basic_read(F_true, buffer, range, found, quoted, delimits); + f_status_t status = private_fl_fss_basic_read(buffer, F_true, range, found, quoted, delimits); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -33,9 +32,8 @@ extern "C" { #endif // _di_fl_fss_extended_object_read_ #ifndef _di_fl_fss_extended_content_read_ - f_return_status fl_fss_extended_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits) { + f_return_status fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -44,7 +42,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(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -64,11 +62,11 @@ extern "C" { uint8_t content_found = 0; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { f_string_range_t content_partial = f_string_range_t_initialize; f_fss_quote_t quoted = 0; - status = private_fl_fss_basic_read(F_false, buffer, range, &content_partial, "ed, delimits); + status = private_fl_fss_basic_read(buffer, F_false, range, &content_partial, "ed, delimits); if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { diff --git a/level_1/fl_fss/c/fss_extended.h b/level_1/fl_fss/c/fss_extended.h index 7f1e3d2..075f656 100644 --- a/level_1/fl_fss/c/fss_extended.h +++ b/level_1/fl_fss/c/fss_extended.h @@ -38,7 +38,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -72,7 +71,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_object_read_ - extern f_return_status fl_fss_extended_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_extended_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits); #endif // _di_fl_fss_extended_object_read_ /** @@ -82,7 +81,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -115,7 +113,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_content_read_ - extern f_return_status fl_fss_extended_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_extended_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_quotes_t *quotes, f_fss_delimits_t *delimits); #endif // _di_fl_fss_extended_content_read_ /** diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 050a23b..6cec9fd 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -6,9 +6,8 @@ extern "C" { #endif #ifndef _di_fl_fss_extended_list_object_read_ - f_return_status fl_fss_extended_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) { + f_return_status fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -16,7 +15,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(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -36,7 +35,7 @@ extern "C" { } // return found nothing if this line only contains whitespace and delimit placeholders. - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. range->start++; @@ -48,8 +47,8 @@ extern "C" { found->start = range->start; // ignore all comment lines. - if (buffer->string[range->start] == f_fss_comment) { - status = f_fss_seek_to_eol(*buffer, range); + if (buffer.string[range->start] == f_fss_comment) { + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -78,48 +77,48 @@ extern "C" { bool graph_first = F_true; // identify where the object ends. - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_first = range->start; slash_count = 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { + while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) { - if (buffer->string[range->start] == f_fss_delimit_slash) slash_count++; + if (buffer.string[range->start] == f_fss_delimit_slash) slash_count++; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - if (buffer->string[range->start] == f_fss_extended_list_open) { + if (buffer.string[range->start] == f_fss_extended_list_open) { graph_first = F_false; stop = range->start - 1; range->start++; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_graph(*buffer, *range); + status = f_fss_is_graph(buffer, *range); if (F_status_is_error(status)) break; if (status == F_true) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { start = range->start; range->start = slash_first; @@ -130,7 +129,7 @@ extern "C" { if (slash_count % 2 == 0) { while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; delimits->used++; @@ -139,7 +138,7 @@ extern "C" { slash_count--; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -155,7 +154,7 @@ extern "C" { return FL_fss_found_object_not; } } - else if (graph_first && buffer->string[range->start] == f_fss_comment) { + else if (graph_first && buffer.string[range->start] == f_fss_comment) { graph_first = F_false; // comments may only have whitespace before the '#', therefore only the first slash needs to be delimited. @@ -171,31 +170,31 @@ extern "C" { continue; } - else if (buffer->string[range->start] == f_fss_extended_list_open) { + else if (buffer.string[range->start] == f_fss_extended_list_open) { graph_first = F_false; stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; - fl_macro_fss_object_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + fl_macro_fss_object_return_on_overflow_delimited((buffer), (*range), (*found), F_none_eos, F_none_stop); - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { found->stop = stop; // move the start position to after the EOL. @@ -207,7 +206,7 @@ extern "C" { continue; } else if (graph_first) { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) { @@ -215,7 +214,7 @@ extern "C" { } } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while @@ -225,9 +224,9 @@ extern "C" { } // seek to the end of the line when no valid object is found. - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -235,9 +234,9 @@ extern "C" { } } // while - fl_macro_fss_object_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + fl_macro_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -249,9 +248,8 @@ extern "C" { #endif // _di_fl_fss_extended_list_object_read_ #ifndef _di_fl_fss_extended_list_content_read_ - f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { + f_return_status fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { #ifndef _di_level_1_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!found) return F_status_set_error(F_parameter); if (!delimits) return F_status_set_error(F_parameter); @@ -261,10 +259,10 @@ 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(buffer, range); if (F_status_is_error(status)) return status; - fl_macro_fss_content_with_comments_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop); + fl_macro_fss_content_with_comments_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, F_none_eos, F_none_stop); status = private_fl_fss_ranges_increase(found); if (F_status_is_error(status)) return status; @@ -277,9 +275,9 @@ extern "C" { f_string_length_t start = 0; // identify where the content ends. - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - status = f_fss_skip_past_space(*buffer, range); + status = f_fss_skip_past_space(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -288,45 +286,45 @@ extern "C" { continue; } - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { slash_first = range->start; slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < buffer->used; ++range->start) { + for (range->start++; range->start <= range->stop && range->start < buffer.used; ++range->start) { - if (buffer->string[range->start] == f_fss_delimit_placeholder) { + if (buffer.string[range->start] == f_fss_delimit_placeholder) { continue; - } else if (buffer->string[range->start] != f_fss_delimit_slash) { + } else if (buffer.string[range->start] != f_fss_delimit_slash) { break; } slash_count++; } // for - if (range->start > range->stop || range->start >= buffer->used) break; + if (range->start > range->stop || range->start >= buffer.used) break; // Only the first slash before a close is delimited, all others are maintained. // For example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on.. // With one or more slashes, even if delimited, this line may never designate a valid content close. - if (buffer->string[range->start] == f_fss_extended_list_close) { + if (buffer.string[range->start] == f_fss_extended_list_close) { range->start++; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while - if (range->start > range->stop || range->start >= buffer->used) break; + if (range->start > range->stop || range->start >= buffer.used) break; - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; @@ -334,41 +332,41 @@ extern "C" { continue; } } - else if (buffer->string[range->start] == f_fss_comment) { + else if (buffer.string[range->start] == f_fss_comment) { status = private_fl_fss_delimits_increase(delimits); if (F_status_is_error(status)) break; delimits->array[delimits->used++] = slash_first; } - status = f_fss_seek_to_eol(*buffer, range); + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) break; continue; } - if (buffer->string[range->start] == f_fss_extended_list_close) { + if (buffer.string[range->start] == f_fss_extended_list_close) { range->start++; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) break; + if (buffer.string[range->start] == f_fss_eol) break; - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) break; if (status == F_false) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) break; } // while if (F_status_is_error(status)) break; - if (range->start > range->stop || range->start >= buffer->used) break; + if (range->start > range->stop || range->start >= buffer.used) break; // found a valid content close, set stop point to last newline. - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { range->start = newline_last + 1; found->array[found->used++].stop = newline_last; @@ -378,16 +376,16 @@ extern "C" { continue; } - if (buffer->string[range->start] == f_fss_comment) { + if (buffer.string[range->start] == f_fss_comment) { start = range->start; - status = f_fss_seek_to_eol(*buffer, range); + status = f_fss_seek_to_eol(buffer, range); if (F_status_is_error(status)) break; status = private_fl_fss_ranges_increase(comments); if (F_status_is_error(status)) break; - if (range->start > range->stop || range->start >= buffer->used) { + if (range->start > range->stop || range->start >= buffer.used) { range->start--; } else { @@ -400,7 +398,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(buffer, range); if (F_status_is_error(status)) break; } // while diff --git a/level_1/fl_fss/c/fss_extended_list.h b/level_1/fl_fss/c/fss_extended_list.h index 23c94bb..2f3d377 100644 --- a/level_1/fl_fss/c/fss_extended_list.h +++ b/level_1/fl_fss/c/fss_extended_list.h @@ -39,7 +39,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -74,7 +73,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_list_object_read_ - extern f_return_status fl_fss_extended_list_object_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_extended_list_object_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_delimits_t *delimits); #endif // _di_fl_fss_extended_list_object_read_ /** @@ -86,7 +85,6 @@ extern "C" { * * @param buffer * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -124,7 +122,7 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_list_content_read_ - extern f_return_status fl_fss_extended_list_content_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments); + extern f_return_status fl_fss_extended_list_content_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_content_t *found, f_fss_delimits_t *delimits, f_fss_comments_t *comments); #endif // _di_fl_fss_extended_list_content_read_ /** diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index a9ea6dc..497dd45 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -190,9 +190,9 @@ extern "C" { #endif // !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) - f_return_status private_fl_fss_basic_read(const bool object_as, f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) { + f_return_status private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quote, f_fss_delimits_t *delimits) { - f_status_t status = f_fss_skip_past_space(*buffer, range); + f_status_t status = f_fss_skip_past_space(buffer, range); if (F_status_is_error(status)) return status; if (status == F_none_eol) { @@ -215,12 +215,12 @@ extern "C" { found->start = range->start; // ignore all comment lines. - if (object_as && buffer->string[range->start] == f_fss_comment) { + if (object_as && buffer.string[range->start] == f_fss_comment) { - while (buffer->string[range->start] != f_fss_eol) { + while (buffer.string[range->start] != f_fss_eol) { range->start++; - if (range->start >= buffer->used) return F_data_not_eos; + if (range->start >= buffer.used) return F_data_not_eos; if (range->start > range->stop) return F_data_not_stop; } // while @@ -238,38 +238,38 @@ extern "C" { } // identify where the object begins. - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { f_string_length_t first_slash = range->start; found->start = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - status = f_fss_is_zero_width(*buffer, *range); + status = f_fss_is_zero_width(buffer, *range); if (F_status_is_error(status)) return status; if (status == F_true) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; continue; } - if (buffer->string[range->start] != f_fss_delimit_slash) { - status = f_fss_is_space(*buffer, *range); + if (buffer.string[range->start] != f_fss_delimit_slash) { + status = f_fss_is_space(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) { found->stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { return FL_fss_found_object_content_not; } @@ -279,12 +279,12 @@ extern "C" { break; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while - if (range->start >= buffer->used) { - found->stop = buffer->used - 1; + if (range->start >= buffer.used) { + found->stop = buffer.used - 1; return F_none_eos; } @@ -293,7 +293,7 @@ extern "C" { return F_none_stop; } - if (buffer->string[range->start] == f_fss_delimit_quote_single || buffer->string[range->start] == f_fss_delimit_quote_double || (object_as && buffer->string[range->start] == f_fss_comment)) { + if (buffer.string[range->start] == f_fss_delimit_quote_single || buffer.string[range->start] == f_fss_delimit_quote_double || (object_as && buffer.string[range->start] == f_fss_comment)) { // only the first slash before a quoted needs to be escaped (or not) as once there is a slash before a quoted, this cannot ever be a quote object. // this simplifies the number of slashes needed. @@ -303,14 +303,14 @@ extern "C" { delimits->array[delimits->used] = first_slash; delimits->used++; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } } - else if (buffer->string[range->start] == f_fss_delimit_quote_single || buffer->string[range->start] == f_fss_delimit_quote_double) { - quote_found = buffer->string[range->start]; + else if (buffer.string[range->start] == f_fss_delimit_quote_single || buffer.string[range->start] == f_fss_delimit_quote_double) { + quote_found = buffer.string[range->start]; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; found->start = range->start; @@ -320,20 +320,20 @@ extern "C" { if (!quote_found) { status = F_none; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) return status; if (status == F_true) break; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while found->stop = range->start - 1; - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. range->start++; @@ -341,7 +341,7 @@ extern "C" { return FL_fss_found_object_content_not; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; @@ -351,35 +351,35 @@ extern "C" { f_string_length_t slash_count = 0; f_string_length_t location = 0; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { first_slash = range->start; slash_count = 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_delimit_placeholder) { - status = f_utf_buffer_increment(*buffer, range, 1); + if (buffer.string[range->start] == f_fss_delimit_placeholder) { + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; continue; } - else if (buffer->string[range->start] != f_fss_delimit_slash) { + else if (buffer.string[range->start] != f_fss_delimit_slash) { break; } slash_count++; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while - if (range->start >= buffer->used) { - found->stop = buffer->used - 1; + if (range->start >= buffer.used) { + found->stop = buffer.used - 1; return F_unterminated_group_eos; } @@ -388,23 +388,23 @@ extern "C" { return F_unterminated_group_stop; } - if (buffer->string[range->start] == quote_found) { + if (buffer.string[range->start] == quote_found) { location = range->start; // check to see if there is a whitespace, EOS, or EOL after the quoted, if not, then this is not a closing quoted and delimits do not apply. - if (range->start + 1 <= range->stop && range->start + 1 < buffer->used) { + 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(buffer, range); if (F_status_is_error(status)) return status; - if (range->start > range->stop || range->start >= buffer->used) { + if (range->start > range->stop || range->start >= buffer.used) { // EOS or EOL was reached, so it is a valid closing quoted. // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE (@todo maybe none on stop?). status = F_true; } else { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) return status; } } @@ -432,7 +432,7 @@ extern "C" { while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; delimits->used++; @@ -441,32 +441,32 @@ extern "C" { slash_count--; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while range->start = location + 1; - while (buffer->string[range->start] == f_fss_delimit_placeholder) { + while (buffer.string[range->start] == f_fss_delimit_placeholder) { range->start++; - if (range->start >= buffer->used) return F_none_eos; + if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; } // while - status = f_fss_is_graph(*buffer, *range); + status = f_fss_is_graph(buffer, *range); if (F_status_is_error(status)) return status; if (status == F_true) { - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while - if (range->start >= buffer->used) { - found->stop = buffer->used - 1; + if (range->start >= buffer.used) { + found->stop = buffer.used - 1; return F_data_not_eos; } @@ -475,13 +475,13 @@ extern "C" { return F_data_not_stop; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; } - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { found->stop = location - 1; // move the start position to after the EOL. @@ -492,7 +492,7 @@ extern "C" { found->stop = location - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; @@ -503,7 +503,7 @@ extern "C" { while (slash_count > 0) { - if (buffer->string[range->start] == f_fss_delimit_slash) { + if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; delimits->used++; @@ -512,7 +512,7 @@ extern "C" { slash_count--; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -524,24 +524,24 @@ extern "C" { } } } - else if (buffer->string[range->start] == quote_found) { + else if (buffer.string[range->start] == quote_found) { // check to see if there is a whitespace, EOS, or EOL after the quoted, if not, then this is not a closing quoted. location = range->start; - if (range->start + 1 <= range->stop && range->start + 1 < buffer->used) { + 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(buffer, range); if (F_status_is_error(status)) return status; - if (range->start > range->stop || range->start >= buffer->used) { + if (range->start > range->stop || range->start >= buffer.used) { // EOS or EOL was reached, so it is a valid closing quoted. // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE (@todo maybe none on stop?). status = F_true; } else { - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) return status; } } @@ -565,12 +565,12 @@ extern "C" { found->stop = range->start - 1; - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; - while (range->start <= range->stop && range->start < buffer->used) { + while (range->start <= range->stop && range->start < buffer.used) { - if (buffer->string[range->start] == f_fss_eol) { + if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. range->start++; @@ -578,26 +578,26 @@ extern "C" { return FL_fss_found_object_content_not; } - status = f_fss_is_space(*buffer, *range); + status = f_fss_is_space(buffer, *range); if (F_status_is_error(status)) return status; if (status == F_true) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object; } - if (buffer->string[range->start] != f_fss_delimit_placeholder) { + if (buffer.string[range->start] != f_fss_delimit_placeholder) { - while (range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] != f_fss_eol) { + while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol) { - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while - if (range->start >= buffer->used) { - found->stop = buffer->used - 1; + if (range->start >= buffer.used) { + found->stop = buffer.used - 1; return F_data_not_eos; } @@ -606,18 +606,18 @@ extern "C" { return F_data_not_stop; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; return FL_fss_found_object_not; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while - if (range->start >= buffer->used) { - found->stop = buffer->used - 1; + if (range->start >= buffer.used) { + found->stop = buffer.used - 1; return F_none_eos; } @@ -627,7 +627,7 @@ extern "C" { } } } - else if (buffer->string[range->start] == f_fss_eol) { + else if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. range->start++; @@ -635,12 +635,12 @@ extern "C" { return FL_fss_found_object_not; } - status = f_utf_buffer_increment(*buffer, range, 1); + status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; } // while - if (range->start >= buffer->used) { - found->stop = buffer->used - 1; + if (range->start >= buffer.used) { + found->stop = buffer.used - 1; return F_unterminated_group_eos; } @@ -651,7 +651,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(buffer, range); if (F_status_is_error(status)) return status; // move the start position to after the EOL. diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 9dbb66e..3b743ff 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -87,15 +87,14 @@ extern "C" { * * Intended to be shared to each of the different implementation variations. * + * @param buffer + * The buffer to read from. * @param object_as * If TRUE, then this operate as an Object. * IF FALSE, then this operates as a Content. * * 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 buffer - * The buffer to read from. - * This will be updated with delimit placeholders as it is being processed. * @param range * The start/stop location within the buffer to be processed. * The start location will be updated as the buffer is being processed. @@ -139,7 +138,7 @@ extern "C" { * @see fl_fss_extended_content_read() */ #if !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) - extern f_return_status private_fl_fss_basic_read(const bool object_as, f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_fss_basic_read(const f_string_static_t buffer, const bool object_as, f_string_range_t *range, f_fss_object_t *found, f_fss_quote_t *quoted, f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_) || !defined(_di_fl_fss_extended_content_read_) /** diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index e046410..efda731 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -5,9 +5,8 @@ extern "C" { #endif #ifndef _di_fll_fss_basic_read_ - f_return_status fll_fss_basic_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_return_status fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { #ifndef _di_level_2_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!objects) return F_status_set_error(F_parameter); if (!contents) return F_status_set_error(F_parameter); @@ -47,7 +46,7 @@ extern "C" { return status; } - if (range->start >= range->stop || range->start >= buffer->used) { + if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { objects->used++; @@ -66,14 +65,14 @@ extern "C" { } if (found_data) { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } return F_none_stop; } else { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_data_not_eos; } @@ -126,7 +125,7 @@ extern "C" { return status; } // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. - else if (range->start >= range->stop || range->start >= buffer->used) { + else if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_content || status == FL_fss_found_content_not || status == FL_fss_found_object_content_not) { objects->used++; contents->used++; @@ -136,7 +135,7 @@ extern "C" { } } - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } diff --git a/level_2/fll_fss/c/fss_basic.h b/level_2/fll_fss/c/fss_basic.h index 15eb113..7297535 100644 --- a/level_2/fll_fss/c/fss_basic.h +++ b/level_2/fll_fss/c/fss_basic.h @@ -68,7 +68,7 @@ extern "C" { * Errors (with error bit) from: fl_fss_basic_object_read(). */ #ifndef _di_fll_fss_basic_read_ - extern f_return_status fll_fss_basic_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits); + extern f_return_status fll_fss_basic_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits); #endif // _di_fll_fss_basic_read_ /** diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index 67966dc..ac8e6b5 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -5,9 +5,8 @@ extern "C" { #endif #ifndef _di_fll_fss_basic_list_read_ - f_return_status fll_fss_basic_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { + f_return_status fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { #ifndef _di_level_2_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!objects) return F_status_set_error(F_parameter); if (!contents) return F_status_set_error(F_parameter); @@ -33,7 +32,7 @@ extern "C" { status = fl_fss_basic_list_object_read(buffer, range, &objects->array[objects->used], objects_delimits); if (F_status_is_error(status)) return status; - if (range->start >= range->stop || range->start >= buffer->used) { + if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { objects->used++; @@ -48,14 +47,14 @@ extern "C" { } if (found_data) { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } return F_none_stop; } else { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_data_not_eos; } @@ -107,7 +106,7 @@ extern "C" { else if (status != FL_fss_found_object && status != FL_fss_found_content && status != FL_fss_found_content_not && status != FL_fss_found_object_content_not) { return status; } - else if (range->start >= range->stop || range->start >= buffer->used) { + else if (range->start >= range->stop || range->start >= buffer.used) { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == FL_fss_found_object || status == FL_fss_found_content || status == FL_fss_found_content_not || status == FL_fss_found_object_content_not) { @@ -115,7 +114,7 @@ extern "C" { contents->used++; } - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } diff --git a/level_2/fll_fss/c/fss_basic_list.h b/level_2/fll_fss/c/fss_basic_list.h index e84a796..2427ba5 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -67,7 +67,7 @@ extern "C" { * Errors (with error bit) from: fl_fss_basic_list_object_read(). */ #ifndef _di_fll_fss_basic_list_read_ - extern f_return_status fll_fss_basic_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments); + extern f_return_status fll_fss_basic_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments); #endif // _di_fll_fss_basic_list_read_ /** @@ -80,7 +80,7 @@ extern "C" { * @param content_prepend * A string to prepend at the start of each line in content, such as spaces. * Set the pointer address to 0 to disable. - * @param buffer + * @param destination * The buffer to write to. * * @return @@ -99,7 +99,7 @@ extern "C" { * Errors (with error bit) from: fl_string_dynamic_increase_by(). */ #ifndef _di_fll_fss_basic_list_write_string_ - extern f_return_status fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_string_dynamic_t *buffer); + extern f_return_status fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_string_dynamic_t *destination); #endif // _di_fll_fss_basic_list_write_string_ #ifdef __cplusplus diff --git a/level_2/fll_fss/c/fss_embedded_list.c b/level_2/fll_fss/c/fss_embedded_list.c index 39b7bf2..fcbac8a 100644 --- a/level_2/fll_fss/c/fss_embedded_list.c +++ b/level_2/fll_fss/c/fss_embedded_list.c @@ -5,9 +5,8 @@ extern "C" { #endif #ifndef _di_fll_fss_embedded_list_read_ - f_return_status fll_fss_embedded_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { + f_return_status fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { #ifndef _di_level_3_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!nest) return F_status_set_error(F_parameter); if (!objects_delimits) return F_status_set_error(F_parameter); @@ -38,7 +37,7 @@ extern "C" { status = fl_fss_embedded_list_object_read(buffer, range, &nest->depth[0].array[nest->depth[0].used].object, objects_delimits); if (F_status_is_error(status)) return status; - if (range->start >= range->stop || range->start >= buffer->used) { + if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { // extended list requires content closure, so this could be an error. @@ -46,14 +45,14 @@ extern "C" { } if (found_data) { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } return F_none_stop; } else { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_data_not_eos; } @@ -101,8 +100,8 @@ extern "C" { return status; } // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. - else if (range->start >= range->stop || range->start >= buffer->used) { - if (range->start >= buffer->used) { + else if (range->start >= range->stop || range->start >= buffer.used) { + if (range->start >= buffer.used) { return F_none_eos; } diff --git a/level_2/fll_fss/c/fss_embedded_list.h b/level_2/fll_fss/c/fss_embedded_list.h index c5351f0..a8b4b59 100644 --- a/level_2/fll_fss/c/fss_embedded_list.h +++ b/level_2/fll_fss/c/fss_embedded_list.h @@ -71,7 +71,7 @@ extern "C" { * Errors (with error bit) from: fl_fss_embedded_list_object_read(). */ #ifndef _di_fll_fss_embedded_list_read_ - extern f_return_status fll_fss_embedded_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments); + extern f_return_status fll_fss_embedded_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments); #endif // _di_fll_fss_embedded_list_read_ /** diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 40081ee..47c657d 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -5,9 +5,8 @@ extern "C" { #endif #ifndef _di_fll_fss_extended_read_ - f_return_status fll_fss_extended_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_return_status fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { #ifndef _di_level_2_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!objects) return F_status_set_error(F_parameter); if (!contents) return F_status_set_error(F_parameter); @@ -53,7 +52,7 @@ extern "C" { return status; } - if (range->start >= range->stop || range->start >= buffer->used) { + if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { objects->used++; @@ -76,14 +75,14 @@ extern "C" { } if (found_data) { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } return F_none_stop; } else { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_data_not_eos; } @@ -150,7 +149,7 @@ extern "C" { return status; } // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. - else if (range->start >= range->stop || range->start >= buffer->used) { + else if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_content || status == FL_fss_found_content_not || status == FL_fss_found_object_content_not || status == F_unterminated_group) { objects->used++; contents->used++; @@ -164,7 +163,7 @@ extern "C" { } } - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { if (status == F_unterminated_group) return F_unterminated_group_eos; return F_none_eos; diff --git a/level_2/fll_fss/c/fss_extended.h b/level_2/fll_fss/c/fss_extended.h index d35d7a3..7fd94d3 100644 --- a/level_2/fll_fss/c/fss_extended.h +++ b/level_2/fll_fss/c/fss_extended.h @@ -69,7 +69,7 @@ extern "C" { * Errors (with error bit) from: fl_fss_extended_object_read(). */ #ifndef _di_fll_fss_extended_read_ - extern f_return_status fll_fss_extended_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits); + extern f_return_status fll_fss_extended_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits); #endif // _di_fll_fss_extended_read_ /** diff --git a/level_2/fll_fss/c/fss_extended_list.c b/level_2/fll_fss/c/fss_extended_list.c index abe81ff..682c6fa 100644 --- a/level_2/fll_fss/c/fss_extended_list.c +++ b/level_2/fll_fss/c/fss_extended_list.c @@ -5,9 +5,8 @@ extern "C" { #endif #ifndef _di_fll_fss_extended_list_read_ - f_return_status fll_fss_extended_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { + f_return_status fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { #ifndef _di_level_2_parameter_checking_ - if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); if (!objects) return F_status_set_error(F_parameter); if (!contents) return F_status_set_error(F_parameter); @@ -33,7 +32,7 @@ extern "C" { status = fl_fss_extended_list_object_read(buffer, range, &objects->array[objects->used], objects_delimits); if (F_status_is_error(status)) return status; - if (range->start >= range->stop || range->start >= buffer->used) { + if (range->start >= range->stop || range->start >= buffer.used) { if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { objects->used++; @@ -48,14 +47,14 @@ extern "C" { } if (found_data) { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } return F_none_stop; } else { - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_data_not_eos; } @@ -107,7 +106,7 @@ extern "C" { else if (status != FL_fss_found_object && status != FL_fss_found_content && status != FL_fss_found_content_not && status != FL_fss_found_object_content_not) { return status; } - else if (range->start >= range->stop || range->start >= buffer->used) { + else if (range->start >= range->stop || range->start >= buffer.used) { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == FL_fss_found_object || status == FL_fss_found_content || status == FL_fss_found_content_not || status == FL_fss_found_object_content_not) { @@ -115,7 +114,7 @@ extern "C" { contents->used++; } - if (range->start >= buffer->used) { + if (range->start >= buffer.used) { return F_none_eos; } diff --git a/level_2/fll_fss/c/fss_extended_list.h b/level_2/fll_fss/c/fss_extended_list.h index 11243a5..fef1469 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -75,7 +75,7 @@ extern "C" { * Errors (with error bit) from: fl_fss_extended_list_object_read(). */ #ifndef _di_fll_fss_extended_list_read_ - extern f_return_status fll_fss_extended_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments); + extern f_return_status fll_fss_extended_list_read(const f_string_static_t buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments); #endif // _di_fll_fss_extended_list_read_ /** diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 03dffc5..0eab15b 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -1365,7 +1365,7 @@ extern "C" { f_string_range_t range = f_macro_string_range_t_initialize(buffer.used); f_fss_delimits_t delimits = f_fss_delimits_t_initialize; - *status = fll_fss_extended_read(&buffer, &range, &objects, &contents, 0, 0, &delimits, 0); + *status = fll_fss_extended_read(buffer, &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.string, range, F_true); diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index c33238e..81f29e7 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -206,7 +206,7 @@ extern "C" { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; f_fss_comments_t comments = f_fss_comments_t_initialize; - *status = fll_fss_basic_list_read(&data_make->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments); + *status = fll_fss_basic_list_read(data_make->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments); if (F_status_is_error(*status)) { fake_print_error_fss(data, *status, "fll_fss_basic_list_read", data.file_data_build_fakefile.string, range, F_true); @@ -272,7 +272,7 @@ extern "C" { delimits.used = 0; content_range = list_contents.array[i].array[0]; - *status = fll_fss_extended_read(&data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0, &delimits, 0); + *status = fll_fss_extended_read(data_make->buffer, &content_range, &settings.objects, &settings.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_fakefile.string, content_range, F_true); @@ -304,7 +304,7 @@ extern "C" { delimits.used = 0; content_range = list_contents.array[i].array[0]; - *status = fll_fss_extended_read(&data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &delimits, 0); + *status = fll_fss_extended_read(data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &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_fakefile.string, content_range, F_true); diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 9e1b3fc..62b985c 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -651,7 +651,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con { f_string_range_t input = f_macro_string_range_t_initialize(local_buffer.used); - status = fll_fss_basic_read(&local_buffer, &input, &basic_objects, &basic_contents, 0, &delimits, 0); + status = fll_fss_basic_read(local_buffer, &input, &basic_objects, &basic_contents, 0, &delimits, 0); } if (F_status_set_error(status)) { @@ -1399,7 +1399,7 @@ f_return_status firewall_buffer_rules(const f_string_t filename, const bool opti { f_string_range_t input = f_macro_string_range_t_initialize(local->buffer.used); - status = fll_fss_basic_list_read(&local->buffer, &input, &local->chain_objects, &local->chain_contents, &delimits, 0, &comments); + status = fll_fss_basic_list_read(local->buffer, &input, &local->chain_objects, &local->chain_contents, &delimits, 0, &comments); } if (F_status_is_error(status)) { @@ -1435,7 +1435,7 @@ f_return_status firewall_buffer_rules(const f_string_t filename, const bool opti f_return_status firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_data_t *data) { f_fss_delimits_t delimits = f_fss_delimits_t_initialize; - f_status_t status = fll_fss_extended_read(&local->buffer, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits, 0); + f_status_t status = fll_fss_extended_read(local->buffer, 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); diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index 0276295..d3555e3 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -187,7 +187,7 @@ extern "C" { delimits->used = 0; comments->used = 0; - status = fll_fss_basic_list_read(&data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments); + status = fll_fss_basic_list_read(data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index a9cbbf8..e337192 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -186,7 +186,7 @@ extern "C" { delimits->used = 0; - status = fll_fss_basic_read(&data->buffer, &input, &data->objects, &data->contents, 0, delimits, 0); + status = fll_fss_basic_read(data->buffer, &input, &data->objects, &data->contents, 0, delimits, 0); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. diff --git a/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c index d9539ca..727f5e6 100644 --- a/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/private-fss_embedded_list_read.c @@ -226,7 +226,7 @@ extern "C" { contents_delimits->used = 0; comments->used = 0; - status = fll_fss_embedded_list_read(&data->buffer, &input, &data->nest, objects_delimits, contents_delimits, comments); + status = fll_fss_embedded_list_read(data->buffer, &input, &data->nest, objects_delimits, contents_delimits, comments); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index a00c525..571543c 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -187,7 +187,7 @@ extern "C" { delimits->used = 0; comments->used = 0; - status = fll_fss_extended_list_read(&data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments); + status = fll_fss_extended_list_read(data->buffer, &input, &data->objects, &data->contents, delimits, 0, comments); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate. diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index c200030..a6cf57a 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -214,7 +214,7 @@ extern "C" { objects_delimits->used = 0; contents_delimits->used = 0; - status = fll_fss_extended_read(&data->buffer, &input, &data->objects, &data->contents, 0, 0, objects_delimits, contents_delimits); + status = fll_fss_extended_read(data->buffer, &input, &data->objects, &data->contents, 0, 0, objects_delimits, contents_delimits); if (F_status_is_error(status)) { // @todo: detect and replace fll_error_file_type_file with fll_error_file_type_pipe as appropriate.