This should make the applications make a little more sense.
That is, when testing for not-error codes, it makes more sense to say not-error return codes than to say not-error error codes.
+++ /dev/null
-/* FLL - Level 3
- * Project: FSS
- * Version: 0.3.x
- * Licenses: lgplv2.1
- * Programmers: Kevin Day
- * Documentation:
- *
- * This program provides error code to string translation.
- */
-#ifndef _error_code_h
-
-// libc includes
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-// fll-0 includes
-#include <level_0/types.h>
-#include <level_0/strings.h>
-#include <level_0/console.h>
-#include <level_0/output.h>
-#include <level_0/pipe.h>
-
-// fll-1 includes
-#include <level_1/colors.h>
-#include <level_1/console.h>
-#include <level_1/strings.h>
-#include <level_1/errors.h>
-
-// fll-2 includes
-#include <level_2/colors.h>
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-#ifndef _di_error_code_version_
- #define error_code_major_version "0"
- #define error_code_minor_version "3"
- #define error_code_micro_version "0"
- #define error_code_version error_code_major_version "." error_code_minor_version "." error_code_micro_version
-#endif // _di_error_code_version_
-
-#ifndef _di_error_code_name_
- #define error_code_name "error_code"
- #define error_code_name_long "Error Code"
-#endif // _di_error_code_name_
-
-#ifndef _di_error_code_defines_
- #define error_code_short_is_okay "o"
- #define error_code_short_is_warning "w"
- #define error_code_short_is_error "e"
-
- #define error_code_long_is_okay "is_okay"
- #define error_code_long_is_warning "is_warning"
- #define error_code_long_is_error "is_error"
-
- enum {
- error_code_parameter_help,
- error_code_parameter_light,
- error_code_parameter_no_color,
- error_code_parameter_version,
-
- error_code_parameter_is_okay,
- error_code_parameter_is_warning,
- error_code_parameter_is_error,
- };
-
- #define f_console_parameter_initialize_error_code \
- { \
- f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
- f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
- f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(error_code_short_is_okay, error_code_long_is_okay, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(error_code_short_is_warning, error_code_long_is_warning, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(error_code_short_is_error, error_code_long_is_error, 0, 0, f_false, f_console_type_normal, 0), \
- }
-
- #define error_code_total_parameters 7
-#endif // _di_error_code_defines_
-
-#ifndef _di_error_code_data_
- typedef struct {
- f_console_parameter parameters[error_code_total_parameters];
-
- f_string_lengths remaining;
- f_bool process_pipe;
-
- fll_color_context context;
- } error_code_data;
-
- #define error_code_data_initialize \
- { \
- f_console_parameter_initialize_error_code, \
- f_string_lengths_initialize, \
- f_false, \
- fll_color_context_initialize, \
- }
-#endif // _di_error_code_data_
-
-#ifndef _di_error_code_print_version_
- extern f_return_status error_code_print_version(const error_code_data data);
-#endif // _di_error_code_print_version_
-
-#ifndef _di_error_code_print_help_
- extern f_return_status error_code_print_help(const error_code_data data);
-#endif // _di_error_code_print_help_
-
-#ifndef _di_error_code_main_
- extern f_return_status error_code_main(const f_array_length argc, const f_string argv[], error_code_data *data);
-#endif // _di_error_code_main_
-
-#ifndef _di_error_code_delete_data_
- extern f_return_status error_code_delete_data(error_code_data *data);
-#endif // _di_error_code_delete_data_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _error_code_h
+++ /dev/null
-/* FLL - Level 3
- * Project: FSS
- * Version: 0.3.x
- * Licenses: lgplv2.1
- * Programmers: Kevin Day
- * Documentation:
- *
- * This program provides error code to string translation.
- */
-#ifndef _fss_error_code_h
-
-// libc includes
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-// fll-0 includes
-#include <level_0/types.h>
-#include <level_0/strings.h>
-#include <level_0/console.h>
-#include <level_0/output.h>
-#include <level_0/pipe.h>
-
-// fll-1 includes
-#include <level_1/colors.h>
-#include <level_1/console.h>
-#include <level_1/strings.h>
-#include <level_1/errors.h>
-
-// fll-2 includes
-#include <level_2/colors.h>
-#include <level_2/fss_errors.h>
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-#ifndef _di_fss_error_code_version_
- #define fss_error_code_major_version "0"
- #define fss_error_code_minor_version "3"
- #define fss_error_code_micro_version "0"
- #define fss_error_code_version fss_error_code_major_version "." fss_error_code_minor_version "." fss_error_code_micro_version
-#endif // _di_fss_error_code_version_
-
-#ifndef _di_fss_error_code_name_
- #define fss_error_code_name "fss_error_code"
- #define fss_error_code_name_long "FSS Error Code"
-#endif // _di_fss_error_code_name_
-
-#ifndef _di_fss_error_code_defines_
- #define fss_error_code_short_is_okay "o"
- #define fss_error_code_short_is_warning "w"
- #define fss_error_code_short_is_error "e"
-
- #define fss_error_code_long_is_okay "is_okay"
- #define fss_error_code_long_is_warning "is_warning"
- #define fss_error_code_long_is_error "is_error"
-
- enum {
- fss_error_code_parameter_help,
- fss_error_code_parameter_light,
- fss_error_code_parameter_no_color,
- fss_error_code_parameter_version,
-
- fss_error_code_parameter_is_okay,
- fss_error_code_parameter_is_warning,
- fss_error_code_parameter_is_error,
- };
-
- #define f_console_parameter_initialize_fss_error_code \
- { \
- f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
- f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
- f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(fss_error_code_short_is_okay, fss_error_code_long_is_okay, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(fss_error_code_short_is_warning, fss_error_code_long_is_warning, 0, 0, f_false, f_console_type_normal, 0), \
- f_console_parameter_initialize(fss_error_code_short_is_error, fss_error_code_long_is_error, 0, 0, f_false, f_console_type_normal, 0), \
- }
-
- #define fss_error_code_total_parameters 7
-#endif // _di_fss_error_code_defines_
-
-#ifndef _di_fss_error_code_data_
- typedef struct {
- f_console_parameter parameters[fss_error_code_total_parameters];
-
- f_string_lengths remaining;
- f_bool process_pipe;
-
- fll_color_context context;
- } fss_error_code_data;
-
- #define fss_error_code_data_initialize \
- { \
- f_console_parameter_initialize_fss_error_code, \
- f_string_lengths_initialize, \
- f_false, \
- fll_color_context_initialize, \
- }
-#endif // _di_fss_error_code_data_
-
-#ifndef _di_fss_error_code_print_version_
- extern f_return_status fss_error_code_print_version(const fss_error_code_data data);
-#endif // _di_fss_error_code_print_version_
-
-#ifndef _di_fss_error_code_print_help_
- extern f_return_status fss_error_code_print_help(const fss_error_code_data data);
-#endif // _di_fss_error_code_print_help_
-
-#ifndef _di_fss_error_code_main_
- extern f_return_status fss_error_code_main(const f_array_length argc, const f_string argv[], fss_error_code_data *data);
-#endif // _di_fss_error_code_main_
-
-#ifndef _di_fss_error_code_delete_data_
- extern f_return_status fss_error_code_delete_data(fss_error_code_data *data);
-#endif // _di_fss_error_code_delete_data_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _fss_error_code_h
+++ /dev/null
-#include <level_3/fss_error_code.h>
-
-int main(const f_array_length argc, const f_string argv[]){
- fss_error_code_data data = fss_error_code_data_initialize;
-
- /*
- if (f_pipe_exists()){
- data.process_pipe = f_true;
- }
- */
-
- return fss_error_code_main(argc, argv, &data);
-}
* Licenses: lgplv2.1
* Programmers: Kevin Day
*/
-#include <level_3/fss_error_code.h>
+#include <level_3/fss_return_code.h>
#ifdef __cplusplus
extern "C"{
#endif
// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_fss_error_code_print_version_
- f_return_status fss_error_code_print_version(const fss_error_code_data data){
- printf("%s\n", fss_error_code_version);
+#ifndef _di_fss_return_code_print_version_
+ f_return_status fss_return_code_print_version(const fss_return_code_data data){
+ printf("%s\n", fss_return_code_version);
return f_none;
}
-#endif // _fss_error_code_print_version_
+#endif // _fss_return_code_print_version_
-#ifndef _di_fss_error_code_print_help_
- f_return_status fss_error_code_print_help(const fss_error_code_data data){
+#ifndef _di_fss_return_code_print_help_
+ f_return_status fss_return_code_print_help(const fss_return_code_data data){
printf("\n");
- fl_print_color(f_standard_output, data.context.title, data.context.reset, " %s", fss_error_code_name_long);
+ fl_print_color(f_standard_output, data.context.title, data.context.reset, " %s", fss_return_code_name_long);
printf("\n");
- fl_print_color(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_error_code_version);
+ fl_print_color(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_return_code_version);
printf("\n\n");
printf("\n");
printf("\n %s", f_console_symbol_short_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_short_is_okay);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_short_is_okay);
printf(", %s", f_console_symbol_long_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_long_is_okay);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_long_is_okay);
printf(" Returns true if the error code is not an error.");
printf("\n %s", f_console_symbol_short_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_short_is_warning);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_short_is_warning);
printf(", %s", f_console_symbol_long_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_long_is_warning);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_long_is_warning);
printf(" Returns true if the error code is a warning.");
printf("\n %s", f_console_symbol_short_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_short_is_error);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_short_is_error);
printf(", %s", f_console_symbol_long_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_long_is_error);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_long_is_error);
printf(" Returns true if the error code is an error.");
fl_print_color(f_standard_output, data.context.important, data.context.reset, " Usage: ");
printf("\n ");
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_error_code_name);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_return_code_name);
printf(" ");
fl_print_color(f_standard_output, data.context.notable, data.context.reset, "[");
return f_none;
}
-#endif // _di_fss_error_code_print_help_
+#endif // _di_fss_return_code_print_help_
-#ifndef _di_fss_error_code_main_
- f_return_status fss_error_code_main(const f_array_length argc, const f_string argv[], fss_error_code_data *data){
+#ifndef _di_fss_return_code_main_
+ f_return_status fss_return_code_main(const f_array_length argc, const f_string argv[], fss_return_code_data *data){
f_status status = f_status_initialize;
f_status allocation_status = f_status_initialize;
- status = fl_process_parameters(argc, argv, data->parameters, fss_error_code_total_parameters, &data->remaining);
+ status = fl_process_parameters(argc, argv, data->parameters, fss_return_code_total_parameters, &data->remaining);
// load colors when not told to show no colors
- if (data->parameters[fss_error_code_parameter_no_color].result == f_console_result_none){
+ if (data->parameters[fss_return_code_parameter_no_color].result == f_console_result_none){
fll_new_color_context(allocation_status, data->context);
if (allocation_status == f_none){
- fll_colors_load_context(&data->context, data->parameters[fss_error_code_parameter_light].result == f_console_result_found);
+ fll_colors_load_context(&data->context, data->parameters[fss_return_code_parameter_light].result == f_console_result_found);
} else {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return allocation_status;
}
}
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", status);
}
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return status;
}
// execute parameter results
- if (data->parameters[fss_error_code_parameter_help].result == f_console_result_found){
- fss_error_code_print_help(*data);
- } else if (data->parameters[fss_error_code_parameter_version].result == f_console_result_found){
- fss_error_code_print_version(*data);
- } else if (data->parameters[fss_error_code_parameter_is_error].result == f_console_result_found && data->remaining.used > 0){
+ if (data->parameters[fss_return_code_parameter_help].result == f_console_result_found){
+ fss_return_code_print_help(*data);
+ } else if (data->parameters[fss_return_code_parameter_version].result == f_console_result_found){
+ fss_return_code_print_version(*data);
+ } else if (data->parameters[fss_return_code_parameter_is_error].result == f_console_result_found && data->remaining.used > 0){
f_array_length counter = f_array_length_initialize;
f_status code = f_status_initialize;
code = (f_status) atoll(argv[data->remaining.array[counter]]);
if (fll_fss_errors_is_error(code)){
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return f_true;
}
}
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return f_false;
- } else if (data->parameters[fss_error_code_parameter_is_warning].result == f_console_result_found && data->remaining.used > 0){
+ } else if (data->parameters[fss_return_code_parameter_is_warning].result == f_console_result_found && data->remaining.used > 0){
f_array_length counter = f_array_length_initialize;
f_status code = f_status_initialize;
code = (f_status) atoll(argv[data->remaining.array[counter]]);
if (fll_fss_errors_is_warning(code)){
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return f_true;
}
}
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return f_false;
- } else if (data->parameters[fss_error_code_parameter_is_okay].result == f_console_result_found && data->remaining.used > 0){
+ } else if (data->parameters[fss_return_code_parameter_is_okay].result == f_console_result_found && data->remaining.used > 0){
f_array_length counter = f_array_length_initialize;
f_status code = f_status_initialize;
code = (f_status) atoll(argv[data->remaining.array[counter]]);
if (fll_fss_errors_is_okay(code)){
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return f_true;
}
}
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return f_false;
} else if (data->remaining.used > 0 || data->process_pipe){
f_array_length counter = f_array_length_initialize;
status = f_invalid_parameter;
}
- fss_error_code_delete_data(data);
+ fss_return_code_delete_data(data);
return status;
}
-#endif // _di_fss_error_code_main_
+#endif // _di_fss_return_code_main_
-#ifndef _di_fss_error_code_delete_data_
- f_return_status fss_error_code_delete_data(fss_error_code_data *data){
+#ifndef _di_fss_return_code_delete_data_
+ f_return_status fss_return_code_delete_data(fss_return_code_data *data){
f_status status = f_status_initialize;
f_delete_string_lengths(status, data->remaining);
return f_none;
}
-#endif // _di_fss_error_code_delete_data_
+#endif // _di_fss_return_code_delete_data_
#ifdef __cplusplus
--- /dev/null
+/* FLL - Level 3
+ * Project: FSS
+ * Version: 0.3.x
+ * Licenses: lgplv2.1
+ * Programmers: Kevin Day
+ * Documentation:
+ *
+ * This program provides error code to string translation.
+ */
+#ifndef _fss_return_code_h
+
+// libc includes
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+// fll-0 includes
+#include <level_0/types.h>
+#include <level_0/strings.h>
+#include <level_0/console.h>
+#include <level_0/output.h>
+#include <level_0/pipe.h>
+
+// fll-1 includes
+#include <level_1/colors.h>
+#include <level_1/console.h>
+#include <level_1/strings.h>
+#include <level_1/errors.h>
+
+// fll-2 includes
+#include <level_2/colors.h>
+#include <level_2/fss_errors.h>
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef _di_fss_return_code_version_
+ #define fss_return_code_major_version "0"
+ #define fss_return_code_minor_version "3"
+ #define fss_return_code_micro_version "0"
+ #define fss_return_code_version fss_return_code_major_version "." fss_return_code_minor_version "." fss_return_code_micro_version
+#endif // _di_fss_return_code_version_
+
+#ifndef _di_fss_return_code_name_
+ #define fss_return_code_name "fss_return_code"
+ #define fss_return_code_name_long "FSS Error Code"
+#endif // _di_fss_return_code_name_
+
+#ifndef _di_fss_return_code_defines_
+ #define fss_return_code_short_is_okay "o"
+ #define fss_return_code_short_is_warning "w"
+ #define fss_return_code_short_is_error "e"
+
+ #define fss_return_code_long_is_okay "is_okay"
+ #define fss_return_code_long_is_warning "is_warning"
+ #define fss_return_code_long_is_error "is_error"
+
+ enum {
+ fss_return_code_parameter_help,
+ fss_return_code_parameter_light,
+ fss_return_code_parameter_no_color,
+ fss_return_code_parameter_version,
+
+ fss_return_code_parameter_is_okay,
+ fss_return_code_parameter_is_warning,
+ fss_return_code_parameter_is_error,
+ };
+
+ #define f_console_parameter_initialize_fss_return_code \
+ { \
+ f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
+ f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
+ f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(fss_return_code_short_is_okay, fss_return_code_long_is_okay, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(fss_return_code_short_is_warning, fss_return_code_long_is_warning, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(fss_return_code_short_is_error, fss_return_code_long_is_error, 0, 0, f_false, f_console_type_normal, 0), \
+ }
+
+ #define fss_return_code_total_parameters 7
+#endif // _di_fss_return_code_defines_
+
+#ifndef _di_fss_return_code_data_
+ typedef struct {
+ f_console_parameter parameters[fss_return_code_total_parameters];
+
+ f_string_lengths remaining;
+ f_bool process_pipe;
+
+ fll_color_context context;
+ } fss_return_code_data;
+
+ #define fss_return_code_data_initialize \
+ { \
+ f_console_parameter_initialize_fss_return_code, \
+ f_string_lengths_initialize, \
+ f_false, \
+ fll_color_context_initialize, \
+ }
+#endif // _di_fss_return_code_data_
+
+#ifndef _di_fss_return_code_print_version_
+ extern f_return_status fss_return_code_print_version(const fss_return_code_data data);
+#endif // _di_fss_return_code_print_version_
+
+#ifndef _di_fss_return_code_print_help_
+ extern f_return_status fss_return_code_print_help(const fss_return_code_data data);
+#endif // _di_fss_return_code_print_help_
+
+#ifndef _di_fss_return_code_main_
+ extern f_return_status fss_return_code_main(const f_array_length argc, const f_string argv[], fss_return_code_data *data);
+#endif // _di_fss_return_code_main_
+
+#ifndef _di_fss_return_code_delete_data_
+ extern f_return_status fss_return_code_delete_data(fss_return_code_data *data);
+#endif // _di_fss_return_code_delete_data_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_return_code_h
--- /dev/null
+#include <level_3/fss_return_code.h>
+
+int main(const f_array_length argc, const f_string argv[]){
+ fss_return_code_data data = fss_return_code_data_initialize;
+
+ /*
+ if (f_pipe_exists()){
+ data.process_pipe = f_true;
+ }
+ */
+
+ return fss_return_code_main(argc, argv, &data);
+}
# fss-0000
-project_name fss_error_code
+project_name fss_return_code
project_level 3
version_major 0
build_compiler gcc
build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_output -lfl_colors -lfll_colors -lfl_errors -lfl_fss -lfll_fss
-build_sources_library fss_error_code.c
+build_sources_library fss_return_code.c
build_sources_program main.c
-build_sources_headers fss_error_code.h
+build_sources_headers fss_return_code.h
build_shared yes
flags_all -z now
flags_shared
flags_static
flags_library -fPIC
-flags_program -fPIE -lfss_error_code
+flags_program -fPIE -lfss_return_code
-#include <level_3/error_code.h>
+#include <level_3/return_code.h>
int main(const f_array_length argc, const f_string argv[]){
- error_code_data data = error_code_data_initialize;
+ return_code_data data = return_code_data_initialize;
/*
if (f_pipe_exists()){
}
*/
- return error_code_main(argc, argv, &data);
+ return return_code_main(argc, argv, &data);
}
* Licenses: lgplv2.1
* Programmers: Kevin Day
*/
-#include <level_3/error_code.h>
+#include <level_3/return_code.h>
#ifdef __cplusplus
extern "C"{
#endif
// version printed may be used by scripts, so this will only print the version number and a newline, no extra information or colors
-#ifndef _di_error_code_print_version_
- f_return_status error_code_print_version(const error_code_data data){
- printf("%s\n", error_code_version);
+#ifndef _di_return_code_print_version_
+ f_return_status return_code_print_version(const return_code_data data){
+ printf("%s\n", return_code_version);
return f_none;
}
-#endif // _error_code_print_version_
+#endif // _return_code_print_version_
-#ifndef _di_error_code_print_help_
- f_return_status error_code_print_help(const error_code_data data){
+#ifndef _di_return_code_print_help_
+ f_return_status return_code_print_help(const return_code_data data){
printf("\n");
- fl_print_color(f_standard_output, data.context.title, data.context.reset, " %s", error_code_name_long);
+ fl_print_color(f_standard_output, data.context.title, data.context.reset, " %s", return_code_name_long);
printf("\n");
- fl_print_color(f_standard_output, data.context.notable, data.context.reset, " Version %s", error_code_version);
+ fl_print_color(f_standard_output, data.context.notable, data.context.reset, " Version %s", return_code_version);
printf("\n\n");
printf(" Print only the version number");
printf("\n %s", f_console_symbol_short_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_short_is_okay);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_short_is_okay);
printf(", %s", f_console_symbol_long_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_long_is_okay);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_long_is_okay);
printf(" Returns true if the error code is not an error.");
printf("\n");
printf("\n %s", f_console_symbol_short_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_short_is_warning);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_short_is_warning);
printf(", %s", f_console_symbol_long_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_long_is_warning);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_long_is_warning);
printf(" Returns true if the error code is a warning.");
printf("\n %s", f_console_symbol_short_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_short_is_error);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_short_is_error);
printf(", %s", f_console_symbol_long_enable);
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_long_is_error);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_long_is_error);
printf(" Returns true if the error code is an error.");
fl_print_color(f_standard_output, data.context.important, data.context.reset, " Usage: ");
printf("\n ");
- fl_print_color(f_standard_output, data.context.standout, data.context.reset, error_code_name);
+ fl_print_color(f_standard_output, data.context.standout, data.context.reset, return_code_name);
printf(" ");
fl_print_color(f_standard_output, data.context.notable, data.context.reset, "[");
return f_none;
}
-#endif // _di_error_code_print_help_
+#endif // _di_return_code_print_help_
-#ifndef _di_error_code_main_
- f_return_status error_code_main(const f_array_length argc, const f_string argv[], error_code_data *data){
+#ifndef _di_return_code_main_
+ f_return_status return_code_main(const f_array_length argc, const f_string argv[], return_code_data *data){
f_status status = f_status_initialize;
f_status allocation_status = f_status_initialize;
- status = fl_process_parameters(argc, argv, data->parameters, error_code_total_parameters, &data->remaining);
+ status = fl_process_parameters(argc, argv, data->parameters, return_code_total_parameters, &data->remaining);
// load colors when not told to show no colors
- if (data->parameters[error_code_parameter_no_color].result == f_console_result_none){
+ if (data->parameters[return_code_parameter_no_color].result == f_console_result_none){
fll_new_color_context(allocation_status, data->context);
if (allocation_status == f_none){
- fll_colors_load_context(&data->context, data->parameters[error_code_parameter_light].result == f_console_result_found);
+ fll_colors_load_context(&data->context, data->parameters[return_code_parameter_light].result == f_console_result_found);
} else {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
- error_code_delete_data(data);
+ return_code_delete_data(data);
return allocation_status;
}
}
fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", status);
}
- error_code_delete_data(data);
+ return_code_delete_data(data);
return status;
}
// execute parameter results
- if (data->parameters[error_code_parameter_help].result == f_console_result_found){
- error_code_print_help(*data);
- } else if (data->parameters[error_code_parameter_version].result == f_console_result_found){
- error_code_print_version(*data);
- } else if (data->parameters[error_code_parameter_is_error].result == f_console_result_found && data->remaining.used > 0){
+ if (data->parameters[return_code_parameter_help].result == f_console_result_found){
+ return_code_print_help(*data);
+ } else if (data->parameters[return_code_parameter_version].result == f_console_result_found){
+ return_code_print_version(*data);
+ } else if (data->parameters[return_code_parameter_is_error].result == f_console_result_found && data->remaining.used > 0){
f_array_length counter = f_array_length_initialize;
f_status code = f_status_initialize;
code = (f_status) atoll(argv[data->remaining.array[counter]]);
if (fl_errors_is_error(code)){
- error_code_delete_data(data);
+ return_code_delete_data(data);
return f_true;
}
}
- error_code_delete_data(data);
+ return_code_delete_data(data);
return f_false;
- } else if (data->parameters[error_code_parameter_is_warning].result == f_console_result_found && data->remaining.used > 0){
+ } else if (data->parameters[return_code_parameter_is_warning].result == f_console_result_found && data->remaining.used > 0){
f_array_length counter = f_array_length_initialize;
f_status code = f_status_initialize;
code = (f_status) atoll(argv[data->remaining.array[counter]]);
if (fl_errors_is_warning(code)){
- error_code_delete_data(data);
+ return_code_delete_data(data);
return f_true;
}
}
- error_code_delete_data(data);
+ return_code_delete_data(data);
return f_false;
- } else if (data->parameters[error_code_parameter_is_okay].result == f_console_result_found && data->remaining.used > 0){
+ } else if (data->parameters[return_code_parameter_is_okay].result == f_console_result_found && data->remaining.used > 0){
f_array_length counter = f_array_length_initialize;
f_status code = f_status_initialize;
code = (f_status) atoll(argv[data->remaining.array[counter]]);
if (fl_errors_is_okay(code)){
- error_code_delete_data(data);
+ return_code_delete_data(data);
return f_true;
}
}
- error_code_delete_data(data);
+ return_code_delete_data(data);
return f_false;
} else if (data->remaining.used > 0 || data->process_pipe){
f_array_length counter = f_array_length_initialize;
status = f_invalid_parameter;
}
- error_code_delete_data(data);
+ return_code_delete_data(data);
return status;
}
-#endif // _di_error_code_main_
+#endif // _di_return_code_main_
-#ifndef _di_error_code_delete_data_
- f_return_status error_code_delete_data(error_code_data *data){
+#ifndef _di_return_code_delete_data_
+ f_return_status return_code_delete_data(return_code_data *data){
f_status status = f_status_initialize;
f_delete_string_lengths(status, data->remaining);
return f_none;
}
-#endif // _di_error_code_delete_data_
+#endif // _di_return_code_delete_data_
#ifdef __cplusplus
--- /dev/null
+/* FLL - Level 3
+ * Project: FSS
+ * Version: 0.3.x
+ * Licenses: lgplv2.1
+ * Programmers: Kevin Day
+ * Documentation:
+ *
+ * This program provides error code to string translation.
+ */
+#ifndef _return_code_h
+
+// libc includes
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+// fll-0 includes
+#include <level_0/types.h>
+#include <level_0/strings.h>
+#include <level_0/console.h>
+#include <level_0/output.h>
+#include <level_0/pipe.h>
+
+// fll-1 includes
+#include <level_1/colors.h>
+#include <level_1/console.h>
+#include <level_1/strings.h>
+#include <level_1/errors.h>
+
+// fll-2 includes
+#include <level_2/colors.h>
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef _di_return_code_version_
+ #define return_code_major_version "0"
+ #define return_code_minor_version "3"
+ #define return_code_micro_version "0"
+ #define return_code_version return_code_major_version "." return_code_minor_version "." return_code_micro_version
+#endif // _di_return_code_version_
+
+#ifndef _di_return_code_name_
+ #define return_code_name "return_code"
+ #define return_code_name_long "Error Code"
+#endif // _di_return_code_name_
+
+#ifndef _di_return_code_defines_
+ #define return_code_short_is_okay "o"
+ #define return_code_short_is_warning "w"
+ #define return_code_short_is_error "e"
+
+ #define return_code_long_is_okay "is_okay"
+ #define return_code_long_is_warning "is_warning"
+ #define return_code_long_is_error "is_error"
+
+ enum {
+ return_code_parameter_help,
+ return_code_parameter_light,
+ return_code_parameter_no_color,
+ return_code_parameter_version,
+
+ return_code_parameter_is_okay,
+ return_code_parameter_is_warning,
+ return_code_parameter_is_error,
+ };
+
+ #define f_console_parameter_initialize_return_code \
+ { \
+ f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
+ f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
+ f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(return_code_short_is_okay, return_code_long_is_okay, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(return_code_short_is_warning, return_code_long_is_warning, 0, 0, f_false, f_console_type_normal, 0), \
+ f_console_parameter_initialize(return_code_short_is_error, return_code_long_is_error, 0, 0, f_false, f_console_type_normal, 0), \
+ }
+
+ #define return_code_total_parameters 7
+#endif // _di_return_code_defines_
+
+#ifndef _di_return_code_data_
+ typedef struct {
+ f_console_parameter parameters[return_code_total_parameters];
+
+ f_string_lengths remaining;
+ f_bool process_pipe;
+
+ fll_color_context context;
+ } return_code_data;
+
+ #define return_code_data_initialize \
+ { \
+ f_console_parameter_initialize_return_code, \
+ f_string_lengths_initialize, \
+ f_false, \
+ fll_color_context_initialize, \
+ }
+#endif // _di_return_code_data_
+
+#ifndef _di_return_code_print_version_
+ extern f_return_status return_code_print_version(const return_code_data data);
+#endif // _di_return_code_print_version_
+
+#ifndef _di_return_code_print_help_
+ extern f_return_status return_code_print_help(const return_code_data data);
+#endif // _di_return_code_print_help_
+
+#ifndef _di_return_code_main_
+ extern f_return_status return_code_main(const f_array_length argc, const f_string argv[], return_code_data *data);
+#endif // _di_return_code_main_
+
+#ifndef _di_return_code_delete_data_
+ extern f_return_status return_code_delete_data(return_code_data *data);
+#endif // _di_return_code_delete_data_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _return_code_h
# fss-0000
-project_name error_code
+project_name return_code
project_level 3
version_major 0
build_compiler gcc
build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_output -lfl_colors -lfll_colors -lfl_errors
-build_sources_library error_code.c
+build_sources_library return_code.c
build_sources_program main.c
-build_sources_headers error_code.h
+build_sources_headers return_code.h
build_shared yes
flags_all -z now
flags_shared
flags_static
flags_library -fPIC
-flags_program -fPIE -lerror_code
+flags_program -fPIE -lreturn_code