This provides some centralization to the static strings to a single global array.
This uses an enumeration similar to the way the function strings in the programs are handled.
This enumeration does come with a cost.
However, adding all the strings together in a single location should have some technical benefits.
build_libraries-level -lfll_1 -lfll_0
build_sources_library control_group.c
-build_sources_library error.c private-error.c error/common.c
+build_sources_library error.c private-error.c error/common.c error/string.c
build_sources_library execute.c private-execute.c
build_sources_library file.c private-file.c
build_sources_library fss.c fss/basic.c fss/basic_list.c fss/embedded_list.c fss/extended.c fss/extended_list.c fss/payload.c
build_sources_library program.c program/common.c program/print.c private-program.c
build_sources_headers control_group.h
-build_sources_headers error.h error/common.h
+build_sources_headers error.h error/common.h error/string.h
build_sources_headers execute.h
build_sources_headers file.h
build_sources_headers fss.h fss/basic.h fss/basic_list.h fss/embedded_list.h fss/extended.h fss/extended_list.h fss/payload.h
build_sources_library level_1/utf_file.c level_1/private-utf_file.c
build_sources_library level_2/control_group.c
-build_sources_library level_2/error.c level_2/error/common.c level_2/private-error.c
+build_sources_library level_2/error.c level_2/error/common.c level_2/error/string.c level_2/private-error.c
build_sources_library level_2/execute.c level_2/private-execute.c
build_sources_library level_2/file.c level_2/private-file.c
build_sources_library level_2/fss.c level_2/fss/basic.c level_2/fss/basic_list.c level_2/fss/embedded_list.c level_2/fss/extended.c level_2/fss/extended_list.c level_2/fss/payload.c
build_sources_headers level_1/utf_file.h
build_sources_headers level_2/control_group.h
-build_sources_headers level_2/error.h level_2/error/common.h
+build_sources_headers level_2/error.h level_2/error/common.h level_2/error/string.h
build_sources_headers level_2/execute.h
build_sources_headers level_2/file.h
build_sources_headers level_2/fss.h level_2/fss/basic.h level_2/fss/basic_list.h level_2/fss/embedded_list.h level_2/fss/extended.h level_2/fss/extended_list.h level_2/fss/payload.h
#define _di_f_string_format_SS_single_s_
#define _di_f_string_format_S_double_s_
#define _di_f_string_format_S_s_
-#define _di_f_string_format_S_single_s_
+//#define _di_f_string_format_S_single_s_
#define _di_f_string_format_UII_s_
#define _di_f_string_format_UI_s_
#define _di_f_string_format_ULL_s_
build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
-build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c
+build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c fll/level_2/error/string.c
build_sources_program fll/level_2/print.c
build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/program/print.c fll/level_2/private-program.c
#define _di_f_string_format_SS_single_s_
#define _di_f_string_format_S_double_s_
#define _di_f_string_format_S_s_
-#define _di_f_string_format_S_single_s_
+//#define _di_f_string_format_S_single_s_
#define _di_f_string_format_UII_s_
#define _di_f_string_format_UI_s_
#define _di_f_string_format_ULL_s_
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
-build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c
+build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c fll/level_2/error/string.c
build_sources_program fll/level_2/print.c
build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/program/print.c fll/level_2/private-program.c
build_sources_documentation man
-build_sources_setting network
-
build_script yes
build_shared yes
build_static no
#define _di_f_string_format_SS_single_s_
#define _di_f_string_format_S_double_s_
#define _di_f_string_format_S_s_
-#define _di_f_string_format_S_single_s_
+//#define _di_f_string_format_S_single_s_
#define _di_f_string_format_UII_s_
#define _di_f_string_format_UI_s_
#define _di_f_string_format_ULL_s_
build_sources_program fll/level_1/path.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
-build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c
+build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c fll/level_2/error/string.c
build_sources_program fll/level_2/execute.c fll/level_2/private-execute.c
build_sources_program fll/level_2/file.c fll/level_2/private-file.c
build_sources_program fll/level_2/fss.c fll/level_2/fss/basic.c fll/level_2/fss/basic_list.c fll/level_2/fss/embedded_list.c fll/level_2/fss/extended.c fll/level_2/fss/extended_list.c fll/level_2/fss/payload.c
build_sources_program fll/level_1/private-fss.c fll/level_1/private-fss-list.c fll/level_1/fss/basic.c fll/level_1/fss/basic_list.c fll/level_1/fss/embedded_list.c fll/level_1/fss/extended.c fll/level_1/fss/extended_list.c fll/level_1/fss/payload.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
-build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c
+build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c fll/level_2/error/string.c
build_sources_program fll/level_2/execute.c fll/level_2/private-execute.c
build_sources_program fll/level_2/fss.c fll/level_2/fss/basic.c fll/level_2/fss/basic_list.c fll/level_2/fss/embedded_list.c fll/level_2/fss/extended.c fll/level_2/fss/extended_list.c fll/level_2/fss/payload.c
build_sources_program fll/level_2/print.c
#define _di_f_string_format_SS_single_s_
#define _di_f_string_format_S_double_s_
#define _di_f_string_format_S_s_
-#define _di_f_string_format_S_single_s_
+//#define _di_f_string_format_S_single_s_
#define _di_f_string_format_UII_s_
#define _di_f_string_format_UI_s_
#define _di_f_string_format_ULL_s_
build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c
build_sources_program fll/level_1/print.c fll/level_1/private-print.c fll/level_1/print/common.c
-build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c
+build_sources_program fll/level_2/error.c fll/level_2/private-error.c fll/level_2/error/common.c fll/level_2/error/string.c
build_sources_program fll/level_2/print.c
build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/program/print.c fll/level_2/private-program.c
: fll_error_file_type_file_s;
if (status == F_access_denied) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QAccess denied while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(024_access_denied_while));
}
if (status == F_access_group) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QCurrent user is not allowed to use the given group while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(025_user_not_allowed_group));
}
if (status == F_access_owner) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QCurrent user is not allowed to use the given owner while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(026_user_not_allowed_owner));
}
if (status == F_directory || status == F_directory_not) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QInvalid directory while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(027_invalid_dir_while));
}
if (status == F_error) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q '%]", "%[', already in an error state.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(028_failed_to), macro_fll_error_s(029_already_in_error));
}
if (status == F_failure) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(028_failed_to));
}
if (status == F_file_close) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', failed to close.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(030_failed_close));
}
if (status == F_file_closed) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', is closed.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(031_is_closed));
}
if (status == F_file_descriptor) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QFile descriptor error while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(032_descriptor_error_while));
}
if (status == F_file_descriptor_max) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QMax file descriptors reached while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(033_descriptor_max_while));
}
if (status == F_file_descriptor_not) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QInvalid file descriptor while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(034_descriptor_invalid_while));
}
if (status == F_directory_empty || status == F_file_empty) {
- return private_fll_error_file_print_before_after_one(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', %Q is empty.%]%r", type_name);
+ return private_fll_error_file_print_before_after_one(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(035_is_empty), type_name);
}
if (status == F_directory_empty_not || status == F_file_empty_not) {
- return private_fll_error_file_print_before_after_one(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', %Q is not empty.%]%r", type_name);
+ return private_fll_error_file_print_before_after_one(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(036_is_empty_not), type_name);
}
if (status == F_file_flush) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', flush failed.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(037_flush_failed));
}
if (status == F_file_found) {
- return private_fll_error_file_print_before_after_one(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', found existing %Q.%]%r", type_name);
+ return private_fll_error_file_print_before_after_one(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(038_found_existing), type_name);
}
if (status == F_file_found_not) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', could not find.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(039_could_not_find));
}
if (status == F_file_open) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', already open.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(040_already_open));
}
if (status == F_file_open_max) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QMax open files reached while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(041_max_open_while));
}
if (status == F_file_overflow) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QOverflow while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(042_overflow_while));
}
if (status == F_file_purge) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', purge failed.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(043_purge_failed));
}
if (status == F_file_read) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QRead failed while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(044_read_failed_while));
}
if (status == F_file_seek) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QSeek failed while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(045_seek_failed_while));
}
if (status == F_file_stat) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QStat failed while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(046_stat_failed_while));
}
if (status == F_file_synchronize) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QSynchronize failed while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(047_synchronize_failed_while));
}
if (status == F_file_type_unknown) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q, the path '%]", "%[' is an unknown file type.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(049_fail_to_path), macro_fll_error_s(048_unknown_file_type));
}
if (status == F_file_utf) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QUTF failure while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(050_utf_fail_while));
}
if (status == F_file_utf_not) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QInvalid UTF while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(051_invalid_utf_while));
}
if (status == F_file_underflow) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QUnderflow while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(052_underflow_while));
}
if (status == F_file_write) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q '%]", "%[', write failure.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(028_failed_to), macro_fll_error_s(053_write_failure));
}
if (status == F_loop) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QLoop while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(054_loop_while));
}
if (status == F_name) {
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QInvalid %Q name '%]", print->to, print->context, print->prefix, type_name, print->context);
+ fl_print_format(macro_fll_error_s(055_invalid_name), print->to, print->context, print->prefix, type_name, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
}
if (status == F_number_overflow) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QNumber overflow while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(056_number_overflow_while));
}
if (status == F_number_underflow) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QNumber underflow while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(057_number_underflow_while));
}
if (status == F_parameter) {
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QInvalid parameter", print->to, print->context, print->prefix);
+ fl_print_format(macro_fll_error_s(006_invalid_parameter), print->to, print->context, print->prefix);
private_fll_error_print_function(print, function);
- fl_print_format(" for the %Q '%]", print->to, type_name, print->context);
+ fl_print_format(macro_fll_error_s(058_for_the), print->to, type_name, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
}
if (status == F_prohibited) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QProhibited by system while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(059_prohibited_system_while));
}
if (status == F_read_only) {
- return private_fll_error_file_print_before_after_one(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', %Q is read only.%]%r", type_name);
+ return private_fll_error_file_print_before_after_one(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(060_read_only), type_name);
}
if (status == F_write_only) {
- private_fll_error_print_unable_to(print, operation, name, type_name, "is write only");
+ private_fll_error_print_unable_to(print, operation, name, type_name, macro_fll_error_s(061_write_only));
- return private_fll_error_file_print_before_after_one(print, name, operation, type_name, "%[%QUnable to %Q %Q '%]", "%[', %Q is write only.%]%r", type_name);
+ return private_fll_error_file_print_before_after_one(print, name, operation, type_name, macro_fll_error_s(022_unable_to), macro_fll_error_s(062_Q_write_only), type_name);
}
if (type == fll_error_file_type_file_e) {
if (status == F_file_type_not_directory) {
- return private_fll_error_file_print_simple(print, name, operation, type_name, "%[%QInvalid or missing directory in path while trying to %Q %Q '%]");
+ return private_fll_error_file_print_simple(print, name, operation, type_name, macro_fll_error_s(063_invalid_dir_path_while));
}
if (status == F_file_type_directory) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q, the path '%]", "%[' is a directory.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(049_fail_to_path), macro_fll_error_s(064_is_directory));
}
}
else if (type == fll_error_file_type_directory_e) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q, the path '%]", "%[' is a file.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(049_fail_to_path), macro_fll_error_s(065_is_file));
}
if (type == fll_error_file_type_file_e || type == fll_error_file_type_directory_e || type == fll_error_file_type_path_e) {
if (status == F_directory_found_not) {
- return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, "%[%QFailed to %Q %Q '%]", "%[' due to an invalid directory in the path.%]%r");
+ return private_fll_error_file_print_before_after_simple(print, name, operation, type_name, macro_fll_error_s(028_failed_to), macro_fll_error_s(066_invalid_dir_path));
}
if (status == F_file_type_pipe || status == F_file_type_socket) {
- return private_fll_error_file_print_before_after_one(print, name, operation, type_name, "%[%QFailed to %Q %Q, the path '%]", "%[' is a %Q.%]%r", status == F_file_type_pipe ? fll_error_file_type_pipe_s : fll_error_file_type_socket_s);
+ return private_fll_error_file_print_before_after_one(print, name, operation, type_name, macro_fll_error_s(049_fail_to_path), macro_fll_error_s(067_is_a_Q), status == F_file_type_pipe ? fll_error_file_type_pipe_s : fll_error_file_type_socket_s);
}
}
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QThe argument for the parameter '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(068_argument_for_parameter), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
- fl_print_format("%[' must not be an empty string.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(069_must_not_empty), print->to, print->context, print->context, f_string_eol_s);
funlockfile(print->to.stream);
}
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(070_argument), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, argument, print->notable);
- fl_print_format("%[' is not a valid number for the parameter '%]", print->to, print->context, print->context);
+ fl_print_format(macro_fll_error_s(071_not_valid_number_parameter), print->to, print->context, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(070_argument), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, argument, print->notable);
- fl_print_format("%[' is negative, which is not allowed for the parameter '%]", print->to, print->context, print->context);
+ fl_print_format(macro_fll_error_s(072_negative_not_allowed), print->to, print->context, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(070_argument), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, argument, print->notable);
- fl_print_format("%[' is too large for the parameter '%]", print->to, print->context, print->context);
+ fl_print_format(macro_fll_error_s(073_too_large_for_parameter), print->to, print->context, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(070_argument), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, argument, print->notable);
- fl_print_format("%[' is positive, which is not allowed for the parameter '%]", print->to, print->context, print->context);
+ fl_print_format(macro_fll_error_s(074_positive_not_allowed), print->to, print->context, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(070_argument), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, argument, print->notable);
- fl_print_format("%[' is too small for the parameter '%]", print->to, print->context, print->context);
+ fl_print_format(macro_fll_error_s(075_too_small_for_parameter), print->to, print->context, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, parameter, print->notable);
fl_print_format(f_string_format_sentence_end_single_quote_s.string, print->to, print->context, print->context, f_string_eol_s);
// FLL-2 error includes.
#include <fll/level_2/error/common.h>
+#include <fll/level_2/error/string.h>
#ifdef __cplusplus
extern "C" {
--- /dev/null
+#include "../error.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fll_error_s_a_
+ const f_string_t fll_error_s_a[] = {
+ "%[%QAccess denied",
+ "%[%QMaximum array length reached",
+ "%[%QMaximum buffer length reached",
+ "%[%QAn error has occurred",
+ "%[%QFile not found",
+ "%[%QMemory problem",
+ "%[%QUnable to allocate memory",
+ "%[%QInvalid parameter",
+ "%[%QMaximum string length reached",
+ "%[%QInvalid UTF-8 character found",
+ "%[%QUTF-8 character (fragment) found",
+ "%[%QInvalid (incomplete) UTF-8 character found",
+ " at the end of string.%]%r",
+ " at the stop point of string.%]%r",
+ ".%]%r",
+ "%[%QFailure",
+ "%[%QSignal received",
+ "%[%QInterrupt signal received",
+ "%[%Q(%]",
+ "%[%ui%]%[)",
+ " when calling function%] ",
+ "%[()",
+ ", ",
+ "%[%QUnable to %Q %Q '%]",
+ "%['%S%S.%]%r",
+ "%[%QAccess denied while trying to %Q %Q '%]",
+ "%[%QCurrent user is not allowed to use the given group while trying to %Q %Q '%]",
+ "%[%QCurrent user is not allowed to use the given owner while trying to %Q %Q '%]",
+ "%[%QInvalid directory while trying to %Q %Q '%]",
+ "%[%QFailed to %Q %Q '%]",
+ "%[', already in an error state.%]%r",
+ "%[', failed to close.%]%r",
+ "%[', is closed.%]%r",
+ "%[%QFile descriptor error while trying to %Q %Q '%]",
+ "%[%QMax file descriptors reached while trying to %Q %Q '%]",
+ "%[%QInvalid file descriptor while trying to %Q %Q '%]",
+ "%[', %Q is empty.%]%r",
+ "%[', %Q is not empty.%]%r",
+ "%[', flush failed.%]%r",
+ "%[', found existing %Q.%]%r",
+ "%[', could not find.%]%r",
+ "%[', already open.%]%r",
+ "%[%QMax open files reached while trying to %Q %Q '%]",
+ "%[%QOverflow while trying to %Q %Q '%]",
+ "%[', purge failed.%]%r",
+ "%[%QRead failed while trying to %Q %Q '%]",
+ "%[%QSeek failed while trying to %Q %Q '%]",
+ "%[%QStat failed while trying to %Q %Q '%]",
+ "%[%QSynchronize failed while trying to %Q %Q '%]",
+ "%[' is an unknown file type.%]%r",
+ "%[%QFailed to %Q %Q, the path '%]",
+ "%[%QUTF failure while trying to %Q %Q '%]",
+ "%[%QInvalid UTF while trying to %Q %Q '%]",
+ "%[%QUnderflow while trying to %Q %Q '%]",
+ "%[', write failure.%]%r",
+ "%[%QLoop while trying to %Q %Q '%]",
+ "%[%QInvalid %Q name '%]",
+ "%[%QNumber overflow while trying to %Q %Q '%]",
+ "%[%QNumber underflow while trying to %Q %Q '%]",
+ " for the %Q '%]",
+ "%[%QProhibited by system while trying to %Q %Q '%]",
+ "%[', %Q is read only.%]%r",
+ "is write only",
+ "%[', %Q is write only.%]%r",
+ "%[%QInvalid or missing directory in path while trying to %Q %Q '%]",
+ "%[' is a directory.%]%r",
+ "%[' is a file.%]%r",
+ "%[' due to an invalid directory in the path.%]%r",
+ "%[' is a %Q.%]%r",
+ "%[%QThe argument for the parameter '%]",
+ "%[' must not be an empty string.%]%r",
+ "%[%QThe argument '%]",
+ "%[' is not a valid number for the parameter '%]",
+ "%[' is negative, which is not allowed for the parameter '%]",
+ "%[' is too large for the parameter '%]",
+ "%[' is positive, which is not allowed for the parameter '%]",
+ "%[' is too small for the parameter '%]",
+ };
+#endif // _di_fll_error_s_a_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 2
+ *
+ * Project: Error
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines string data to be used for/by project error.
+ *
+ * This is auto-included by error.h and should not need to be explicitly included.
+ */
+#ifndef _FLL_error_string_h
+#define _FLL_error_string_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * A special array of strings intended for centralizing hard-coded strings.
+ *
+ * The macro macro_fll_error_s() is used to reference the array index by the enum name.
+ *
+ * macro_fll_error_s():
+ * - name: The name of the function.
+ */
+#ifndef _di_fll_error_s_a_
+ extern const f_string_t fll_error_s_a[];
+
+ #define macro_fll_error_s(name) fll_error_s_a[fll_error_s_##name##_e]
+#endif // _di_fll_error_s_a_
+
+/**
+ * An enum representing specific indexes within the above array.
+ *
+ * This is a convenience enum used to make code slightly more readable.
+ */
+#ifndef _di_fll_error_s_e_
+ enum {
+ fll_error_s_000_access_denied_e,
+ fll_error_s_001_max_arr_length_e,
+ fll_error_s_002_max_buf_length_e,
+ fll_error_s_003_error_occurred_e,
+ fll_error_s_004_file_not_found_e,
+ fll_error_s_005_memory_problem_e,
+ fll_error_s_005_unable_allocate_e,
+ fll_error_s_006_invalid_parameter_e,
+ fll_error_s_007_max_str_length_e,
+ fll_error_s_008_invalid_utf8_char_e,
+ fll_error_s_009_utf8_char_fragment_e,
+ fll_error_s_010_invalid_utf8_char_e,
+ fll_error_s_011_end_of_str_e,
+ fll_error_s_012_stop_of_str_e,
+ fll_error_s_013_period_e,
+ fll_error_s_014_failure_e,
+ fll_error_s_015_signal_received_e,
+ fll_error_s_016_signal_interrupt_e,
+ fll_error_s_017_Q_e,
+ fll_error_s_018_ui_e,
+ fll_error_s_019_when_calling_e,
+ fll_error_s_020_parenthesis_e,
+ fll_error_s_021_comma_e,
+ fll_error_s_022_unable_to_e,
+ fll_error_s_023_SS_e,
+ fll_error_s_024_access_denied_while_e,
+ fll_error_s_025_user_not_allowed_group_e,
+ fll_error_s_026_user_not_allowed_owner_e,
+ fll_error_s_027_invalid_dir_while_e,
+ fll_error_s_028_failed_to_e,
+ fll_error_s_029_already_in_error_e,
+ fll_error_s_030_failed_close_e,
+ fll_error_s_031_is_closed_e,
+ fll_error_s_032_descriptor_error_while_e,
+ fll_error_s_033_descriptor_max_while_e,
+ fll_error_s_034_descriptor_invalid_while_e,
+ fll_error_s_035_is_empty_e,
+ fll_error_s_036_is_empty_not_e,
+ fll_error_s_037_flush_failed_e,
+ fll_error_s_038_found_existing_e,
+ fll_error_s_039_could_not_find_e,
+ fll_error_s_040_already_open_e,
+ fll_error_s_041_max_open_while_e,
+ fll_error_s_042_overflow_while_e,
+ fll_error_s_043_purge_failed_e,
+ fll_error_s_044_read_failed_while_e,
+ fll_error_s_045_seek_failed_while_e,
+ fll_error_s_046_stat_failed_while_e,
+ fll_error_s_047_synchronize_failed_while_e,
+ fll_error_s_048_unknown_file_type_e,
+ fll_error_s_049_fail_to_path_e,
+ fll_error_s_050_utf_fail_while_e,
+ fll_error_s_051_invalid_utf_while_e,
+ fll_error_s_052_underflow_while_e,
+ fll_error_s_053_write_failure_e,
+ fll_error_s_054_loop_while_e,
+ fll_error_s_055_invalid_name_e,
+ fll_error_s_056_number_overflow_while_e,
+ fll_error_s_057_number_underflow_while_e,
+ fll_error_s_058_for_the_e,
+ fll_error_s_059_prohibited_system_while_e,
+ fll_error_s_060_read_only_e,
+ fll_error_s_061_write_only_e,
+ fll_error_s_062_Q_write_only_e,
+ fll_error_s_063_invalid_dir_path_while_e,
+ fll_error_s_064_is_directory_e,
+ fll_error_s_065_is_file_e,
+ fll_error_s_066_invalid_dir_path_e,
+ fll_error_s_067_is_a_Q_e,
+ fll_error_s_068_argument_for_parameter_e,
+ fll_error_s_069_must_not_empty_e,
+ fll_error_s_070_argument_e,
+ fll_error_s_071_not_valid_number_parameter_e,
+ fll_error_s_072_negative_not_allowed_e,
+ fll_error_s_073_too_large_for_parameter_e,
+ fll_error_s_074_positive_not_allowed_e,
+ fll_error_s_075_too_small_for_parameter_e,
+ }; // enum
+#endif // _di_fll_error_s_e_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FLL_error_string_h
f_status_t private_fll_error_print(fl_print_t * const print, const f_status_t status, const f_string_t function, const uint8_t flag) {
if (status == F_access_denied) {
- return private_fll_error_print_simple(print, function, "%[%QAccess denied");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(000_access_denied));
}
if (status == F_array_too_large) {
- return private_fll_error_print_simple(print, function, "%[%QMaximum array length reached");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(001_max_arr_length));
}
if (status == F_buffer_too_large) {
- return private_fll_error_print_simple(print, function, "%[%QMaximum buffer length reached");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(002_max_buf_length));
}
if (status == F_error) {
- return private_fll_error_print_simple(print, function, "%[%QAn error has occurred");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(003_error_occurred));
}
if (status == F_file_found_not) {
- return private_fll_error_print_simple(print, function, "%[%QFile not found");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(004_file_not_found));
}
if (status == F_memory) {
- return private_fll_error_print_simple(print, function, "%[%QMemory problem");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(005_memory_problem));
}
if (status == F_memory_not) {
- return private_fll_error_print_simple(print, function, "%[%QUnable to allocate memory");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(005_unable_allocate));
}
if (status == F_parameter) {
- return private_fll_error_print_simple(print, function, "%[%QInvalid parameter");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(006_invalid_parameter));
}
if (status == F_string_too_large) {
- return private_fll_error_print_simple(print, function, "%[%QMaximum string length reached");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(007_max_str_length));
}
if (status == F_utf_not) {
- return private_fll_error_print_simple(print, function, "%[%QInvalid UTF-8 character found");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(008_invalid_utf8_char));
}
if (status == F_utf_fragment) {
- return private_fll_error_print_simple(print, function, "%[%QUTF-8 character (fragment) found");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(009_utf8_char_fragment));
}
if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) {
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%QInvalid (incomplete) UTF-8 character found", print->to, print->context, print->prefix);
+ fl_print_format(macro_fll_error_s(010_invalid_utf8_char), print->to, print->context, print->prefix);
private_fll_error_print_function(print, function);
if (status == F_complete_not_utf_eos) {
- fl_print_format(" at the end of string.%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(011_end_of_str), print->to, print->context, f_string_eol_s);
}
else if (status == F_complete_not_utf_stop) {
- fl_print_format(" at the stop point of string.%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(012_stop_of_str), print->to, print->context, f_string_eol_s);
}
else {
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
}
funlockfile(print->to.stream);
}
if (status == F_failure) {
- return private_fll_error_print_simple(print, function, "%[%QFailure");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(014_failure));
}
if (status == F_signal) {
- return private_fll_error_print_simple(print, function, "%[%QSignal received");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(015_signal_received));
}
if (status == F_interrupt) {
- return private_fll_error_print_simple(print, function, "%[%QInterrupt signal received");
+ return private_fll_error_print_simple(print, function, macro_fll_error_s(016_signal_interrupt));
}
if ((flag & fll_error_file_flag_fallback_e) && print->verbosity != f_console_verbosity_quiet_e) {
if (print->verbosity != f_console_verbosity_quiet_e) {
flockfile(print->to.stream);
- fl_print_format("%[%Q(%]", print->to, print->context, print->prefix, print->context);
- fl_print_format("%[%ui%]%[)", print->to, print->notable, status, print->notable, print->context);
+ fl_print_format(macro_fll_error_s(017_Q), print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(018_ui), print->to, print->notable, status, print->notable, print->context);
private_fll_error_print_function(print, function);
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
funlockfile(print->to.stream);
}
void private_fll_error_print_function(fl_print_t * const print, const f_string_t function) {
if (function) {
- fl_print_format(" when calling function%] ", print->to, print->context);
- fl_print_format("%[%S%]", print->to, print->notable, function, print->notable);
- fl_print_format("%[()", print->to, print->context);
+ fl_print_format(macro_fll_error_s(019_when_calling), print->to, print->context);
+ fl_print_format(f_string_format_S_single_s.string, print->to, print->notable, function, print->notable);
+ fl_print_format(macro_fll_error_s(020_parenthesis), print->to, print->context);
}
}
#endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_)
private_fll_error_print_function(print, function);
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
funlockfile(print->to.stream);
}
flockfile(print->to.stream);
- fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type, print->context);
+ fl_print_format(macro_fll_error_s(022_unable_to), print->to, print->context, print->prefix, operation, type, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
- fl_print_format("%['%S%S.%]%r", print->to, print->context, message ? ", " : "", message ? message : "", print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(023_SS), print->to, print->context, message ? macro_fll_error_s(021_comma) : f_string_empty_s.string, message ? message : f_string_empty_s.string, print->context, f_string_eol_s);
funlockfile(print->to.stream);
}
build_libraries -lc
build_libraries-individual -lfl_print -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_print -lf_string -lf_type_array -lf_utf
-build_sources_library error.c private-error.c error/common.c
+build_sources_library error.c private-error.c error/common.c error/string.c
-build_sources_headers error.h error/common.h
+build_sources_headers error.h error/common.h error/string.h
build_script yes
build_shared yes
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
fake_print_error_build_operation_file_partial(print, operation, source, destination, how);
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
f_file_stream_unlock(print->to);
}
fake_print_error_build_operation_file_partial(print, operation, source, destination, how);
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
f_file_stream_unlock(print->to);
}
fake_print_error_build_operation_file_partial(print, operation, source, destination, how);
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
f_file_stream_unlock(print->to);
}
f_file_stream_lock(print->to);
- fl_print_format("%[%QThe argument '%]", print->to, print->context, print->prefix, print->context);
+ fl_print_format(macro_fll_error_s(070_argument), print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, argument, print->notable);
fl_print_format("%[' is not not valid and may only be one of either '%]", print->to, print->context, print->context);
fl_print_format(f_string_format_r_single_s.string, print->to, print->notable, fake_make_operation_argument_force_s, print->notable);
if (function) {
fl_print_format(" while calling%] %[%S%]", print->to, print->context, print->notable, function, print->notable);
- fl_print_format("%[()", print->to, print->context);
+ fl_print_format(macro_fll_error_s(020_parenthesis), print->to, print->context);
}
- fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ fl_print_format(macro_fll_error_s(013_period), print->to, print->context, f_string_eol_s);
f_file_stream_unlock(print->to);
}
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*
#endif
/**
- * A special array of strings intended for representing funciton names.
+ * A special array of strings intended for representing function names.
*
* These are primarily used for printing errors with the function names.
*