From f37161e42b5cd0d220eec248bedca04587b34e50 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 10 Dec 2022 18:00:03 -0600 Subject: [PATCH] Update: Redesign project structure to follow the "main" design used in fss_write. This makes the program structure more consistent. The structure being followed easily allows for a more object-oriented directory structure and design. This design is more accurately closer to "progam-oriented" than "object-oriented" due to the structure revolving around a program. The design of the code itself in fss_write is object-oriented like. Use this code design for fss_status_code and status_code. The other programs do not need to do this and have everything under the "main". --- level_3/iki_read/c/{ => main}/common-print.c | 0 level_3/iki_read/c/{ => main}/common-print.h | 0 level_3/iki_read/c/{ => main}/common.c | 0 level_3/iki_read/c/{ => main}/common.h | 0 level_3/iki_read/c/{ => main}/iki_read.c | 0 level_3/iki_read/c/{ => main}/iki_read.h | 6 +- level_3/iki_read/c/{ => main}/main.c | 0 level_3/iki_read/c/{ => main}/print.c | 0 level_3/iki_read/c/{ => main}/print.h | 0 level_3/iki_read/c/{ => main}/private-common.c | 0 level_3/iki_read/c/{ => main}/private-common.h | 0 level_3/iki_read/c/{ => main}/private-print.c | 0 level_3/iki_read/c/{ => main}/private-print.h | 0 level_3/iki_read/c/{ => main}/private-read.c | 0 level_3/iki_read/c/{ => main}/private-read.h | 0 level_3/iki_read/data/build/settings | 6 +- level_3/iki_write/c/{ => main}/common-print.c | 0 level_3/iki_write/c/{ => main}/common-print.h | 0 level_3/iki_write/c/{ => main}/common.c | 0 level_3/iki_write/c/{ => main}/common.h | 0 level_3/iki_write/c/{ => main}/iki_write.c | 0 level_3/iki_write/c/{ => main}/iki_write.h | 6 +- level_3/iki_write/c/{ => main}/main.c | 0 level_3/iki_write/c/{ => main}/print.c | 0 level_3/iki_write/c/{ => main}/print.h | 0 level_3/iki_write/c/{ => main}/private-common.c | 0 level_3/iki_write/c/{ => main}/private-common.h | 0 level_3/iki_write/c/{ => main}/private-write.c | 0 level_3/iki_write/c/{ => main}/private-write.h | 0 level_3/iki_write/data/build/settings | 6 +- level_3/status_code/c/fss/common.c | 14 +++++ level_3/status_code/c/fss/common.h | 37 ++++++++++++ .../c/{main-fss_status_code.c => fss/main.c} | 16 ++---- .../c/{private-common.c => fss/status_code.c} | 1 - level_3/status_code/c/fss/status_code.h | 58 +++++++++++++++++++ level_3/status_code/c/{ => main}/common-print.c | 0 level_3/status_code/c/{ => main}/common-print.h | 0 level_3/status_code/c/{ => main}/common.c | 2 - level_3/status_code/c/{ => main}/common.h | 27 ++++----- .../c/{main-status_code.c => main/main.c} | 4 ++ level_3/status_code/c/{ => main}/print.c | 17 +++++- level_3/status_code/c/{ => main}/print.h | 0 .../status_code/c/{ => main}/private-status_code.c | 1 - .../status_code/c/{ => main}/private-status_code.h | 0 level_3/status_code/c/{ => main}/status_code.c | 1 - level_3/status_code/c/{ => main}/status_code.h | 6 +- level_3/status_code/c/private-common.h | 19 ------- level_3/status_code/data/build/fakefile | 11 +++- level_3/status_code/data/build/settings | 10 ++-- .../{settings.fss_status_code => settings.fss} | 9 ++- level_3/status_code/data/build/settings.main | 65 ++++++++++++++++++++++ level_3/utf8/c/{ => main}/common-print.c | 0 level_3/utf8/c/{ => main}/common-print.h | 0 level_3/utf8/c/{ => main}/common.c | 0 level_3/utf8/c/{ => main}/common.h | 0 level_3/utf8/c/{ => main}/main.c | 0 level_3/utf8/c/{ => main}/print.c | 0 level_3/utf8/c/{ => main}/print.h | 0 level_3/utf8/c/{ => main}/private-common.c | 0 level_3/utf8/c/{ => main}/private-common.h | 0 level_3/utf8/c/{ => main}/private-utf8.c | 0 level_3/utf8/c/{ => main}/private-utf8.h | 0 .../utf8/c/{ => main}/private-utf8_bytesequence.c | 0 .../utf8/c/{ => main}/private-utf8_bytesequence.h | 0 level_3/utf8/c/{ => main}/private-utf8_codepoint.c | 0 level_3/utf8/c/{ => main}/private-utf8_codepoint.h | 0 level_3/utf8/c/{ => main}/utf8.c | 0 level_3/utf8/c/{ => main}/utf8.h | 6 +- level_3/utf8/data/build/settings | 8 +-- 69 files changed, 249 insertions(+), 87 deletions(-) rename level_3/iki_read/c/{ => main}/common-print.c (100%) rename level_3/iki_read/c/{ => main}/common-print.h (100%) rename level_3/iki_read/c/{ => main}/common.c (100%) rename level_3/iki_read/c/{ => main}/common.h (100%) rename level_3/iki_read/c/{ => main}/iki_read.c (100%) rename level_3/iki_read/c/{ => main}/iki_read.h (94%) rename level_3/iki_read/c/{ => main}/main.c (100%) rename level_3/iki_read/c/{ => main}/print.c (100%) rename level_3/iki_read/c/{ => main}/print.h (100%) rename level_3/iki_read/c/{ => main}/private-common.c (100%) rename level_3/iki_read/c/{ => main}/private-common.h (100%) rename level_3/iki_read/c/{ => main}/private-print.c (100%) rename level_3/iki_read/c/{ => main}/private-print.h (100%) rename level_3/iki_read/c/{ => main}/private-read.c (100%) rename level_3/iki_read/c/{ => main}/private-read.h (100%) rename level_3/iki_write/c/{ => main}/common-print.c (100%) rename level_3/iki_write/c/{ => main}/common-print.h (100%) rename level_3/iki_write/c/{ => main}/common.c (100%) rename level_3/iki_write/c/{ => main}/common.h (100%) rename level_3/iki_write/c/{ => main}/iki_write.c (100%) rename level_3/iki_write/c/{ => main}/iki_write.h (94%) rename level_3/iki_write/c/{ => main}/main.c (100%) rename level_3/iki_write/c/{ => main}/print.c (100%) rename level_3/iki_write/c/{ => main}/print.h (100%) rename level_3/iki_write/c/{ => main}/private-common.c (100%) rename level_3/iki_write/c/{ => main}/private-common.h (100%) rename level_3/iki_write/c/{ => main}/private-write.c (100%) rename level_3/iki_write/c/{ => main}/private-write.h (100%) create mode 100644 level_3/status_code/c/fss/common.c create mode 100644 level_3/status_code/c/fss/common.h rename level_3/status_code/c/{main-fss_status_code.c => fss/main.c} (62%) rename level_3/status_code/c/{private-common.c => fss/status_code.c} (79%) create mode 100644 level_3/status_code/c/fss/status_code.h rename level_3/status_code/c/{ => main}/common-print.c (100%) rename level_3/status_code/c/{ => main}/common-print.h (100%) rename level_3/status_code/c/{ => main}/common.c (99%) rename level_3/status_code/c/{ => main}/common.h (95%) rename level_3/status_code/c/{main-status_code.c => main/main.c} (81%) rename level_3/status_code/c/{ => main}/print.c (94%) rename level_3/status_code/c/{ => main}/print.h (100%) rename level_3/status_code/c/{ => main}/private-status_code.c (99%) rename level_3/status_code/c/{ => main}/private-status_code.h (100%) rename level_3/status_code/c/{ => main}/status_code.c (99%) rename level_3/status_code/c/{ => main}/status_code.h (93%) delete mode 100644 level_3/status_code/c/private-common.h rename level_3/status_code/data/build/{settings.fss_status_code => settings.fss} (75%) create mode 100644 level_3/status_code/data/build/settings.main rename level_3/utf8/c/{ => main}/common-print.c (100%) rename level_3/utf8/c/{ => main}/common-print.h (100%) rename level_3/utf8/c/{ => main}/common.c (100%) rename level_3/utf8/c/{ => main}/common.h (100%) rename level_3/utf8/c/{ => main}/main.c (100%) rename level_3/utf8/c/{ => main}/print.c (100%) rename level_3/utf8/c/{ => main}/print.h (100%) rename level_3/utf8/c/{ => main}/private-common.c (100%) rename level_3/utf8/c/{ => main}/private-common.h (100%) rename level_3/utf8/c/{ => main}/private-utf8.c (100%) rename level_3/utf8/c/{ => main}/private-utf8.h (100%) rename level_3/utf8/c/{ => main}/private-utf8_bytesequence.c (100%) rename level_3/utf8/c/{ => main}/private-utf8_bytesequence.h (100%) rename level_3/utf8/c/{ => main}/private-utf8_codepoint.c (100%) rename level_3/utf8/c/{ => main}/private-utf8_codepoint.h (100%) rename level_3/utf8/c/{ => main}/utf8.c (100%) rename level_3/utf8/c/{ => main}/utf8.h (95%) diff --git a/level_3/iki_read/c/common-print.c b/level_3/iki_read/c/main/common-print.c similarity index 100% rename from level_3/iki_read/c/common-print.c rename to level_3/iki_read/c/main/common-print.c diff --git a/level_3/iki_read/c/common-print.h b/level_3/iki_read/c/main/common-print.h similarity index 100% rename from level_3/iki_read/c/common-print.h rename to level_3/iki_read/c/main/common-print.h diff --git a/level_3/iki_read/c/common.c b/level_3/iki_read/c/main/common.c similarity index 100% rename from level_3/iki_read/c/common.c rename to level_3/iki_read/c/main/common.c diff --git a/level_3/iki_read/c/common.h b/level_3/iki_read/c/main/common.h similarity index 100% rename from level_3/iki_read/c/common.h rename to level_3/iki_read/c/main/common.h diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/main/iki_read.c similarity index 100% rename from level_3/iki_read/c/iki_read.c rename to level_3/iki_read/c/main/iki_read.c diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/main/iki_read.h similarity index 94% rename from level_3/iki_read/c/iki_read.h rename to level_3/iki_read/c/main/iki_read.h index 45f6006..d425d33 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/main/iki_read.h @@ -51,9 +51,9 @@ #include // IKI Read includes. -#include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/iki_read/c/main.c b/level_3/iki_read/c/main/main.c similarity index 100% rename from level_3/iki_read/c/main.c rename to level_3/iki_read/c/main/main.c diff --git a/level_3/iki_read/c/print.c b/level_3/iki_read/c/main/print.c similarity index 100% rename from level_3/iki_read/c/print.c rename to level_3/iki_read/c/main/print.c diff --git a/level_3/iki_read/c/print.h b/level_3/iki_read/c/main/print.h similarity index 100% rename from level_3/iki_read/c/print.h rename to level_3/iki_read/c/main/print.h diff --git a/level_3/iki_read/c/private-common.c b/level_3/iki_read/c/main/private-common.c similarity index 100% rename from level_3/iki_read/c/private-common.c rename to level_3/iki_read/c/main/private-common.c diff --git a/level_3/iki_read/c/private-common.h b/level_3/iki_read/c/main/private-common.h similarity index 100% rename from level_3/iki_read/c/private-common.h rename to level_3/iki_read/c/main/private-common.h diff --git a/level_3/iki_read/c/private-print.c b/level_3/iki_read/c/main/private-print.c similarity index 100% rename from level_3/iki_read/c/private-print.c rename to level_3/iki_read/c/main/private-print.c diff --git a/level_3/iki_read/c/private-print.h b/level_3/iki_read/c/main/private-print.h similarity index 100% rename from level_3/iki_read/c/private-print.h rename to level_3/iki_read/c/main/private-print.h diff --git a/level_3/iki_read/c/private-read.c b/level_3/iki_read/c/main/private-read.c similarity index 100% rename from level_3/iki_read/c/private-read.c rename to level_3/iki_read/c/main/private-read.c diff --git a/level_3/iki_read/c/private-read.h b/level_3/iki_read/c/main/private-read.h similarity index 100% rename from level_3/iki_read/c/private-read.h rename to level_3/iki_read/c/main/private-read.h diff --git a/level_3/iki_read/data/build/settings b/level_3/iki_read/data/build/settings index 4babf3b..57cf750 100644 --- a/level_3/iki_read/data/build/settings +++ b/level_3/iki_read/data/build/settings @@ -22,11 +22,11 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library iki_read.c common.c common-print.c print.c private-common.c private-print.c private-read.c +build_sources_library main/iki_read.c main/common.c main/common-print.c main/print.c main/private-common.c main/private-print.c main/private-read.c -build_sources_program main.c +build_sources_program main/main.c -build_sources_headers iki_read.h common.h common-print.h print.h +build_sources_headers main/iki_read.h main/common.h main/common-print.h main/print.h build_script yes build_shared yes diff --git a/level_3/iki_write/c/common-print.c b/level_3/iki_write/c/main/common-print.c similarity index 100% rename from level_3/iki_write/c/common-print.c rename to level_3/iki_write/c/main/common-print.c diff --git a/level_3/iki_write/c/common-print.h b/level_3/iki_write/c/main/common-print.h similarity index 100% rename from level_3/iki_write/c/common-print.h rename to level_3/iki_write/c/main/common-print.h diff --git a/level_3/iki_write/c/common.c b/level_3/iki_write/c/main/common.c similarity index 100% rename from level_3/iki_write/c/common.c rename to level_3/iki_write/c/main/common.c diff --git a/level_3/iki_write/c/common.h b/level_3/iki_write/c/main/common.h similarity index 100% rename from level_3/iki_write/c/common.h rename to level_3/iki_write/c/main/common.h diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/main/iki_write.c similarity index 100% rename from level_3/iki_write/c/iki_write.c rename to level_3/iki_write/c/main/iki_write.c diff --git a/level_3/iki_write/c/iki_write.h b/level_3/iki_write/c/main/iki_write.h similarity index 94% rename from level_3/iki_write/c/iki_write.h rename to level_3/iki_write/c/main/iki_write.h index 35d96f2..721f413 100644 --- a/level_3/iki_write/c/iki_write.h +++ b/level_3/iki_write/c/main/iki_write.h @@ -51,9 +51,9 @@ #include // IKI Write includes. -#include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/iki_write/c/main.c b/level_3/iki_write/c/main/main.c similarity index 100% rename from level_3/iki_write/c/main.c rename to level_3/iki_write/c/main/main.c diff --git a/level_3/iki_write/c/print.c b/level_3/iki_write/c/main/print.c similarity index 100% rename from level_3/iki_write/c/print.c rename to level_3/iki_write/c/main/print.c diff --git a/level_3/iki_write/c/print.h b/level_3/iki_write/c/main/print.h similarity index 100% rename from level_3/iki_write/c/print.h rename to level_3/iki_write/c/main/print.h diff --git a/level_3/iki_write/c/private-common.c b/level_3/iki_write/c/main/private-common.c similarity index 100% rename from level_3/iki_write/c/private-common.c rename to level_3/iki_write/c/main/private-common.c diff --git a/level_3/iki_write/c/private-common.h b/level_3/iki_write/c/main/private-common.h similarity index 100% rename from level_3/iki_write/c/private-common.h rename to level_3/iki_write/c/main/private-common.h diff --git a/level_3/iki_write/c/private-write.c b/level_3/iki_write/c/main/private-write.c similarity index 100% rename from level_3/iki_write/c/private-write.c rename to level_3/iki_write/c/main/private-write.c diff --git a/level_3/iki_write/c/private-write.h b/level_3/iki_write/c/main/private-write.h similarity index 100% rename from level_3/iki_write/c/private-write.h rename to level_3/iki_write/c/main/private-write.h diff --git a/level_3/iki_write/data/build/settings b/level_3/iki_write/data/build/settings index 9d29ba5..da5f754 100644 --- a/level_3/iki_write/data/build/settings +++ b/level_3/iki_write/data/build/settings @@ -21,11 +21,11 @@ build_libraries-individual -lfll_error -lfll_iki -lfll_print -lfll_program -lfl_ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library iki_write.c common.c common-print.c print.c private-common.c private-write.c +build_sources_library main/iki_write.c main/common.c main/common-print.c main/print.c main/private-common.c main/private-write.c -build_sources_program main.c +build_sources_program main/main.c -build_sources_headers iki_write.h common.h common-print.h print.h +build_sources_headers main/iki_write.h main/common.h main/common-print.h main/print.h build_script yes build_shared yes diff --git a/level_3/status_code/c/fss/common.c b/level_3/status_code/c/fss/common.c new file mode 100644 index 0000000..5587146 --- /dev/null +++ b/level_3/status_code/c/fss/common.c @@ -0,0 +1,14 @@ +#include "status_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_status_code_fss_program_name_s_ + const f_string_static_t status_code_fss_program_name_s = macro_f_string_static_t_initialize(STATUS_CODE_fss_program_name_s, 0, STATUS_CODE_fss_program_name_s_length); + const f_string_static_t status_code_fss_program_name_long_s = macro_f_string_static_t_initialize(STATUS_CODE_fss_program_name_long_s, 0, STATUS_CODE_fss_program_name_long_s_length); +#endif // _di_status_code_fss_program_name_s_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_3/status_code/c/fss/common.h b/level_3/status_code/c/fss/common.h new file mode 100644 index 0000000..4faec02 --- /dev/null +++ b/level_3/status_code/c/fss/common.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Provides the common data structures. + * + * This is auto-included and should not need to be explicitly included. + */ +#ifndef _status_code_fss_common_h +#define _status_code_fss_common_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The program name. + */ +#ifndef _di_status_code_fss_program_name_s_ + #define STATUS_CODE_fss_program_name_s "fss_status_code" + #define STATUS_CODE_fss_program_name_long_s "FSS Status Code" + + #define STATUS_CODE_fss_program_name_s_length 15 + #define STATUS_CODE_fss_program_name_long_s_length 15 + + extern const f_string_static_t status_code_fss_program_name_s; + extern const f_string_static_t status_code_fss_program_name_long_s; +#endif // _di_status_code_program_name_s_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_fss_common_h diff --git a/level_3/status_code/c/main-fss_status_code.c b/level_3/status_code/c/fss/main.c similarity index 62% rename from level_3/status_code/c/main-fss_status_code.c rename to level_3/status_code/c/fss/main.c index afdfd5f..baf7772 100644 --- a/level_3/status_code/c/main-fss_status_code.c +++ b/level_3/status_code/c/fss/main.c @@ -1,17 +1,14 @@ #include "status_code.h" - -// FLL-2 includes. -#include - -#ifndef _di_status_code_program_name_s_ - const f_string_static_t status_code_program_name_s = macro_f_string_static_t_initialize(STATUS_CODE_program_name_s, 0, STATUS_CODE_program_name_s_length); - const f_string_static_t status_code_program_name_long_s = macro_f_string_static_t_initialize(STATUS_CODE_program_name_long_s, 0, STATUS_CODE_program_name_long_s_length); -#endif // _di_status_code_program_name_s_ +#include "../main/status_code.h" int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; status_code_setting_t setting = status_code_setting_t_initialize; + setting.program_name = &status_code_fss_program_name_s; + setting.program_name_long = &status_code_fss_program_name_long_s; + setting.status_string_from = &fll_fss_status_string_from; + setting.status_string_to = &fll_fss_status_string_to; f_console_parameter_t parameters[] = status_code_console_parameter_t_initialize; data.parameters.array = parameters; @@ -28,9 +25,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp); status_code_setting_load(arguments, &data, &setting); - - setting.status_string_from = &fll_fss_status_string_from; - setting.status_string_to = &fll_fss_status_string_to; } status_code_main(&data, &setting); diff --git a/level_3/status_code/c/private-common.c b/level_3/status_code/c/fss/status_code.c similarity index 79% rename from level_3/status_code/c/private-common.c rename to level_3/status_code/c/fss/status_code.c index 7540b79..4740201 100644 --- a/level_3/status_code/c/private-common.c +++ b/level_3/status_code/c/fss/status_code.c @@ -1,5 +1,4 @@ #include "status_code.h" -#include "private-common.h" #ifdef __cplusplus extern "C" { diff --git a/level_3/status_code/c/fss/status_code.h b/level_3/status_code/c/fss/status_code.h new file mode 100644 index 0000000..1c70154 --- /dev/null +++ b/level_3/status_code/c/fss/status_code.h @@ -0,0 +1,58 @@ +/** + * FLL - Level 3 + * + * Project: Status Code + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * This program provides status code to/from string translation. + */ +#ifndef _status_code_fss_h +#define _status_code_fss_h + +// Libc includes. +#include +#include +#include +#include + +// FLL-0 includes. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FLL-1 includes. +#include +#include +#include + +// FLL-2 includes. +#include +#include +#include +#include + +// Status Code includes. +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _status_code_fss_h diff --git a/level_3/status_code/c/common-print.c b/level_3/status_code/c/main/common-print.c similarity index 100% rename from level_3/status_code/c/common-print.c rename to level_3/status_code/c/main/common-print.c diff --git a/level_3/status_code/c/common-print.h b/level_3/status_code/c/main/common-print.h similarity index 100% rename from level_3/status_code/c/common-print.h rename to level_3/status_code/c/main/common-print.h diff --git a/level_3/status_code/c/common.c b/level_3/status_code/c/main/common.c similarity index 99% rename from level_3/status_code/c/common.c rename to level_3/status_code/c/main/common.c index 1ba6c32..a7a7529 100644 --- a/level_3/status_code/c/common.c +++ b/level_3/status_code/c/main/common.c @@ -53,8 +53,6 @@ extern "C" { if (!main || !setting) return; - setting->flag = 0; - // Load parameters. setting->status = f_console_parameter_process(arguments, &main->parameters); diff --git a/level_3/status_code/c/common.h b/level_3/status_code/c/main/common.h similarity index 95% rename from level_3/status_code/c/common.h rename to level_3/status_code/c/main/common.h index 15f310f..ce0b119 100644 --- a/level_3/status_code/c/common.h +++ b/level_3/status_code/c/main/common.h @@ -49,19 +49,11 @@ extern "C" { * The program name. */ #ifndef _di_status_code_program_name_s_ - #ifdef _status_code_as_fss_status_code - #define STATUS_CODE_program_name_s "fss_status_code" - #define STATUS_CODE_program_name_long_s "FSS Status Code" + #define STATUS_CODE_program_name_s "status_code" + #define STATUS_CODE_program_name_long_s "Status Code" - #define STATUS_CODE_program_name_s_length 15 - #define STATUS_CODE_program_name_long_s_length 15 - #else - #define STATUS_CODE_program_name_s "status_code" - #define STATUS_CODE_program_name_long_s "Status Code" - - #define STATUS_CODE_program_name_s_length 11 - #define STATUS_CODE_program_name_long_s_length 11 - #endif // _status_code_as_fss_status_code + #define STATUS_CODE_program_name_s_length 11 + #define STATUS_CODE_program_name_long_s_length 11 extern const f_string_static_t status_code_program_name_s; extern const f_string_static_t status_code_program_name_long_s; @@ -230,7 +222,7 @@ extern "C" { * line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not. * line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not. * - * status_string_from: A pointer to the status string function (usually either f_status_string_from() or fll_fss_status_string_from()). + * status_string_from: A pointer to the status string function (usually either fll_status_string_from() or fll_fss_status_string_from()). * status_string_to: A pointer to the status string function (usually either f_status_string_to() or fll_fss_status_string_to()). */ #ifndef _di_status_code_setting_t_ @@ -242,6 +234,9 @@ extern "C" { f_string_static_t line_first; f_string_static_t line_last; + const f_string_static_t *program_name; + const f_string_static_t *program_name_long; + f_status_t (*status_string_from)(const f_string_static_t name, f_status_t * const code); f_status_t (*status_string_to)(const f_status_t code, f_string_static_t * const name); } status_code_setting_t; @@ -252,8 +247,10 @@ extern "C" { F_none, \ f_string_static_t_initialize, \ f_string_static_t_initialize, \ - &fll_status_string_from, \ - &f_status_string_to, \ + 0, \ + 0, \ + 0, \ + 0, \ } #endif // _di_status_code_setting_t_ diff --git a/level_3/status_code/c/main-status_code.c b/level_3/status_code/c/main/main.c similarity index 81% rename from level_3/status_code/c/main-status_code.c rename to level_3/status_code/c/main/main.c index 5c7ac19..1771c67 100644 --- a/level_3/status_code/c/main-status_code.c +++ b/level_3/status_code/c/main/main.c @@ -4,6 +4,10 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; status_code_setting_t setting = status_code_setting_t_initialize; + setting.program_name = &status_code_program_name_s; + setting.program_name_long = &status_code_program_name_long_s; + setting.status_string_from = &fll_status_string_from; + setting.status_string_to = &f_status_string_to; f_console_parameter_t parameters[] = status_code_console_parameter_t_initialize; data.parameters.array = parameters; diff --git a/level_3/status_code/c/print.c b/level_3/status_code/c/main/print.c similarity index 94% rename from level_3/status_code/c/print.c rename to level_3/status_code/c/main/print.c index 4b1c474..2792eb8 100644 --- a/level_3/status_code/c/print.c +++ b/level_3/status_code/c/main/print.c @@ -1,5 +1,4 @@ #include "status_code.h" -#include "private-common.h" #include "print.h" #ifdef __cplusplus @@ -91,7 +90,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, status_code_program_name_long_s, status_code_program_version_s); + fll_program_print_help_header( + print, + setting->program_name_long + ? *setting->program_name_long + : status_code_program_name_long_s, + status_code_program_version_s + ); fll_program_print_help_option_standard(print); @@ -105,7 +110,13 @@ extern "C" { f_print_dynamic_raw(f_string_eol_s, print.to); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, status_code_program_name_s, status_code_program_help_parameters_s); + fll_program_print_help_usage( + print, + setting->program_name + ? *setting->program_name + : status_code_program_name_s, + status_code_program_help_parameters_s + ); f_print_dynamic_raw(setting->line_last, print.to); diff --git a/level_3/status_code/c/print.h b/level_3/status_code/c/main/print.h similarity index 100% rename from level_3/status_code/c/print.h rename to level_3/status_code/c/main/print.h diff --git a/level_3/status_code/c/private-status_code.c b/level_3/status_code/c/main/private-status_code.c similarity index 99% rename from level_3/status_code/c/private-status_code.c rename to level_3/status_code/c/main/private-status_code.c index 2eb0c0e..8613610 100644 --- a/level_3/status_code/c/private-status_code.c +++ b/level_3/status_code/c/main/private-status_code.c @@ -1,5 +1,4 @@ #include "status_code.h" -#include "private-common.h" #include "private-status_code.h" #ifdef __cplusplus diff --git a/level_3/status_code/c/private-status_code.h b/level_3/status_code/c/main/private-status_code.h similarity index 100% rename from level_3/status_code/c/private-status_code.h rename to level_3/status_code/c/main/private-status_code.h diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/main/status_code.c similarity index 99% rename from level_3/status_code/c/status_code.c rename to level_3/status_code/c/main/status_code.c index bedbeb1..2b42044 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/main/status_code.c @@ -1,5 +1,4 @@ #include "status_code.h" -#include "private-common.h" #include "private-status_code.h" #ifdef __cplusplus diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/main/status_code.h similarity index 93% rename from level_3/status_code/c/status_code.h rename to level_3/status_code/c/main/status_code.h index 7baab5f..a710823 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/main/status_code.h @@ -42,9 +42,9 @@ #include // Status Code includes. -#include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/status_code/c/private-common.h b/level_3/status_code/c/private-common.h deleted file mode 100644 index dc1d6a4..0000000 --- a/level_3/status_code/c/private-common.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: Status Code - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_common_h -#define _PRIVATE_common_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_common_h diff --git a/level_3/status_code/data/build/fakefile b/level_3/status_code/data/build/fakefile index 218debe..72b7d6a 100644 --- a/level_3/status_code/data/build/fakefile +++ b/level_3/status_code/data/build/fakefile @@ -14,8 +14,15 @@ main: using_default: build settings - build settings.fss_status_code + build settings.main + build settings.fss using_mode: build settings parameter:'mode:value' - build settings.fss_status_code parameter:'mode:value' + build settings.main parameter:'mode:value' + build settings.fss parameter:'mode:value' + +install: + shell ./install.sh parameter:'work' + shell ./install.sh parameter:'work' -s data/build/settings.main + shell ./install.sh parameter:'work' -s data/build/settings.fss diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index 3889dfb..ee7116c 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -1,6 +1,6 @@ # fss-0001 # -# Settings for the "status_code" program. +# Builds the main library of the project with all parts except "main" program related. # build_name status_code @@ -25,11 +25,11 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status_st build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library status_code.c common.c common-print.c print.c private-common.c private-status_code.c +build_sources_library main/status_code.c main/common.c main/common-print.c main/print.c main/private-status_code.c +build_sources_library fss/status_code.c fss/common.c -build_sources_program main-status_code.c - -build_sources_headers status_code.h common.h common-print.h print.h +build_sources_headers main/status_code.h main/common.h main/common-print.h main/print.h +build_sources_headers fss/status_code.h fss/common.h build_script yes build_shared yes diff --git a/level_3/status_code/data/build/settings.fss_status_code b/level_3/status_code/data/build/settings.fss similarity index 75% rename from level_3/status_code/data/build/settings.fss_status_code rename to level_3/status_code/data/build/settings.fss index dedfadb..8031b35 100644 --- a/level_3/status_code/data/build/settings.fss_status_code +++ b/level_3/status_code/data/build/settings.fss @@ -1,6 +1,7 @@ # fss-0001 # -# Settings for the "fss_status_code" program. +# Builds the "fss" program (fss_status_code). +# This must be called after the "setting". # build_name fss_status_code @@ -21,11 +22,11 @@ build_indexer_arguments rcs build_language c build_libraries -lc -lstatus_code -build_libraries-individual -lfll_error -lfll_fss_status_string -lfll_print -lfll_program -lfll_status_string -lfl_conversion -lfl_fss -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_fss -lf_memory -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf +build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status_string -lfl_conversion -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_program main-fss_status_code.c +build_sources_program fss/main.c build_script yes build_shared yes @@ -51,8 +52,6 @@ search_static yes environment PATH LD_LIBRARY_PATH -defines -D_status_code_as_fss_status_code - #defines -D_di_libcap_ -D_di_thread_support_ defines -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_ diff --git a/level_3/status_code/data/build/settings.main b/level_3/status_code/data/build/settings.main new file mode 100644 index 0000000..5e3991e --- /dev/null +++ b/level_3/status_code/data/build/settings.main @@ -0,0 +1,65 @@ +# fss-0001 +# +# Builds the "main" program (status_code). +# This must be called after the "setting". +# + +build_name status_code + +version_major 0 +version_minor 7 +version_micro 0 +version_file micro +version_target minor + +modes individual level monolithic clang test +modes_default monolithic + +build_compiler gcc +build_compiler-clang clang +build_indexer ar +build_indexer_arguments rcs +build_language c + +build_libraries -lc -lstatus_code +build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status_string -lfl_conversion -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_pipe -lf_print -lf_signal -lf_status_string -lf_string -lf_type_array -lf_utf +build_libraries-level -lfll_2 -lfll_1 -lfll_0 +build_libraries-monolithic -lfll + +build_sources_program main/main.c + +build_script yes +build_shared yes +build_static no + +path_headers program/status_code +path_library_script script +path_library_shared shared +path_library_static static +path_object_script script +path_object_shared shared +path_object_static static +path_program_script script +path_program_shared shared +path_program_static static + +has_path_standard yes +preserve_path_headers yes + +search_exclusive yes +search_shared yes +search_static yes + +environment PATH LD_LIBRARY_PATH + +#defines -D_di_libcap_ -D_di_thread_support_ +defines -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_ + +flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses -Wno-missing-braces +flags-clang -Wno-logical-op-parentheses +flags-test -O0 -fstack-protector -Wall +flags-coverage -O0 --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ + +flags_library -fPIC +flags_object -fPIC +flags_program -fPIE diff --git a/level_3/utf8/c/common-print.c b/level_3/utf8/c/main/common-print.c similarity index 100% rename from level_3/utf8/c/common-print.c rename to level_3/utf8/c/main/common-print.c diff --git a/level_3/utf8/c/common-print.h b/level_3/utf8/c/main/common-print.h similarity index 100% rename from level_3/utf8/c/common-print.h rename to level_3/utf8/c/main/common-print.h diff --git a/level_3/utf8/c/common.c b/level_3/utf8/c/main/common.c similarity index 100% rename from level_3/utf8/c/common.c rename to level_3/utf8/c/main/common.c diff --git a/level_3/utf8/c/common.h b/level_3/utf8/c/main/common.h similarity index 100% rename from level_3/utf8/c/common.h rename to level_3/utf8/c/main/common.h diff --git a/level_3/utf8/c/main.c b/level_3/utf8/c/main/main.c similarity index 100% rename from level_3/utf8/c/main.c rename to level_3/utf8/c/main/main.c diff --git a/level_3/utf8/c/print.c b/level_3/utf8/c/main/print.c similarity index 100% rename from level_3/utf8/c/print.c rename to level_3/utf8/c/main/print.c diff --git a/level_3/utf8/c/print.h b/level_3/utf8/c/main/print.h similarity index 100% rename from level_3/utf8/c/print.h rename to level_3/utf8/c/main/print.h diff --git a/level_3/utf8/c/private-common.c b/level_3/utf8/c/main/private-common.c similarity index 100% rename from level_3/utf8/c/private-common.c rename to level_3/utf8/c/main/private-common.c diff --git a/level_3/utf8/c/private-common.h b/level_3/utf8/c/main/private-common.h similarity index 100% rename from level_3/utf8/c/private-common.h rename to level_3/utf8/c/main/private-common.h diff --git a/level_3/utf8/c/private-utf8.c b/level_3/utf8/c/main/private-utf8.c similarity index 100% rename from level_3/utf8/c/private-utf8.c rename to level_3/utf8/c/main/private-utf8.c diff --git a/level_3/utf8/c/private-utf8.h b/level_3/utf8/c/main/private-utf8.h similarity index 100% rename from level_3/utf8/c/private-utf8.h rename to level_3/utf8/c/main/private-utf8.h diff --git a/level_3/utf8/c/private-utf8_bytesequence.c b/level_3/utf8/c/main/private-utf8_bytesequence.c similarity index 100% rename from level_3/utf8/c/private-utf8_bytesequence.c rename to level_3/utf8/c/main/private-utf8_bytesequence.c diff --git a/level_3/utf8/c/private-utf8_bytesequence.h b/level_3/utf8/c/main/private-utf8_bytesequence.h similarity index 100% rename from level_3/utf8/c/private-utf8_bytesequence.h rename to level_3/utf8/c/main/private-utf8_bytesequence.h diff --git a/level_3/utf8/c/private-utf8_codepoint.c b/level_3/utf8/c/main/private-utf8_codepoint.c similarity index 100% rename from level_3/utf8/c/private-utf8_codepoint.c rename to level_3/utf8/c/main/private-utf8_codepoint.c diff --git a/level_3/utf8/c/private-utf8_codepoint.h b/level_3/utf8/c/main/private-utf8_codepoint.h similarity index 100% rename from level_3/utf8/c/private-utf8_codepoint.h rename to level_3/utf8/c/main/private-utf8_codepoint.h diff --git a/level_3/utf8/c/utf8.c b/level_3/utf8/c/main/utf8.c similarity index 100% rename from level_3/utf8/c/utf8.c rename to level_3/utf8/c/main/utf8.c diff --git a/level_3/utf8/c/utf8.h b/level_3/utf8/c/main/utf8.h similarity index 95% rename from level_3/utf8/c/utf8.h rename to level_3/utf8/c/main/utf8.h index 668cbcd..4347b81 100644 --- a/level_3/utf8/c/utf8.h +++ b/level_3/utf8/c/main/utf8.h @@ -55,9 +55,9 @@ #include // UTF-8 includes. -#include -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_3/utf8/data/build/settings b/level_3/utf8/data/build/settings index 210338f..f1838f7 100644 --- a/level_3/utf8/data/build/settings +++ b/level_3/utf8/data/build/settings @@ -22,12 +22,12 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll -build_sources_library common.c common-print.c print.c utf8.c -build_sources_library private-common.c private-utf8.c private-utf8_bytesequence.c private-utf8_codepoint.c +build_sources_library main/common.c main/common-print.c main/print.c main/utf8.c +build_sources_library main/private-common.c main/private-utf8.c main/private-utf8_bytesequence.c main/private-utf8_codepoint.c -build_sources_program main.c +build_sources_program main/main.c -build_sources_headers common.h common-print.h print.h utf8.h +build_sources_headers main/common.h main/common-print.h main/print.h main/utf8.h build_script yes build_shared yes -- 1.8.3.1