From 208db5f663b3a55fe1f8ab06c74babe0a30779d0 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 2 Sep 2019 00:50:51 -0500 Subject: [PATCH] Update: rename fl_program as fll_program, rename f_colors and fl_colors, move functions from fll_colors into fl_colors, and provide addition fll_programs functions Cleanup the parameter processing code. In the process: - The fl_program was moved into fll_program. - fll_colors_load_context() is at too high of a level, move it to fl_colors_load_context() (and deleting the now empty fll_colors project). - Update programs to use the update fll_program helpers. - The f_colors and fl_colors should now be f_color and fl_color. Regenerate the package dependencies. --- build/level_0/settings | 2 +- build/level_1/settings | 4 +- build/level_2/settings | 4 +- build/monolithic/settings | 4 +- level_0/{f_colors/c/colors.h => f_color/c/color.h} | 54 ++++---- .../{f_colors => f_color}/data/build/dependencies | 0 level_0/{f_colors => f_color}/data/build/settings | 4 +- .../bash/colors.sh => fl_color/bash/color.sh} | 0 .../{fl_colors/c/colors.c => fl_color/c/color.c} | 52 +++++++- .../{fl_colors/c/colors.h => fl_color/c/color.h} | 72 ++++++++-- .../data/build/dependencies | 2 +- .../{fl_colors => fl_color}/data/build/settings | 6 +- level_1/fl_console/c/console.h | 2 + level_1/fl_program/c/program.c | 17 --- level_1/fl_program/c/program.h | 43 ------ level_1/fl_program/data/build/dependencies | 3 - level_2/fll_colors/c/colors.c | 55 -------- level_2/fll_colors/c/colors.h | 42 ------ level_2/fll_colors/data/build/settings | 30 ----- level_2/fll_program/c/program.c | 128 ++++++++++++++++++ level_2/fll_program/c/program.h | 148 +++++++++++++++++++++ .../data/build/dependencies | 5 +- .../fll_program}/data/build/settings | 6 +- level_3/firewall/c/firewall.c | 87 +++--------- level_3/firewall/c/firewall.h | 5 +- level_3/firewall/data/build/dependencies | 5 +- level_3/firewall/data/build/settings | 2 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 119 +++-------------- .../fss_basic_list_read/c/fss_basic_list_read.h | 5 +- .../fss_basic_list_read/data/build/dependencies | 5 +- level_3/fss_basic_list_read/data/build/settings | 2 +- .../fss_basic_list_write/c/fss_basic_list_write.c | 90 ++----------- .../fss_basic_list_write/c/fss_basic_list_write.h | 5 +- .../fss_basic_list_write/data/build/dependencies | 5 +- level_3/fss_basic_list_write/data/build/settings | 2 +- level_3/fss_basic_read/c/fss_basic_read.c | 103 +++----------- level_3/fss_basic_read/c/fss_basic_read.h | 5 +- level_3/fss_basic_read/data/build/dependencies | 5 +- level_3/fss_basic_read/data/build/settings | 2 +- level_3/fss_basic_write/c/fss_basic_write.c | 90 ++----------- level_3/fss_basic_write/c/fss_basic_write.h | 5 +- level_3/fss_basic_write/data/build/dependencies | 5 +- level_3/fss_basic_write/data/build/settings | 2 +- level_3/fss_extended_read/c/fss_extended_read.c | 111 +++------------- level_3/fss_extended_read/c/fss_extended_read.h | 5 +- level_3/fss_extended_read/data/build/dependencies | 13 +- level_3/fss_extended_read/data/build/settings | 2 +- level_3/fss_extended_write/c/fss_extended_write.c | 98 +++----------- level_3/fss_extended_write/c/fss_extended_write.h | 5 +- level_3/fss_extended_write/data/build/dependencies | 13 +- level_3/fss_extended_write/data/build/settings | 2 +- level_3/fss_status_code/c/fss_status_code.c | 104 +++------------ level_3/fss_status_code/c/fss_status_code.h | 7 +- level_3/fss_status_code/data/build/dependencies | 20 +-- level_3/fss_status_code/data/build/settings | 2 +- level_3/init/c/init.c | 81 ++--------- level_3/init/c/init.h | 4 +- level_3/init/data/build/dependencies | 14 +- level_3/init/data/build/settings | 2 +- level_3/status_code/c/status_code.c | 104 +++------------ level_3/status_code/c/status_code.h | 5 +- level_3/status_code/data/build/dependencies | 18 ++- level_3/status_code/data/build/settings | 2 +- 63 files changed, 664 insertions(+), 1180 deletions(-) rename level_0/{f_colors/c/colors.h => f_color/c/color.h} (69%) rename level_0/{f_colors => f_color}/data/build/dependencies (100%) rename level_0/{f_colors => f_color}/data/build/settings (88%) rename level_1/{fl_colors/bash/colors.sh => fl_color/bash/color.sh} (100%) rename level_1/{fl_colors/c/colors.c => fl_color/c/color.c} (72%) rename level_1/{fl_colors/c/colors.h => fl_color/c/color.h} (69%) rename level_1/{fl_colors => fl_color}/data/build/dependencies (84%) rename level_1/{fl_colors => fl_color}/data/build/settings (82%) delete mode 100644 level_1/fl_program/c/program.c delete mode 100644 level_1/fl_program/c/program.h delete mode 100644 level_1/fl_program/data/build/dependencies delete mode 100644 level_2/fll_colors/c/colors.c delete mode 100644 level_2/fll_colors/c/colors.h delete mode 100644 level_2/fll_colors/data/build/settings create mode 100644 level_2/fll_program/c/program.c create mode 100644 level_2/fll_program/c/program.h rename level_2/{fll_colors => fll_program}/data/build/dependencies (53%) rename {level_1/fl_program => level_2/fll_program}/data/build/settings (75%) diff --git a/build/level_0/settings b/build/level_0/settings index 7846191..e41ce5b 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -13,7 +13,7 @@ build_libraries -lc build_libraries_fll build_sources_library console.c conversion.c file.c memory.c pipe.c print.c utf.c build_sources_program -build_sources_headers colors.h console.h conversion.h file.h fss.h memory.h path_fll.h path_filesystem.h pipe.h print.h serialized.h socket.h status.h string.h type.h type_array.h utf.h +build_sources_headers color.h console.h conversion.h file.h fss.h memory.h path_fll.h path_filesystem.h pipe.h print.h serialized.h socket.h status.h string.h type.h type_array.h utf.h build_shared yes build_static yes diff --git a/build/level_1/settings b/build/level_1/settings index 1cc2a70..53c2bcb 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -11,9 +11,9 @@ build_compiler gcc build_linker ar build_libraries -lc build_libraries_fll -lfll_0 -build_sources_library colors.c console.c directory.c file.c fss.c fss_basic.c fss_basic_list.c fss_extended.c program.c serialized.c socket.c status.c string.c utf.c +build_sources_library color.c console.c directory.c file.c fss.c fss_basic.c fss_basic_list.c fss_extended.c serialized.c socket.c status.c string.c utf.c build_sources_program -build_sources_headers colors.h console.h directory.h file.h fss.h fss_basic.h fss_basic_list.h fss_status.h fss_extended.h fss_macro.h program.h serialized.h socket.h status.h string.h utf.h +build_sources_headers color.h console.h directory.h file.h fss.h fss_basic.h fss_basic_list.h fss_status.h fss_extended.h fss_macro.h serialized.h socket.h status.h string.h utf.h build_shared yes build_static yes diff --git a/build/level_2/settings b/build/level_2/settings index 32bcc8a..f5f1a52 100644 --- a/build/level_2/settings +++ b/build/level_2/settings @@ -11,9 +11,9 @@ build_compiler gcc build_linker ar build_libraries -lc build_libraries_fll -lfll_0 -lfll_1 -build_sources_library colors.c execute.c fss_basic.c fss_basic_list.c fss_extended.c fss_status.c status.c +build_sources_library execute.c fss_basic.c fss_basic_list.c fss_extended.c fss_status.c program.c status.c build_sources_program -build_sources_headers colors.h execute.h fss_basic.h fss_basic_list.h fss_extended.h fss_status.h status.h +build_sources_headers execute.h fss_basic.h fss_basic_list.h fss_extended.h fss_status.h program.h status.h build_shared yes build_static yes diff --git a/build/monolithic/settings b/build/monolithic/settings index a4749a7..ec702ab 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -11,9 +11,9 @@ build_compiler gcc build_linker ar build_libraries -lc build_libraries_fll -build_sources_library level_0/console.c level_0/conversion.c level_0/file.c level_0/memory.c level_0/pipe.c level_0/print.c level_0/utf.c level_1/colors.c level_1/console.c level_1/directory.c level_1/file.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/program.c level_1/serialized.c level_1/socket.c level_1/status.c level_1/string.c level_1/utf.c level_2/colors.c level_2/execute.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_status.c level_2/status.c +build_sources_library level_0/console.c level_0/conversion.c level_0/file.c level_0/memory.c level_0/pipe.c level_0/print.c level_0/utf.c level_1/color.c level_1/console.c level_1/directory.c level_1/file.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/serialized.c level_1/socket.c level_1/status.c level_1/string.c level_1/utf.c level_2/execute.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_status.c level_2/program.c level_2/status.c build_sources_program -build_sources_headers level_0/colors.h level_0/console.h level_0/conversion.h level_0/file.h level_0/fss.h level_0/memory.h level_0/path_fll.h level_0/path_filesystem.h level_0/pipe.h level_0/print.h level_0/serialized.h level_0/socket.h level_0/status.h level_0/string.h level_0/type.h level_0/type_array.h level_0/utf.h level_1/colors.h level_1/console.h level_1/directory.h level_1/file.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_status.h level_1/fss_extended.h level_1/fss_macro.h level_1/program.h level_1/serialized.h level_1/socket.h level_1/status.h level_1/string.h level_1/utf.h level_2/colors.h level_2/execute.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_status.h level_2/status.h +build_sources_headers level_0/color.h level_0/console.h level_0/conversion.h level_0/file.h level_0/fss.h level_0/memory.h level_0/path_fll.h level_0/path_filesystem.h level_0/pipe.h level_0/print.h level_0/serialized.h level_0/socket.h level_0/status.h level_0/string.h level_0/type.h level_0/type_array.h level_0/utf.h level_1/color.h level_1/console.h level_1/directory.h level_1/file.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_status.h level_1/fss_extended.h level_1/fss_macro.h level_1/serialized.h level_1/socket.h level_1/status.h level_1/string.h level_1/utf.h level_2/execute.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_status.h level_2/program.h level_2/status.h build_sources_bash build_sources_settings build_shared yes diff --git a/level_0/f_colors/c/colors.h b/level_0/f_color/c/color.h similarity index 69% rename from level_0/f_colors/c/colors.h rename to level_0/f_color/c/color.h index 45be0fc..12b40ed 100644 --- a/level_0/f_colors/c/colors.h +++ b/level_0/f_color/c/color.h @@ -1,15 +1,15 @@ /** * FLL - Level 0 * - * Project: Colors + * Project: Color * API Version: 0.5 * Licenses: lgplv2.1 * * Provide basic color output support (linux & xterm). * This is the Featureless LINUX Library, so there is no support for non-linux colors at this time. */ -#ifndef _F_colors_h -#define _F_colors_h +#ifndef _F_color_h +#define _F_color_h // fll-0 includes #include @@ -27,8 +27,8 @@ extern "C" { typedef f_min_u_int f_color_id; // f_color_id codes - #define f_color_linux 0 - #define f_color_xterminal 1 + #define f_color_code_linux 0 + #define f_color_code_xterminal 1 #endif // _di_f_color_types_ /** @@ -90,16 +90,16 @@ extern "C" { #define f_color_help_names_initialize { "alert", "command", "comment", "emphasize", "standard", "syntax", "title", "topic", "version" } #endif // _di_f_color_help_ -#ifndef _di_f_colors_format_ +#ifndef _di_f_color_format_ typedef struct { const char *begin; const char *end; const char *medium; - } f_colors_format; + } f_color_format; - #define f_colors_format_initialize_linux { "\033[", "m", ";" } - #define f_colors_format_initialize_xterminal { "\033[", "m", ";" } -#endif // _di_f_colors_format_ + #define f_color_format_initialize_linux { "\033[", "m", ";" } + #define f_color_format_initialize_xterminal { "\033[", "m", ";" } +#endif // _di_f_color_format_ /** * A structure containing all supported color codes. @@ -107,10 +107,10 @@ extern "C" { * Different system will support a different set. * * Custom initializers are provided for common defaults: - * - f_colors_initialize_linux: ideal for linux console. - * - f_colors_initialize_xterminal: ideal for linux x-terminal. + * - f_color_initialize_linux: ideal for linux console. + * - f_color_initialize_xterminal: ideal for linux x-terminal. */ -#ifndef _di_f_colors_ +#ifndef _di_f_color_ typedef struct { const char *reset; const char *bold; @@ -150,29 +150,29 @@ extern "C" { const char *bright_purple_bg; const char *bright_teal_bg; const char *bright_white_bg; - } f_colors; + } f_color; - #define f_colors_initialize_linux { "0", "1", "4", "5", "7", "8", "30", "31", "32", "33", "34", "35", "36", "37", "40", "41", "42", "43", "44", "45", "46", "47", "30", "31", "32", "33", "34", "35", "36", "37", "40", "41", "42", "43", "44", "45", "46", "47" } - #define f_colors_initialize_xterminal { "0", "1", "4", "5", "7", "8", "30", "31", "32", "33", "34", "35", "36", "37", "40", "41", "42", "43", "44", "45", "46", "47", "90", "91", "92", "93", "94", "95", "96", "97", "100", "101", "102", "103", "104", "105", "106", "107" } -#endif // _di_f_colors_ + #define f_color_initialize_linux { "0", "1", "4", "5", "7", "8", "30", "31", "32", "33", "34", "35", "36", "37", "40", "41", "42", "43", "44", "45", "46", "47", "30", "31", "32", "33", "34", "35", "36", "37", "40", "41", "42", "43", "44", "45", "46", "47" } + #define f_color_initialize_xterminal { "0", "1", "4", "5", "7", "8", "30", "31", "32", "33", "34", "35", "36", "37", "40", "41", "42", "43", "44", "45", "46", "47", "90", "91", "92", "93", "94", "95", "96", "97", "100", "101", "102", "103", "104", "105", "106", "107" } +#endif // _di_f_color_ /** - * Provide global default global instances of f_colors structures. + * Provide global default global instances of f_color structures. * * Supported instances: - * - f_colors_format_linux: ideal for linux console. - * - f_colors_format_xterminal: ideal for linux x-terminal. + * - f_color_format_linux: ideal for linux console. + * - f_color_format_xterminal: ideal for linux x-terminal. */ -#ifndef _di_f_default_colors_ - static const f_colors_format f_colors_format_linux = f_colors_format_initialize_linux; - static const f_colors_format f_colors_format_xterminal = f_colors_format_initialize_xterminal; +#ifndef _di_f_color_default_ + static const f_color_format f_color_format_linux = f_color_format_initialize_linux; + static const f_color_format f_color_format_xterminal = f_color_format_initialize_xterminal; - static const f_colors f_colors_linux = f_colors_initialize_linux; - static const f_colors f_colors_xterminal = f_colors_initialize_xterminal; -#endif // _di_f_default_colors_ + static const f_color f_color_linux = f_color_initialize_linux; + static const f_color f_color_xterminal = f_color_initialize_xterminal; +#endif // _di_f_color_default_ #ifdef __cplusplus } // extern "C" #endif -#endif // _F_colors_h +#endif // _F_color_h diff --git a/level_0/f_colors/data/build/dependencies b/level_0/f_color/data/build/dependencies similarity index 100% rename from level_0/f_colors/data/build/dependencies rename to level_0/f_color/data/build/dependencies diff --git a/level_0/f_colors/data/build/settings b/level_0/f_color/data/build/settings similarity index 88% rename from level_0/f_colors/data/build/settings rename to level_0/f_color/data/build/settings index 4d76991..039ddd4 100644 --- a/level_0/f_colors/data/build/settings +++ b/level_0/f_color/data/build/settings @@ -1,6 +1,6 @@ # fss-0000 -project_name f_colors +project_name f_color project_level 0 version_major 0 @@ -13,7 +13,7 @@ build_libraries -lc build_libraries_fll -lf_memory build_sources_library build_sources_program -build_sources_headers colors.h +build_sources_headers color.h build_sources_bash build_sources_settings build_shared yes diff --git a/level_1/fl_colors/bash/colors.sh b/level_1/fl_color/bash/color.sh similarity index 100% rename from level_1/fl_colors/bash/colors.sh rename to level_1/fl_color/bash/color.sh diff --git a/level_1/fl_colors/c/colors.c b/level_1/fl_color/c/color.c similarity index 72% rename from level_1/fl_colors/c/colors.c rename to level_1/fl_color/c/color.c index 4916350..4149a5e 100644 --- a/level_1/fl_colors/c/colors.c +++ b/level_1/fl_color/c/color.c @@ -1,11 +1,11 @@ -#include +#include #ifdef __cplusplus extern "C" { #endif #ifndef _di_fl_color_set_ - f_return_status fl_color_set(FILE *file, const f_colors_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5) { + f_return_status fl_color_set(FILE *file, const f_color_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5) { #ifndef _di_level_1_parameter_checking_ if (file == 0) return f_status_set_error(f_invalid_parameter); if (color1 == 0) return f_status_set_error(f_invalid_parameter); @@ -27,7 +27,7 @@ extern "C" { #endif // _di_fl_color_set_ #ifndef _di_fl_color_save_ - f_return_status fl_color_save(f_string_dynamic *buffer, const f_colors_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5) { + f_return_status fl_color_save(f_string_dynamic *buffer, const f_color_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5) { #ifndef _di_level_1_parameter_checking_ if (buffer == 0) return f_status_set_error(f_invalid_parameter); if (color1 == 0) return f_status_set_error(f_invalid_parameter); @@ -190,6 +190,52 @@ extern "C" { } #endif // _di_fl_color_print_code_ +#ifndef _di_fl_color_load_context_ + f_return_status fl_color_load_context(fl_color_context *context, const f_bool use_light_colors) { + #ifndef _di_level_1_parameter_checking_ + if (context == 0) return f_status_set_error(f_invalid_parameter); + #endif // _di_level_1_parameter_checking_ + + f_status status = f_none; + + // switch to the appropriate terminal color mode + { + char *environment = getenv("TERM"); + + if (!environment || strncmp(environment, "linux", 6) == 0) { + context->color_list = f_color_linux; + } + else { + context->color_list = f_color_xterminal; + } + } + + // load the colors + if (use_light_colors) { + status = fl_macro_color_save_1(&context->reset, context->color_format, context->color_list.reset); + + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->warning, context->color_format, context->color_list.yellow); + if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&context->error, context->color_format, context->color_list.bold, context->color_list.red); + if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&context->title, context->color_format, context->color_list.bold, context->color_list.blue); + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->notable, context->color_format, context->color_list.bold); + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->important, context->color_format, context->color_list.blue); + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->standout, context->color_format, context->color_list.purple); + } + else { + status = fl_macro_color_save_1(&context->reset, context->color_format, context->color_list.reset); + + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->warning, context->color_format, context->color_list.yellow); + if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&context->error, context->color_format, context->color_list.bold, context->color_list.red); + if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&context->title, context->color_format, context->color_list.bold, context->color_list.yellow); + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->notable, context->color_format, context->color_list.bold); + if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&context->important, context->color_format, context->color_list.bold, context->color_list.green); + if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&context->standout, context->color_format, context->color_list.green); + } + + return status; + } +#endif // _di_fl_color_load_context_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_1/fl_colors/c/colors.h b/level_1/fl_color/c/color.h similarity index 69% rename from level_1/fl_colors/c/colors.h rename to level_1/fl_color/c/color.h index b867297..9f61be3 100644 --- a/level_1/fl_colors/c/colors.h +++ b/level_1/fl_color/c/color.h @@ -1,22 +1,22 @@ /** * FLL - Level 1 * - * Project: Colors + * Project: Color * API Version: 0.5 * Licenses: lgplv2.1 * * Provide basic color output support (linux & xterm). * This is the Featureless LINUX Library, so there is no support for non-linux colors at this time. */ -#ifndef _FL_colors_h -#define _FL_colors_h +#ifndef _FL_color_h +#define _FL_color_h // libc includes #include #include // fll-0 includes -#include +#include #include #include #include @@ -29,8 +29,8 @@ extern "C" { #ifndef _di_fl_color_context_ typedef struct { - f_colors color_list; - f_colors_format color_format; + f_color color_list; + f_color_format color_format; f_string_dynamic reset; f_string_dynamic warning; f_string_dynamic error; @@ -42,10 +42,10 @@ extern "C" { f_string_dynamic normal_reset; } fl_color_context; - #define fl_color_context_initialize { f_colors_initialize_linux, f_colors_format_initialize_linux, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize } + #define fl_color_context_initialize { f_color_initialize_linux, f_color_format_initialize_linux, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize, f_string_dynamic_initialize } - #define fl_new_color_context(status, color_context) \ - f_macro_string_dynamic_resize(status, color_context.reset, f_color_max_size + 1); \ + #define fl_macro_color_context_new(status, color_context) \ + f_macro_string_dynamic_new(status, color_context.reset, f_color_max_size + 1); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.warning, f_color_max_size + 1); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.error, f_color_max_size + 1); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.title, f_color_max_size + 1); \ @@ -55,7 +55,7 @@ extern "C" { if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal, f_color_max_size + 1); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal_reset, f_color_max_size + 1); - #define fl_delete_color_context(status, color_context) \ + #define fl_macro_color_context_delete(status, color_context) \ f_macro_string_dynamic_delete(status, color_context.reset); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.warning); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.error); \ @@ -66,7 +66,7 @@ extern "C" { if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.normal); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.normal_reset); - #define fl_destroy_color_context(status, color_context, size) \ + #define fl_macro_color_context_destroy(status, color_context, size) \ f_macro_string_dynamic_destroy(status, color_context.reset); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.warning, size); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.error, size); \ @@ -76,6 +76,28 @@ extern "C" { if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.standout, size); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.normal); \ if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.normal_reset); + + #define fl_macro_color_context_resize(status, color_context) \ + f_macro_string_dynamic_resize(status, color_context.reset, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.warning, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.error, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.title, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.notable, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.important, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.standout, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal_reset, f_color_max_size + 1); + + #define fl_macro_color_context_adjust(status, color_context) \ + f_macro_string_dynamic_adjust(status, color_context.reset, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.warning, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.error, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.title, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.notable, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.important, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.standout, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal_reset, f_color_max_size + 1); #endif // _di_fl_color_context_ /** @@ -103,7 +125,7 @@ extern "C" { * f_invalid_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_color_set_ - extern f_return_status fl_color_set(FILE *file, const f_colors_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5); + extern f_return_status fl_color_set(FILE *file, const f_color_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5); #define fl_macro_color_set_1(file, format, color1) fl_color_set(file, format, color1, 0, 0, 0, 0) #define fl_macro_color_set_2(file, format, color1, color2) fl_color_set(file, format, color1, color2, 0, 0, 0) @@ -138,7 +160,7 @@ extern "C" { * f_reallocation_error (with error bit) on memory reallocation error. */ #ifndef _di_fl_color_save_ - extern f_return_status fl_color_save(f_string_dynamic *buffer, const f_colors_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5); + extern f_return_status fl_color_save(f_string_dynamic *buffer, const f_color_format format, const char *color1, const char *color2, const char *color3, const char *color4, const char *color5); #define fl_macro_color_save_1(buffer, format, color1) fl_color_save(buffer, format, color1, 0, 0, 0, 0) #define fl_macro_color_save_2(buffer, format, color1, color2) fl_color_save(buffer, format, color1, color2, 0, 0, 0) @@ -220,8 +242,30 @@ extern "C" { extern f_return_status fl_color_print_code(FILE *file, const f_string_dynamic color); #endif // _di_fl_color_print_code_ + +/** + * Load the appropriate colors into the color context. + * + * This will handle the difference betweem xorg terminals and linux consoles. + * If you wish to use non-standard colors either redefine this function or don't use it. + * + * @param context + * The color context the load the color codes into. + * @param use_light_colors + * Set to f_true to use colors for light backgrounds. + * Set to f_false to use colors forr dark backgrounds. + * + * @return + * f_none on success. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * f_reallocation_error (with error bit) on memory reallocation error. + */ +#ifndef _di_fl_color_load_context_ + extern f_return_status fl_color_load_context(fl_color_context *context, const f_bool use_light_colors); +#endif // _di_fl_color_load_context_ + #ifdef __cplusplus } // extern "C" #endif -#endif // _FL_colors_h +#endif // _FL_color_h diff --git a/level_1/fl_colors/data/build/dependencies b/level_1/fl_color/data/build/dependencies similarity index 84% rename from level_1/fl_colors/data/build/dependencies rename to level_1/fl_color/data/build/dependencies index 424bcf3..f86139a 100644 --- a/level_1/fl_colors/data/build/dependencies +++ b/level_1/fl_color/data/build/dependencies @@ -2,6 +2,6 @@ f_type f_status f_memory f_string -f_colors +f_color f_file f_print diff --git a/level_1/fl_colors/data/build/settings b/level_1/fl_color/data/build/settings similarity index 82% rename from level_1/fl_colors/data/build/settings rename to level_1/fl_color/data/build/settings index 412158d..74b9847 100644 --- a/level_1/fl_colors/data/build/settings +++ b/level_1/fl_color/data/build/settings @@ -1,6 +1,6 @@ # fss-0000 -project_name fl_colors +project_name fl_color project_level 1 version_major 0 @@ -11,9 +11,9 @@ build_compiler gcc build_linker ar build_libraries -lc build_libraries_fll -lf_print -lf_file -lf_memory -build_sources_library colors.c +build_sources_library color.c build_sources_program -build_sources_headers colors.h +build_sources_headers color.h build_sources_bash build_sources_settings build_shared yes diff --git a/level_1/fl_console/c/console.h b/level_1/fl_console/c/console.h index 60bb462..7557dca 100644 --- a/level_1/fl_console/c/console.h +++ b/level_1/fl_console/c/console.h @@ -56,6 +56,8 @@ extern "C" { * The console parameters to look for. * @param total_parameters * The used size of the parameters array. + * @param remaining + * A list of remaining parameters not associated with anything. * * @return * f_none on success. diff --git a/level_1/fl_program/c/program.c b/level_1/fl_program/c/program.c deleted file mode 100644 index 520a3d1..0000000 --- a/level_1/fl_program/c/program.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fl_program_print_version_ - f_return_status fl_program_print_version(const f_string version) { - printf("%s\n", version); - - return f_none; - } -#endif // _di_fl_program_print_version_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_1/fl_program/c/program.h b/level_1/fl_program/c/program.h deleted file mode 100644 index 35d4785..0000000 --- a/level_1/fl_program/c/program.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * FLL - Level 1 - * - * Project: Program - * API Version: 0.5 - * Licenses: lgplv2.1 - * - * Provide functions commonly used by FLL based programs. - */ -#ifndef _FL_program_h -#define _FL_program_h - -// libc include -#include - -// fll-0 includes -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fl_program_print_version_ - /** - * Print version. - * - * @param version - * The version number to print. - * - * @return - * f_none on success. - * Error bit is set on error. - */ - extern f_return_status fl_program_print_version(const f_string version); -#endif // _di_fl_program_print_version_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _FL_program_h diff --git a/level_1/fl_program/data/build/dependencies b/level_1/fl_program/data/build/dependencies deleted file mode 100644 index d57c21e..0000000 --- a/level_1/fl_program/data/build/dependencies +++ /dev/null @@ -1,3 +0,0 @@ -f_type -f_status -f_string diff --git a/level_2/fll_colors/c/colors.c b/level_2/fll_colors/c/colors.c deleted file mode 100644 index 80a68be..0000000 --- a/level_2/fll_colors/c/colors.c +++ /dev/null @@ -1,55 +0,0 @@ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fll_colors_load_context_ - f_return_status fll_colors_load_context(fl_color_context *data, f_bool use_light_colors) { - #ifndef _di_level_2_parameter_checking_ - if (data == 0) return f_status_set_error(f_invalid_parameter); - #endif // _di_level_2_parameter_checking_ - - f_status status = f_none; - - // switch to the appropriate terminal color mode - { - char *environment = getenv("TERM"); - - if (!environment || strncmp(environment, "linux", 6) == 0) { - data->color_list = f_colors_linux; - } - else { - data->color_list = f_colors_xterminal; - } - } - - // load the colors - if (use_light_colors) { - status = fl_macro_color_save_1(&data->reset, data->color_format, data->color_list.reset); - - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->warning, data->color_format, data->color_list.yellow); - if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&data->error, data->color_format, data->color_list.bold, data->color_list.red); - if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&data->title, data->color_format, data->color_list.bold, data->color_list.blue); - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->notable, data->color_format, data->color_list.bold); - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->important, data->color_format, data->color_list.blue); - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->standout, data->color_format, data->color_list.purple); - } - else { - status = fl_macro_color_save_1(&data->reset, data->color_format, data->color_list.reset); - - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->warning, data->color_format, data->color_list.yellow); - if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&data->error, data->color_format, data->color_list.bold, data->color_list.red); - if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&data->title, data->color_format, data->color_list.bold, data->color_list.yellow); - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->notable, data->color_format, data->color_list.bold); - if (f_status_is_not_error(status)) status = fl_macro_color_save_2(&data->important, data->color_format, data->color_list.bold, data->color_list.green); - if (f_status_is_not_error(status)) status = fl_macro_color_save_1(&data->standout, data->color_format, data->color_list.green); - } - - return status; - } -#endif // _di_fll_colors_load_context_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_2/fll_colors/c/colors.h b/level_2/fll_colors/c/colors.h deleted file mode 100644 index 6e62899..0000000 --- a/level_2/fll_colors/c/colors.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * FLL - Level 2 - * - * Project: Colors - * API Version: 0.5 - * Licenses: lgplv2.1 - * - * Provide standard color handling. - */ -#ifndef _FLL_colors_h -#define _FLL_colors_h - -// libc includes -#include -#include - -// fll-0 includes -#include -#include -#include - -// fll-1 includes -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fll_colors_load_context_ - /** - * For any application that uses the standard color contexts, this function will load the appropriate colors to the structure. - * This will handle the difference betweem xorg terminals and linux consoles. - * If you wish to use non-standard colors either redefine this function or don't use it. - */ - extern f_return_status fll_colors_load_context(fl_color_context *data, f_bool use_light_colors); -#endif // _di_fll_colors_load_context_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _FLL_colors_h diff --git a/level_2/fll_colors/data/build/settings b/level_2/fll_colors/data/build/settings deleted file mode 100644 index 10381d7..0000000 --- a/level_2/fll_colors/data/build/settings +++ /dev/null @@ -1,30 +0,0 @@ -# fss-0000 - -project_name fll_colors -project_level 2 - -version_major 0 -version_minor 5 -version_micro 0 - -build_compiler gcc -build_linker ar -build_libraries -lc -build_libraries_fll -lfl_colors -lf_print -lf_file -lf_memory -build_sources_library colors.c -build_sources_program -build_sources_headers colors.h -build_sources_bash -build_sources_settings -build_shared yes -build_static yes - -defines_all -defines_static -defines_shared - -flags_all -z now -g -flags_shared -flags_static -flags_library -fPIC -flags_program -fPIE diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c new file mode 100644 index 0000000..6209a15 --- /dev/null +++ b/level_2/fll_program/c/program.c @@ -0,0 +1,128 @@ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_fll_program_print_help_header_ + f_return_status fll_program_print_help_header(const fl_color_context context, const f_string name, const f_string version) { + printf("%c", f_string_eol); + fl_color_print(f_standard_output, context.title, context.reset, " %s", name); + + printf("%c", f_string_eol); + fl_color_print(f_standard_output, context.notable, context.reset, " Version %s", version); + + printf("%c%c", f_string_eol, f_string_eol); + fl_color_print(f_standard_output, context.important, context.reset, " Available Options: "); + + return f_none; + } +#endif // _di_fll_program_print_help_header_ + +#ifndef _di_fll_program_print_help_option_ + f_return_status fll_program_print_help_option(const fl_color_context context, const f_string option_short, const f_string option_long, const f_string description) { + printf("%c", f_string_eol); + printf(" %s", f_console_symbol_short_enable); + fl_color_print(f_standard_output, context.standout, context.reset, option_short); + + printf(", %s", f_console_symbol_long_enable); + fl_color_print(f_standard_output, context.standout, context.reset, option_long); + printf(" %s", description); + + return f_none; + } +#endif // _di_fll_program_print_help_option_ + +#ifndef _di_fll_program_print_help_option_long_ + f_return_status fll_program_print_help_option_long(const fl_color_context context, const f_string option_long, const f_string description) { + printf("%c", f_string_eol); + printf(" %s", f_console_symbol_long_enable); + fl_color_print(f_standard_output, context.standout, context.reset, option_long); + printf(" %s", description); + + return f_none; + } +#endif // _di_fll_program_print_help_option_long_ + +#ifndef _di_fll_program_print_help_usage_ + f_return_status fll_program_print_help_usage(const fl_color_context context, const f_string name, const f_string parameters) { + printf("%c%c", f_string_eol, f_string_eol); + fl_color_print(f_standard_output, context.important, context.reset, " Usage:"); + + printf("%c ", f_string_eol); + fl_color_print(f_standard_output, context.standout, context.reset, name); + + printf(" "); + fl_color_print(f_standard_output, context.notable, context.reset, "["); + + printf(" options "); + fl_color_print(f_standard_output, context.notable, context.reset, "]"); + + if (parameters[0] != '\0') { + printf(" "); + fl_color_print(f_standard_output, context.notable, context.reset, "["); + + printf(" %s ", parameters); + fl_color_print(f_standard_output, context.notable, context.reset, "]"); + } + + printf("%c%c", f_string_eol, f_string_eol); + } +#endif // _di_fll_program_print_help_usage_ + +#ifndef _di_fll_program_print_version_ + f_return_status fll_program_print_version(const f_string version) { + printf("%s%c", version, f_string_eol); + + return f_none; + } +#endif // _di_fll_program_print_version_ + +#ifndef _di_fll_program_process_parameters_ + f_return_status fll_program_process_parameters(const f_array_length argc, const f_string argv[], f_console_parameter parameters[], const f_array_length total_parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, f_string_lengths *remaining, fl_color_context *context) { + f_status status = f_none; + f_status allocation_status = f_none; + + status = fl_process_parameters(argc, argv, parameters, total_parameters, remaining); + + // load colors when not told to show no colors + if (parameters[parameter_no_color].result == f_console_result_none) { + fl_macro_color_context_new(allocation_status, (*context)); + + if (f_status_is_error(allocation_status)) { + fprintf(f_standard_error, "Critical Error: unable to allocate memory.\n"); + return allocation_status; + } + + fl_color_load_context(context, parameters[parameter_light].result == f_console_result_found); + } + + if (f_status_is_error(status)) { + status = f_status_set_fine(status); + + if (status == f_no_data) { + fl_color_print_line(f_standard_error, context->error, context->reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass."); + // TODO: there is a way to identify which parameter is incorrect + // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 + // nothing can be 0 as that represents the program name, unless argv[] is improperly created + } + else if (status == f_allocation_error || status == f_reallocation_error) { + fl_color_print_line(f_standard_error, context->error, context->reset, "CRITICAL ERROR: unable to allocate memory."); + } + else if (status == f_invalid_parameter) { + fl_color_print_line(f_standard_error, context->error, context->reset, "INTERNAL ERROR: Invalid parameter when calling fl_process_parameters()."); + } + else { + fl_color_print_line(f_standard_error, context->error, context->reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_process_parameters().", status); + } + + return f_status_set_error(status); + } + + return status; + } +#endif // _di_fll_program_process_parameters_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h new file mode 100644 index 0000000..129c56d --- /dev/null +++ b/level_2/fll_program/c/program.h @@ -0,0 +1,148 @@ +/** + * FLL - Level 2 + * + * Project: Program + * API Version: 0.5 + * Licenses: lgplv2.1 + * + * Provide functions commonly used by FLL based programs. + */ +#ifndef _FL_program_h +#define _FL_program_h + +// libc include +#include + +// fll-0 includes +#include +#include +#include +#include + +// fll-1 includes +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Print standard help header. + * + * @param context + * The color context. + * @param name + * The name of the program. + * @param version + * The version number of the program. + * + * @return + * f_none on success. + */ +#ifndef _di_fll_program_print_help_header_ + extern f_return_status fll_program_print_help_header(const fl_color_context context, const f_string name, const f_string version); +#endif // _di_fll_program_print_help_header_ + +/** + * Print standard help option. + * + * @param context + * The color context. + * @param option_short + * The short name of the option. + * @param option_long + * The long name of the option. + * @param description + * A desciption associated with the option. + * + * @return + * f_none on success. + */ +#ifndef _di_fll_program_print_help_option_ + extern f_return_status fll_program_print_help_option(const fl_color_context context, const f_string option_short, const f_string option_long, const f_string description); +#endif // _di_fll_program_print_help_option_ + +/** + * Print standard help option (long option only). + * + * @param context + * The color context. + * @param option_long + * The long name of the option. + * @param description + * A desciption associated with the option. + * + * @return + * f_none on success. + */ +#ifndef _di_fll_program_print_help_option_long_ + extern f_return_status fll_program_print_help_option_long(const fl_color_context context, const f_string option_long, const f_string description); +#endif // _di_fll_program_print_help_option_long_ + +/** + * Print standard help usage. + * + * @param context + * The color context. + * @param name + * The name of the program. + * @param parameters + * The non-option parameters to be displayed inside the brackets. + * Set the first array value to EOS to disable printing of parameters. + * + * @return + * f_none on success. + */ +#ifndef _di_fll_program_print_help_usage_ + extern f_return_status fll_program_print_help_usage(const fl_color_context context, const f_string name, const f_string parameters); +#endif // _di_fll_program_print_help_usage_ + +/** + * Print the program version. + * + * @param version + * The version number of the program. + * + * @return + * f_none on success. + */ +#ifndef _di_fll_program_print_version_ + extern f_return_status fll_program_print_version(const f_string version); +#endif // _di_fll_program_print_version_ + +/** + * Perform basic parameter loading, including initialization of color context and printing errors. + * + * @param argc + * The number of parameters passed to the process. + * @param argv + * The parameters passed to the process. + * @param parameters + * The console parameters to look for. + * @param total_parameters + * The used size of the parameters array. + * @param parameter_no_color + * The parameter in the parameters array representing the no-color option. + * @param parameter_light + * The parameter in the parameters array representing the light-color option. + * @param remaining + * A list of remaining parameters not associated with anything. + * @param context + * The color context. + * + * @return + * f_none on success. + * f_no_data if "additional" parameters were expected but not found. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * f_reallocation_error (with error bit) on memory reallocation error. + */ +#ifndef _di_fll_program_process_parameters_ + extern f_return_status fll_program_process_parameters(const f_array_length argc, const f_string argv[], f_console_parameter parameters[], const f_array_length total_parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, f_string_lengths *remaining, fl_color_context *context); +#endif // _di_fll_program_process_parameters_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _FL_program_h diff --git a/level_2/fll_colors/data/build/dependencies b/level_2/fll_program/data/build/dependencies similarity index 53% rename from level_2/fll_colors/data/build/dependencies rename to level_2/fll_program/data/build/dependencies index c45b97c..79cc2f4 100644 --- a/level_2/fll_colors/data/build/dependencies +++ b/level_2/fll_program/data/build/dependencies @@ -2,5 +2,6 @@ f_type f_status f_memory f_string -f_colors -fl_colors +f_console +fl_color +fl_console diff --git a/level_1/fl_program/data/build/settings b/level_2/fll_program/data/build/settings similarity index 75% rename from level_1/fl_program/data/build/settings rename to level_2/fll_program/data/build/settings index 0d2769f..dc05494 100644 --- a/level_1/fl_program/data/build/settings +++ b/level_2/fll_program/data/build/settings @@ -1,7 +1,7 @@ # fss-0000 -project_name fl_program -project_level 1 +project_name fll_program +project_level 2 version_major 0 version_minor 5 @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lf_memory +build_libraries_fll -lfl_console -lf_utf -lfl_color -lf_print -lf_file -lf_console -lf_memory build_sources_library program.c build_sources_program build_sources_headers program.h diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 93af858..b126d00 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -13,94 +13,41 @@ extern "C" { #ifndef _di_firewall_print_help_ f_return_status firewall_print_help(const firewall_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", firewall_name_long); + fll_program_print_help_header(data.context, firewall_name_long, firewall_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", firewall_version); - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); #ifdef _en_firewall_debug_ - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_debug); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_debug); - printf(" Enable debugging"); + fll_program_print_help_option(data.context, f_console_standard_short_debug, f_console_standard_long_debug, " Enable debugging."); #endif // _en_firewall_debug_ - printf("\n\n"); + printf("%c%c", f_string_eol, f_string_eol); fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Commands: "); - printf("\n "); + printf("%c ", f_string_eol); fl_color_print(f_standard_output, data.context.standout, data.context.reset, firewall_command_start); printf(" Turn on the firewall"); - printf("\n "); + printf("%c ", f_string_eol); fl_color_print(f_standard_output, data.context.standout, data.context.reset, firewall_command_stop); printf(" Turn off the firewall"); - printf("\n "); + printf("%c ", f_string_eol); fl_color_print(f_standard_output, data.context.standout, data.context.reset, firewall_command_restart); printf(" Turn off and then turn on the firewall"); - printf("\n "); + printf("%c ", f_string_eol); fl_color_print(f_standard_output, data.context.standout, data.context.reset, firewall_command_lock); printf(" Prevent all communication"); - printf("\n "); + printf("%c ", f_string_eol); fl_color_print(f_standard_output, data.context.standout, data.context.reset, firewall_command_show); printf(" Show active firewall settings"); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, firewall_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" command "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf("\n\n"); + fll_program_print_help_usage(data.context, firewall_name, "command"); return f_none; } @@ -115,10 +62,10 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[firewall_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (status2 == f_none) { - fll_colors_load_context(&data->context, data->parameters[firewall_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[firewall_parameter_light].result == f_console_result_found); } else { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -155,7 +102,7 @@ extern "C" { firewall_print_help(*data); } else if (data->parameters[firewall_parameter_version].result == f_console_result_found) { - fl_program_print_version(firewall_version); + fll_program_print_version(firewall_version); } else { // now determine which command was placed first @@ -739,7 +686,7 @@ extern "C" { f_macro_string_lengths_delete(status, data->remaining); f_macro_string_dynamics_delete(status, data->devices); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index 62d35bf..e9d6cba 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -25,19 +25,18 @@ #include // fll-1 includes -#include +#include #include #include #include -#include #include // fll-2 includes -#include #include #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/firewall/data/build/dependencies b/level_3/firewall/data/build/dependencies index 9e5b969..eab59ce 100644 --- a/level_3/firewall/data/build/dependencies +++ b/level_3/firewall/data/build/dependencies @@ -7,14 +7,13 @@ f_fss f_pipe f_print f_utf -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/firewall/data/build/settings b/level_3/firewall/data/build/settings index b2a89d3..c4fea7d 100644 --- a/level_3/firewall/data/build/settings +++ b/level_3/firewall/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_colors -lf_file -lf_utf -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_color -lf_file -lf_utf -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library firewall.c private-firewall.c diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index d24705f..a5061bc 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -6,108 +6,23 @@ extern "C" { #ifndef _di_fss_basic_list_read_print_help_ f_return_status fss_basic_list_read_print_help(const fss_basic_list_read_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_basic_list_read_name_long); + fll_program_print_help_header(data.context, fss_basic_list_read_name_long, fss_basic_list_read_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_basic_list_read_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_basic_list_read_short_name, fss_basic_list_read_long_name, " Find and print content from this object name."); + fll_program_print_help_option(data.context, fss_basic_list_read_short_count, fss_basic_list_read_long_count, " Find a specific occurrence of the object."); + fll_program_print_help_option(data.context, fss_basic_list_read_short_total, fss_basic_list_read_long_total, " Print the total number of objects in this file."); + fll_program_print_help_option(data.context, fss_basic_list_read_short_object, fss_basic_list_read_long_object, " Print the object instead of the content."); + fll_program_print_help_option(data.context, fss_basic_list_read_short_size, fss_basic_list_read_long_size, " Print total lines in the given content."); + fll_program_print_help_option(data.context, fss_basic_list_read_short_line, fss_basic_list_read_long_line, " Print only the content at the given line."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_short_name); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_long_name); - printf(" Find and print content from this object name"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_short_count); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_long_count); - printf(" Find a specific occurrence of the object"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_short_total); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_long_total); - printf(" Print the total number of objects in this file"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_short_object); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_long_object); - printf(" Print the object instead of the content"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_short_size); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_long_size); - printf(" Print total lines in the given content"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_short_line); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_long_line); - printf(" Print only the content at the given line"); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_read_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" filename(s) "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_basic_list_read_name, "filename(s)"); return f_none; } @@ -124,7 +39,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_basic_list_read_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (f_status_is_error(status2)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -132,7 +47,7 @@ extern "C" { return status2; } else { - fll_colors_load_context(&data->context, data->parameters[fss_basic_list_read_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_basic_list_read_parameter_light].result == f_console_result_found); } } @@ -164,7 +79,7 @@ extern "C" { fss_basic_list_read_print_help(*data); } else if (data->parameters[fss_basic_list_read_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_basic_list_read_version); + fll_program_print_version(fss_basic_list_read_version); } else if (data->remaining.used > 0 || data->process_pipe) { f_string_length counter = 0; @@ -615,7 +530,7 @@ extern "C" { f_macro_string_dynamic_delete(status, data->buffer); f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.h b/level_3/fss_basic_list_read/c/fss_basic_list_read.h index 6f6c5ff..85a58db 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.h @@ -26,17 +26,16 @@ #include // fll-1 includes -#include +#include #include #include #include -#include #include // fll-2 includes -#include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_basic_list_read/data/build/dependencies b/level_3/fss_basic_list_read/data/build/dependencies index 4823a86..fd8beec 100644 --- a/level_3/fss_basic_list_read/data/build/dependencies +++ b/level_3/fss_basic_list_read/data/build/dependencies @@ -6,14 +6,13 @@ f_console f_fss f_pipe f_print -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/fss_basic_list_read/data/build/settings b/level_3/fss_basic_list_read/data/build/settings index b162095..2f6bcb2 100644 --- a/level_3/fss_basic_list_read/data/build/settings +++ b/level_3/fss_basic_list_read/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_color -lf_file -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_basic_list_read.c diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index aa288df..187d67c 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -6,82 +6,20 @@ extern "C" { #ifndef _di_fss_basic_list_write_print_help_ f_return_status fss_basic_list_write_print_help(const fss_basic_list_write_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_basic_list_write_name_long); + fll_program_print_help_header(data.context, fss_basic_list_write_name_long, fss_basic_list_write_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_basic_list_write_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_basic_list_write_short_object, fss_basic_list_write_long_object, " Write an object instead of content."); + fll_program_print_help_option(data.context, fss_basic_list_write_short_file, fss_basic_list_write_long_file, " Specify a file to send output to."); + fll_program_print_help_option(data.context, fss_basic_list_write_short_string, fss_basic_list_write_long_string, " Specify a string to convert."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n"); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_object); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_object); - printf(" Write an object instead of content."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_file); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_file); - printf(" Specify a file to send output to."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_string); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_string); - printf(" Specify a string to convert."); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_basic_list_write_name, ""); return f_none; } @@ -96,7 +34,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_basic_list_write_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (f_status_is_error(status2)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -104,7 +42,7 @@ extern "C" { return status2; } else { - fll_colors_load_context(&data->context, data->parameters[fss_basic_list_write_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_basic_list_write_parameter_light].result == f_console_result_found); } } @@ -136,7 +74,7 @@ extern "C" { fss_basic_list_write_print_help(*data); } else if (data->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_basic_list_write_version); + fll_program_print_version(fss_basic_list_write_version); } else { f_array_length counter = 0; @@ -296,7 +234,7 @@ extern "C" { } // while f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h index 382cb91..ea44cd1 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.h @@ -22,17 +22,16 @@ #include // fll-1 includes -#include +#include #include #include #include #include -#include #include // fll-2 includes -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_basic_list_write/data/build/dependencies b/level_3/fss_basic_list_write/data/build/dependencies index 4823a86..fd8beec 100644 --- a/level_3/fss_basic_list_write/data/build/dependencies +++ b/level_3/fss_basic_list_write/data/build/dependencies @@ -6,14 +6,13 @@ f_console f_fss f_pipe f_print -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/fss_basic_list_write/data/build/settings b/level_3/fss_basic_list_write/data/build/settings index aaee712..3d9820b 100644 --- a/level_3/fss_basic_list_write/data/build/settings +++ b/level_3/fss_basic_list_write/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_color -lf_file -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_basic_list_write.c diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 24b4335..5c23903 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -6,94 +6,21 @@ extern "C" { #ifndef _di_fss_basic_read_print_help_ f_return_status fss_basic_read_print_help(const fss_basic_read_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_basic_read_name_long); + fll_program_print_help_header(data.context, fss_basic_read_name_long, fss_basic_read_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_basic_read_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_basic_read_short_name, fss_basic_read_long_name, " Find and print content from this object name."); + fll_program_print_help_option(data.context, fss_basic_read_short_count, fss_basic_read_long_count, " Find a specific occurrence of the object."); + fll_program_print_help_option(data.context, fss_basic_read_short_total, fss_basic_read_long_total, " Print the total number of objects in this file."); + fll_program_print_help_option(data.context, fss_basic_read_short_object, fss_basic_read_long_object, " Print the object instead of the content."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_short_name); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_long_name); - printf(" Find and print content from this object name"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_short_count); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_long_count); - printf(" Find a specific occurrence of the object"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_short_total); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_long_total); - printf(" Print the total number of objects in this file"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_short_object); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_long_object); - printf(" Print the object instead of the content"); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_read_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" filename(s) "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_basic_read_name, "filename(s)"); return f_none; } @@ -110,7 +37,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_basic_read_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (f_status_is_error(status2)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -118,7 +45,7 @@ extern "C" { return status2; } else { - fll_colors_load_context(&data->context, data->parameters[fss_basic_read_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_basic_read_parameter_light].result == f_console_result_found); } } @@ -150,7 +77,7 @@ extern "C" { fss_basic_read_print_help(*data); } else if (data->parameters[fss_basic_read_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_basic_read_version); + fll_program_print_version(fss_basic_read_version); } else if (data->remaining.used > 0 || data->process_pipe) { f_string_length counter = 0; @@ -504,7 +431,7 @@ extern "C" { f_macro_string_dynamic_delete(status, data->buffer); f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_basic_read/c/fss_basic_read.h b/level_3/fss_basic_read/c/fss_basic_read.h index 1f96c35..6ff2da9 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -26,17 +26,16 @@ #include // fll-1 includes -#include +#include #include #include #include -#include #include // fll-2 includes -#include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_basic_read/data/build/dependencies b/level_3/fss_basic_read/data/build/dependencies index 4823a86..fd8beec 100644 --- a/level_3/fss_basic_read/data/build/dependencies +++ b/level_3/fss_basic_read/data/build/dependencies @@ -6,14 +6,13 @@ f_console f_fss f_pipe f_print -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/fss_basic_read/data/build/settings b/level_3/fss_basic_read/data/build/settings index 0a9782e..9743404 100644 --- a/level_3/fss_basic_read/data/build/settings +++ b/level_3/fss_basic_read/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_color -lf_file -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_basic_read.c diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 64d4ef4..03ede7f 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -6,82 +6,20 @@ extern "C" { #ifndef _di_fss_basic_write_print_help_ f_return_status fss_basic_write_print_help(const fss_basic_write_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_basic_write_name_long); + fll_program_print_help_header(data.context, fss_basic_write_name_long, fss_basic_write_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_basic_write_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_basic_write_short_object, fss_basic_write_long_object, " Write an object instead of content."); + fll_program_print_help_option(data.context, fss_basic_write_short_file, fss_basic_write_long_file, " Specify a file to send output to."); + fll_program_print_help_option(data.context, fss_basic_write_short_string, fss_basic_write_long_string, " Specify a string to convert."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n"); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_object); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_object); - printf(" Write an object instead of content."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_file); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_file); - printf(" Specify a file to send output to."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_string); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_string); - printf(" Specify a string to convert."); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_basic_write_name, ""); return f_none; } @@ -96,7 +34,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_basic_write_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (f_status_is_error(status2)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -104,7 +42,7 @@ extern "C" { return status2; } else { - fll_colors_load_context(&data->context, data->parameters[fss_basic_write_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_basic_write_parameter_light].result == f_console_result_found); } } @@ -136,7 +74,7 @@ extern "C" { fss_basic_write_print_help(*data); } else if (data->parameters[fss_basic_write_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_basic_write_version); + fll_program_print_version(fss_basic_write_version); } else { f_array_length counter = 0; @@ -296,7 +234,7 @@ extern "C" { } // while f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h index 37716b2..2980d51 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -22,16 +22,15 @@ #include // fll-1 includes -#include +#include #include #include #include -#include #include // fll-2 includes -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_basic_write/data/build/dependencies b/level_3/fss_basic_write/data/build/dependencies index 4823a86..fd8beec 100644 --- a/level_3/fss_basic_write/data/build/dependencies +++ b/level_3/fss_basic_write/data/build/dependencies @@ -6,14 +6,13 @@ f_console f_fss f_pipe f_print -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/fss_basic_write/data/build/settings b/level_3/fss_basic_write/data/build/settings index d1d3205..44cc613 100644 --- a/level_3/fss_basic_write/data/build/settings +++ b/level_3/fss_basic_write/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_color -lf_file -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_basic_write.c diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 804d534..9bf5b16 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -6,101 +6,22 @@ extern "C" { #ifndef _di_fss_extended_read_print_help_ f_return_status fss_extended_read_print_help(const fss_extended_read_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_extended_read_name_long); + fll_program_print_help_header(data.context, fss_extended_read_name_long, fss_extended_read_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_extended_read_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_extended_read_short_name, fss_extended_read_long_name, " Find and print content from this object name."); + fll_program_print_help_option(data.context, fss_extended_read_short_count, fss_extended_read_long_count, " Find a specific occurrence of the object."); + fll_program_print_help_option(data.context, fss_extended_read_short_total, fss_extended_read_long_total, " Print the total number of objects in this file."); + fll_program_print_help_option(data.context, fss_extended_read_short_object, fss_extended_read_long_object, " Print the object instead of the content."); + fll_program_print_help_option(data.context, fss_extended_read_short_select, fss_extended_read_long_select, " Select a specific content to print, default is 0."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_short_name); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_long_name); - printf(" Find and print content from this object name"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_short_count); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_long_count); - printf(" Find a specific occurrence of the object"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_short_total); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_long_total); - printf(" Print the total number of objects in this file"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_short_object); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_long_object); - printf(" Print the object instead of the content"); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_short_select); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_long_select); - printf(" Select a specific content to print, default is 0"); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_read_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" filename(s) "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_extended_read_name, "filename(s)"); return f_none; } @@ -117,7 +38,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_extended_read_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (f_status_is_error(status2)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -125,7 +46,7 @@ extern "C" { return status2; } else { - fll_colors_load_context(&data->context, data->parameters[fss_extended_read_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_extended_read_parameter_light].result == f_console_result_found); } } @@ -157,7 +78,7 @@ extern "C" { fss_extended_read_print_help(*data); } else if (data->parameters[fss_extended_read_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_extended_read_version); + fll_program_print_version(fss_extended_read_version); } else if (data->remaining.used > 0 || data->process_pipe) { f_string_length counter = 0; @@ -512,7 +433,7 @@ extern "C" { f_macro_string_dynamic_delete(status, data->buffer); f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_extended_read/c/fss_extended_read.h b/level_3/fss_extended_read/c/fss_extended_read.h index ff0512c..4ac7910 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -26,17 +26,16 @@ #include // fll-1 includes -#include +#include #include #include #include -#include #include // fll-2 includes -#include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_extended_read/data/build/dependencies b/level_3/fss_extended_read/data/build/dependencies index 5fc6035..fd8beec 100644 --- a/level_3/fss_extended_read/data/build/dependencies +++ b/level_3/fss_extended_read/data/build/dependencies @@ -1,19 +1,18 @@ -f_console +f_type f_status -f_fss f_memory +f_string +f_console +f_fss f_pipe f_print -f_string -f_type -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/fss_extended_read/data/build/settings b/level_3/fss_extended_read/data/build/settings index 9232c71..554b231 100644 --- a/level_3/fss_extended_read/data/build/settings +++ b/level_3/fss_extended_read/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_color -lf_file -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_extended_read.c diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 201ee7a..2b67fb6 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -6,89 +6,21 @@ extern "C" { #ifndef _di_fss_extended_write_print_help_ f_return_status fss_extended_write_print_help(const fss_extended_write_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_extended_write_name_long); + fll_program_print_help_header(data.context, fss_extended_write_name_long, fss_extended_write_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_extended_write_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_extended_write_short_object, fss_extended_write_long_object, " Write an object instead of content."); + fll_program_print_help_option(data.context, fss_extended_write_short_file, fss_extended_write_long_file, " Specify a file to send output to."); + fll_program_print_help_option(data.context, fss_extended_write_short_string, fss_extended_write_long_string, " Specify a string to convert."); + fll_program_print_help_option(data.context, fss_extended_write_short_partial, fss_extended_write_long_partial, " For 'content', do not output the end of content character."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n"); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_object); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_object); - printf(" Write an object instead of content."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_file); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_file); - printf(" Specify a file to send output to."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_string); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_string); - printf(" Specify a string to convert."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_partial); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_partial); - printf(" For 'content', do not output the end of content character."); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_extended_write_name, ""); return f_none; } @@ -103,7 +35,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_extended_write_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, data->context); + fl_macro_color_context_new(status2, data->context); if (f_status_is_error(status2)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -111,7 +43,7 @@ extern "C" { return status2; } else { - fll_colors_load_context(&data->context, data->parameters[fss_extended_write_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_extended_write_parameter_light].result == f_console_result_found); } } @@ -143,7 +75,7 @@ extern "C" { fss_extended_write_print_help(*data); } else if (data->parameters[fss_extended_write_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_extended_write_version); + fll_program_print_version(fss_extended_write_version); } else { f_array_length counter = 0; @@ -341,7 +273,7 @@ extern "C" { } // while f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h index fff6db5..a4867e8 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -22,17 +22,16 @@ #include // fll-1 includes -#include +#include #include #include #include #include -#include #include // fll-2 includes -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_extended_write/data/build/dependencies b/level_3/fss_extended_write/data/build/dependencies index 5fc6035..fd8beec 100644 --- a/level_3/fss_extended_write/data/build/dependencies +++ b/level_3/fss_extended_write/data/build/dependencies @@ -1,19 +1,18 @@ -f_console +f_type f_status -f_fss f_memory +f_string +f_console +f_fss f_pipe f_print -f_string -f_type -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/fss_extended_write/data/build/settings b/level_3/fss_extended_write/data/build/settings index 0a24da6..162ecf9 100644 --- a/level_3/fss_extended_write/data/build/settings +++ b/level_3/fss_extended_write/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_color -lf_file -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_extended_write.c diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index 2ae6753..273fd1e 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -6,95 +6,21 @@ extern "C" { #ifndef _di_fss_status_code_print_help_ f_return_status fss_status_code_print_help(const fss_status_code_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", fss_status_code_name_long); + fll_program_print_help_header(data.context, fss_status_code_name_long, fss_status_code_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", fss_status_code_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, fss_status_code_short_is_fine, fss_status_code_long_is_fine, " Print f_true if the error code is not an error."); + fll_program_print_help_option(data.context, fss_status_code_short_is_warning, fss_status_code_long_is_warning, "Print f_true if the error code is a warning."); + fll_program_print_help_option(data.context, fss_status_code_short_is_error, fss_status_code_long_is_error, " Print f_true if the error code is an error."); + fll_program_print_help_option(data.context, fss_status_code_short_number, fss_status_code_long_number, " Convert status code name to number."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n"); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_short_is_fine); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_long_is_fine); - printf(" Returns true if the error code is not an error."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_short_is_warning); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_long_is_warning); - printf(" Returns true if the error code is a warning."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_short_is_error); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_long_is_error); - printf(" Returns true if the error code is an error."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_short_number); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_long_number); - printf(" Convert status code name to number."); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, fss_status_code_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "<"); - - printf(" error code(s) "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, ">"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, fss_status_code_name, "status code(s)"); return f_none; } @@ -109,7 +35,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[fss_status_code_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(allocation_status, data->context); + fl_macro_color_context_new(allocation_status, data->context); if (f_status_is_error(allocation_status)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -117,7 +43,7 @@ extern "C" { return allocation_status; } - fll_colors_load_context(&data->context, data->parameters[fss_status_code_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[fss_status_code_parameter_light].result == f_console_result_found); } if (f_status_is_error(status)) { @@ -148,7 +74,7 @@ extern "C" { fss_status_code_print_help(*data); } else if (data->parameters[fss_status_code_parameter_version].result == f_console_result_found) { - fl_program_print_version(fss_status_code_version); + fll_program_print_version(fss_status_code_version); } else if (data->parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { if (data->remaining.used > 0) { @@ -361,7 +287,7 @@ extern "C" { } // while f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/fss_status_code/c/fss_status_code.h b/level_3/fss_status_code/c/fss_status_code.h index e44119a..4f940f2 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -23,16 +23,15 @@ #include // fll-1 includes -#include +#include #include #include -#include #include // fll-2 includes -#include -#include #include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/fss_status_code/data/build/dependencies b/level_3/fss_status_code/data/build/dependencies index 3850bda..8f6fe51 100644 --- a/level_3/fss_status_code/data/build/dependencies +++ b/level_3/fss_status_code/data/build/dependencies @@ -1,20 +1,24 @@ -f_console +f_type f_status -f_fss f_memory +f_string +f_color +f_console +f_conversion +f_file +f_fss f_pipe f_print -f_string -f_type -fl_colors +f_utf +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors -fll_status +fl_utf fll_execute fll_fss +fll_program +fll_status diff --git a/level_3/fss_status_code/data/build/settings b/level_3/fss_status_code/data/build/settings index 1d0e9ae..db39b7b 100644 --- a/level_3/fss_status_code/data/build/settings +++ b/level_3/fss_status_code/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_status -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_status -lfll_program -lfll_fss -lfll_execute -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_file -lfl_directory -lfl_console -lfl_color -lf_utf -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library fss_status_code.c diff --git a/level_3/init/c/init.c b/level_3/init/c/init.c index 954dfdf..1779e14 100644 --- a/level_3/init/c/init.c +++ b/level_3/init/c/init.c @@ -22,77 +22,20 @@ extern "C" { #ifndef _di_init_print_help_ f_return_status init_print_help(const init_argument argument) { - printf("\n"); - fl_color_print(f_standard_output, argument.context.title, argument.context.reset, " %s", init_name_long); + fll_program_print_help_header(data.context, init_name_long, init_version); - printf("\n"); - fl_color_print(f_standard_output, argument.context.notable, argument.context.reset, " Version %s", init_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + fll_program_print_help_option(data.context, f_console_standard_short_debug, f_console_standard_long_debug, " Enable debugging."); - printf("\n\n"); - fl_color_print(f_standard_output, argument.context.important, argument.context.reset, " Available Options: "); + printf("%c", f_string_eol); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_help); + fll_program_print_help_option(data.context, init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, " Do not attempt to process kernel command line or perform any boot-time specific preparations."); + fll_program_print_help_option(data.context, init_parameter_runlevel_short_name, init_parameter_runlevel_long_name, " Specify a custom run level, ignoring the kernel command line runlevel argument."); - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_debug); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_debug); - printf(" Enable debugging"); - - printf("\n %s", init_parameter_no_prepare_short_name); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_debug); - - printf(", %s", init_parameter_no_prepare_long_name); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_debug); - printf(" Do not attempt to process kernel command line or perform any boot-time specific preparations."); - - printf("\n %s", init_parameter_runlevel_short_name); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_short_debug); - - printf(", %s", init_parameter_runlevel_long_name); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, f_console_standard_long_debug); - printf(" Specify a custom run level, ignoring the kernel command line runlevel argument."); - - printf("\n\n"); - fl_color_print(f_standard_output, argument.context.important, argument.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, argument.context.standout, argument.context.reset, init_name); - - printf(" "); - fl_color_print(f_standard_output, argument.context.notable, argument.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, argument.context.notable, argument.context.reset, "]"); - - printf("\n\n"); + fll_program_print_help_usage(data.context, init_name, ""); return f_none; } @@ -113,10 +56,10 @@ extern "C" { // load colors when not told to show no colors if (argument->parameters[init_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(status2, argument->context); + fl_macro_color_context_new(status2, argument->context); if (status2 == f_none) { - fll_colors_load_context(&argument->context, argument->parameters[init_parameter_light].result == f_console_result_found); + fl_color_load_context(&argument->context, argument->parameters[init_parameter_light].result == f_console_result_found); } else { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); init_delete_argument((*argument)); diff --git a/level_3/init/c/init.h b/level_3/init/c/init.h index f09356e..0c2d4fc 100644 --- a/level_3/init/c/init.h +++ b/level_3/init/c/init.h @@ -201,11 +201,11 @@ extern "C" { #define init_delete_argument(status, argument) \ memset(&argument.parameters, 0, sizeof(f_console_parameter) * init_total_parameters); \ - fl_delete_color_context(status, argument.context); + fl_macro_color_context_delete(status, argument.context); #define init_destroy_argument(status, argument) \ memset(&argument.parameters, 0, sizeof(f_console_parameter) * init_total_parameters); \ - fl_destroy_color_context(status, argument.context); + fl_macro_color_context_destroy(status, argument.context); #endif // _di_init_argument_ #ifndef _di_init_print_version_ diff --git a/level_3/init/data/build/dependencies b/level_3/init/data/build/dependencies index 7c8202b..22893e8 100644 --- a/level_3/init/data/build/dependencies +++ b/level_3/init/data/build/dependencies @@ -1,20 +1,20 @@ -f_console +f_type f_status -f_fss f_memory +f_string +f_color +f_console +f_fss f_pipe f_print -f_string -f_type f_utf -fl_colors +fl_color fl_console fl_directory fl_file fl_fss -fl_program fl_status fl_string -fll_colors fll_execute fll_fss +fll_program diff --git a/level_3/init/data/build/settings b/level_3/init/data/build/settings index 07ee316..cc3d8cd 100644 --- a/level_3/init/data/build/settings +++ b/level_3/init/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_fss -lfll_execute -lfll_colors -lfl_string -lfl_status -lfl_program -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_colors -lf_file -lf_utf -lf_print -lf_pipe -lf_console -lf_memory +build_libraries_fll -lfll_program -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_color -lf_file -lf_utf -lf_print -lf_pipe -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library init.c private-init.c diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index b6a9442..9a64cb5 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -6,95 +6,21 @@ extern "C" { #ifndef _di_status_code_print_help_ f_return_status status_code_print_help(const status_code_data data) { - printf("\n"); - fl_color_print(f_standard_output, data.context.title, data.context.reset, " %s", status_code_name_long); + fll_program_print_help_header(data.context, status_code_name_long, status_code_version); - printf("\n"); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, " Version %s", status_code_version); + fll_program_print_help_option(data.context, f_console_standard_short_help, f_console_standard_long_help, " Print this help message."); + fll_program_print_help_option(data.context, f_console_standard_short_light, f_console_standard_long_light, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(data.context, f_console_standard_short_no_color, f_console_standard_long_no_color, "Do not output in color."); + fll_program_print_help_option(data.context, f_console_standard_short_version, f_console_standard_long_version, " Print only the version number."); + printf("%c", f_string_eol); - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Available Options: "); + fll_program_print_help_option(data.context, status_code_short_is_fine, status_code_long_is_fine, " Print f_true if the error code is not an error."); + fll_program_print_help_option(data.context, status_code_short_is_warning, status_code_long_is_warning, "Print f_true if the error code is a warning."); + fll_program_print_help_option(data.context, status_code_short_is_error, status_code_long_is_error, " Print f_true if the error code is an error."); + fll_program_print_help_option(data.context, status_code_short_number, status_code_long_number, " Convert status code name to number."); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_help); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_help); - printf(" Print this help message"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_light); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_light); - printf(" Output using colors that show up better on light backgrounds"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_no_color); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_no_color); - printf(" Do not output in color"); - - printf("\n %s", f_console_symbol_short_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_short_version); - - printf(", %s", f_console_symbol_long_disable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, f_console_standard_long_version); - printf(" Print only the version number"); - - - printf("\n"); - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_short_is_fine); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_long_is_fine); - printf(" Returns true if the error code is not an error."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_short_is_warning); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_long_is_warning); - printf(" Returns true if the error code is a warning."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_short_is_error); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_long_is_error); - printf(" Returns true if the error code is an error."); - - printf("\n %s", f_console_symbol_short_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_short_number); - - printf(", %s", f_console_symbol_long_enable); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_long_number); - printf(" Convert status code name to number."); - - - printf("\n\n"); - fl_color_print(f_standard_output, data.context.important, data.context.reset, " Usage: "); - - printf("\n "); - fl_color_print(f_standard_output, data.context.standout, data.context.reset, status_code_name); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "["); - - printf(" options "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "]"); - - printf(" "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, "<"); - - printf(" error code(s) "); - fl_color_print(f_standard_output, data.context.notable, data.context.reset, ">"); - - - printf("\n\n"); + fll_program_print_help_usage(data.context, status_code_name, "status code(s)"); return f_none; } @@ -109,7 +35,7 @@ extern "C" { // load colors when not told to show no colors if (data->parameters[status_code_parameter_no_color].result == f_console_result_none) { - fl_new_color_context(allocation_status, data->context); + fl_macro_color_context_new(allocation_status, data->context); if (f_status_is_error(allocation_status)) { fprintf(f_standard_error, "Critical Error: unable to allocate memory\n"); @@ -117,7 +43,7 @@ extern "C" { return allocation_status; } - fll_colors_load_context(&data->context, data->parameters[status_code_parameter_light].result == f_console_result_found); + fl_color_load_context(&data->context, data->parameters[status_code_parameter_light].result == f_console_result_found); } if (f_status_is_error(status)) { @@ -148,7 +74,7 @@ extern "C" { status_code_print_help(*data); } else if (data->parameters[status_code_parameter_version].result == f_console_result_found) { - fl_program_print_version(status_code_version); + fll_program_print_version(status_code_version); } else if (data->parameters[status_code_parameter_is_error].result == f_console_result_found) { if (data->remaining.used > 0) { @@ -360,7 +286,7 @@ extern "C" { } // while f_macro_string_lengths_delete(status, data->remaining); - fl_delete_color_context(status, data->context); + fl_macro_color_context_delete(status, data->context); return f_none; } diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index 1b1b607..5524544 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -21,15 +21,14 @@ #include // fll-1 includes -#include +#include #include #include -#include #include // fll-2 includes -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/status_code/data/build/dependencies b/level_3/status_code/data/build/dependencies index 72a958b..bc7bb00 100644 --- a/level_3/status_code/data/build/dependencies +++ b/level_3/status_code/data/build/dependencies @@ -1,15 +1,19 @@ +f_type +f_status +f_memory +f_string +f_color f_console f_conversion -f_status +f_file f_pipe f_print -f_string -f_type -fl_colors +f_utf +fl_color fl_console fl_file -fl_program -fl_string fl_status -fll_colors +fl_string +fl_utf +fll_program fll_status diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index 75fb187..0d3f2cc 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -10,7 +10,7 @@ version_micro 0 build_compiler gcc build_linker ar build_libraries -lc -build_libraries_fll -lfll_status -lfll_colors -lfl_status -lfl_string -lfl_program -lfl_file -lfl_console -lf_utf -lfl_colors -lf_file -lf_print -lf_pipe -lf_conversion -lf_console -lf_memory +build_libraries_fll -lfll_status -lfll_program -lfl_utf -lfl_string -lfl_status -lfl_file -lfl_console -lfl_color -lf_utf -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_memory #build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0 #build_libraries_fll-monolithic -lfll build_sources_library status_code.c -- 1.8.3.1