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".
#include <fll/level_2/program.h>
// IKI Read includes.
-#include <program/iki_read/common.h>
-#include <program/iki_read/common-print.h>
-#include <program/iki_read/print.h>
+#include <program/iki_read/main/common.h>
+#include <program/iki_read/main/common-print.h>
+#include <program/iki_read/main/print.h>
#ifdef __cplusplus
extern "C" {
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
#include <fll/level_2/program.h>
// IKI Write includes.
-#include <program/iki_write/common.h>
-#include <program/iki_write/common-print.h>
-#include <program/iki_write/print.h>
+#include <program/iki_write/main/common.h>
+#include <program/iki_write/main/common-print.h>
+#include <program/iki_write/main/print.h>
#ifdef __cplusplus
extern "C" {
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
--- /dev/null
+#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
--- /dev/null
+/**
+ * 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
#include "status_code.h"
-
-// FLL-2 includes.
-#include <fll/level_2/fss_status_string.h>
-
-#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;
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);
#include "status_code.h"
-#include "private-common.h"
#ifdef __cplusplus
extern "C" {
--- /dev/null
+/**
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+// FLL-0 includes.
+#include <fll/level_0/type.h>
+#include <fll/level_0/status.h>
+#include <fll/level_0/memory.h>
+#include <fll/level_0/string.h>
+#include <fll/level_0/utf.h>
+#include <fll/level_0/color.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/console.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+#include <fll/level_0/status_string.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/print.h>
+#include <fll/level_1/string.h>
+
+// FLL-2 includes.
+#include <fll/level_2/error.h>
+#include <fll/level_2/fss_status_string.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// Status Code includes.
+#include <program/status_code/main/common.h>
+#include <program/status_code/main/common-print.h>
+#include <program/status_code/fss/common.h>
+#include <program/status_code/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _status_code_fss_h
if (!main || !setting) return;
- setting->flag = 0;
-
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
* 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;
* 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_
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;
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_
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;
#include "status_code.h"
-#include "private-common.h"
#include "print.h"
#ifdef __cplusplus
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);
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);
#include "status_code.h"
-#include "private-common.h"
#include "private-status_code.h"
#ifdef __cplusplus
#include "status_code.h"
-#include "private-common.h"
#include "private-status_code.h"
#ifdef __cplusplus
#include <fll/level_2/status_string.h>
// Status Code includes.
-#include <program/status_code/common.h>
-#include <program/status_code/common-print.h>
-#include <program/status_code/print.h>
+#include <program/status_code/main/common.h>
+#include <program/status_code/main/common-print.h>
+#include <program/status_code/main/print.h>
#ifdef __cplusplus
extern "C" {
+++ /dev/null
-/**
- * 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
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
# 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
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
# 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
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
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_
--- /dev/null
+# 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
#include <fll/level_2/program.h>
// UTF-8 includes.
-#include <program/utf8/common.h>
-#include <program/utf8/common-print.h>
-#include <program/utf8/print.h>
+#include <program/utf8/main/common.h>
+#include <program/utf8/main/common-print.h>
+#include <program/utf8/main/print.h>
#ifdef __cplusplus
extern "C" {
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