From: Kevin Day Date: Fri, 9 Oct 2020 00:15:35 +0000 (-0500) Subject: Bugfix: the color output is incorrect. X-Git-Tag: 0.5.1~39 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=99d15f707d10a346b5c84c348a426d779a7b1e91;p=fll Bugfix: the color output is incorrect. Fix the dependencies: - Remove dependency to fl_color. - Add f_color. - Add f_file. - Add f_print. --- diff --git a/level_2/fll_error/c/error.c b/level_2/fll_error/c/error.c index b3946d7..0580bef 100644 --- a/level_2/fll_error/c/error.c +++ b/level_2/fll_error/c/error.c @@ -27,7 +27,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sAccess denied while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -38,7 +38,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sCurrrent user is not allowed to use the given group while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -49,7 +49,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sCurrrent user is not allowed to use the given owner while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -60,7 +60,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sInvalid directory while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -71,7 +71,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix ? 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, "' is not empty.%s%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s' is not empty.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -82,7 +82,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix ? 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, "' is not open.%s%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s' is not open.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -93,7 +93,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix ? 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, "' already exists.%s%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s' already exists.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -104,35 +104,32 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sFailed to find %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_file_open) { - fl_color_print(error.to.stream, error.context, "%s%sUnable to open the file '", error.context.before->string, error.prefix ? error.prefix : ""); - fl_color_print(error.to.stream, error.notable, "%s", name); - fl_color_print(error.to.stream, error.context, "'."); - fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sUnable to open the file '", error.context.before->string, error.prefix ? error.prefix : ""); + 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[0]); return F_false; } if (status == F_file_descriptor) { - fl_color_print(error.to.stream, error.context, "%s%sFile descriptor error while trying to open the file '", error.context.before->string, error.prefix ? error.prefix : ""); - fl_color_print(error.to.stream, error.notable, "%s", name); - fl_color_print(error.to.stream, error.context, "'."); + fprintf(error.to.stream, "%s%sFile descriptor error while trying to open the file '", error.context.before->string, error.prefix ? error.prefix : ""); + 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[0]); return F_false; } if (status == F_number_underflow) { - fl_color_print(error.to.stream, error.context, "%s%sInteger underflow while trying to buffer the file '", error.context.before->string, error.prefix ? error.prefix : ""); - fl_color_print(error.to.stream, error.notable, "%s", name); - fl_color_print(error.to.stream, error.context, "'."); - fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sInteger underflow while trying to buffer the file '", error.context.before->string, error.prefix ? error.prefix : ""); + 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[0]); return F_false; } @@ -142,7 +139,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sA read error occurred while accessing the file '", error.context.before->string, error.prefix ? error.prefix : ""); 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -153,7 +150,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sA seek error occurred while accessing the file '", error.context.before->string, error.prefix ? error.prefix : ""); 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -164,7 +161,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sLoop while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -175,7 +172,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sInvalid %s name '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -186,7 +183,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sOverflow while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -201,7 +198,7 @@ extern "C" { 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -212,44 +209,35 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sProhibited by system while trying to %s %s '", error.context.before->string, error.prefix ? 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%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s'.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; } - if (type == fll_error_file_type_file) { + 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[0]); fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? 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, "' due to an invalid directory in the path.%s%c", error.context.after->string, f_string_eol[0]); + 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[0]); } return F_false; } - } - else if (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[0]); - fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? 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, "' due to an invalid directory in the path.%s%c", error.context.after->string, f_string_eol[0]); - } - return F_false; - } + 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[0]); + fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? 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[0]); + } - if (status == F_failure) { - if (error.verbosity != f_console_verbosity_quiet) { - fprintf(error.to.stream, "%c", f_string_eol[0]); - fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? 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); + return F_false; } - - return F_false; } } @@ -265,7 +253,7 @@ extern "C" { fprintf(error.to.stream, "%c", f_string_eol[0]); fprintf(error.to.stream, "%s%sThe argument for the parameter '", error.context.before->string, error.prefix ? 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, "' must not be an empty string.%s%c", error.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, "%s' must not be an empty string.%s%c", error.context.before->string, error.context.after->string, f_string_eol[0]); } return F_false; @@ -276,9 +264,9 @@ extern "C" { fprintf(error.to.stream, "%c", argument[0]); fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? 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, "' is not a valid number for the parameter '"); - 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%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); + 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[0]); } return F_false; @@ -289,9 +277,9 @@ extern "C" { fprintf(error.to.stream, "%c", argument[0]); fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? 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, "' is negative, which is not allowed for the parameter '"); - 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%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); + 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[0]); } return F_false; @@ -302,9 +290,9 @@ extern "C" { fprintf(error.to.stream, "%c", argument[0]); fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? 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, "' is too large for the parameter '"); - 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%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); + 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[0]); } return F_false; @@ -315,9 +303,9 @@ extern "C" { fprintf(error.to.stream, "%c", argument[0]); fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? 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, "' is positive, which is not allowed for the parameter '"); - 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%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); + 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[0]); } return F_false; @@ -328,9 +316,9 @@ extern "C" { fprintf(error.to.stream, "%c", argument[0]); fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? 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, "' is too small for the parameter '"); - 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%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); + 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[0]); } return F_false; diff --git a/level_2/fll_error/c/error.h b/level_2/fll_error/c/error.h index 4848e57..94fdd34 100644 --- a/level_2/fll_error/c/error.h +++ b/level_2/fll_error/c/error.h @@ -20,9 +20,10 @@ #include #include #include +#include +#include // fll-1 includes -#include #include // fll-2 error includes diff --git a/level_2/fll_error/c/private-error.c b/level_2/fll_error/c/private-error.c index e8c7296..b5d1087 100644 --- a/level_2/fll_error/c/private-error.c +++ b/level_2/fll_error/c/private-error.c @@ -76,7 +76,9 @@ extern "C" { if (fallback && error.verbosity != f_console_verbosity_quiet) { if (error.verbosity != f_console_verbosity_quiet) { fprintf(error.to.stream, "%c", f_string_eol[0]); - fprintf(error.to.stream, "%s%s(%llu)", error.context.before->string, error.prefix ? error.prefix : "", status); + fprintf(error.to.stream, "%s%s(", error.context.before->string, error.prefix ? 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); private_fll_error_print_function(error, function); diff --git a/level_2/fll_error/data/build/dependencies b/level_2/fll_error/data/build/dependencies index 6518702..17636a8 100644 --- a/level_2/fll_error/data/build/dependencies +++ b/level_2/fll_error/data/build/dependencies @@ -5,6 +5,8 @@ f_status f_memory f_string f_utf +f_color f_console -fl_color +f_file +f_print fl_string diff --git a/level_2/fll_error/data/build/settings b/level_2/fll_error/data/build/settings index c71ae99..f3a4c93 100644 --- a/level_2/fll_error/data/build/settings +++ b/level_2/fll_error/data/build/settings @@ -19,7 +19,7 @@ build_compiler gcc build_indexer ar build_language c build_libraries -lc -build_libraries-individual -lfl_string -lfl_color -lf_print -lf_file -lf_console -lf_utf -lf_memory +build_libraries-individual -lfl_string -lf_color -lf_print -lf_file -lf_console -lf_utf -lf_memory build_sources_library error.c private-error.c build_sources_program build_sources_headers error.h error-common.h