From: Kevin Day Date: Fri, 12 Mar 2021 04:52:23 +0000 (-0600) Subject: Cleanup: use 'print' instead of 'error' for variable name. X-Git-Tag: 0.5.3~97 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=3a4505e1dd6d73584ab38f3642968c55dcf9512d;p=fll Cleanup: use 'print' instead of 'error' for variable name. --- diff --git a/level_2/fll_error/c/error.c b/level_2/fll_error/c/error.c index 6a7c959..a7adfda 100644 --- a/level_2/fll_error/c/error.c +++ b/level_2/fll_error/c/error.c @@ -6,13 +6,13 @@ extern "C" { #endif #ifndef _di_fll_error_print_ - f_status_t fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback) { - return private_fll_error_print(error, status, function, fallback); + f_status_t fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) { + return private_fll_error_print(print, status, function, fallback); } #endif // _di_fll_error_print_ #ifndef _di_fll_error_file_print_ - f_status_t fll_error_file_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type) { + f_status_t fll_error_file_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type) { const char *type_name = fll_error_file_type_string_file; if (type == fll_error_file_type_directory) { @@ -23,193 +23,193 @@ extern "C" { } if (status == F_access_denied) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sAccess denied while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sAccess denied while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_access_group) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sCurrent user is not allowed to use the given group while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sCurrent user is not allowed to use the given group while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_access_owner) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sCurrent user is not allowed to use the given owner while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sCurrent user is not allowed to use the given owner while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_directory) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid directory while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid directory while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_directory_empty_not) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s' is not empty.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s' is not empty.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_file_closed) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s' is not open.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s' is not open.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_file_found) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s' already exists.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s' already exists.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_file_found_not) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sFailed to find %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sFailed to find %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_file_open) { - fprintf(error.to.stream, "%s%sUnable to open the %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sUnable to open the %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); return F_false; } if (status == F_file_descriptor) { - fprintf(error.to.stream, "%s%sFile descriptor error while trying to open the %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sFile descriptor print while trying to open the %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%c", f_string_eol_s[0]); return F_false; } if (status == F_number_underflow) { - fprintf(error.to.stream, "%s%sInteger underflow while trying to buffer the %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInteger underflow while trying to buffer the %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); return F_false; } if (status == F_file_read) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sA read error occurred while accessing the %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sA read print occurred while accessing the %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_file_seek) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sA seek error occurred while accessing the %s '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sA seek print occurred while accessing the %s '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_loop) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sLoop while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sLoop while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_name) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid %s name '", error.context.before->string, error.prefix, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid %s name '", print.context.before->string, print.prefix, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_number_overflow) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sOverflow while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sOverflow while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_parameter) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid parameter", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid parameter", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, " for the %s '", type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, " for the %s '", type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_prohibited) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sProhibited by system while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sProhibited by system while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; @@ -217,11 +217,11 @@ extern "C" { if (type == fll_error_file_type_file) { if (status == F_file_type_not_directory) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid or missing directory in path while trying to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid or missing directory in path while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; @@ -230,11 +230,11 @@ extern "C" { if (type == fll_error_file_type_file || type == fll_error_file_type_directory) { if (status == F_directory_found_not) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s' due to an invalid directory in the path.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sFailed to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s' due to an invalid directory in the path.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; @@ -242,11 +242,11 @@ extern "C" { if (type == fll_error_file_type_directory) { if (status == F_failure) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix, operation, type_name); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sFailed to %s %s '", print.context.before->string, print.prefix, operation, type_name); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; @@ -254,90 +254,90 @@ extern "C" { } } - return private_fll_error_print(error, status, function, fallback); + return private_fll_error_print(print, status, function, fallback); } #endif // _di_fll_error_file_print_ #ifndef _di_fll_error_parameter_integer_print_ - f_status_t fll_error_parameter_integer_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument) { + f_status_t fll_error_parameter_integer_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument) { if (status == F_data_not) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe argument for the parameter '", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); - fprintf(error.to.stream, "%s' must not be an empty string.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe argument for the parameter '", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); + fprintf(print.to.stream, "%s' must not be an empty string.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_number) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); - fprintf(error.to.stream, "%s' is not a valid number for the parameter '", error.context.before->string); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); + fprintf(print.to.stream, "%s' is not a valid number for the parameter '", print.context.before->string); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_number_negative) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); - fprintf(error.to.stream, "%s' is negative, which is not allowed for the parameter '", error.context.before->string); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); + fprintf(print.to.stream, "%s' is negative, which is not allowed for the parameter '", print.context.before->string); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_number_overflow) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); - fprintf(error.to.stream, "%s' is too large for the parameter '", error.context.before->string); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); + fprintf(print.to.stream, "%s' is too large for the parameter '", print.context.before->string); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_number_positive) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); - fprintf(error.to.stream, "%s' is positive, which is not allowed for the parameter '", error.context.before->string); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); + fprintf(print.to.stream, "%s' is positive, which is not allowed for the parameter '", print.context.before->string); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_number_underflow) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); - fprintf(error.to.stream, "%s' is too small for the parameter '", error.context.before->string); - fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); - fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); + fprintf(print.to.stream, "%s' is too small for the parameter '", print.context.before->string); + fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } return F_false; } - return private_fll_error_print(error, status, function, fallback); + return private_fll_error_print(print, status, function, fallback); } #endif // _di_fll_error_parameter_integer_print_ diff --git a/level_2/fll_error/c/error.h b/level_2/fll_error/c/error.h index 8674fe6..35156c3 100644 --- a/level_2/fll_error/c/error.h +++ b/level_2/fll_error/c/error.h @@ -52,7 +52,7 @@ extern "C" { * F_true is returned if the status code is unknown. */ #ifndef _di_fll_error_print_ - extern f_status_t fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback); + extern f_status_t fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback); #endif // _di_fll_error_print_ /** @@ -80,7 +80,7 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fll_error_file_print_ - extern f_status_t fll_error_file_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type); + extern f_status_t fll_error_file_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type); #endif // _di_fll_error_file_print_ /** @@ -106,7 +106,7 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fll_error_parameter_integer_print_ - extern f_status_t fll_error_parameter_integer_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument); + extern f_status_t fll_error_parameter_integer_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument); #endif // _di_fll_error_parameter_integer_print_ #ifdef __cplusplus diff --git a/level_2/fll_error/c/private-error.c b/level_2/fll_error/c/private-error.c index bbd4fb9..47be928 100644 --- a/level_2/fll_error/c/private-error.c +++ b/level_2/fll_error/c/private-error.c @@ -6,122 +6,122 @@ extern "C" { #endif #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - f_status_t private_fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback) { + f_status_t private_fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) { if (status == F_access_denied) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sAccess denied", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sAccess denied", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_array_too_large) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sMaximum array length reached", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sMaximum array length reached", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_buffer_too_large) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sMaximum buffer length reached", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sMaximum buffer length reached", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_memory_not) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sUnable to allocate memory", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sUnable to allocate memory", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_parameter) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid parameter", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid parameter", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_string_too_large) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sMaximum string length reached", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sMaximum string length reached", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_utf) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid UTF-8 character", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid UTF-8 character", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } if (status == F_complete_not_utf) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%sInvalid (incomplete) UTF-8 character", error.context.before->string, error.prefix); + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%sInvalid (incomplete) UTF-8 character", print.context.before->string, print.prefix); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } return F_false; } - if (fallback && error.verbosity != f_console_verbosity_quiet) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol_s[0]); - fprintf(error.to.stream, "%s%s(", error.context.before->string, error.prefix); - fprintf(error.to.stream, "%s%s%llu%s", error.context.after->string, error.notable.before->string, status, error.notable.after->string); - fprintf(error.to.stream, "%s)", error.context.before->string); + if (fallback && print.verbosity != f_console_verbosity_quiet) { + if (print.verbosity != f_console_verbosity_quiet) { + fprintf(print.to.stream, "%c", f_string_eol_s[0]); + fprintf(print.to.stream, "%s%s(", print.context.before->string, print.prefix); + fprintf(print.to.stream, "%s%s%llu%s", print.context.after->string, print.notable.before->string, status, print.notable.after->string); + fprintf(print.to.stream, "%s)", print.context.before->string); - private_fll_error_print_function(error, function); + private_fll_error_print_function(print, function); - fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol_s[0]); + fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); } } @@ -130,12 +130,12 @@ extern "C" { #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - void private_fll_error_print_function(const fll_error_print_t error, const f_string_t function) { + void private_fll_error_print_function(const fll_error_print_t print, const f_string_t function) { if (function) { - fprintf(error.to.stream, " when calling function %s", error.context.after->string); - fprintf(error.to.stream, "%s%s%s", error.notable.before->string, function, error.notable.after->string); - fprintf(error.to.stream, "%s()", error.context.before->string); + fprintf(print.to.stream, " when calling function %s", print.context.after->string); + fprintf(print.to.stream, "%s%s%s", print.notable.before->string, function, print.notable.after->string); + fprintf(print.to.stream, "%s()", print.context.before->string); } } #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) diff --git a/level_2/fll_error/c/private-error.h b/level_2/fll_error/c/private-error.h index 7fcd4d5..91f588e 100644 --- a/level_2/fll_error/c/private-error.h +++ b/level_2/fll_error/c/private-error.h @@ -39,7 +39,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - extern f_status_t private_fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal; + extern f_status_t private_fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) /** @@ -61,7 +61,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - void private_fll_error_print_function(const fll_error_print_t error, const f_string_t function) f_gcc_attribute_visibility_internal; + void private_fll_error_print_function(const fll_error_print_t print, const f_string_t function) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) #ifdef __cplusplus