From a7a4c0bf4dc7754b27181d000678eb1564a048ab Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 8 Jun 2020 16:53:27 -0500 Subject: [PATCH] Progress: continue cleaning up comment documentation, fixing discovered problems In particular, the fl_socket (which needs to be reviewed for being moved into f_socket) needed to be documented and had some issues to resolve. --- level_0/f_directory/c/directory.h | 24 +- level_0/f_file/c/file.h | 48 ++-- level_0/f_file/c/private-file.h | 20 +- level_0/f_socket/c/socket.h | 3 - level_1/fl_fss/c/fss.c | 133 +++++----- level_1/fl_fss/c/fss.h | 37 ++- level_1/fl_fss/c/fss_basic.c | 61 ++--- level_1/fl_fss/c/fss_basic.h | 48 ++-- level_1/fl_fss/c/fss_basic_list.c | 46 +--- level_1/fl_fss/c/fss_basic_list.h | 49 ++-- level_1/fl_fss/c/fss_extended.c | 99 +------ level_1/fl_fss/c/fss_extended.h | 48 ++-- level_1/fl_fss/c/fss_extended_list.c | 67 +---- level_1/fl_fss/c/fss_extended_list.h | 51 ++-- level_1/fl_print/c/print.c | 152 +++-------- level_1/fl_print/c/print.h | 36 ++- level_1/fl_serialized/c/private-serialized.c | 4 +- level_1/fl_serialized/c/serialized.c | 10 +- level_1/fl_serialized/c/serialized.h | 8 +- level_1/fl_socket/c/socket.c | 121 +++------ level_1/fl_socket/c/socket.h | 86 +++++- level_1/fl_string/c/private-string.c | 4 +- level_1/fl_string/c/private-string.h | 20 +- level_1/fl_string/c/string.c | 13 +- level_1/fl_string/c/string.h | 374 ++++++++++----------------- level_2/fll_execute/c/execute.h | 6 +- level_2/fll_fss/c/fss.c | 5 - 27 files changed, 657 insertions(+), 916 deletions(-) diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index 28092e5..cb66c61 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -120,7 +120,7 @@ extern "C" { * F_prohibited (with error bit) if filesystem does not allow for removing. * F_read_only (with error bit) if file is read-only. * F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached). - * F_failure (with error bit) for any other (mkdir()) error. + * F_failure (with error bit) for any other error. * * @see mkdir() */ @@ -154,7 +154,7 @@ extern "C" { * F_prohibited (with error bit) if filesystem does not allow for removing. * F_read_only (with error bit) if file is read-only. * F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached). - * F_failure (with error bit) for any other (mkdirat()) error. + * F_failure (with error bit) for any other error. * * @see mkdirat() */ @@ -173,9 +173,9 @@ extern "C" { * F_file_found_not if the path was not found. * F_true if path was found and path is a directory (or a symlink to a directory). * F_access_denied (with error bit) if access to the file was denied. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -201,9 +201,9 @@ extern "C" { * F_true if path was found and path is a directory (or a symlink to a directory). * F_access_denied (with error bit) if access to the file was denied. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -224,9 +224,9 @@ extern "C" { * F_file_found_not if the path was not found. * F_true if path was found and path is a directory. * F_access_denied (with error bit) if access to the file was denied. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -252,9 +252,9 @@ extern "C" { * F_true if path was found and path is a directory. * F_access_denied (with error bit) if access to the file was denied. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -405,7 +405,7 @@ extern "C" { * F_prohibited (with error bit) if filesystem does not allow for removing. * F_read_only (with error bit) if file is read-only. * F_number_overflow (with error bit) on integer overflow. - * F_failure (with error bit) for any other (remove()) error. + * F_failure (with error bit) for any other error. * * @see nftw() * @see remove() @@ -444,7 +444,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_prohibited (with error bit) if filesystem does not allow for removing. * F_read_only (with error bit) if file is read-only. - * F_failure (with error bit) for any other (remove()) error. + * F_failure (with error bit) for any other error. * * @see nftw() * @see remove() diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index 8cead21..a185867 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -292,7 +292,7 @@ extern "C" { * F_false (with error bit) on unknown/unhandled errors. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -322,7 +322,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -355,7 +355,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -390,7 +390,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -428,7 +428,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -869,9 +869,9 @@ extern "C" { * F_true if path was found. * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -902,7 +902,7 @@ extern "C" { * F_false (with error bit) on unknown/unhandled errors. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -951,9 +951,9 @@ extern "C" { * F_true if path was found and path is type. * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -981,9 +981,9 @@ extern "C" { * F_true if path was found and path is type. * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -1518,9 +1518,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -1548,9 +1548,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -1573,9 +1573,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -1601,9 +1601,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -1630,9 +1630,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -1655,9 +1655,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * diff --git a/level_0/f_file/c/private-file.h b/level_0/f_file/c/private-file.h index a2e4510..3c71898 100644 --- a/level_0/f_file/c/private-file.h +++ b/level_0/f_file/c/private-file.h @@ -34,7 +34,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -67,7 +67,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -104,7 +104,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -144,7 +144,7 @@ extern "C" { * F_input_output (with error bit) on I/O error. * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the filename is too long. + * F_name (with error bit) on path name error. * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. @@ -772,9 +772,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -806,9 +806,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * @@ -835,9 +835,9 @@ extern "C" { * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. - * F_loop (with error bit) if a loop occurred. + * F_loop (with error bit) on loop error. * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) if the name is somehow invalid. + * F_name (with error bit) on path name error. * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * diff --git a/level_0/f_socket/c/socket.h b/level_0/f_socket/c/socket.h index a3e0d2e..08d3872 100644 --- a/level_0/f_socket/c/socket.h +++ b/level_0/f_socket/c/socket.h @@ -28,9 +28,6 @@ extern "C"{ * Socket Types. */ #ifndef _di_f_socket_types_ - #define f_socket_id int - #define f_socket_close_id unsigned short - enum { f_socket_close_fast = 1, // As in close(); f_socket_close_read, // As in shutdown(, SHUT_RD); diff --git a/level_1/fl_fss/c/fss.c b/level_1/fl_fss/c/fss.c index 60ddf35..0942ff5 100644 --- a/level_1/fl_fss/c/fss.c +++ b/level_1/fl_fss/c/fss.c @@ -90,7 +90,7 @@ extern "C" { range.stop = i; // 1: A possibly valid header type was found, now convert it into its proper format and save the header type. - f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); + const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); if (F_status_is_error(status)) return status; if (status == F_none) { @@ -146,7 +146,7 @@ extern "C" { range.start = i - 4; range.stop = i; - f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); + const f_status status = f_conversion_string_to_hexidecimal_unsigned(buffer.string, &header->type, range); if (F_status_is_error(status)) return status; header->length = i + 1; @@ -273,11 +273,72 @@ extern "C" { width_max = buffer.used - range.start; } - // @todo update to check against control characters and zero-width space. return f_utf_is_whitespace(buffer.string + range.start, width_max); } #endif // _di_fl_fss_is_space_ +#ifndef _di_fl_fss_shift_delimiters_ + f_return_status fl_fss_shift_delimiters(f_string_dynamic *buffer, const f_string_range range) { + #ifndef _di_level_1_parameter_checking_ + if (buffer->used <= 0) return F_status_set_error(F_parameter); + if (range.start < 0) return F_status_set_error(F_parameter); + if (range.stop < range.start) return F_status_set_error(F_parameter); + if (range.start >= buffer->used) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + + f_string_length position = 0; + f_string_length distance = 0; + unsigned short utf_width = 0; + unsigned short i = 0; + + position = range.start; + + while (position < buffer->used && position <= range.stop) { + if (buffer->string[position] == f_fss_delimit_placeholder) { + distance++; + } + + // do not waste time trying to process what is only going to be replaced with a delimit placeholder + if (position + distance >= buffer->used || position + distance > range.stop) { + break; + } + + utf_width = f_macro_utf_byte_width_is(buffer->string[position]); + if (utf_width > 1) { + // not enough space in buffer or in range range to process UTF-8 character. + if (position + utf_width >= buffer->used || position + utf_width > range.stop) { + return F_status_set_error(F_utf); + } + + if (distance > 0) { + while (utf_width > 0) { + buffer->string[position] = buffer->string[position + distance]; + utf_width--; + position++; + } + } + } + else { + // shift everything down one for each placeholder found + if (distance > 0) { + buffer->string[position] = buffer->string[position + distance]; + } + + position++; + } + } + + if (distance > 0) { + while (position < buffer->used + distance && position <= range.stop) { + buffer->string[position] = f_fss_delimit_placeholder; + position++; + } + } + + return F_none; + } +#endif // _di_fl_fss_shift_delimiters_ + #ifndef _di_fl_fss_skip_past_space_ f_return_status fl_fss_skip_past_space(const f_string_static buffer, f_string_range *range) { #ifndef _di_level_1_parameter_checking_ @@ -381,9 +442,7 @@ extern "C" { } } // for - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; return F_none; } @@ -491,68 +550,6 @@ extern "C" { } #endif // _di_fl_fss_skip_past_non_graph_ -#ifndef _di_fl_fss_shift_delimiters_ - f_return_status fl_fss_shift_delimiters(f_string_dynamic *buffer, const f_string_range range) { - #ifndef _di_level_1_parameter_checking_ - if (buffer->used <= 0) return F_status_set_error(F_parameter); - if (range.start < 0) return F_status_set_error(F_parameter); - if (range.stop < range.start) return F_status_set_error(F_parameter); - if (range.start >= buffer->used) return F_status_set_error(F_parameter); - #endif // _di_level_1_parameter_checking_ - - f_string_length position = 0; - f_string_length distance = 0; - unsigned short utf_width = 0; - unsigned short i = 0; - - position = range.start; - - while (position < buffer->used && position <= range.stop) { - if (buffer->string[position] == f_fss_delimit_placeholder) { - distance++; - } - - // do not waste time trying to process what is only going to be replaced with a delimit placeholder - if (position + distance >= buffer->used || position + distance > range.stop) { - break; - } - - utf_width = f_macro_utf_byte_width_is(buffer->string[position]); - if (utf_width > 1) { - // not enough space in buffer or in range range to process UTF-8 character. - if (position + utf_width >= buffer->used || position + utf_width > range.stop) { - return F_status_set_error(F_utf); - } - - if (distance > 0) { - while (utf_width > 0) { - buffer->string[position] = buffer->string[position + distance]; - utf_width--; - position++; - } - } - } - else { - // shift everything down one for each placeholder found - if (distance > 0) { - buffer->string[position] = buffer->string[position + distance]; - } - - position++; - } - } - - if (distance > 0) { - while (position < buffer->used + distance && position <= range.stop) { - buffer->string[position] = f_fss_delimit_placeholder; - position++; - } - } - - return F_none; - } -#endif // _di_fl_fss_shift_delimiters_ - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_fss/c/fss.h b/level_1/fl_fss/c/fss.h index 3bee5c4..d37ee9e 100644 --- a/level_1/fl_fss/c/fss.h +++ b/level_1/fl_fss/c/fss.h @@ -49,9 +49,8 @@ extern "C" { * F_none on success. * F_none_stop if the stop range is reached before all steps are completed. * F_none_eos if the end of buffer is reached before all steps are completed. - * F_parameter (with error bit) if a parameter is invalid. - * F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_fss_decrement_buffer_ extern f_return_status fl_fss_decrement_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step); @@ -68,6 +67,7 @@ extern "C" { * @return * F_none on success * FL_fss_header_not if no header is found. + * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. * * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned(). @@ -86,12 +86,12 @@ extern "C" { * * @return * F_none on success. + * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. * - * Errors from (with error bit): f_conversion_string_to_hexidecimal_unsigned(). * Errors from (with error bit): f_file_read_until(). - * Errors from (with error bit): fl_fss_identify() * Errors from (with error bit): f_file_seek(). + * Errors from (with error bit): fl_fss_identify() * * @see f_file_read_until() * @see fl_fss_identify() @@ -121,9 +121,9 @@ extern "C" { * F_none on success. * F_none_stop if the stop range is reached before all steps are completed. * F_none_eos if the end of buffer is reached before all steps are completed. - * F_parameter (with error bit) if a parameter is invalid. * F_incomplete_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_fss_increment_buffer_ extern f_return_status fl_fss_increment_buffer(const f_string_static buffer, f_string_range *range, const f_string_length step); @@ -142,9 +142,9 @@ extern "C" { * @return * F_true if the character in the buffer is a graph character. * F_false if the character in the buffer is not a graph character. - * F_maybe (with error bit) if the character width is outside the stop position. - * F_failure (with error bit) if the buffer is not wide enough or the width is outside the stop position. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_graph(). */ #ifndef _di_fl_fss_is_graph_ extern f_return_status fl_fss_is_graph(const f_string_static buffer, const f_string_range range); @@ -163,9 +163,9 @@ extern "C" { * @return * F_true if the character in the buffer is a space character. * F_false if the character in the buffer is not a space character. - * F_maybe (with error bit) if the character width is outside the stop position. - * F_failure (with error bit) if the buffer is not wide enough or the width is outside the stop position. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_space(). */ #ifndef _di_fl_fss_is_space_ extern f_return_status fl_fss_is_space(const f_string_static buffer, const f_string_range range); @@ -206,7 +206,17 @@ extern "C" { * * @return * F_none on success. + * F_none_eol on success and EOL was reached. + * F_none_eos on success and EOS was reached. + * F_none_stop on success and stop point was reached. + * F_incomplete_utf (with error bit) if an incomplete UTF-8 fragment was found. + * F_incomplete_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS. + * F_incomplete_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_control(). + * Errors from (with error bit): f_utf_is_whitespace(). + * Errors from (with error bit): f_utf_is_zero_width(). */ #ifndef _di_fl_fss_skip_past_space_ extern f_return_status fl_fss_skip_past_space(const f_string_static buffer, f_string_range *range); @@ -226,7 +236,16 @@ extern "C" { * * @return * F_none on success. + * F_none_eol on success and EOL was reached. + * F_none_eos on success and EOS was reached. + * F_none_stop on success and stop point was reached. + * F_incomplete_utf (with error bit) if an incomplete UTF-8 fragment was found. + * F_incomplete_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS. + * F_incomplete_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_graph(). + * Errors from (with error bit): f_utf_is_zero_width(). */ #ifndef _di_fl_fss_skip_past_non_graph_ extern f_return_status fl_fss_skip_past_non_graph(const f_string_static buffer, f_string_range *range); diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index 04e9ca5..69b8cbc 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -21,7 +21,9 @@ extern "C" { // delimits must only be applied once a valid object is found f_string_lengths delimits = f_string_lengths_initialize; - fl_fss_skip_past_space(*buffer, location); + status = fl_fss_skip_past_space(*buffer, location); + if (F_status_is_error(status)) return status; + fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, F_data_not_eos, F_data_not_stop) // return found nothing if this line only contains whitespace and delimit placeholders @@ -206,7 +208,6 @@ extern "C" { slash_count--; } - status = fl_fss_increment_buffer(*buffer, location, 1); if (F_status_is_error(status)) return status; } // while @@ -232,16 +233,6 @@ extern "C" { return FL_fss_found_object_not; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } else if (buffer->string[location->start] == f_string_eol[0]) { @@ -386,6 +377,8 @@ extern "C" { f_string_lengths delimits = f_string_lengths_initialize; fl_fss_skip_past_space(*buffer, location); + if (F_status_is_error(status)) return status; + fl_macro_fss_content_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop) // return found nothing if this line only contains whitespace and delimit placeholders @@ -398,14 +391,14 @@ extern "C" { found->array[found->used].start = location->start; // search for valid content - do { + for (;;) { fl_macro_fss_skip_past_delimit_placeholders((*buffer), (*location)) fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop) if (buffer->string[location->start] == f_fss_basic_close) break; location->start++; - } while (F_true); + } // for // Save the stop length found->array[found->used].stop = location->start - 1; @@ -433,12 +426,8 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders(object, (*location)) - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= object.used) { - return F_data_not_eos; - } + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= object.used) return F_data_not_eos; start_position = location->start; @@ -447,7 +436,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); - if (F_status_is_error(status)) return status; } @@ -478,7 +466,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -533,7 +520,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -556,7 +542,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -566,7 +551,7 @@ extern "C" { else if (object.string[location->start] == f_fss_delimit_slash) { f_string_length slash_count = 0; - do { + for (;;) { buffer->string[buffer_position.stop] = object.string[location->start]; buffer_position.stop++; slash_count++; @@ -574,7 +559,6 @@ extern "C" { status = fl_fss_increment_buffer(*buffer, location, 1); if (F_status_is_error(status)) return status; - fl_macro_fss_skip_past_delimit_placeholders(object, (*location)); if (location->start > location->stop || location->start >= object.used) { @@ -586,7 +570,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -596,7 +579,7 @@ extern "C" { slash_count = 0; break; } - } while (F_true); + } // for while (slash_count > 0) { buffer->string[buffer_position.stop] = f_fss_delimit_slash; @@ -646,12 +629,8 @@ extern "C" { buffer->used = buffer_position.stop + 1; } - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= object.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= object.used) return F_none_eos; return F_none; } @@ -669,6 +648,11 @@ extern "C" { f_string_range buffer_position = f_string_range_initialize; f_string_length pre_allocate_size = 0; + fl_macro_fss_skip_past_delimit_placeholders(content, (*location)) + + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= content.used) return F_data_not_eos; + // add an additional 1 to ensure that there is room for the terminating newline. pre_allocate_size = buffer->used + (content.used) + 1 + f_fss_default_allocation_step_string; @@ -677,7 +661,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); - if (F_status_is_error(status)) return status; } @@ -700,12 +683,8 @@ extern "C" { buffer->string[buffer_position.stop] = f_string_eol[0]; buffer->used = buffer_position.stop + 1; - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= content.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= content.used) return F_none_eos; return F_none; } diff --git a/level_1/fl_fss/c/fss_basic.h b/level_1/fl_fss/c/fss_basic.h index 5530c0f..4f387b6 100644 --- a/level_1/fl_fss/c/fss_basic.h +++ b/level_1/fl_fss/c/fss_basic.h @@ -51,16 +51,23 @@ extern "C" { * @return * FL_fss_found_object on success and object was found (start location is at end of object). * FL_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_object_read_ extern f_return_status fl_fss_basic_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found); @@ -86,16 +93,23 @@ extern "C" { * @return * FL_fss_found_content on success and content was found (start location is at end of content). * FL_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_stop on success after reaching stopping point (a valid content is not yet confirmed). - * F_none_eos on success after reaching the end of the buffer (a valid content is not yet confirmed). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_data_not_eos no content found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_content_read_ extern f_return_status fl_fss_basic_content_read(f_string_dynamic *buffer, f_string_range *location, f_fss_content *found); @@ -118,14 +132,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_basic_object_write_ extern f_return_status fl_fss_basic_object_write(f_string_dynamic *buffer, const f_string_static object, f_string_range *location); @@ -147,14 +163,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_basic_content_write_ extern f_return_status fl_fss_basic_content_write(f_string_dynamic *buffer, const f_string_static content, f_string_range *location); diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 9aebd6c..a5990a8 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -394,12 +394,8 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders(object, (*location)) - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= object.used) { - return F_data_not_eos; - } + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= object.used) return F_data_not_eos; start_position = location->start; @@ -408,7 +404,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); - if (F_status_is_error(status)) return status; } @@ -470,7 +465,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -504,12 +498,8 @@ extern "C" { buffer->string[buffer_position.stop + 1] = f_string_eol[0]; buffer->used = buffer_position.stop + 2; - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= object.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= object.used) return F_none_eos; return F_none; } @@ -531,12 +521,8 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders(content, (*location)) - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= content.used) { - return F_data_not_eos; - } + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= content.used) return F_data_not_eos; start_position = location->start; @@ -605,7 +591,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -651,7 +636,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -677,16 +661,6 @@ extern "C" { has_graph = F_true; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } @@ -702,12 +676,8 @@ extern "C" { buffer->string[buffer_position.stop] = f_string_eol[0]; buffer->used = buffer_position.stop + 1; - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= content.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= content.used) return F_none_eos; return F_none; } diff --git a/level_1/fl_fss/c/fss_basic_list.h b/level_1/fl_fss/c/fss_basic_list.h index 1d35f0a..833f00f 100644 --- a/level_1/fl_fss/c/fss_basic_list.h +++ b/level_1/fl_fss/c/fss_basic_list.h @@ -52,16 +52,23 @@ extern "C" { * @return * FL_fss_found_object on success and object was found (start location is at end of object). * FL_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_fss_skip_past_space(). */ #ifndef _di_fl_fss_basic_list_object_read_ extern f_return_status fl_fss_basic_list_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found); @@ -87,16 +94,23 @@ extern "C" { * @return * FL_fss_found_content on success and content was found (start location is at end of content). * FL_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_stop on success after reaching stopping point (a valid content is not yet confirmed). - * F_none_eos on success after reaching the end of the buffer (a valid content is not yet confirmed). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_data_not_eos no content found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_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 *buffer, f_string_range *location, f_fss_content *found); @@ -119,15 +133,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_basic_list_object_write_ extern f_return_status fl_fss_basic_list_object_write(const f_string_static object, f_string_range *location, f_string_dynamic *buffer); @@ -149,14 +164,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_basic_list_content_write_ extern f_return_status fl_fss_basic_list_content_write(const f_string_static content, f_string_range *location, f_string_dynamic *buffer); diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index e637f4c..3241144 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -75,16 +75,6 @@ extern "C" { return FL_fss_found_object; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } else if (buffer->string[location->start] != f_fss_delimit_slash) { @@ -232,16 +222,6 @@ extern "C" { return FL_fss_found_object_not; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } else if (buffer->string[location->start] == f_string_eol[0]) { @@ -404,7 +384,6 @@ extern "C" { if (F_status_is_error(status)) { f_macro_string_lengths_delete_simple(delimits); - return status; } } @@ -438,7 +417,6 @@ extern "C" { if (buffer->string[location->start] == f_string_eol[0]) { fl_macro_fss_apply_delimit_placeholders((*buffer), delimits); - return FL_fss_found_content; } @@ -446,16 +424,6 @@ extern "C" { break; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } else if (buffer->string[location->start] != f_fss_delimit_slash) { @@ -608,16 +576,6 @@ extern "C" { return F_status_is_warning(F_unterminated_group); } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } else if (buffer->string[location->start] == f_string_eol[0]) { @@ -671,7 +629,6 @@ extern "C" { status = fl_fss_increment_buffer(*buffer, location, 1); if (F_status_is_error(status)) return status; - while (location->start <= location->stop && location->start < buffer->used) { if (buffer->string[location->start] == f_string_eol[0]) { fl_macro_fss_apply_delimit_placeholders((*buffer), delimits); @@ -709,9 +666,7 @@ extern "C" { if (F_status_is_error(status)) return status; } // while - if (continue_main_loop) { - break; - } + if (continue_main_loop) break; fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, F_none_eos, F_none_stop) } @@ -791,12 +746,8 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders(object, (*location)) - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= object.used) { - return F_data_not_eos; - } + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= object.used) return F_data_not_eos; start_position = location->start; @@ -805,7 +756,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); - if (F_status_is_error(status)) return status; } @@ -852,7 +802,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -941,7 +890,7 @@ extern "C" { else if (object.string[location->start] == f_fss_delimit_slash) { f_string_length slash_count = 0; - do { + for (;;) { buffer->string[buffer_position.stop] = object.string[location->start]; buffer_position.stop++; slash_count++; @@ -949,7 +898,6 @@ extern "C" { status = fl_fss_increment_buffer(*buffer, location, 1); if (F_status_is_error(status)) return status; - fl_macro_fss_skip_past_delimit_placeholders(object, (*location)); if (location->start > location->stop || location->start >= object.used) { @@ -961,7 +909,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -971,7 +918,7 @@ extern "C" { slash_count = 0; break; } - } while (F_true); + } // for while (slash_count > 0) { buffer->string[buffer_position.stop] = f_fss_delimit_slash; @@ -1021,12 +968,8 @@ extern "C" { buffer->used = buffer_position.stop + 1; } - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= object.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= object.used) return F_none_eos; return F_none; } @@ -1045,6 +988,11 @@ extern "C" { f_string_length start_position = 0; f_string_length pre_allocate_size = 0; + fl_macro_fss_skip_past_delimit_placeholders(content, (*location)) + + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= content.used) return F_data_not_eos; + // add an additional 1 to ensure that there is room for the terminating newline. pre_allocate_size = buffer->used + (content.used) + 1 + f_fss_default_allocation_step_string; @@ -1053,19 +1001,9 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); - if (F_status_is_error(status)) return status; } - fl_macro_fss_skip_past_delimit_placeholders(content, (*location)) - - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= content.used) { - return F_data_not_eos; - } - start_position = location->start; // if this first slash is followed by a quote, then that quote must be delimited. @@ -1111,7 +1049,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -1128,7 +1065,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -1154,7 +1090,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -1211,7 +1146,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -1239,7 +1173,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -1269,12 +1202,8 @@ extern "C" { buffer->string[buffer_position.stop] = ' '; buffer->used = buffer_position.stop + 1; - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= content.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= content.used) return F_none_eos; return F_none; } diff --git a/level_1/fl_fss/c/fss_extended.h b/level_1/fl_fss/c/fss_extended.h index b7c0bc7..3d949fa 100644 --- a/level_1/fl_fss/c/fss_extended.h +++ b/level_1/fl_fss/c/fss_extended.h @@ -51,16 +51,23 @@ extern "C" { * @return * FL_fss_found_object on success and object was found (start location is at end of object). * FL_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_object_read_ extern f_return_status fl_fss_extended_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found); @@ -86,16 +93,23 @@ extern "C" { * @return * FL_fss_found_content on success and content was found (start location is at end of content). * FL_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_stop on success after reaching stopping point (a valid content is not yet confirmed). - * F_none_eos on success after reaching the end of the buffer (a valid content is not yet confirmed). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_data_not_eos no content found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_content_read_ extern f_return_status fl_fss_extended_content_read(f_string_dynamic *buffer, f_string_range *location, f_fss_content *found); @@ -118,14 +132,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_extended_object_write_ extern f_return_status fl_fss_extended_object_write(const f_string_static object, f_string_range *location, f_string_dynamic *buffer); @@ -147,14 +163,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_extended_content_write_ extern f_return_status fl_fss_extended_content_write(const f_string_static content, f_string_range *location, f_string_dynamic *buffer); diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 39bbf5c..bb33519 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -741,16 +741,12 @@ extern "C" { f_macro_fss_objects_delete_simple(objects); if (location->start > location->stop) { - if (depth == 0) { - return F_status_set_error(F_unterminated_stop); - } + if (depth == 0) return F_status_set_error(F_unterminated_stop); return F_status_set_error(F_unterminated_nest_stop); } - if (depth == 0) { - return F_status_set_error(F_unterminated_eos); - } + if (depth == 0) return F_status_set_error(F_unterminated_eos); return F_status_set_error(F_unterminated_nest_eos); } @@ -771,12 +767,8 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders(object, (*location)) - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= object.used) { - return F_data_not_eos; - } + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= object.used) return F_data_not_eos; start_position = location->start; @@ -801,16 +793,6 @@ extern "C" { break; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } @@ -857,7 +839,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -871,9 +852,7 @@ extern "C" { } } else if (object.string[location->start] == f_string_eol[0]) { - if (buffer_position.stop == buffer_position.start) { - return F_data_not_eol; - } + if (buffer_position.stop == buffer_position.start) return F_data_not_eol; break; } @@ -891,12 +870,8 @@ extern "C" { buffer->string[buffer_position.stop + 1] = f_string_eol[0]; buffer->used = buffer_position.stop + 2; - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= object.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= object.used) return F_none_eos; return F_none; } @@ -920,12 +895,8 @@ extern "C" { fl_macro_fss_skip_past_delimit_placeholders(content, (*location)) - if (location->start > location->stop) { - return F_data_not_stop; - } - else if (location->start >= content.used) { - return F_data_not_eos; - } + if (location->start > location->stop) return F_data_not_stop; + else if (location->start >= content.used) return F_data_not_eos; start_position = location->start; @@ -934,7 +905,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); - if (F_status_is_error(status)) return status; } @@ -994,7 +964,6 @@ extern "C" { if (pre_allocate_size > buffer->size) { f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); - if (F_status_is_error(status)) return status; } @@ -1066,16 +1035,6 @@ extern "C" { has_graph = F_true; } else if (F_status_is_error(status)) { - f_status status2 = F_status_set_fine(status); - - if (status2 == F_failure) { - return F_status_set_error(F_utf); - } - - if (status2 == F_failure) { - return F_status_set_error(F_incomplete_utf); - } - return status; } @@ -1091,12 +1050,8 @@ extern "C" { buffer->string[buffer_position.stop] = f_string_eol[0]; buffer->used = buffer_position.stop + 1; - if (location->start > location->stop) { - return F_none_stop; - } - else if (location->start >= content.used) { - return F_none_eos; - } + if (location->start > location->stop) return F_none_stop; + else if (location->start >= content.used) return F_none_eos; */ return F_none; diff --git a/level_1/fl_fss/c/fss_extended_list.h b/level_1/fl_fss/c/fss_extended_list.h index 9c8fa35..cd3708d 100644 --- a/level_1/fl_fss/c/fss_extended_list.h +++ b/level_1/fl_fss/c/fss_extended_list.h @@ -52,16 +52,23 @@ extern "C" { * @return * FL_fss_found_object on success and object was found (start location is at end of object). * FL_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_fss_skip_past_space(). */ #ifndef _di_fl_fss_extended_list_object_read_ extern f_return_status fl_fss_extended_list_object_read(f_string_dynamic *buffer, f_string_range *location, f_fss_object *found); @@ -91,16 +98,23 @@ extern "C" { * @return * FL_fss_found_content on success and content was found (start location is at end of content). * FL_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_unterminated_eos (with error bit) if end of buffer is reached before a closing bracket is found. - * F_unterminated_stop (with error bit) if stop location is reached before a closing bracket is found. - * F_unterminated_nest_eos (with error bit) if end of buffer is reached while inside a nested list before a closing bracket is found. - * F_unterminated_nest_stop (with error bit) if stop location is reached while inside a nested list before a closing bracket is found. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_unterminated_group_eos (with warning bit) if EOS was reached before the a group termination was reached. + * F_unterminated_group_stop (with warning bit) if stop point was reached before the a group termination was reached. * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * F_incomplete_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). + * Errors from (with error bit): fl_fss_is_graph(). + * Errors from (with error bit): fl_fss_is_space(). + * Errors from (with error bit): fl_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 *buffer, f_string_range *location, f_fss_nest *found); @@ -123,15 +137,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_extended_list_object_write_ extern f_return_status fl_fss_extended_list_object_write(const f_string_static object, f_string_range *location, f_string_dynamic *buffer); @@ -153,14 +168,16 @@ extern "C" { * * @return * F_none on success. - * F_none_stop on success after reaching stopping point . * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_none_stop on success after reaching stopping point . * F_incomplete_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. - * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors from (with error bit): fl_fss_increment_buffer(). */ #ifndef _di_fl_fss_extended_list_content_write_ extern f_return_status fl_fss_extended_list_content_write(const f_string_static content, f_string_range *location, f_string_dynamic *buffer); diff --git a/level_1/fl_print/c/print.c b/level_1/fl_print/c/print.c index 2768363..7c35d8d 100644 --- a/level_1/fl_print/c/print.c +++ b/level_1/fl_print/c/print.c @@ -20,9 +20,7 @@ extern "C" { status = f_utf_is_whitespace(string + i, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -37,9 +35,7 @@ extern "C" { status = f_utf_is_whitespace(string + i, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -47,18 +43,14 @@ extern "C" { if (status == F_true) { f_string_length j = i + f_macro_utf_byte_width(string[i]); - if (j == length) { - return F_none; - } + if (j == length) return F_none; for (; j < length; j += f_macro_utf_byte_width(string[j])) { width_max = (length - j) + 1; status = f_utf_is_whitespace(string + j, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -68,23 +60,17 @@ extern "C" { for (; i < j; i++) { if (string[i] == 0) continue; - if (fputc(string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(string[i], output) == 0) return F_status_set_error(F_output); } // for break; } } // for - if (status == F_true) { - break; - } + if (status == F_true) break; } - if (fputc(string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(string[i], output) == 0) return F_status_set_error(F_output); } // for return F_none; @@ -106,9 +92,7 @@ extern "C" { status = f_utf_is_whitespace(buffer.string + i, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -123,9 +107,7 @@ extern "C" { status = f_utf_is_whitespace(buffer.string + i, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -133,18 +115,14 @@ extern "C" { if (status == F_true) { f_string_length j = i + f_macro_utf_byte_width(buffer.string[i]); - if (j == buffer.used) { - return F_none; - } + if (j == buffer.used) return F_none; for (; j < buffer.used; j += f_macro_utf_byte_width(buffer.string[j])) { width_max = (buffer.used - j) + 1; status = f_utf_is_whitespace(buffer.string + j, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -154,9 +132,7 @@ extern "C" { for (; i < j; i++) { if (buffer.string[i] == 0) continue; - if (fputc(buffer.string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); } // for break; @@ -168,9 +144,7 @@ extern "C" { } } - if (fputc(buffer.string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); } // for return F_none; @@ -197,9 +171,7 @@ extern "C" { status = f_utf_is_whitespace(buffer.string + i, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -228,9 +200,7 @@ extern "C" { if (status == F_true) { f_string_length j = i + width_i; - if (j == range.stop) { - return F_none; - } + if (j == range.stop) return F_none; for (uint8_t width_j = f_macro_utf_byte_width(buffer.string[j]); j <= range.stop; j += width_j) { width_j = f_macro_utf_byte_width(buffer.string[j]); @@ -238,9 +208,7 @@ extern "C" { status = f_utf_is_whitespace(buffer.string + j, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -256,9 +224,7 @@ extern "C" { width_i = f_macro_utf_byte_width(buffer.string[i]); for (uint8_t k = 0; k < width_i; k++) { - if (fputc(buffer.string[i + k], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i + k], output) == 0) return F_status_set_error(F_output); } // for } // for @@ -272,9 +238,7 @@ extern "C" { } for (uint8_t k = 0; k < width_i; k++) { - if (fputc(buffer.string[i + k], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i + k], output) == 0) return F_status_set_error(F_output); } // for } // for @@ -296,9 +260,7 @@ extern "C" { status = f_utf_character_is_whitespace(string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -312,9 +274,7 @@ extern "C" { status = f_utf_character_is_whitespace(string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -322,17 +282,13 @@ extern "C" { if (status == F_true) { f_string_length j = i + 1; - if (j == length) { - return F_none; - } + if (j == length) return F_none; for (; j < length; j++) { status = f_utf_character_is_whitespace(string[j]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -342,23 +298,17 @@ extern "C" { for (; i < j; i++) { if (string[i] == 0) continue; - if (fputc(string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(string[i], output) == 0) return F_status_set_error(F_output); } // for break; } } // for - if (status == F_true) { - break; - } + if (status == F_true) break; } - if (fputc(string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(string[i], output) == 0) return F_status_set_error(F_output); } // for return F_none; @@ -378,9 +328,7 @@ extern "C" { status = f_utf_character_is_whitespace(buffer.string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -394,9 +342,7 @@ extern "C" { status = f_utf_character_is_whitespace(buffer.string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -404,17 +350,13 @@ extern "C" { if (status == F_true) { f_string_length j = i + 1; - if (j == buffer.used) { - return F_none; - } + if (j == buffer.used) return F_none; for (; j < buffer.used; j++) { status = f_utf_character_is_whitespace(buffer.string[j]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -424,9 +366,7 @@ extern "C" { for (; i < j; i++) { if (buffer.string[i] == 0) continue; - if (fputc(buffer.string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); } // for break; @@ -438,9 +378,7 @@ extern "C" { } } - if (fputc(buffer.string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); } // for return F_none; @@ -464,9 +402,7 @@ extern "C" { status = f_utf_character_is_whitespace(buffer.string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -480,9 +416,7 @@ extern "C" { status = f_utf_character_is_whitespace(buffer.string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -490,17 +424,13 @@ extern "C" { if (status == F_true) { f_string_length j = i + 1; - if (j == range.stop) { - return F_none; - } + if (j == range.stop) return F_none; for (; j <= range.stop; j++) { status = f_utf_character_is_whitespace(buffer.string[j]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } @@ -510,23 +440,17 @@ extern "C" { for (; i <= j; i++) { if (buffer.string[i] == 0) continue; - if (fputc(buffer.string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); } // for break; } } // for - if (status == F_true) { - break; - } + if (status == F_true) break; } - if (fputc(buffer.string[i], output) == 0) { - return F_status_set_error(F_output); - } + if (fputc(buffer.string[i], output) == 0) return F_status_set_error(F_output); } // for return F_none; diff --git a/level_1/fl_print/c/print.h b/level_1/fl_print/c/print.h index d869979..a4e93c8 100644 --- a/level_1/fl_print/c/print.h +++ b/level_1/fl_print/c/print.h @@ -40,10 +40,12 @@ extern "C" { * * @return * F_none on success. - * F_output (with error bit) on failure. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. - * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * Errors from (with error bit): f_utf_is_whitespace(). */ #ifndef _di_fl_print_trim_string_ extern f_return_status fl_print_trim_string(FILE *output, const f_string string, const f_string_length length); @@ -65,10 +67,12 @@ extern "C" { * * @return * F_none on success. - * F_output (with error bit) on failure. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. - * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * Errors from (with error bit): f_utf_is_whitespace(). */ #ifndef _di_fl_print_trim_string_dynamic_ extern f_return_status fl_print_trim_string_dynamic(FILE *output, const f_string_static buffer); @@ -92,10 +96,12 @@ extern "C" { * * @return * F_none on success. - * F_output (with error bit) on failure. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. - * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * Errors from (with error bit): f_utf_is_whitespace(). */ #ifndef _di_fl_print_trim_string_dynamic_partial_ extern f_return_status fl_print_trim_string_dynamic_partial(FILE *output, const f_string_static buffer, const f_string_range range); @@ -118,10 +124,12 @@ extern "C" { * * @return * F_none on success. - * F_output (with error bit) on failure. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. - * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * Errors from (with error bit): f_utf_character_is_whitespace(). */ #ifndef _di_fl_print_trim_utf_string_ extern f_return_status fl_print_trim_utf_string(FILE *output, const f_utf_string string, const f_utf_string_length length); @@ -143,10 +151,12 @@ extern "C" { * * @return * F_none on success. - * F_output (with error bit) on failure. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. - * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * Errors from (with error bit): f_utf_character_is_whitespace(). */ #ifndef _di_fl_print_trim_utf_string_dynamic_ extern f_return_status fl_print_trim_utf_string_dynamic(FILE *output, const f_utf_string_static buffer); @@ -170,10 +180,12 @@ extern "C" { * * @return * F_none on success. - * F_output (with error bit) on failure. + * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. - * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. + * + * Errors from (with error bit): f_utf_character_is_whitespace(). */ #ifndef _di_fl_print_trim_utf_string_dynamic_partial_ extern f_return_status fl_print_trim_utf_string_dynamic_partial(FILE *output, const f_utf_string_static buffer, const f_utf_string_range range); diff --git a/level_1/fl_serialized/c/private-serialized.c b/level_1/fl_serialized/c/private-serialized.c index 876cda3..b9d5ac2 100644 --- a/level_1/fl_serialized/c/private-serialized.c +++ b/level_1/fl_serialized/c/private-serialized.c @@ -45,9 +45,7 @@ extern "C" { return F_none_eos; } - if (i + width > serialized.used) { - return F_status_set_error(F_incomplete_utf_eos); - } + if (i + width > serialized.used) return F_status_set_error(F_incomplete_utf_eos); i += width; } // while diff --git a/level_1/fl_serialized/c/serialized.c b/level_1/fl_serialized/c/serialized.c index e70a037..9fd3733 100644 --- a/level_1/fl_serialized/c/serialized.c +++ b/level_1/fl_serialized/c/serialized.c @@ -15,7 +15,6 @@ extern "C" { if (serialized->used + value.used + 1 >= serialized->size) { f_macro_string_dynamic_resize(status, (*serialized), serialized->size + value.used + 1); - if (F_status_is_error(status)) return status; } @@ -53,7 +52,6 @@ extern "C" { if (serialized.string[i] == f_serialized_simple_splitter || i + 1 >= serialized.used) { if (strings->used >= strings->size) { f_macro_string_dynamics_resize(status, (*strings), strings->size + f_serialized_default_allocation_step); - if (F_status_is_error(status)) return status; } @@ -74,7 +72,6 @@ extern "C" { if (total > strings->array[strings->used].size) { f_macro_string_dynamic_new(status, strings->array[strings->used], total); - if (F_status_is_error(status)) return status; strings->array[strings->used].size = total; @@ -123,7 +120,6 @@ extern "C" { if (serialized.string[i] == f_serialized_simple_splitter || i + 1 >= serialized.used) { if (locations->used >= locations->size) { f_macro_string_ranges_resize(status, (*locations), locations->size + f_serialized_default_allocation_step); - if (F_status_is_error(status)) return status; } @@ -144,9 +140,7 @@ extern "C" { locations->used++; - if (i + width > serialized.used) { - return F_status_set_error(F_incomplete_utf_eos); - } + if (i + width > serialized.used) return F_status_set_error(F_incomplete_utf_eos); start = i + width; } @@ -182,7 +176,6 @@ extern "C" { f_string_range range = f_string_range_initialize; f_status status = private_fl_unserialize_simple_find(serialized, index, &range); - if (F_status_is_error(status)) return status; if (status == F_data_not_eos) { @@ -196,7 +189,6 @@ extern "C" { f_status status_allocation = F_none; f_macro_string_dynamic_resize(status_allocation, (*dynamic), total); - if (F_status_is_error(status_allocation)) return status_allocation; } diff --git a/level_1/fl_serialized/c/serialized.h b/level_1/fl_serialized/c/serialized.h index a52c5f1..660425d 100644 --- a/level_1/fl_serialized/c/serialized.h +++ b/level_1/fl_serialized/c/serialized.h @@ -43,8 +43,8 @@ extern "C" { * * @return * F_none on success. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_serialize_simple_ extern f_return_status fl_serialize_simple(const f_string_static value, f_string_dynamic *serialized); @@ -68,8 +68,8 @@ extern "C" { * @return * F_none on success. * F_incomplete_utf_eos if end of sting is reached before a complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_unserialize_simple_ extern f_return_status fl_unserialize_simple(const f_string_static serialized, f_string_dynamics *strings); @@ -93,8 +93,8 @@ extern "C" { * @return * F_none on success. * F_incomplete_utf_eos if end of sting is reached before a complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_unserialize_simple_map_ extern f_return_status fl_unserialize_simple_map(const f_string_static serialized, f_string_ranges *locations); @@ -150,8 +150,8 @@ extern "C" { * F_none_eos on success at end of string. * F_data_not_eos if end of string reached before index was reached (dynamic->used is set to 0). * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_unserialize_simple_get_ extern f_return_status fl_unserialize_simple_get(const f_string_static serialized, const f_array_length index, f_string_dynamic *dynamic); diff --git a/level_1/fl_socket/c/socket.c b/level_1/fl_socket/c/socket.c index bc52a31..1a469f4 100644 --- a/level_1/fl_socket/c/socket.c +++ b/level_1/fl_socket/c/socket.c @@ -5,47 +5,25 @@ extern "C"{ #endif #ifndef _di_fl_socket_file_bind_ - f_return_status fl_socket_file_bind(const f_string socket_path, f_socket_id *socket_id, struct sockaddr_un *socket_address) { - memset(&socket_address, 0, sizeof(struct sockaddr_un)); - socket_address->sun_family = AF_UNIX; - strncpy(socket_address->sun_path, socket_path, sizeof(socket_address->sun_path) - 1); + f_return_status fl_socket_file_bind(const f_string path, const int id, struct sockaddr_un *address) { + memset(&address, 0, sizeof(struct sockaddr_un)); + address->sun_family = AF_UNIX; + strncpy(address->sun_path, path, sizeof(address->sun_path) - 1); - if (bind(*socket_id, (struct sockaddr *) socket_address, sizeof(struct sockaddr_un)) < 0) { - if (errno == EACCES) { - return F_access_denied; - } - else if (errno == EADDRINUSE) { - return F_busy_address; - } - else if (errno == EADDRNOTAVAIL) { - return F_unavailable_address; - } - else if (errno == EINVAL) { - return F_busy_socket; - } - else if (errno == ENOTSOCK) { - return F_socket; - } - else if (errno == ENAMETOOLONG) { - return F_string_too_large; - } - else if (errno == ENOENT) { - return F_file_found_not; - } - else if (errno == EFAULT) { - return F_address; - } - else if (errno == ENOTDIR) { - return F_directory_found_not; - } - else if (errno == ENOMEM) { - return F_memory_out; - } - else if (errno == ELOOP) { - return F_loop; - } + if (bind(id, (struct sockaddr *) address, sizeof(struct sockaddr_un)) < 0) { + if (errno == EACCES) return F_status_set_error(F_access_denied); + else if (errno == EADDRINUSE) return F_status_set_error(F_busy_address); + else if (errno == EADDRNOTAVAIL) return F_status_set_error(F_unavailable_address); + else if (errno == EFAULT) return F_status_set_error(F_buffer); + else if (errno == EINVAL) return F_status_set_error(F_busy_socket); + else if (errno == ELOOP) return F_status_set_error(F_loop); + else if (errno == ENAMETOOLONG) return F_status_set_error(F_string_too_large); + else if (errno == ENOENT) return F_status_set_error(F_file_found_not); + else if (errno == ENOMEM) return F_status_set_error(F_memory_out); + else if (errno == ENOTDIR) return F_status_set_error(F_directory_found_not); + else if (errno == ENOTSOCK) return F_status_set_error(F_descriptor); - return F_failure; + return F_status_set_error(F_failure); } return F_none; @@ -53,22 +31,15 @@ extern "C"{ #endif // _di_fl_socket_file_bind_ #ifndef _di_fl_socket_listen_ - f_return_status fl_socket_listen(const f_socket_id socket_id, const unsigned int socket_backlog) { - if (listen(socket_id, socket_backlog) < 0) { - if (errno == EADDRINUSE) { - return F_busy; - } - else if (errno == EBADF) { - return F_file_descriptor; - } - else if (errno == ENOTSOCK) { - return F_socket; - } - else if (errno == EOPNOTSUPP) { - return F_unsupported; - } + f_return_status fl_socket_listen(const int id, const unsigned int max_backlog) { + + if (listen(id, max_backlog) < 0) { + if (errno == EADDRINUSE) return F_status_set_error(F_busy_address); + else if (errno == EBADF) return F_status_set_error(F_file_descriptor); + else if (errno == ENOTSOCK) return F_status_set_error(F_descriptor); + else if (errno == EOPNOTSUPP) return F_status_set_error(F_unsupported); - return F_failure; + return F_status_set_error(F_failure); } return F_none; @@ -76,48 +47,36 @@ extern "C"{ #endif // _di_fl_socket_listen_ #ifndef _di_fl_socket_close_client_ - // terminate a socket connection. - f_return_status fl_socket_close_client(const f_socket_id socket_id_client, const f_socket_close_id close_action) { + f_return_status fl_socket_close_client(const int id, const unsigned short action) { unsigned int error_code = 0; - if (close_action == f_socket_close_fast) { - if (close(socket_id_client) < 0) { + if (action == f_socket_close_fast) { + if (close(id) < 0) { error_code = errno; } } else { - if (close_action == f_socket_close_read || close_action == f_socket_close_write || close_action == f_socket_close_read_write) { - if (shutdown(socket_id_client, close_action) < 0) { + if (action == f_socket_close_read || action == f_socket_close_write || action == f_socket_close_read_write) { + if (shutdown(id, action) < 0) { error_code = errno; } } else { - // socket close id is unsupported. - return F_unsupported; + return F_status_set_error(F_unsupported); } } if (error_code > 0) { - if (error_code == EBADF) { - return F_file_descriptor; - } - else if (error_code == EINVAL) { - return F_value; - } - else if (error_code == ENOTCONN) { - return F_connected_not; - } - else if (error_code == ENOTSOCK) { - return F_socket; - } - else if (error_code == EINTR) { - return F_interrupted; - } - else if (error_code == EBADF) { - return F_input_output; - } + if (error_code == EBADF) return F_status_set_error(F_file_descriptor); + else if (error_code == EDQUOT) return F_status_set_error(F_filesystem_quota_block); + else if (error_code == EINTR) return F_status_set_error(F_interrupted); + else if (error_code == EINVAL) return F_status_set_error(F_value); + else if (error_code == EIO) return F_status_set_error(F_input_output); + else if (error_code == ENOTCONN) return F_connected_not; + else if (error_code == ENOTSOCK) return F_status_set_error(F_descriptor); + else if (error_code == ENOSPC) return F_status_set_error(F_parameter); - return F_failure; + return F_status_set_error(F_failure); } return F_none; diff --git a/level_1/fl_socket/c/socket.h b/level_1/fl_socket/c/socket.h index 13bdb60..129ef76 100644 --- a/level_1/fl_socket/c/socket.h +++ b/level_1/fl_socket/c/socket.h @@ -29,27 +29,85 @@ extern "C"{ #endif +/** + * Bind a UNIX socket. + * + * @param path + * The path to a socket file to bind to. + * @param id + * The ID of a socket. + * @param address + * The socket address information. + * + * @return + * F_none on success. + * F_address (with error bit) if address is already in use (therefore unavailable). + * F_buffer (with error bit) if the buffer is invalid. + * F_busy_address (with error bit) if address is already in use (therefore unavailable). + * F_busy_socket (with error bit) if socket defined by id is already bound (therefore unavailable). + * F_descriptor (with error bit) if the id is not a socket descriptor. + * F_directory_found_not (with error bit) if directory was not found. + * F_file_found_not (with error bit) if file not found. + * F_memory_out (with error bit) if out of memory. + * F_name (with error bit) on path name error. + * F_string_too_large (with error bit) if string is too large to store in the buffer. + * F_unavailable_address (with error bit) if address is unavailable (is non-existent or not local). + * + * @see bind() + */ #ifndef _di_fl_socket_file_bind_ - /** - * bind a socket. - */ - extern f_return_status fl_socket_file_bind(const f_string socket_path, f_socket_id *socket_id, struct sockaddr_un *socket_address); + extern f_return_status fl_socket_file_bind(const f_string path, const int id, struct sockaddr_un *address); #endif // _di_fl_socket_file_bind_ +/** + * Terminate a socket connection. + * + * @param id + * The ID of a socket. + * @param max_backlog + * The max length of the pending connections queue. + * Suggested default setting: 8. + * + * @return + * F_none on success. + * F_busy_address (with error bit) if address is already in use (therefore unavailable). + * F_descriptor (with error bit) if the id is not a socket descriptor. + * F_file_descriptor (with error bit) if id is an invalid descriptor. + * F_unsupported (with error bit) if this socket does not support the listen() operation. + * + * @see listen() + */ #ifndef _di_fl_socket_listen_ - /** - * terminate a socket connection. - * suggested socket_backlog default setting = 8. - */ - extern f_return_status fl_socket_listen(const f_socket_id socket_id, const unsigned int socket_backlog); + extern f_return_status fl_socket_listen(const int id, const unsigned int max_backlog); #endif // _di_fl_socket_listen_ +/** + * Terminate a client socket connection. + * + * @param id + * The ID of a socket. + * @param action + * The action to perform on close. + * f_socket_close_fast calls close(). + * + * @return + * F_none on success. + * F_connected_not if the socket is not connected. + * F_busy_address (with error bit) if address is already in use (therefore unavailable). + * F_descriptor (with error bit) if the id is not a socket descriptor. + * F_file_descriptor (with error bit) if id is an invalid descriptor. + * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. + * F_input_output (with error bit) if an I/O error occurred. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_parameter (with error bit) if a parameter is invalid. + * F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached). + * F_unsupported (with error bit) if this socket does not support the listen() operation. + * + * @see close() + * @see shutdown() + */ #ifndef _di_fl_socket_close_client_ - /** - * terminate a socket connection. - * suggested default close_action = f_socket_close_fast. - */ - extern f_return_status fl_socket_close_client(const f_socket_id socket_id_client, const f_socket_close_id close_action); + extern f_return_status fl_socket_close_client(const int id, const unsigned short action); #endif // _di_fl_socket_close_client_ #ifdef __cplusplus diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index 1406484..af7e0f6 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -153,9 +153,7 @@ extern "C" { width_max = (stop2 - i2) + 1; status = f_utf_is_whitespace(string2 + i2, width_max); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) { - return F_status_set_error(F_utf); - } + if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); return status; } diff --git a/level_1/fl_string/c/private-string.h b/level_1/fl_string/c/private-string.h index 6ef1f5e..c3920b0 100644 --- a/level_1/fl_string/c/private-string.h +++ b/level_1/fl_string/c/private-string.h @@ -33,10 +33,11 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0 (start > stop). * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. * * @see fl_string_append() * @see fl_string_mash() @@ -61,10 +62,11 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0 (start > stop). * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. * * @see fl_string_append_nulless() * @see fl_string_mash_nulless() @@ -151,10 +153,10 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. * * @see fl_string_prepend() * @see fl_string_dynamic_prepend() @@ -177,10 +179,10 @@ extern "C" { * * @return * F_none on success. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. * * @see fl_string_prepend_nulless() * @see fl_string_dynamic_prepend_nulless() @@ -206,9 +208,9 @@ extern "C" { * @return * F_none on success. * F_data_not on success but only whitespace found. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * * @see fl_string_dynamic_rip() * @see fl_string_rip() diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 0a47988..67854a9 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -24,10 +24,7 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (length == 0) return F_data_not; - - if (destination->used < length) { - return private_fl_string_append(source, length, destination); - } + if (destination->used < length) return private_fl_string_append(source, length, destination); f_string_length i = 1; f_string_length j = 1; @@ -238,7 +235,7 @@ extern "C" { if (source.used == 0) return F_data_not; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append(glue, glue_length, destination); + const f_status status = private_fl_string_append(glue, glue_length, destination); if (F_status_is_error(status)) return status; } @@ -256,7 +253,7 @@ extern "C" { if (source.used == 0) return F_data_not; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append_nulless(glue, glue_length, destination); + const f_status status = private_fl_string_append_nulless(glue, glue_length, destination); if (F_status_is_error(status)) return status; } @@ -274,7 +271,7 @@ extern "C" { if (source.used == 0) return F_data_not; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend(glue, glue_length, destination); + const f_status status = private_fl_string_prepend(glue, glue_length, destination); if (F_status_is_error(status)) return status; } @@ -292,7 +289,7 @@ extern "C" { if (source.used == 0) return F_data_not; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); + const f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); if (F_status_is_error(status)) return status; } diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 5a21c5c..7aac1ba 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -47,12 +47,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_append_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_ extern f_return_status fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -73,12 +71,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_append_assure_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_assure_ extern f_return_status fl_string_append_assure(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -100,12 +96,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_append_assure() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_assure_nulless_ extern f_return_status fl_string_append_assure_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -126,12 +120,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_append() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_append_nulless_ extern f_return_status fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -156,11 +148,6 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_dynamic_compare() - * @see fl_string_dynamic_compare_trim() - * @see fl_string_dynamic_partial_compare() - * @see fl_string_dynamic_partial_compare_trim() */ #ifndef _di_fl_string_compare_ extern f_return_status fl_string_compare(const f_string string1, const f_string string2, const f_string_length length1, const f_string_length length2); @@ -186,11 +173,6 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_dynamic_compare() - * @see fl_string_dynamic_compare_trim() - * @see fl_string_dynamic_partial_compare() - * @see fl_string_dynamic_partial_compare_trim() */ #ifndef _di_fl_string_compare_trim_ extern f_return_status fl_string_compare_trim(const f_string string1, const f_string string2, const f_string_length length1, const f_string_length length2); @@ -207,12 +189,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_append_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_ extern f_return_status fl_string_dynamic_append(const f_string_static source, f_string_dynamic *destination); @@ -229,12 +209,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_append_assure_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_assure_ extern f_return_status fl_string_dynamic_append_assure(const f_string_static source, f_string_dynamic *destination); @@ -253,12 +231,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_append_assure() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_assure_nulless_ extern f_return_status fl_string_dynamic_append_assure_nulless(const f_string_static source, f_string_dynamic *destination); @@ -277,12 +253,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_append() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_append_nulless_ extern f_return_status fl_string_dynamic_append_nulless(const f_string_static source, f_string_dynamic *destination); @@ -303,11 +277,6 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_compare() - * @see fl_string_compare_trim() - * @see fl_string_dynamic_partial_compare() - * @see fl_string_dynamic_partial_compare_trim() */ #ifndef _di_fl_string_dynamic_compare_ extern f_return_status fl_string_dynamic_compare(const f_string_static string1, const f_string_static string2); @@ -329,11 +298,6 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_compare() - * @see fl_string_compare_trim() - * @see fl_string_dynamic_partial_compare() - * @see fl_string_dynamic_partial_compare_trim() */ #ifndef _di_fl_string_dynamic_compare_trim_ extern f_return_status fl_string_dynamic_compare_trim(const f_string_static string1, const f_string_static string2); @@ -356,12 +320,14 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. * - * @see fl_string_dynamic_mash_nulless() + * Errors from (with error bit): f_utf_is_graph(). + * + * @see f_utf_is_graph() */ #ifndef _di_fl_string_dynamic_mash_ extern f_return_status fl_string_dynamic_mash(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -386,12 +352,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_mash() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mash_nulless_ extern f_return_status fl_string_dynamic_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -414,12 +378,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_mish_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mish_ extern f_return_status fl_string_dynamic_mish(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -444,12 +406,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_mish() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_mish_nulless_ extern f_return_status fl_string_dynamic_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, f_string_dynamic *destination); @@ -467,13 +427,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_append_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_ extern f_return_status fl_string_dynamic_partial_append(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -493,13 +451,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_append_assure_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_assure_ extern f_return_status fl_string_dynamic_partial_append_assure(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -521,13 +477,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_append_assure() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_assure_nulless_ extern f_return_status fl_string_dynamic_partial_append_assure_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -547,13 +501,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_append() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_append_nulless_ extern f_return_status fl_string_dynamic_partial_append_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -578,11 +530,6 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_compare() - * @see fl_string_compare_trim() - * @see fl_string_dynamic_compare() - * @see fl_string_dynamic_compare_trim() */ #ifndef _di_fl_string_dynamic_partial_compare_ extern f_return_status fl_string_dynamic_partial_compare(const f_string_static string1, const f_string_static string2, const f_string_range range1, const f_string_range range2); @@ -608,11 +555,6 @@ extern "C" { * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_compare() - * @see fl_string_compare_trim() - * @see fl_string_dynamic_compare() - * @see fl_string_dynamic_compare_trim() */ #ifndef _di_fl_string_dynamic_partial_compare_trim_ extern f_return_status fl_string_dynamic_partial_compare_trim(const f_string_static string1, const f_string_static string2, const f_string_range range1, const f_string_range range2); @@ -636,13 +578,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_mash_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mash_ extern f_return_status fl_string_dynamic_partial_mash(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -668,13 +608,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_mash() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mash_nulless_ extern f_return_status fl_string_dynamic_partial_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -698,13 +636,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_mish_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mish_ extern f_return_status fl_string_dynamic_partial_mish(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -730,13 +666,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_mish() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_mish_nulless_ extern f_return_status fl_string_dynamic_partial_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -756,13 +690,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_prepend_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_ extern f_return_status fl_string_dynamic_partial_prepend(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -784,13 +716,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_prepend_assure_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_assure_ extern f_return_status fl_string_dynamic_partial_prepend_assure(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -812,13 +742,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_prepend_assure() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_assure_nulless_ extern f_return_status fl_string_dynamic_partial_prepend_assure_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -838,13 +766,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if source length is 0 or range is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_partial_prepend() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_partial_prepend_nulless_ extern f_return_status fl_string_dynamic_partial_prepend_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -863,12 +789,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_prepend_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_ extern f_return_status fl_string_dynamic_prepend(const f_string_static source, f_string_dynamic *destination); @@ -889,12 +813,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_prepend_assure_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_assure_ extern f_return_status fl_string_dynamic_prepend_assure(const f_string_static source, f_string_dynamic *destination); @@ -915,12 +837,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_prepend_assure() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_assure_nulless_ extern f_return_status fl_string_dynamic_prepend_assure_nulless(const f_string_static source, f_string_dynamic *destination); @@ -939,12 +859,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0. - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_prepend() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_prepend_nulless_ extern f_return_status fl_string_dynamic_prepend_nulless(const f_string_static source, f_string_dynamic *destination); @@ -965,12 +883,11 @@ extern "C" { * * @return * F_none on success. - * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. + * F_data_not if source length is 0. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_rip_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_dynamic_rip_ extern f_return_status fl_string_dynamic_rip(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -994,11 +911,9 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_rip() + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_rip_nulless_ extern f_return_status fl_string_dynamic_rip_nulless(const f_string_static source, const f_string_range range, f_string_dynamic *destination); @@ -1021,9 +936,6 @@ extern "C" { * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_dynamic_seek_line_to_utf_character() - * @see fl_string_seek_line_to_utf_character() */ #ifndef _di_fl_string_dynamic_seek_line_to_ extern f_return_status fl_string_dynamic_seek_line_to(const f_string_static buffer, f_string_range *range, const int8_t seek_to_this); @@ -1044,14 +956,15 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. - * F_utf (with error bit) if character is an invalid UTF-8 character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if character is an invalid UTF-8 character. * - * @see fl_string_dynamic_seek_line_to() - * @see fl_string_seek_line_to() + * Errors from (with error bit): f_utf_char_to_character(). + * + * @see f_utf_char_to_character() */ #ifndef _di_fl_string_dynamic_seek_line_to_utf_character_ extern f_return_status fl_string_dynamic_seek_line_to_utf_character(const f_string_static buffer, f_string_range *range, const f_utf_character seek_to_this); @@ -1072,13 +985,15 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_graph(). * - * @see fl_string_seek_line_until_graph() + * @see f_utf_is_graph() */ #ifndef _di_fl_string_dynamic_seek_line_until_graph_ extern f_return_status fl_string_dynamic_seek_line_until_graph(const f_string_static buffer, f_string_range *range, const int8_t placeholder); @@ -1100,13 +1015,15 @@ extern "C" { * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_string_seek_line_until_non_graph() + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_dynamic_seek_line_until_non_graph_ extern f_return_status fl_string_dynamic_seek_line_until_non_graph(const f_string_static buffer, f_string_range *range, const int8_t placeholder); @@ -1128,13 +1045,9 @@ extern "C" { * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_dynamic_seek_to_utf_character() - * @see fl_string_seek_to() - * @see fl_string_seek_to_utf_character() */ #ifndef _di_fl_string_dynamic_seek_to_ extern f_return_status fl_string_dynamic_seek_to(const f_string_static buffer, f_string_range *range, const int8_t seek_to_this); @@ -1155,15 +1068,15 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if character is an invalid UTF-8 character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. - * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_incomplete_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. + * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if character is an invalid UTF-8 character. * - * @see fl_string_dynamic_seek_to() - * @see fl_string_seek_to() - * @see fl_string_seek_to_character() + * Errors from (with error bit): f_utf_char_to_character(). + * + * @see f_utf_char_to_character() */ #ifndef _di_fl_string_dynamic_seek_to_utf_character_ extern f_return_status fl_string_dynamic_seek_to_utf_character(const f_string_static buffer, f_string_range *range, const f_utf_character seek_to_this); @@ -1182,8 +1095,8 @@ extern "C" { * * @return * F_none on success. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if string is too large to fit into the buffer. */ #ifndef _di_fl_string_dynamic_terminate_ @@ -1205,8 +1118,8 @@ extern "C" { * * @return * F_none on success. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if string is too large to fit into the buffer. */ #ifndef _di_fl_string_dynamic_terminate_after_ @@ -1232,12 +1145,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_mash_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mash_ extern f_return_status fl_string_mash(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1264,12 +1175,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_mash() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mash_nulless_ extern f_return_status fl_string_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1294,12 +1203,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_mish_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mish_ extern f_return_status fl_string_mish(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1326,12 +1233,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_mish() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_mish_nulless_ extern f_return_status fl_string_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1352,12 +1257,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_prepend_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_ extern f_return_status fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1380,12 +1283,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_prepend_assure_nulless() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_assure_ extern f_return_status fl_string_prepend_assure(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1409,12 +1310,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_prepend_assure() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_assure_nulless_ extern f_return_status fl_string_prepend_assure_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1438,12 +1337,10 @@ extern "C" { * @return * F_none on success. * F_data_not if source length is 0 (start > stop). - * f_string_length_size (with error bit) if the combined string is too large. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_dynamic_prepend() + * F_parameter (with error bit) if a parameter is invalid. + * f_string_length_size (with error bit) if the combined string is too large. */ #ifndef _di_fl_string_prepend_nulless_ extern f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1465,11 +1362,9 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_rip_nulless() + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_rip_ extern f_return_status fl_string_rip(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1493,11 +1388,9 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. - * - * @see fl_string_rip() + * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_rip_nulless_ extern f_return_status fl_string_rip_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); @@ -1519,10 +1412,6 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_stop on success, but stopped stop location. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_dynamic_seek_line_to() - * @see fl_string_dynamic_seek_line_to_utf_character() - * @see fl_string_seek_line_to_utf_character() */ #ifndef _di_fl_string_seek_line_to_ extern f_return_status fl_string_seek_line_to(const f_string string, f_string_range *range, const int8_t seek_to_this); @@ -1542,13 +1431,14 @@ extern "C" { * @return * F_none on success. * F_none_eol on success, but stopped at EOL. - * F_utf (with error bit) if character is an invalid UTF-8 character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if character is an invalid UTF-8 character. * - * @see fl_string_dynamic_seek_line_to() - * @see fl_string_seek_line_to() + * Errors from (with error bit): f_utf_char_to_character(). + * + * @see f_utf_char_to_character() */ #ifndef _di_fl_string_seek_line_to_utf_character_ extern f_return_status fl_string_seek_line_to_utf_character(const f_string string, f_string_range *range, const f_utf_character seek_to_this); @@ -1570,11 +1460,13 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors from (with error bit): f_utf_is_graph(). * - * @see fl_string_dynamic_seek_line_until_graph() + * @see f_utf_is_graph() */ #ifndef _di_fl_string_seek_line_until_graph_ extern f_return_status fl_string_seek_line_until_graph(const f_string string, f_string_range *range, const int8_t placeholder); @@ -1597,11 +1489,13 @@ extern "C" { * F_none_stop on success, but stopped stop location. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. - * F_parameter (with error bit) if a parameter is invalid. * F_memory_allocation (with error bit) on memory allocation error. * F_memory_reallocation (with error bit) on memory reallocation error. + * F_parameter (with error bit) if a parameter is invalid. * - * @see fl_string_dynamic_seek_line_until_non_graph() + * Errors from (with error bit): f_utf_is_whitespace(). + * + * @see f_utf_is_whitespace() */ #ifndef _di_fl_string_seek_line_until_non_graph_ extern f_return_status fl_string_seek_line_until_non_graph(const f_string string, f_string_range *range, const int8_t placeholder); @@ -1624,10 +1518,6 @@ extern "C" { * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. - * - * @see fl_string_dynamic_seek_to() - * @see fl_string_dynamic_seek_to_utf_character() - * @see fl_string_seek_to_utf_character() */ #ifndef _di_fl_string_seek_to_ extern f_return_status fl_string_seek_to(const f_string string, f_string_range *range, const int8_t seek_to_this); @@ -1647,14 +1537,14 @@ extern "C" { * @return * F_none on success. * F_none_stop on success, but stopped stop location. - * F_utf (with error bit) if character is an invalid UTF-8 character. * F_incomplete_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_incomplete_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. + * F_utf (with error bit) if character is an invalid UTF-8 character. + * + * Errors from (with error bit): f_utf_char_to_character(). * - * @see fl_string_dynamic_seek_to() - * @see fl_string_dynamic_seek_to_utf_character() - * @see fl_string_seek_to() + * @see f_utf_char_to_character() */ #ifndef _di_fl_string_seek_to_utf_character_ extern f_return_status fl_string_seek_to_utf_character(const f_string string, f_string_range *range, const f_utf_character seek_to_this); diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index ec7b0df..b21e2f1 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -299,7 +299,7 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_file_found_not (with error bit) if file does not exist at the program_path. - * F_name (with error bit) if the program_path is too long. + * F_name (with error bit) on path name error. * F_memory_out (with error bit) if out of memory. * F_number_overflow (with error bit) on overflow error. * F_directory (with error bit) on invalid directory in program_path. @@ -342,7 +342,7 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_file_found_not (with error bit) if file does not exist at the program_path. - * F_name (with error bit) if the program_path is too long. + * F_name (with error bit) on path name error. * F_memory_out (with error bit) if out of memory. * F_number_overflow (with error bit) on overflow error. * F_directory (with error bit) on invalid directory in program_path. @@ -416,7 +416,7 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_file_found_not (with error bit) if file does not exist at the program_path. - * F_name (with error bit) if the program_path is too long. + * F_name (with error bit) on path name error. * F_memory_out (with error bit) if out of memory. * F_number_overflow (with error bit) on overflow error. * F_directory (with error bit) on invalid directory in program_path. diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index a000f52..f5f4bea 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -79,7 +79,6 @@ extern "C" { for (k = 0; k < contents.array[i].used; k++) { status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[k], &values[j]->array[values[j]->used]); - if (F_status_is_error(status)) return status; values[j]->used++; @@ -119,7 +118,6 @@ extern "C" { for (k = 0; k < contents.array[i].used; k++) { status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[k], values[j]); - if (F_status_is_error(status)) return status; } // for } // for @@ -158,7 +156,6 @@ extern "C" { if (values[j]->used == 0) { for (k = 0; k < contents.array[i].used; k++) { status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], values[j]); - if (F_status_is_error(status)) return status; } // for } @@ -208,7 +205,6 @@ extern "C" { for (k = 0; k < contents.array[i].used; k++) { status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], &values[j]->array[values[j]->used]); - if (F_status_is_error(status)) return status; } // for @@ -252,7 +248,6 @@ extern "C" { for (k = 0; k < contents.array[i].used; k++) { status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], values[j]); - if (F_status_is_error(status)) return status; } // for } // for -- 1.8.3.1