From: Kevin Day Date: Mon, 26 Oct 2020 00:18:41 +0000 (-0500) Subject: Update: Better handle comments in FSS and fix problems. X-Git-Tag: 0.5.1~11 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=2239b604cd62a1d8fb20287995318bd63895867a;p=fll Update: Better handle comments in FSS and fix problems. Comments may exist inside of an FSS Basic List and FSS Extended List. Handle the comments. The FSS Basic List Read and FSS Extended List read both need to print the ignore character around content in pipe mode. The FSS Extended List needs to specifically not do this for individual nested objects. Fix problems in the FSS Basic List read content handling when an object is found such that content is empty. Clean up some of the code, doing some basic code simplification. The FSS Basic List Read should always return a range and should not exclusively end always at an EOL. Fix a case where not enough memory is allocated for delimits in FSS Basic List. Add missing/incomplete parameter checks. --- diff --git a/build/level_0/settings b/build/level_0/settings index 770c3fc..ee48205 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -22,7 +22,7 @@ build_libraries -lc build_libraries-level build_sources_library account.c console.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c private-file.c fss.c iki.c private-iki.c memory.c path.c private-path.c pipe.c print.c private-print.c serialize.c private-serialize.c signal.c socket.c utf.c private-utf.c build_sources_program -build_sources_headers account.h account-common.h color.h console.h console-common.h conversion.h conversion-common.h directory.h directory_type.h directory-common.h environment.h environment-common.h file.h file-common.h fss.h fss-common.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h iki.h iki-common.h memory.h memory_structure.h path.h path-common.h pipe.h print.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h status_array.h string.h string-common.h string_dynamic.h string_map.h string_quantity.h string_range.h type.h type_array.h utf.h utf-common.h +build_sources_headers account.h account-common.h color.h console.h console-common.h conversion.h conversion-common.h directory.h directory_type.h directory-common.h environment.h environment-common.h file.h file-common.h fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h iki.h iki-common.h memory.h memory_structure.h path.h path-common.h pipe.h print.h serialize.h serialize-common.h signal.h signal-common.h socket.h socket-common.h status.h status_array.h string.h string-common.h string_dynamic.h string_map.h string_quantity.h string_range.h type.h type_array.h utf.h utf-common.h build_sources_script build_sources_setting build_script yes diff --git a/build/monolithic/settings b/build/monolithic/settings index 152db49..2e3203a 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -22,7 +22,7 @@ build_libraries -lc build_libraries-monolithic build_sources_library level_0/account.c level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/fss.c level_0/iki.c level_0/private-iki.c level_0/memory.c level_0/path.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/error.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c build_sources_program -build_sources_headers level_0/account.h level_0/account-common.h level_0/color.h level_0/console.h level_0/console-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/memory.h level_0/memory_structure.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h +build_sources_headers level_0/account.h level_0/account-common.h level_0/color.h level_0/console.h level_0/console-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/memory.h level_0/memory_structure.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h build_sources_script build_sources_setting build_script yes diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 44e44c5..263a951 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -25,6 +25,7 @@ // fll-0 fss includes #include +#include #include #include #include diff --git a/level_0/f_fss/c/fss_comment.h b/level_0/f_fss/c/fss_comment.h new file mode 100644 index 0000000..de6bd85 --- /dev/null +++ b/level_0/f_fss/c/fss_comment.h @@ -0,0 +1,82 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgplv2.1 + * + * Defines set data to be used for/by project fss. + * + * This is auto-included by fss.h and should not need to be explicitly included. + */ +#ifndef _F_fss_comment_h +#define _F_fss_comment_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Designate an fss comment location. + */ +#ifndef _di_f_fss_comment_t_ + typedef f_string_range_t f_fss_comment_t; +#endif // _di_f_fss_comment_t_ + +/** + * An array of f_fss_comment_t. + * + * array: the array of fss quote. + * size: total amount of allocated space. + * used: total number of allocated spaces used. + */ +#ifndef _di_f_fss_comments_t_ + typedef f_string_ranges_t f_fss_comments_t; + + #define f_fss_comments_t_initialize f_string_ranges_t_initialize + + #define f_macro_fss_comments_t_clear(delimits) f_macro_string_ranges_t_clear(delimits) + + #define f_macro_fss_comments_t_new(status, delimits, length) f_macro_string_ranges_t_new(status, delimits, length) + + #define f_macro_fss_comments_t_delete(status, delimits) f_macro_string_ranges_t_delete(status, delimits) + #define f_macro_fss_comments_t_destroy(status, delimits) f_macro_string_ranges_t_destroy(status, delimits) + + #define f_macro_fss_comments_t_delete_simple(delimits) f_macro_string_ranges_t_delete_simple(delimits) + #define f_macro_fss_comments_t_destroy_simple(delimits) f_macro_string_ranges_t_destroy_simple(delimits) + + #define f_macro_fss_comments_t_resize(status, delimits, new_length) f_macro_string_ranges_t_resize(status, delimits, new_length) + #define f_macro_fss_comments_t_adjust(status, delimits, new_length) f_macro_string_ranges_t_adjust(status, delimits, new_length) +#endif // _di_f_fss_comments_t_ + +/** + * An array of f_fss_comments_t. + * + * array: the array of fss quotes. + * size: total amount of allocated space. + * used: total number of allocated spaces used. + */ +#ifndef _di_f_fss_commentss_t_ + typedef f_string_rangess_t f_fss_commentss_t; + + #define f_fss_commentss_t_initialize f_string_rangess_t_initialize + + #define f_macro_fss_commentss_t_clear(quotess) f_macro_string_rangess_t_clear(quotess) + + #define f_macro_fss_commentss_t_new(status, quotess, length) f_macro_string_rangess_t_new(status, quotess, length) + + #define f_macro_fss_commentss_t_delete(status, quotess) f_macro_string_rangess_t_delete(status, quotess) + #define f_macro_fss_commentss_t_destroy(status, quotess) f_macro_string_rangess_t_destroy(status, quotess) + + #define f_macro_fss_commentss_t_delete_simple(quotess) f_macro_string_rangess_t_delete_simple(quotess) + #define f_macro_fss_commentss_t_destroy_simple(quotess) f_macro_string_rangess_t_destroy_simple(quotess) + + #define f_macro_fss_commentss_t_resize(status, quotess, new_length) f_macro_string_rangess_t_resize(status, quotess, new_length) + #define f_macro_fss_commentss_t_adjust(status, quotess, new_length) f_macro_string_rangess_t_adjust(status, quotess, new_length) +#endif // _di_f_fss_commentss_t_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_fss_comment_h diff --git a/level_0/f_fss/c/fss_delimit.h b/level_0/f_fss/c/fss_delimit.h index 2eda779..3679f50 100644 --- a/level_0/f_fss/c/fss_delimit.h +++ b/level_0/f_fss/c/fss_delimit.h @@ -59,7 +59,7 @@ extern "C" { #ifndef _di_f_fss_delimitss_t_ typedef f_string_lengthss_t f_fss_delimitss_t; - #define f_fss_delimitss_t_initialize f_f_string_lengthss_t_initialize + #define f_fss_delimitss_t_initialize f_string_lengthss_t_initialize #define f_macro_fss_delimitss_t_clear(quotess) f_macro_string_lengthss_t_clear(quotess) diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index e06e7cd..112ec98 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -22,7 +22,7 @@ build_libraries -lc build_libraries-individual -lf_memory -lf_utf build_sources_library fss.c build_sources_program -build_sources_headers fss.h fss-common.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h +build_sources_headers fss.h fss-common.h fss_comment.h fss_delimit.h fss_named.h fss_nest.h fss_quote.h fss_set.h build_sources_script build_sources_setting build_script yes diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index f8bd34c..63a4569 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -11,6 +11,7 @@ extern "C" { 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_ const f_array_length_t delimits_used = delimits->used; @@ -32,6 +33,7 @@ extern "C" { 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); diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index c331cbe..5156313 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -11,6 +11,7 @@ extern "C" { 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_ const f_array_length_t delimits_used = delimits->used; @@ -57,16 +58,18 @@ extern "C" { return FL_fss_found_object_not; } - f_string_length_t first_slash = 0; + f_string_length_t slash_first = 0; f_string_length_t slash_count = 0; f_string_length_t start = 0; f_string_length_t stop = 0; + 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) { if (buffer->string[range->start] == f_fss_delimit_slash) { - first_slash = range->start; + slash_first = range->start; slash_count = 1; for (range->start++; range->start <= range->stop && range->start < buffer->used; range->start++) { @@ -83,6 +86,7 @@ extern "C" { 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) { + graph_first = F_false; stop = range->start - 1; status = f_utf_buffer_increment(*buffer, range, 1); @@ -90,25 +94,15 @@ extern "C" { 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); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (status == F_false) break; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + 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); @@ -116,14 +110,10 @@ extern "C" { if (buffer->string[range->start] == f_fss_eol) { start = range->start; - range->start = first_slash; + range->start = slash_first; status = private_fl_fss_delimits_increase_by((slash_count / 2) + 1, delimits); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (slash_count % 2 == 0) { while (slash_count > 0) { @@ -155,40 +145,40 @@ extern "C" { return FL_fss_found_object_not; } } + 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. + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = slash_first; + range->start++; + } + else { + graph_first = F_false; + } continue; } 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); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; 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); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (status == F_false) break; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + 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); @@ -197,28 +187,25 @@ extern "C" { found->stop = stop; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; return FL_fss_found_object; } continue; } + else if (graph_first) { + status = f_fss_is_space(*buffer, *range); + if (F_status_is_error(status)) break; - status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; + if (status == F_false) { + graph_first = F_false; + } } - } // while - // seek to the end of the line when no valid object is found. - status = f_fss_seek_to_eol(*buffer, range); + status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) break; + } // while if (F_status_is_error(status)) { delimits->used = delimits_used; @@ -233,6 +220,9 @@ extern "C" { return F_data_not_stop; } + // seek to the end of the line when no valid object is found. + status = f_fss_seek_to_eol(*buffer, range); + // move the start position to after the EOL. range->start++; @@ -241,49 +231,55 @@ 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_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) { #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); + if (!comments) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ 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); if (F_status_is_error(status)) return status; - fl_macro_fss_content_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_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; found->array[found->used].start = range->start; - f_string_length_t last_newline = range->start; - f_string_length_t first_slash = 0; + f_string_length_t newline_last = range->start; + f_string_length_t slash_first = 0; f_string_length_t slash_count = 0; f_string_length_t start = 0; + f_string_length_t comment_delimit = 0; - bool found_newline = F_false; + 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) { if (buffer->string[range->start] == f_fss_eol) { - found_newline = F_true; - last_newline = range->start; - - status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; - fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + delimits->array[delimits->used++] = comment_delimit; + } + newline_last = range->start; + graph_first = 0x1; + range->start++; continue; } if (buffer->string[range->start] == f_fss_delimit_slash) { - first_slash = range->start; + slash_first = range->start; slash_count = 1; for (range->start++; range->start <= range->stop && range->start < buffer->used; range->start++) { @@ -297,145 +293,173 @@ extern "C" { slash_count++; } // for - if (found_newline) { - fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); - } - else { - fl_macro_fss_content_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - } + if (range->start > range->stop || range->start >= buffer->used) break; if (buffer->string[range->start] == f_fss_basic_list_open) { - status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + graph_first = 0x0; + range->start++; 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); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) return status; if (status == F_false) break; status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) break; } // while - if (found_newline) { - fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); - } - else { - fl_macro_fss_content_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - } + if (range->start > range->stop || range->start >= buffer->used) break; if (buffer->string[range->start] == f_fss_eol) { start = range->start; - - range->start = first_slash; + range->start = slash_first; if (slash_count % 2 == 0) { - if (found_newline) { - found->array[found->used].stop = last_newline; - range->start = last_newline + 1; - found->used++; + found->array[found->used++].stop = newline_last; + range->start = newline_last + 1; - return FL_fss_found_content; - } - - return FL_fss_found_content_not; + return FL_fss_found_content; } - status = private_fl_fss_delimits_increase_by(slash_count / 2, delimits); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + status = private_fl_fss_delimits_increase_by((slash_count / 2) + 1, delimits); + if (F_status_is_error(status)) break; while (slash_count > 0) { if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { - delimits->array[delimits->used] = range->start; - delimits->used++; + delimits->array[delimits->used++] = range->start; } slash_count--; } status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) break; } // while - found_newline = F_true; + if (F_status_is_error(status)) break; + + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + graph_first = 0x1; range->start = start + 1; } } + else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + graph_first = 0x2; + comment_delimit = slash_first; + range->start++; + } continue; } - else if (buffer->string[range->start] == f_fss_basic_list_open) { - status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + + if (buffer->string[range->start] == f_fss_basic_list_open) { + range->start++; + graph_first = 0x0; 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); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) return status; if (status == F_false) break; status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) break; } // while - if (found_newline) { - fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); - } - else { - fl_macro_fss_content_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); - } + if (F_status_is_error(status)) 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 (found_newline) { - found->array[found->used++].stop = last_newline; - range->start = last_newline + 1; - return FL_fss_found_content; + 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; + } + else { + range->start = newline_last + 1; + found->array[found->used++].stop = newline_last; } - if (!found_newline) { - range->start = last_newline; + return FL_fss_found_content; + } + + 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; + + delimits->array[delimits->used++] = comment_delimit; } - return FL_fss_found_content_not; + newline_last = range->start; + graph_first = 0x1; } continue; } - status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; - } // while + if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + start = range->start; + + 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) { + range->start--; + } + else { + newline_last = range->start; + } + + comments->array[comments->used].start = start; + comments->array[comments->used++].stop = range->start++; + continue; + } - if (found_newline) { - found->array[found->used++].stop = last_newline; - range->start = last_newline + 1; + if (graph_first == 0x1) { + status = f_fss_is_space(*buffer, *range); + if (F_status_is_error(status)) break; + + if (status == F_false) { + graph_first = 0x0; + } + } - fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) break; + } // while - return FL_fss_found_content; + if (F_status_is_error(status)) { + delimits->used = delimits_used; + comments->used = comments_used; + return status; } - fl_macro_fss_content_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); + found->array[found->used++].stop = range->start - 1; - return FL_fss_found_content_not; + fl_macro_fss_content_return_on_overflow_delimited((*buffer), (*range), (*found), F_none_eos, F_none_stop); + + return FL_fss_found_content; } #endif // _di_fl_fss_basic_list_content_read_ @@ -820,7 +844,16 @@ extern "C" { status = private_fl_fss_destination_increase(destination); if (F_status_is_error(status)) return status; - destination->string[destination->used++] = f_fss_basic_list_close; + // check to see if a newline exists, at the end. + if (destination->used) { + for (i = destination->used - 1; i > 0; --i) { + if (destination->string[i] != f_fss_delimit_placeholder) break; + } // for + } + + if (!destination->used || destination->string[i] != f_fss_eol) { + destination->string[destination->used++] = f_fss_basic_list_close; + } } if (range->start > range->stop) { diff --git a/level_1/fl_fss/c/fss_basic_list.h b/level_1/fl_fss/c/fss_basic_list.h index fc6689f..7af77ec 100644 --- a/level_1/fl_fss/c/fss_basic_list.h +++ b/level_1/fl_fss/c/fss_basic_list.h @@ -94,6 +94,10 @@ extern "C" { * A set of all locations where a valid content was found. * @param delimits * A delimits array representing where delimits exist within the buffer. + * @param comments + * An array of ranges representing where comments are found within any valid content. + * This only stores comments found within valid content only. + * The comment range will include the trailing newline. * * @return * FL_fss_found_content on success and content was found (start location is at end of content). @@ -119,7 +123,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); + 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); #endif // _di_fl_fss_basic_list_content_read_ /** diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index 01b2bce..75ea13d 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -11,6 +11,7 @@ extern "C" { 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_ const f_array_length_t delimits_used = delimits->used; @@ -37,6 +38,7 @@ extern "C" { 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_none; diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 997693b..1892f93 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -11,6 +11,7 @@ extern "C" { 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_ const f_array_length_t delimits_used = delimits->used; @@ -69,58 +70,62 @@ extern "C" { return FL_fss_found_object_not; } + f_string_length_t start = 0; + f_string_length_t stop = 0; + f_string_length_t slash_first = 0; + f_string_length_t slash_count = 0; + + 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) { if (buffer->string[range->start] == f_fss_delimit_slash) { - f_string_length_t first_slash = range->start; - f_string_length_t slash_count = 1; + slash_first = range->start; + slash_count = 1; status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + 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)) { - 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); - if (F_status_is_error(status)) return status; + 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); if (buffer->string[range->start] == f_fss_extended_list_open) { - f_string_length_t stop_point = range->start - 1; - - status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + graph_first = F_false; + stop = range->start - 1; + range->start++; while (range->start <= range->stop && range->start < buffer->used) { - if (buffer->string[range->start] == f_fss_eol || (status = f_fss_is_graph(*buffer, *range)) == F_true) { - break; - } + if (buffer->string[range->start] == f_fss_eol) { + status = f_fss_is_graph(*buffer, *range); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) return status; + if (status == F_true) break; + } status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + 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); if (buffer->string[range->start] == f_fss_eol) { - f_string_length_t start = range->start; + start = range->start; - range->start = first_slash; + range->start = slash_first; status = private_fl_fss_delimits_increase_by((slash_count / 2) + 1, delimits); - - if (F_status_is_error(status)) { - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (slash_count % 2 == 0) { while (slash_count > 0) { @@ -135,10 +140,12 @@ extern "C" { } status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) break; } // while - found->stop = stop_point; + if (F_status_is_error(status)) break; + + found->stop = stop; range->start = start + 1; return FL_fss_found_object; @@ -148,31 +155,48 @@ extern "C" { return FL_fss_found_object_not; } } + 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. + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = slash_first; + range->start++; + } + else { + graph_first = F_false; + } continue; } else if (buffer->string[range->start] == f_fss_extended_list_open) { - f_string_length_t stop_point = range->start - 1; + graph_first = F_false; + stop = range->start - 1; status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) break; while (range->start <= range->stop && range->start < buffer->used) { + if (buffer->string[range->start] == f_fss_eol) break; status = f_fss_is_space(*buffer, *range); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) return status; if (status == F_false) break; status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + 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); if (buffer->string[range->start] == f_fss_eol) { - found->stop = stop_point; + found->stop = stop; // move the start position to after the EOL. range->start++; @@ -182,33 +206,56 @@ extern "C" { continue; } + else if (graph_first) { + status = f_fss_is_space(*buffer, *range); + if (F_status_is_error(status)) break; + + if (status == F_false) { + graph_first = F_false; + } + } status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) break; } // while + if (F_status_is_error(status)) { + delimits->used = delimits_used; + return status; + } + // 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) { status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) return status; + + if (F_status_is_error(status)) { + delimits->used = delimits_used; + return status; + } } // while 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); - if (F_status_is_error(status)) return status; + + if (F_status_is_error(status)) { + delimits->used = delimits_used; + return status; + } return FL_fss_found_object_not; } #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_nest_t *found, f_fss_delimits_t *delimits) { + f_return_status fl_fss_extended_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) { #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); + if (!comments) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ const f_array_length_t found_used = found->used; @@ -239,13 +286,15 @@ extern "C" { } const f_array_length_t delimits_used = delimits->used; + const f_array_length_t comments_used = comments->used; f_array_length_t depth = 0; f_array_length_t position = 0; f_string_length_t position_previous = range->start; f_string_length_t line_start = range->start; - f_string_length_t last_newline = range->start; + f_string_length_t newline_last = range->start; + f_string_length_t comment_delimit = 0; f_string_length_t slash_first = 0; f_string_length_t slash_last = 0; @@ -255,6 +304,8 @@ extern "C" { bool is_open = F_false; + uint8_t graph_first = 0x0; // 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set. + // initialize depth 1 start position. // positions_start.used is used as a max depth (such that positions_start.used == max depth + 1). positions_start.array[0] = range->start; @@ -263,12 +314,19 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_eol) { - last_newline = range->start; - position_previous = range->start; - range->start++; + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + newline_last = range->start; + position_previous = range->start++; + graph_first = 0x1; if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_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); @@ -284,40 +342,28 @@ extern "C" { slash_count = 1; position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - delimits->used = delimits_used; - return status; - } + 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)) { position_previous = range->start; if (buffer->string[range->start] == f_fss_delimit_slash) { - slash_last = range->start; - slash_count++; + slash_last = range->start++; } status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + 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, 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, 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). @@ -326,65 +372,72 @@ extern "C" { // 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) { - last_newline = range->start; - position_previous = range->start; - range->start++; + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + newline_last = range->start; + position_previous = range->start++; line_start = range->start; + graph_first = 0x1; } else if (buffer->string[range->start] == f_fss_extended_list_open || buffer->string[range->start] == f_fss_extended_list_close) { before_list_open = position_previous; is_open = F_false; + graph_first = 0x0; if (buffer->string[range->start] == f_fss_extended_list_open) { is_open = F_true; } - position_previous = range->start; - range->start++; + position_previous = range->start++; while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_eol) { - last_newline = range->start; - line_start = range->start + 1; - break; - } + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } - if (buffer->string[range->start] != f_fss_delimit_placeholder && (status = f_fss_is_space(*buffer, *range)) == F_false) { + newline_last = range->start; + line_start = range->start + 1; + graph_first = 0x1; break; } - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); + if (buffer->string[range->start] != f_fss_delimit_placeholder) { + status = f_fss_is_space(*buffer, *range); + if (F_status_is_error(status)) break; - delimits->used = delimits_used; - return status; + if (status == F_false) break; } position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - delimits->used = delimits_used; - return status; - } + 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, 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, 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) { - last_newline = range->start; + newline_last = range->start; line_start = range->start + 1; + graph_first = 0x1; if (is_open) { bool is_object = F_false; @@ -396,55 +449,39 @@ extern "C" { range->start = slash_first; status = private_fl_fss_delimits_increase_by((slash_count / 2) + 1, delimits); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - range->start = last_newline; - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; // apply slash delimits, only slashes and placeholders should be present. while (slash_count > 0) { if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { - delimits->array[delimits->used] = range->start; - delimits->used++; + delimits->array[delimits->used++] = range->start; } slash_count--; } // Delimit slashes and placeholders are required to be in the ASCII range. - position_previous = range->start; - range->start++; + position_previous = range->start++; } // while + if (F_status_is_error(status)) break; + // when slashes are even, the object is valid and needs to be processed. if (is_object) { depth++; if (depth > positions_start.size) { f_macro_string_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - range->start = last_newline; - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; } if (positions_start.used < depth) { positions_start.used = depth; } - positions_start.array[depth] = last_newline + 1; + positions_start.array[depth] = newline_last + 1; objects.array[depth].start = line_start; objects.array[depth].stop = before_list_open; @@ -452,77 +489,54 @@ extern "C" { } else { status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - range->start = last_newline; - delimits->used = delimits_used; - return status; - } - - delimits->array[delimits->used] = slash_last; - delimits->used++; + delimits->array[delimits->used++] = slash_last; } - range->start = last_newline; + range->start = newline_last; } } + else if (graph_first == 0x1 && buffer->string[range->start] == f_fss_comment) { + graph_first = 0x2; + comment_delimit = slash_first; + } + else { + graph_first = 0x0; + } } else if (buffer->string[range->start] == f_fss_extended_list_open) { + graph_first = 0x0; before_list_open = position_previous; - position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - delimits->used = delimits_used; - return status; - } + status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) break; 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 (F_status_is_error(status)) break; - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } - - if (status == F_false) { - break; - } + if (status == F_false) break; } position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + 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, 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, 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) { @@ -530,24 +544,10 @@ extern "C" { if (depth >= positions_start.size) { f_macro_string_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; f_macro_fss_objects_t_resize(status, objects, objects.size + f_fss_default_allocation_step); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; } if (positions_start.used <= depth) { @@ -559,29 +559,38 @@ extern "C" { objects.array[depth].start = line_start; objects.array[depth].stop = before_list_open; - last_newline = range->start; + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + newline_last = range->start; line_start = range->start + 1; + graph_first = 0x1; } else { // No valid object close found, seek until EOL. status = f_fss_seek_to_eol(*buffer, range); + if (F_status_is_error(status)) break; - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; - delimits->used = delimits_used; - return status; + delimits->array[delimits->used++] = comment_delimit; } - last_newline = range->start; + newline_last = range->start; line_start = range->start + 1; + graph_first = 0x1; while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_eol) { - last_newline = range->start; + newline_last = range->start; line_start = range->start + 1; break; } @@ -589,38 +598,28 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + 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, 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, 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_extended_list_close) { + graph_first = 0x0; + while (range->start <= range->stop && range->start < buffer->used) { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (buffer->string[range->start] == f_fss_eol) { break; @@ -628,14 +627,7 @@ extern "C" { if (buffer->string[range->start] != f_fss_delimit_placeholder) { status = f_fss_is_space(*buffer, *range); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (status == F_false) { break; @@ -643,48 +635,29 @@ extern "C" { } } // while + if (F_status_is_error(status)) break; + if (depth > 0) { - fl_macro_fss_nest_return_on_overflow((*buffer), (*range), (*found), (*delimits), delimits_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, 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) { status = private_fl_fss_nest_increase(found); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; if (found->depth[depth].used == found->depth[depth].size) { f_macro_fss_items_t_resize(status, found->depth[depth], found->depth[depth].size + f_fss_default_allocation_step); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; } position = found->depth[depth].used; if (found->depth[depth].array[position].content.size != 1) { f_macro_fss_content_t_resize(status, found->depth[depth].array[position].content, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; } // only assign object positions for nested objects. @@ -694,7 +667,7 @@ extern "C" { } found->depth[depth].array[position].content.array[0].start = positions_start.array[depth]; - found->depth[depth].array[position].content.array[0].stop = last_newline; + found->depth[depth].array[position].content.array[0].stop = newline_last; found->depth[depth].array[position].content.used = 1; if (position >= found->depth[depth].used) { @@ -705,19 +678,20 @@ extern "C" { found->used = depth + 1; } - last_newline = range->start; + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + newline_last = range->start; line_start = range->start + 1; + graph_first = 0x1; if (!depth) { status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + 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) @@ -735,45 +709,78 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_fss_eol) { - last_newline = range->start; + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + newline_last = range->start; line_start = range->start + 1; + graph_first = 0x1; break; } position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + 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, 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, 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) { + position = range->start; + + 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) { + range->start--; + } + else { + if (graph_first == 0x2) { + status = private_fl_fss_delimits_increase(delimits); + if (F_status_is_error(status)) break; + + delimits->array[delimits->used++] = comment_delimit; + } + + newline_last = range->start; + graph_first = 0x1; + } + + comments->array[comments->used].start = position; + comments->array[comments->used++].stop = range->start++; + continue; + } else if (buffer->string[range->start] != f_fss_eol) { position_previous = range->start; - status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); + if (graph_first == 0x1) { + status = f_fss_is_space(*buffer, *range); + if (F_status_is_error(status)) break; - delimits->used = delimits_used; - return status; + if (status == F_false) { + graph_first = 0x0; + } } + status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) break; + if (range->start >= buffer->used || range->start > range->stop) { break; } @@ -784,19 +791,19 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); - - if (F_status_is_error(status)) { - f_macro_string_lengths_t_delete_simple(positions_start); - f_macro_fss_objects_t_delete_simple(objects); - - delimits->used = delimits_used; - return status; - } + if (F_status_is_error(status)) break; } // while f_macro_string_lengths_t_delete_simple(positions_start); f_macro_fss_objects_t_delete_simple(objects); + delimits->used = delimits_used; + comments->used = comments_used; + + if (F_status_is_error(status)) { + return status; + } + if (range->start > range->stop) { if (!depth) { return F_status_set_error(F_unterminated_stop); diff --git a/level_1/fl_fss/c/fss_extended_list.h b/level_1/fl_fss/c/fss_extended_list.h index 084a3b0..d64d668 100644 --- a/level_1/fl_fss/c/fss_extended_list.h +++ b/level_1/fl_fss/c/fss_extended_list.h @@ -98,6 +98,10 @@ extern "C" { * A set of all locations where a valid content was found. * @param delimits * A delimits array representing where delimits exist within the buffer. + * @param comments + * An array of ranges representing where comments are found within any valid content. + * This only stores comments found within valid content only. + * The comment range will include the trailing newline. * * @return * FL_fss_found_content on success and content was found (start location is at end of content). @@ -122,7 +126,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_nest_t *found, f_fss_delimits_t *delimits); + extern f_return_status fl_fss_extended_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); #endif // _di_fl_fss_extended_list_content_read_ /** diff --git a/level_1/fl_fss/c/fss_macro.h b/level_1/fl_fss/c/fss_macro.h index be6b094..b4a37d5 100644 --- a/level_1/fl_fss/c/fss_macro.h +++ b/level_1/fl_fss/c/fss_macro.h @@ -54,6 +54,22 @@ extern "C" { } #endif // _di_fl_macro_fss_content_return_on_overflow_ +#ifndef _di_fl_macro_fss_content_with_comments_return_on_overflow_ + #define fl_macro_fss_content_with_comments_return_on_overflow(buffer, range, found, delimits, delimits_used, comments, comments_used, eos_status, stop_status) \ + if (range.start >= buffer.used) { \ + delimits.used = delimits_used; \ + comments.used = comments_used; \ + found.array[found.used].stop = buffer.used - 1; \ + return eos_status; \ + } \ + else if (range.start > range.stop) { \ + delimits.used = delimits_used; \ + comments.used = comments_used; \ + found.array[found.used].stop = range.stop; \ + return stop_status; \ + } +#endif // _di_fl_macro_fss_content_with_comments_return_on_overflow_ + #ifndef _di_fl_macro_fss_content_return_on_overflow_delimited_ #define fl_macro_fss_content_return_on_overflow_delimited(buffer, range, found, eos_status, stop_status) \ if (range.start >= buffer.used) { \ @@ -67,19 +83,19 @@ extern "C" { #endif // _di_fl_macro_fss_content_return_on_overflow_delimited_ #ifndef _di_fl_macro_fss_nest_return_on_overflow_ - #define fl_macro_fss_nest_return_on_overflow(buffer, range, found, delimits, delimits_used, positions, objects, eos_status, stop_status) \ + #define fl_macro_fss_nest_return_on_overflow(buffer, range, found, delimits, delimits_used, comments, comments_used, positions, objects, eos_status, stop_status) \ if (range.start >= buffer.used) { \ delimits.used = delimits_used; \ + comments.used = comments_used; \ f_macro_string_lengths_t_delete_simple(positions); \ f_macro_fss_objects_t_delete_simple(objects); \ - \ return eos_status; \ } \ else if (range.start > range.stop) { \ delimits.used = delimits_used; \ + comments.used = comments_used; \ f_macro_string_lengths_t_delete_simple(positions); \ f_macro_fss_objects_t_delete_simple(objects); \ - \ return stop_status; \ } #endif // _di_fl_macro_fss_nest_return_on_overflow_ @@ -89,13 +105,11 @@ extern "C" { if (range.start >= buffer.used) { \ f_macro_string_lengths_t_delete_simple(positions); \ f_macro_fss_objects_t_delete_simple(objects); \ - \ return eos_status; \ } \ else if (range.start > range.stop) { \ f_macro_string_lengths_t_delete_simple(positions); \ f_macro_fss_objects_t_delete_simple(objects); \ - \ return stop_status; \ } #endif // _di_fl_macro_fss_nest_return_on_overflow_delimited_ diff --git a/level_1/fl_fss/c/fss_status.h b/level_1/fl_fss/c/fss_status.h index 14fe54a..2dde3ee 100644 --- a/level_1/fl_fss/c/fss_status.h +++ b/level_1/fl_fss/c/fss_status.h @@ -8,6 +8,7 @@ * Provides fss-specific status definitions. * * Warning: changing status codes will break abi, so recompile every file that includes and uses these error codes when this gets changed. + * @fixme this can be moved into level_0 because level_0/status is now a special case that can be included by other level_0 projects. */ #ifndef _FL_fss_status_h #define _FL_fss_status_h diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index d84d1c7..67966dc 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -5,7 +5,7 @@ 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_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) { #ifndef _di_level_2_parameter_checking_ if (!buffer) return F_status_set_error(F_parameter); if (!range) return F_status_set_error(F_parameter); @@ -65,11 +65,9 @@ extern "C" { if (status == FL_fss_found_object) { found_data = F_true; - status = fl_fss_basic_list_content_read(buffer, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits); - if (F_status_is_error(status)) { - return status; - } + status = fl_fss_basic_list_content_read(buffer, range, &contents->array[contents->used], contents_delimits ? contents_delimits : objects_delimits, comments); + if (F_status_is_error(status)) return status; break; } diff --git a/level_2/fll_fss/c/fss_basic_list.h b/level_2/fll_fss/c/fss_basic_list.h index 1cd4cfa..4142638 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -46,6 +46,9 @@ extern "C" { * (optional) An array of delimits for contents detected during processing. * The caller is expected to decide if and when to process them. * Set pointer address to 0 and all delimits will instead utilize objects_delimits. + * @param comments + * An array of ranges representing where comments are found within any valid content. + * This only stores comments found within valid content only. * * @return * F_none on success. @@ -64,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); + 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); #endif // _di_fll_fss_basic_list_read_ /** diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 45d1969..b8dae82 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -12,6 +12,7 @@ extern "C" { if (!objects) return F_status_set_error(F_parameter); if (!contents) return F_status_set_error(F_parameter); if (!objects_delimits) return F_status_set_error(F_parameter); + if (!contents_delimits) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ f_status_t status = F_none; diff --git a/level_2/fll_fss/c/fss_extended_list.c b/level_2/fll_fss/c/fss_extended_list.c index 64316f5..852f9ad 100644 --- a/level_2/fll_fss/c/fss_extended_list.c +++ b/level_2/fll_fss/c/fss_extended_list.c @@ -5,12 +5,14 @@ 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_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_return_status fll_fss_extended_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) { #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); + if (!contents_delimits) return F_status_set_error(F_parameter); + if (!comments) return F_status_set_error(F_parameter); #endif // _di_level_3_parameter_checking_ f_status_t status = F_none; @@ -63,7 +65,7 @@ extern "C" { if (status == FL_fss_found_object) { found_data = F_true; - status = fl_fss_extended_list_content_read(buffer, range, nest, contents_delimits ? contents_delimits : objects_delimits); + status = fl_fss_extended_list_content_read(buffer, range, nest, contents_delimits ? contents_delimits : objects_delimits, comments); break; } diff --git a/level_2/fll_fss/c/fss_extended_list.h b/level_2/fll_fss/c/fss_extended_list.h index 5510a22..253e9ec 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -43,6 +43,9 @@ extern "C" { * (optional) An array of delimits for contents detected during processing. * The caller is expected to decide if and when to process them. * Set pointer address to 0 and all delimits will instead utilize objects_delimits. + * @param comments + * An array of ranges representing where comments are found within any valid content. + * This only stores comments found within valid content only. * * @return * F_none on success (both valid object and valid content found with start location is at end of content). @@ -68,7 +71,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_nest_t *nest, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits); + extern f_return_status fll_fss_extended_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); #endif // _di_fll_fss_extended_list_read_ /** diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index b24b3c5..d30f10f 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -385,6 +385,7 @@ extern "C" { fss_basic_list_read_depths_t depths = fss_basic_list_read_depths_t_initialize; f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_fss_comments_t comments = f_fss_comments_t_initialize; f_string_length_t original_size = data->quantity.total; @@ -400,6 +401,7 @@ extern "C" { if (F_status_is_error_not(status) && depths.array[0].depth > 0) { macro_fss_basic_list_read_depths_t_delete_simple(depths); f_macro_fss_delimits_t_delete_simple(delimits); + f_macro_fss_comments_t_delete_simple(comments); if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { fprintf(data->output.stream, "0%c", f_string_eol[0]); @@ -428,7 +430,7 @@ extern "C" { fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); } else { - status = fss_basic_list_read_main_process_file(arguments, data, "-", depths, &delimits); + status = fss_basic_list_read_main_process_file(arguments, data, "-", depths, &delimits, &comments); if (F_status_is_error(status)) { fll_error_file_print(data->error, F_status_set_fine(status), "fss_basic_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); @@ -484,7 +486,7 @@ extern "C" { break; } - status = fss_basic_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &delimits); + status = fss_basic_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &delimits, &comments); if (F_status_is_error(status)) { fll_error_file_print(data->error, F_status_set_fine(status), "fss_basic_list_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); @@ -506,6 +508,7 @@ extern "C" { macro_fss_basic_list_read_depths_t_delete_simple(depths); f_macro_fss_delimits_t_delete_simple(delimits); + f_macro_fss_comments_t_delete_simple(comments); } else { fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]); 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 9105126..b1ea0cb 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 @@ -170,7 +170,7 @@ extern "C" { #endif // _di_fss_basic_list_read_main_preprocess_depth_ #ifndef _di_fss_basic_list_read_main_process_file_ - f_return_status fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data, const f_string_t filename, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits) { + f_return_status fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data, const f_string_t filename, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) { f_status_t status = F_none; const f_string_lengths_t except_none = f_string_lengths_t_initialize; @@ -185,8 +185,9 @@ extern "C" { f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used); delimits->used = 0; + comments->used = 0; - status = fll_fss_basic_list_read(&data->buffer, &input, &data->objects, &data->contents, delimits, 0); + 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. @@ -212,6 +213,16 @@ extern "C" { return status; } + + f_array_length_t i = 0; + f_array_length_t j = 0; + + // comments are not to be part of the file, so remove them. + for (; i < comments->used; ++i) { + for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) { + data->buffer.string[j] = f_fss_delimit_placeholder; + } // for + } // for } f_number_unsigned_t select = 0; @@ -329,7 +340,9 @@ extern "C" { if (data->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { if (data->contents.array[i].used) { + fss_basic_list_read_print_content_ignore(*data); f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*data); } } @@ -354,7 +367,9 @@ extern "C" { if (data->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) { if (data->contents.array[i].used) { + fss_basic_list_read_print_content_ignore(*data); f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*data); } } @@ -374,6 +389,8 @@ extern "C" { } f_array_length_t at = 0; + f_array_length_t total = 0; + f_array_length_t line_current = 0; for (; i < data->objects.used; i++) { @@ -384,7 +401,7 @@ extern "C" { fprintf(data->output.stream, "0%c", f_string_eol[0]); } else { - f_array_length_t total = 1; + total = 1; for (j = data->contents.array[i].array[0].start; j <= data->contents.array[i].array[0].stop; j++) { if (!data->buffer.string[j]) continue; @@ -422,7 +439,7 @@ extern "C" { } // for } else { - f_array_length_t line_current = 0; + line_current = 0; for (; i <= data->contents.array[i].array[0].stop; i++) { if (!data->buffer.string[i]) continue; @@ -455,11 +472,11 @@ extern "C" { } if (data->contents.array[i].used > 0) { + fss_basic_list_read_print_content_ignore(*data); f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*data); - if (data->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data->output.stream, "%c", fss_basic_list_read_pipe_content_end); - } + fss_basic_list_read_print_set_end(*data); } else if (include_empty) { fprintf(data->output.stream, "%c", f_string_eol[0]); @@ -570,11 +587,11 @@ extern "C" { continue; } + fss_basic_list_read_print_content_ignore(*data); f_print_except_dynamic_partial(data->output.stream, data->buffer, data->contents.array[i].array[0], delimited ? *delimits : except_none); + fss_basic_list_read_print_content_ignore(*data); - if (data->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data->output.stream, "%c", fss_basic_list_read_pipe_content_end); - } + fss_basic_list_read_print_set_end(*data); } // for return F_none; @@ -607,6 +624,15 @@ extern "C" { } #endif // _di_fss_basic_list_read_print_content_end_ +#ifndef _di_fss_basic_list_read_print_content_ignore_ + void fss_basic_list_read_print_content_ignore(const fss_basic_list_read_data_t data) { + + if (data.parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(data.output.stream, "%c", fss_basic_list_read_pipe_content_ignore); + } + } +#endif // _di_fss_basic_list_read_print_content_ignore_ + #ifndef _di_fss_basic_list_read_print_set_end_ void fss_basic_list_read_print_set_end(const fss_basic_list_read_data_t data) { diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h index 610391c..c748a02 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.h @@ -191,6 +191,9 @@ extern "C" { * The processed depth parameters. * @param delimits * An array of delimits detected during processing. + * @param comments + * An array of ranges representing where comments are found within any valid content. + * This only stores comments found within valid content only. * * @return * F_none on success. @@ -200,7 +203,7 @@ extern "C" { * @see fss_basic_list_read_main_preprocess_depth() */ #ifndef _di_fss_basic_list_read_main_process_file_ - extern f_return_status fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data, const f_string_t file_name, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits) f_gcc_attribute_visibility_internal; + extern f_return_status fss_basic_list_read_main_process_file(const f_console_arguments_t arguments, fss_basic_list_read_data_t *data, const f_string_t file_name, const fss_basic_list_read_depths_t depths, f_fss_delimits_t *delimits, f_fss_comments_t *comments) f_gcc_attribute_visibility_internal; #endif // _di_fss_basic_list_read_main_process_file_ /** @@ -214,6 +217,18 @@ extern "C" { #endif // _di_fss_basic_list_read_print_object_end_ /** + * Print the ignore character for content. + * + * This is only used in pipe output mode. + * + * @param data + * The program specific data. + */ +#ifndef _di_fss_basic_list_read_print_content_ignore_ + extern void fss_basic_list_read_print_content_ignore(const fss_basic_list_read_data_t data) f_gcc_attribute_visibility_internal; +#endif // _di_fss_basic_list_read_print_content_ignore_ + +/** * Print the end of an content. * * @param data diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 61abc15..7b78ca6 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -386,6 +386,7 @@ extern "C" { f_fss_delimits_t objects_delimits = f_fss_delimits_t_initialize; f_fss_delimits_t contents_delimits = f_fss_delimits_t_initialize; + f_fss_comments_t comments = f_fss_comments_t_initialize; f_string_length_t original_size = data->quantity.total; @@ -416,7 +417,7 @@ extern "C" { fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_pipe); } else { - status = fss_extended_list_read_main_process_file(arguments, data, "-", depths, &objects_delimits, &contents_delimits); + status = fss_extended_list_read_main_process_file(arguments, data, "-", depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, "-", "read", fll_error_file_type_pipe); @@ -470,7 +471,7 @@ extern "C" { break; } - status = fss_extended_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &objects_delimits, &contents_delimits); + status = fss_extended_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments); if (F_status_is_error(status)) { fll_error_file_print(data->error, F_status_set_fine(status), "fss_extended_list_read_main_process_file", F_true, arguments.argv[data->remaining.array[i]], "read", fll_error_file_type_file); @@ -491,6 +492,7 @@ extern "C" { macro_fss_extended_list_read_depths_t_delete_simple(depths); f_macro_fss_delimits_t_delete_simple(objects_delimits); f_macro_fss_delimits_t_delete_simple(contents_delimits); + f_macro_fss_comments_t_delete_simple(comments); } else { fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]); 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 04dc532..d6b443e 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 @@ -170,7 +170,7 @@ extern "C" { #endif // _di_fss_extended_list_read_main_preprocess_depth_ #ifndef _di_fss_extended_list_read_main_process_file_ - f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t filename, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { + f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t filename, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) { f_status_t status = F_none; { @@ -178,8 +178,9 @@ extern "C" { objects_delimits->used = 0; contents_delimits->used = 0; + comments->used = 0; - status = fll_fss_extended_list_read(&data->buffer, &input, &data->nest, objects_delimits, contents_delimits); + status = fll_fss_extended_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. @@ -203,6 +204,16 @@ extern "C" { return status; } + + f_array_length_t i = 0; + f_array_length_t j = 0; + + // comments are not to be part of the file, so remove them. + for (; i < comments->used; ++i) { + for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) { + data->buffer.string[j] = f_fss_delimit_placeholder; + } // for + } // for } // Requested depths cannot be greater than contents depth. @@ -591,6 +602,66 @@ extern "C" { } #endif // _di_fss_extended_list_read_main_process_for_depth_ +#ifndef _di_fss_extended_list_read_print_object_end_ + void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) { + + if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_start); + } + else { + if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(data.output.stream, "%c%c", f_fss_extended_list_open, f_fss_extended_list_open_end); + } + else { + fprintf(data.output.stream, "%c", f_fss_eol); + } + } + } +#endif // _di_fss_extended_list_read_print_object_end_ + +#ifndef _di_fss_extended_list_read_print_content_end_ + void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) { + + if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_start); + } + else { + if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); + } + else { + fprintf(data.output.stream, "%c", f_fss_eol); + } + } + } +#endif // _di_fss_extended_list_read_print_content_end_ + +#ifndef _di_fss_extended_list_read_print_content_ignore_ + void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_data_t data) { + + if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_ignore); + } + } +#endif // _di_fss_extended_list_read_print_content_ignore_ + +#ifndef _di_fss_extended_list_read_print_set_end_ + void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) { + + if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { + fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_end); + } + else { + if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found && data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { + fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); + } + else { + fprintf(data.output.stream, "%c", f_fss_eol); + } + } + } +#endif // _di_fss_extended_list_read_print_set_end_ + #ifndef _di_fss_extended_list_read_process_delimits_ void fss_extended_list_read_process_delimits(const fss_extended_list_read_data_t data, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) { @@ -682,6 +753,7 @@ extern "C" { for (i = 0; i < items->used; ++i) { for (j = 0; j < original_used; ++j) { + for (k = 0; k < items->array[i].content.used; ++k) { if (original_delimits[j] >= items->array[i].content.array[k].start && original_delimits[j] <= items->array[i].content.array[k].stop) { @@ -793,66 +865,6 @@ extern "C" { } #endif // _di_fss_extended_list_read_process_delimits_within_greater_ -#ifndef _di_fss_extended_list_read_print_object_end_ - void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) { - - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_start); - } - else { - if (data.parameters[fss_extended_list_read_parameter_content].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_extended_list_open, f_fss_extended_list_open_end); - } - else { - fprintf(data.output.stream, "%c", f_fss_eol); - } - } - } -#endif // _di_fss_extended_list_read_print_object_end_ - -#ifndef _di_fss_extended_list_read_print_content_end_ - void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) { - - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_start); - } - else { - if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); - } - else { - fprintf(data.output.stream, "%c", f_fss_eol); - } - } - } -#endif // _di_fss_extended_list_read_print_content_end_ - -#ifndef _di_fss_extended_list_read_print_content_ignore_ - void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_data_t data) { - - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_ignore); - } - } -#endif // _di_fss_extended_list_read_print_content_ignore_ - -#ifndef _di_fss_extended_list_read_print_set_end_ - void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) { - - if (data.parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) { - fprintf(data.output.stream, "%c", fss_extended_list_read_pipe_content_end); - } - else { - if (data.parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) { - fprintf(data.output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end); - } - else { - fprintf(data.output.stream, "%c", f_fss_eol); - } - } - } -#endif // _di_fss_extended_list_read_print_set_end_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h index 10e8493..2384e81 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.h @@ -193,6 +193,9 @@ extern "C" { * An array of delimits detected during processing, for top-level objects. * @param contents_delimits * An array of delimits detected during processing, for contents. + * @param comments + * An array of ranges representing where comments are found within any valid content. + * This only stores comments found within valid content only. * * @see fss_extended_list_read_main_preprocess_depth() * @see fss_extended_list_read_main_process_for_depth() @@ -203,7 +206,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fss_extended_list_read_main_process_file_ - extern f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t file_name, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits) f_gcc_attribute_visibility_internal; + extern f_return_status fss_extended_list_read_main_process_file(const f_console_arguments_t arguments, fss_extended_list_read_data_t *data, const f_string_t file_name, const fss_extended_list_read_depths_t depths, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments) f_gcc_attribute_visibility_internal; #endif // _di_fss_extended_list_read_main_process_file_ /** @@ -239,6 +242,48 @@ extern "C" { #endif // _di_fss_extended_list_read_main_process_for_depth_ /** + * Print the end of an content. + * + * @param data + * The program specific data. + */ +#ifndef _di_fss_extended_list_read_print_content_end_ + extern void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; +#endif // _di_fss_extended_list_read_print_content_end_ + +/** + * Print the ignore character for content. + * + * This is only used in pipe output mode. + * + * @param data + * The program specific data. + */ +#ifndef _di_fss_extended_list_read_print_content_ignore_ + extern void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; +#endif // _di_fss_extended_list_read_print_content_ignore_ + +/** + * Print the end of an object (which is essentially the start of a content). + * + * @param data + * The program specific data. + */ +#ifndef _di_fss_extended_list_read_print_object_end_ + extern void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; +#endif // _di_fss_extended_list_read_print_object_end_ + +/** + * Print the end of an object/content set. + * + * @param data + * The program specific data. + */ +#ifndef _di_fss_extended_list_read_print_set_end_ + extern void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; +#endif // _di_fss_extended_list_read_print_set_end_ + +/** * Rewrite the object and content delimit ranges to be within the given depth range. * * @param data @@ -315,48 +360,6 @@ extern "C" { extern f_return_status fss_extended_list_read_process_delimits_within_greater(const fss_extended_list_read_data_t data, const f_string_length_t depth, const f_string_length_t location) f_gcc_attribute_visibility_internal; #endif // _di_fss_extended_list_read_process_delimits_within_greater_ -/** - * Print the end of an object (which is essentially the start of a content). - * - * @param data - * The program specific data. - */ -#ifndef _di_fss_extended_list_read_print_object_end_ - extern void fss_extended_list_read_print_object_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; -#endif // _di_fss_extended_list_read_print_object_end_ - -/** - * Print the end of an content. - * - * @param data - * The program specific data. - */ -#ifndef _di_fss_extended_list_read_print_content_end_ - extern void fss_extended_list_read_print_content_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; -#endif // _di_fss_extended_list_read_print_content_end_ - -/** - * Print the ignore character for content. - * - * This is only used in pipe output mode. - * - * @param data - * The program specific data. - */ -#ifndef _di_fss_extended_list_read_print_content_ignore_ - extern void fss_extended_list_read_print_content_ignore(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; -#endif // _di_fss_extended_list_read_print_content_ignore_ - -/** - * Print the end of an object/content set. - * - * @param data - * The program specific data. - */ -#ifndef _di_fss_extended_list_read_print_set_end_ - extern void fss_extended_list_read_print_set_end(const fss_extended_list_read_data_t data) f_gcc_attribute_visibility_internal; -#endif // _di_fss_extended_list_read_print_set_end_ - #ifdef __cplusplus } // extern "C" #endif