]> Kevux Git Server - fll/commitdiff
Progress: Stub out the fss_write program.
authorKevin Day <thekevinday@gmail.com>
Wed, 23 Nov 2022 03:16:20 +0000 (21:16 -0600)
committerKevin Day <thekevinday@gmail.com>
Wed, 23 Nov 2022 03:16:20 +0000 (21:16 -0600)
The fss_write program is going to replace all of the other fss_X_write programs.
This is the initial setup and may not be the final structure.
I still have some fiddlign to do to figure out how I want them to share code.

The final result is intended to have the fss_write being capable of compiling all of the fss_X_write programs as well as the fss_write program.

93 files changed:
level_3/fss_write/c/basic/basic.c [new file with mode: 0644]
level_3/fss_write/c/basic/basic.h [new file with mode: 0644]
level_3/fss_write/c/basic/common.c [new file with mode: 0644]
level_3/fss_write/c/basic/common.h [new file with mode: 0644]
level_3/fss_write/c/basic/main.c [new file with mode: 0644]
level_3/fss_write/c/basic/print.c [new file with mode: 0644]
level_3/fss_write/c/basic/print.h [new file with mode: 0644]
level_3/fss_write/c/basic/private-common.c [new file with mode: 0644]
level_3/fss_write/c/basic/private-common.h [new file with mode: 0644]
level_3/fss_write/c/basic/private-print.c [new file with mode: 0644]
level_3/fss_write/c/basic/private-print.h [new file with mode: 0644]
level_3/fss_write/c/basic/private-write.c [new file with mode: 0644]
level_3/fss_write/c/basic/private-write.h [new file with mode: 0644]
level_3/fss_write/c/basic_list/basic_list.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/basic_list.h [new file with mode: 0644]
level_3/fss_write/c/basic_list/common.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/common.h [new file with mode: 0644]
level_3/fss_write/c/basic_list/main.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/print.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/print.h [new file with mode: 0644]
level_3/fss_write/c/basic_list/private-common.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/private-common.h [new file with mode: 0644]
level_3/fss_write/c/basic_list/private-print.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/private-print.h [new file with mode: 0644]
level_3/fss_write/c/basic_list/private-write.c [new file with mode: 0644]
level_3/fss_write/c/basic_list/private-write.h [new file with mode: 0644]
level_3/fss_write/c/embedded_list/common.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/common.h [new file with mode: 0644]
level_3/fss_write/c/embedded_list/embedded_list.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/embedded_list.h [new file with mode: 0644]
level_3/fss_write/c/embedded_list/main.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/print.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/print.h [new file with mode: 0644]
level_3/fss_write/c/embedded_list/private-common.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/private-common.h [new file with mode: 0644]
level_3/fss_write/c/embedded_list/private-print.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/private-print.h [new file with mode: 0644]
level_3/fss_write/c/embedded_list/private-write.c [new file with mode: 0644]
level_3/fss_write/c/embedded_list/private-write.h [new file with mode: 0644]
level_3/fss_write/c/extended/common.c [new file with mode: 0644]
level_3/fss_write/c/extended/common.h [new file with mode: 0644]
level_3/fss_write/c/extended/extended.c [new file with mode: 0644]
level_3/fss_write/c/extended/extended.h [new file with mode: 0644]
level_3/fss_write/c/extended/main.c [new file with mode: 0644]
level_3/fss_write/c/extended/print.c [new file with mode: 0644]
level_3/fss_write/c/extended/print.h [new file with mode: 0644]
level_3/fss_write/c/extended/private-common.c [new file with mode: 0644]
level_3/fss_write/c/extended/private-common.h [new file with mode: 0644]
level_3/fss_write/c/extended/private-print.c [new file with mode: 0644]
level_3/fss_write/c/extended/private-print.h [new file with mode: 0644]
level_3/fss_write/c/extended/private-write.c [new file with mode: 0644]
level_3/fss_write/c/extended/private-write.h [new file with mode: 0644]
level_3/fss_write/c/extended_list/common.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/common.h [new file with mode: 0644]
level_3/fss_write/c/extended_list/extended_list.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/extended_list.h [new file with mode: 0644]
level_3/fss_write/c/extended_list/main.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/print.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/print.h [new file with mode: 0644]
level_3/fss_write/c/extended_list/private-common.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/private-common.h [new file with mode: 0644]
level_3/fss_write/c/extended_list/private-print.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/private-print.h [new file with mode: 0644]
level_3/fss_write/c/extended_list/private-write.c [new file with mode: 0644]
level_3/fss_write/c/extended_list/private-write.h [new file with mode: 0644]
level_3/fss_write/c/main/common.c [new file with mode: 0644]
level_3/fss_write/c/main/common.h [new file with mode: 0644]
level_3/fss_write/c/main/fss_write.c [new file with mode: 0644]
level_3/fss_write/c/main/fss_write.h [new file with mode: 0644]
level_3/fss_write/c/main/main.c [new file with mode: 0644]
level_3/fss_write/c/main/print.c [new file with mode: 0644]
level_3/fss_write/c/main/print.h [new file with mode: 0644]
level_3/fss_write/c/main/private-common.c [new file with mode: 0644]
level_3/fss_write/c/main/private-common.h [new file with mode: 0644]
level_3/fss_write/c/main/private-write.c [new file with mode: 0644]
level_3/fss_write/c/main/private-write.h [new file with mode: 0644]
level_3/fss_write/c/payload/common.c [new file with mode: 0644]
level_3/fss_write/c/payload/common.h [new file with mode: 0644]
level_3/fss_write/c/payload/main.c [new file with mode: 0644]
level_3/fss_write/c/payload/payload.c [new file with mode: 0644]
level_3/fss_write/c/payload/payload.h [new file with mode: 0644]
level_3/fss_write/c/payload/print.c [new file with mode: 0644]
level_3/fss_write/c/payload/print.h [new file with mode: 0644]
level_3/fss_write/c/payload/private-common.c [new file with mode: 0644]
level_3/fss_write/c/payload/private-common.h [new file with mode: 0644]
level_3/fss_write/c/payload/private-print.c [new file with mode: 0644]
level_3/fss_write/c/payload/private-print.h [new file with mode: 0644]
level_3/fss_write/c/payload/private-write.c [new file with mode: 0644]
level_3/fss_write/c/payload/private-write.h [new file with mode: 0644]
level_3/fss_write/data/build/defines [new file with mode: 0644]
level_3/fss_write/data/build/dependencies [new file with mode: 0644]
level_3/fss_write/data/build/fakefile [new file with mode: 0644]
level_3/fss_write/data/build/settings [new file with mode: 0644]

diff --git a/level_3/fss_write/c/basic/basic.c b/level_3/fss_write/c/basic/basic.c
new file mode 100644 (file)
index 0000000..4fd48b9
--- /dev/null
@@ -0,0 +1,19 @@
+#include "fss_write_basic.h"
+#include "private-common.h"
+#include "private-basic.h"
+#include "../main/fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_basic_process_help_
+  void fss_write_basic_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    fss_write_basic_print_help(main, setting);
+  }
+#endif // _di_fss_write_basic_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic/basic.h b/level_3/fss_write/c/basic/basic.h
new file mode 100644 (file)
index 0000000..a431e08
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for the FSS-0000 Basic.
+ */
+#ifndef _fss_write_basic_h
+#define _fss_write_basic_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/basic.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/basic.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/basic/common.h>
+#include <program/fss_write/main/common.h>
+#include <program/fss_write/basic/print.h>
+#include <program/fss_write/main/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Process help for FSS-0000 (Basic).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any other failure.
+ */
+#ifndef _di_fss_write_basic_process_help_
+  extern void fss_write_basic_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_basic_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_basic_h
diff --git a/level_3/fss_write/c/basic/common.c b/level_3/fss_write/c/basic/common.c
new file mode 100644 (file)
index 0000000..3b1ba69
--- /dev/null
@@ -0,0 +1,13 @@
+#include "basic.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_basic_strings_
+  const f_string_static_t fss_write_basic_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_standard_s, 0, FSS_WRITE_basic_standard_s_length);
+#endif // _di_fss_write_basic_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic/common.h b/level_3/fss_write/c/basic/common.h
new file mode 100644 (file)
index 0000000..e2f9e85
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_basic_common_h
+#define _fss_write_basic_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The FSS-0000 (Basic) specific strings.
+ */
+#ifndef _di_fss_write_basic_strings_
+  #define FSS_WRITE_basic_standard_s "FSS-0000 (Basic)"
+
+  #define FSS_WRITE_basic_standard_s_length 16
+
+  extern const f_string_static_t fss_write_basic_standard_s;
+#endif // _di_fss_write_basic_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_basic_common_h
diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c
new file mode 100644 (file)
index 0000000..b982c3c
--- /dev/null
@@ -0,0 +1,39 @@
+#include "basic.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+  setting.process_help = &fss_write_basic_print_help;
+  setting.process_pipe = &fss_write_basic_process_pipe;
+  setting.process_normal = &fss_write_basic_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_basic_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/basic/print.c b/level_3/fss_write/c/basic/print.c
new file mode 100644 (file)
index 0000000..378d12a
--- /dev/null
@@ -0,0 +1,34 @@
+#include "basic.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_basic_print_help_
+  f_status_t fss_write_basic_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    f_file_stream_lock(print.to);
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+
+    fss_write_print_help(setting, print);
+
+    fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+
+    // @todo
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    f_file_stream_flush(print.to);
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_basic_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic/print.h b/level_3/fss_write/c/basic/print.h
new file mode 100644 (file)
index 0000000..491dc41
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_basic_print_h
+#define _fss_write_basic_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for FSS-0000 (Basic).
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_basic_print_help_
+  extern f_status_t fss_write_basic_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_basic_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_basic_print_h
diff --git a/level_3/fss_write/c/basic/private-common.c b/level_3/fss_write/c/basic/private-common.c
new file mode 100644 (file)
index 0000000..a06220a
--- /dev/null
@@ -0,0 +1,10 @@
+#include "basic.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic/private-common.h b/level_3/fss_write/c/basic/private-common.h
new file mode 100644 (file)
index 0000000..372a8f3
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_basic_common_h
+#define _PRIVATE_fss_write_basic_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_basic_common_h
diff --git a/level_3/fss_write/c/basic/private-print.c b/level_3/fss_write/c/basic/private-print.c
new file mode 100644 (file)
index 0000000..4f1da6c
--- /dev/null
@@ -0,0 +1,11 @@
+#include "basic.h"
+#include "private-common.h"
+#include "private-print.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic/private-print.h b/level_3/fss_write/c/basic/private-print.h
new file mode 100644 (file)
index 0000000..d5185f4
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_basic_print_h
+#define _PRIVATE_fss_write_basic_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_basic_print_h
diff --git a/level_3/fss_write/c/basic/private-write.c b/level_3/fss_write/c/basic/private-write.c
new file mode 100644 (file)
index 0000000..7197a20
--- /dev/null
@@ -0,0 +1,11 @@
+#include "basic.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic/private-write.h b/level_3/fss_write/c/basic/private-write.h
new file mode 100644 (file)
index 0000000..0c87310
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_basic_write_h
+#define _PRIVATE_fss_write_basic_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_basic_write_h
diff --git a/level_3/fss_write/c/basic_list/basic_list.c b/level_3/fss_write/c/basic_list/basic_list.c
new file mode 100644 (file)
index 0000000..147d352
--- /dev/null
@@ -0,0 +1,19 @@
+#include "fss_write_basic_list.h"
+#include "private-common.h"
+#include "private-basic_list.h"
+#include "../main/fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_basic_list_process_help_
+  void fss_write_basic_list_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    fss_write_basic_list_print_help(main, setting);
+  }
+#endif // _di_fss_write_basic_list_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic_list/basic_list.h b/level_3/fss_write/c/basic_list/basic_list.h
new file mode 100644 (file)
index 0000000..1206d46
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for the FSS-0002 Basic List.
+ */
+#ifndef _fss_write_basic_list_h
+#define _fss_write_basic_list_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/basic_list.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/basic_list.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/basic_list/common.h>
+#include <program/fss_write/main/common.h>
+#include <program/fss_write/basic_list/print.h>
+#include <program/fss_write/main/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Process help for FSS-0002 (Basic List).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any other failure.
+ */
+#ifndef _di_fss_write_basic_list_process_help_
+  extern void fss_write_basic_list_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_basic_list_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_basic_list_h
diff --git a/level_3/fss_write/c/basic_list/common.c b/level_3/fss_write/c/basic_list/common.c
new file mode 100644 (file)
index 0000000..ee13670
--- /dev/null
@@ -0,0 +1,13 @@
+#include "basic_list.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_basic_list_strings_
+  const f_string_static_t fss_write_basic_list_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_basic_list_standard_s, 0, FSS_WRITE_basic_list_standard_s_length);
+#endif // _di_fss_write_basic_list_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic_list/common.h b/level_3/fss_write/c/basic_list/common.h
new file mode 100644 (file)
index 0000000..c0beb2a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_basic_list_common_h
+#define _fss_write_basic_list_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The FSS-0002 (Basic List) specific strings.
+ */
+#ifndef _di_fss_write_basic_list_strings_
+  #define FSS_WRITE_basic_list_standard_s "FSS-0002 (Basic List)"
+
+  #define FSS_WRITE_basic_list_standard_s_length 21
+
+  extern const f_string_static_t fss_write_basic_list_standard_s;
+#endif // _di_fss_write_basic_list_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_basic_list_common_h
diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c
new file mode 100644 (file)
index 0000000..212c2d2
--- /dev/null
@@ -0,0 +1,39 @@
+#include "basic_list.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+  setting.process_help = &fss_write_basic_list_print_help;
+  setting.process_pipe = &fss_write_basic_list_process_pipe;
+  setting.process_normal = &fss_write_basic_list_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_basic_list_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/basic_list/print.c b/level_3/fss_write/c/basic_list/print.c
new file mode 100644 (file)
index 0000000..0b5dabf
--- /dev/null
@@ -0,0 +1,34 @@
+#include "basic_list.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_basic_list_print_help_
+  f_status_t fss_write_basic_list_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    f_file_stream_lock(print.to);
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+
+    fss_write_print_help(setting, print);
+
+    fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+
+    // @todo
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    f_file_stream_flush(print.to);
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_basic_list_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic_list/print.h b/level_3/fss_write/c/basic_list/print.h
new file mode 100644 (file)
index 0000000..6c93979
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_basic_list_print_h
+#define _fss_write_basic_list_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for FSS-0002 (Basic List).
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_basic_list_print_help_
+  extern f_status_t fss_write_basic_list_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_basic_list_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_basic_list_print_h
diff --git a/level_3/fss_write/c/basic_list/private-common.c b/level_3/fss_write/c/basic_list/private-common.c
new file mode 100644 (file)
index 0000000..24b56de
--- /dev/null
@@ -0,0 +1,10 @@
+#include "basic_list.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic_list/private-common.h b/level_3/fss_write/c/basic_list/private-common.h
new file mode 100644 (file)
index 0000000..15d08f1
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_basic_list_common_h
+#define _PRIVATE_fss_write_basic_list_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_basic_list_common_h
diff --git a/level_3/fss_write/c/basic_list/private-print.c b/level_3/fss_write/c/basic_list/private-print.c
new file mode 100644 (file)
index 0000000..237b20a
--- /dev/null
@@ -0,0 +1,11 @@
+#include "basic_list.h"
+#include "private-common.h"
+#include "private-print.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic_list/private-print.h b/level_3/fss_write/c/basic_list/private-print.h
new file mode 100644 (file)
index 0000000..a73b839
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_basic_list_print_h
+#define _PRIVATE_fss_write_basic_list_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_basic_list_print_h
diff --git a/level_3/fss_write/c/basic_list/private-write.c b/level_3/fss_write/c/basic_list/private-write.c
new file mode 100644 (file)
index 0000000..98c2396
--- /dev/null
@@ -0,0 +1,11 @@
+#include "basic_list.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/basic_list/private-write.h b/level_3/fss_write/c/basic_list/private-write.h
new file mode 100644 (file)
index 0000000..dbe4d7f
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_basic_list_write_h
+#define _PRIVATE_fss_write_basic_list_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_basic_list_write_h
diff --git a/level_3/fss_write/c/embedded_list/common.c b/level_3/fss_write/c/embedded_list/common.c
new file mode 100644 (file)
index 0000000..ce3090a
--- /dev/null
@@ -0,0 +1,13 @@
+#include "embedded_list.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_embedded_list_strings_
+  const f_string_static_t fss_write_embedded_list_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_embedded_list_standard_s, 0, FSS_WRITE_embedded_list_standard_s_length);
+#endif // _di_fss_write_embedded_list_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/embedded_list/common.h b/level_3/fss_write/c/embedded_list/common.h
new file mode 100644 (file)
index 0000000..1a3c162
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_embedded_list_common_h
+#define _fss_write_embedded_list_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The FSS-0008 (Embedded List) specific strings.
+ */
+#ifndef _di_fss_write_embedded_list_strings_
+  #define FSS_WRITE_embedded_list_standard_s "FSS-0008 (Embedded List)"
+
+  #define FSS_WRITE_embedded_list_standard_s_length 24
+
+  extern const f_string_static_t fss_write_embedded_list_standard_s;
+#endif // _di_fss_write_embedded_list_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_embedded_list_common_h
diff --git a/level_3/fss_write/c/embedded_list/embedded_list.c b/level_3/fss_write/c/embedded_list/embedded_list.c
new file mode 100644 (file)
index 0000000..3456ed3
--- /dev/null
@@ -0,0 +1,19 @@
+#include "fss_write_embedded_list.h"
+#include "private-common.h"
+#include "private-embedded_list.h"
+#include "../main/fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_embedded_list_process_help_
+  void fss_write_embedded_list_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    fss_write_embedded_list_print_help(main, setting);
+  }
+#endif // _di_fss_write_embedded_list_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/embedded_list/embedded_list.h b/level_3/fss_write/c/embedded_list/embedded_list.h
new file mode 100644 (file)
index 0000000..dc1e9e5
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for the FSS-0008 Embedded List.
+ */
+#ifndef _fss_write_embedded_list_h
+#define _fss_write_embedded_list_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/embedded_list.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/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/embedded_list/common.h>
+#include <program/fss_write/main/common.h>
+#include <program/fss_write/embedded_list/print.h>
+#include <program/fss_write/main/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Process help for FSS-0008 (Embedded List).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any other failure.
+ */
+#ifndef _di_fss_write_embedded_list_process_help_
+  extern void fss_write_embedded_list_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_embedded_list_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_embedded_list_h
diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c
new file mode 100644 (file)
index 0000000..fec94f5
--- /dev/null
@@ -0,0 +1,39 @@
+#include "embedded_list.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+  setting.process_help = &fss_write_embedded_list_print_help;
+  setting.process_pipe = &fss_write_embedded_list_process_pipe;
+  setting.process_normal = &fss_write_embedded_list_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_embedded_list_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/embedded_list/print.c b/level_3/fss_write/c/embedded_list/print.c
new file mode 100644 (file)
index 0000000..174016c
--- /dev/null
@@ -0,0 +1,34 @@
+#include "embedded_list.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_embedded_list_print_help_
+  f_status_t fss_write_embedded_list_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    f_file_stream_lock(print.to);
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+
+    fss_write_print_help(setting, print);
+
+    fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+
+    // @todo
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    f_file_stream_flush(print.to);
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_embedded_list_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/embedded_list/print.h b/level_3/fss_write/c/embedded_list/print.h
new file mode 100644 (file)
index 0000000..41a14ef
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_embedded_list_print_h
+#define _fss_write_embedded_list_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for FSS-0008 (Embedded List).
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_embedded_list_print_help_
+  extern f_status_t fss_write_embedded_list_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_embedded_list_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_embedded_list_print_h
diff --git a/level_3/fss_write/c/embedded_list/private-common.c b/level_3/fss_write/c/embedded_list/private-common.c
new file mode 100644 (file)
index 0000000..59e28ca
--- /dev/null
@@ -0,0 +1,10 @@
+#include "embedded_list.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/embedded_list/private-common.h b/level_3/fss_write/c/embedded_list/private-common.h
new file mode 100644 (file)
index 0000000..3cc9f06
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_embedded_list_common_h
+#define _PRIVATE_fss_write_embedded_list_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_embedded_list_common_h
diff --git a/level_3/fss_write/c/embedded_list/private-print.c b/level_3/fss_write/c/embedded_list/private-print.c
new file mode 100644 (file)
index 0000000..0661540
--- /dev/null
@@ -0,0 +1,11 @@
+#include "embedded_list.h"
+#include "private-common.h"
+#include "private-print.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/embedded_list/private-print.h b/level_3/fss_write/c/embedded_list/private-print.h
new file mode 100644 (file)
index 0000000..26e7567
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_embedded_list_print_h
+#define _PRIVATE_fss_write_embedded_list_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_embedded_list_print_h
diff --git a/level_3/fss_write/c/embedded_list/private-write.c b/level_3/fss_write/c/embedded_list/private-write.c
new file mode 100644 (file)
index 0000000..543fd73
--- /dev/null
@@ -0,0 +1,11 @@
+#include "embedded_list.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/embedded_list/private-write.h b/level_3/fss_write/c/embedded_list/private-write.h
new file mode 100644 (file)
index 0000000..1b3876b
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_embedded_list_write_h
+#define _PRIVATE_fss_write_embedded_list_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_embedded_list_write_h
diff --git a/level_3/fss_write/c/extended/common.c b/level_3/fss_write/c/extended/common.c
new file mode 100644 (file)
index 0000000..4d18b02
--- /dev/null
@@ -0,0 +1,13 @@
+#include "extended.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_extended_strings_
+  const f_string_static_t fss_write_extended_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_standard_s, 0, FSS_WRITE_extended_standard_s_length);
+#endif // _di_fss_write_extended_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended/common.h b/level_3/fss_write/c/extended/common.h
new file mode 100644 (file)
index 0000000..3e63318
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_extended_common_h
+#define _fss_write_extended_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The FSS-0001 (Extended) specific strings.
+ */
+#ifndef _di_fss_write_extended_strings_
+  #define FSS_WRITE_extended_standard_s "FSS-0001 (Extended)"
+
+  #define FSS_WRITE_extended_standard_s_length 19
+
+  extern const f_string_static_t fss_write_extended_standard_s;
+#endif // _di_fss_write_extended_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_extended_common_h
diff --git a/level_3/fss_write/c/extended/extended.c b/level_3/fss_write/c/extended/extended.c
new file mode 100644 (file)
index 0000000..7076971
--- /dev/null
@@ -0,0 +1,19 @@
+#include "fss_write_extended.h"
+#include "private-common.h"
+#include "private-extended.h"
+#include "../main/fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_extended_process_help_
+  void fss_write_extended_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    fss_write_extended_print_help(main, setting);
+  }
+#endif // _di_fss_write_extended_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended/extended.h b/level_3/fss_write/c/extended/extended.h
new file mode 100644 (file)
index 0000000..dd0bf6e
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for the FSS-0001 Extended.
+ */
+#ifndef _fss_write_extended_h
+#define _fss_write_extended_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/extended.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/extended.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/extended/common.h>
+#include <program/fss_write/main/common.h>
+#include <program/fss_write/extended/print.h>
+#include <program/fss_write/main/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Process help for FSS-0001 (Extended).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any other failure.
+ */
+#ifndef _di_fss_write_extended_process_help_
+  extern void fss_write_extended_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_extended_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_extended_h
diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c
new file mode 100644 (file)
index 0000000..b6dc078
--- /dev/null
@@ -0,0 +1,39 @@
+#include "extended.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+  setting.process_help = &fss_write_extended_print_help;
+  setting.process_pipe = &fss_write_extended_process_pipe;
+  setting.process_normal = &fss_write_extended_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_extended_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/extended/print.c b/level_3/fss_write/c/extended/print.c
new file mode 100644 (file)
index 0000000..b698a8f
--- /dev/null
@@ -0,0 +1,34 @@
+#include "extended.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_extended_print_help_
+  f_status_t fss_write_extended_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    f_file_stream_lock(print.to);
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+
+    fss_write_print_help(setting, print);
+
+    fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+
+    // @todo
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    f_file_stream_flush(print.to);
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_extended_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended/print.h b/level_3/fss_write/c/extended/print.h
new file mode 100644 (file)
index 0000000..9b2977d
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_extended_print_h
+#define _fss_write_extended_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for FSS-0001 (Extended).
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_extended_print_help_
+  extern f_status_t fss_write_extended_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_extended_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_extended_print_h
diff --git a/level_3/fss_write/c/extended/private-common.c b/level_3/fss_write/c/extended/private-common.c
new file mode 100644 (file)
index 0000000..b7b6f0b
--- /dev/null
@@ -0,0 +1,10 @@
+#include "extended.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended/private-common.h b/level_3/fss_write/c/extended/private-common.h
new file mode 100644 (file)
index 0000000..75ef75a
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_extended_common_h
+#define _PRIVATE_fss_write_extended_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_extended_common_h
diff --git a/level_3/fss_write/c/extended/private-print.c b/level_3/fss_write/c/extended/private-print.c
new file mode 100644 (file)
index 0000000..cd8abd9
--- /dev/null
@@ -0,0 +1,11 @@
+#include "extended.h"
+#include "private-common.h"
+#include "private-print.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended/private-print.h b/level_3/fss_write/c/extended/private-print.h
new file mode 100644 (file)
index 0000000..c9a1b96
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_extended_print_h
+#define _PRIVATE_fss_write_extended_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_extended_print_h
diff --git a/level_3/fss_write/c/extended/private-write.c b/level_3/fss_write/c/extended/private-write.c
new file mode 100644 (file)
index 0000000..4429121
--- /dev/null
@@ -0,0 +1,11 @@
+#include "extended.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended/private-write.h b/level_3/fss_write/c/extended/private-write.h
new file mode 100644 (file)
index 0000000..449dab4
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_extended_write_h
+#define _PRIVATE_fss_write_extended_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_extended_write_h
diff --git a/level_3/fss_write/c/extended_list/common.c b/level_3/fss_write/c/extended_list/common.c
new file mode 100644 (file)
index 0000000..60b8a80
--- /dev/null
@@ -0,0 +1,13 @@
+#include "extended_list.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_extended_list_strings_
+  const f_string_static_t fss_write_extended_list_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_extended_list_standard_s, 0, FSS_WRITE_extended_list_standard_s_length);
+#endif // _di_fss_write_extended_list_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended_list/common.h b/level_3/fss_write/c/extended_list/common.h
new file mode 100644 (file)
index 0000000..4e79e14
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_extended_list_common_h
+#define _fss_write_extended_list_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The FSS-0001 (Extended List) specific strings.
+ */
+#ifndef _di_fss_write_extended_list_strings_
+  #define FSS_WRITE_extended_list_standard_s "FSS-0001 (Extended List)"
+
+  #define FSS_WRITE_extended_list_standard_s_length 24
+
+  extern const f_string_static_t fss_write_extended_list_standard_s;
+#endif // _di_fss_write_extended_list_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_extended_list_common_h
diff --git a/level_3/fss_write/c/extended_list/extended_list.c b/level_3/fss_write/c/extended_list/extended_list.c
new file mode 100644 (file)
index 0000000..dbb6e0b
--- /dev/null
@@ -0,0 +1,19 @@
+#include "fss_write_extended_list.h"
+#include "private-common.h"
+#include "private-extended_list.h"
+#include "../main/fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_extended_list_process_help_
+  void fss_write_extended_list_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    fss_write_extended_list_print_help(main, setting);
+  }
+#endif // _di_fss_write_extended_list_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended_list/extended_list.h b/level_3/fss_write/c/extended_list/extended_list.h
new file mode 100644 (file)
index 0000000..d08abd3
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for the FSS-0003 Extended List.
+ */
+#ifndef _fss_write_extended_list_h
+#define _fss_write_extended_list_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/extended.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/extended.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/extended/common.h>
+#include <program/fss_write/main/common.h>
+#include <program/fss_write/extended/print.h>
+#include <program/fss_write/main/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Process help for FSS-0003 (Extended List).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any other failure.
+ */
+#ifndef _di_fss_write_extended_list_process_help_
+  extern void fss_write_extended_list_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_extended_list_process_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_extended_list_h
diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c
new file mode 100644 (file)
index 0000000..4a2b2e5
--- /dev/null
@@ -0,0 +1,39 @@
+#include "extended_list.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+  setting.process_help = &fss_write_extended_list_print_help;
+  setting.process_pipe = &fss_write_extended_list_process_pipe;
+  setting.process_normal = &fss_write_extended_list_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_extended_list_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/extended_list/print.c b/level_3/fss_write/c/extended_list/print.c
new file mode 100644 (file)
index 0000000..c1ebcc2
--- /dev/null
@@ -0,0 +1,34 @@
+#include "extended_list.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_extended_list_print_help_
+  f_status_t fss_write_extended_list_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    f_file_stream_lock(print.to);
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+
+    fss_write_print_help(setting, print);
+
+    fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+
+    // @todo
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    f_file_stream_flush(print.to);
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_extended_list_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended_list/print.h b/level_3/fss_write/c/extended_list/print.h
new file mode 100644 (file)
index 0000000..dc81d38
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_extended_list_print_h
+#define _fss_write_extended_list_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for FSS-0003 (Extended List).
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_extended_list_print_help_
+  extern f_status_t fss_write_extended_list_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_extended_list_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_extended_list_print_h
diff --git a/level_3/fss_write/c/extended_list/private-common.c b/level_3/fss_write/c/extended_list/private-common.c
new file mode 100644 (file)
index 0000000..cd7888c
--- /dev/null
@@ -0,0 +1,10 @@
+#include "extended_list.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended_list/private-common.h b/level_3/fss_write/c/extended_list/private-common.h
new file mode 100644 (file)
index 0000000..87f37d3
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_extended_list_common_h
+#define _PRIVATE_fss_write_extended_list_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_extended_list_common_h
diff --git a/level_3/fss_write/c/extended_list/private-print.c b/level_3/fss_write/c/extended_list/private-print.c
new file mode 100644 (file)
index 0000000..1ac3a0d
--- /dev/null
@@ -0,0 +1,11 @@
+#include "extended_list.h"
+#include "private-common.h"
+#include "private-print.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended_list/private-print.h b/level_3/fss_write/c/extended_list/private-print.h
new file mode 100644 (file)
index 0000000..7fea7e6
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_extended_list_print_h
+#define _PRIVATE_fss_write_extended_list_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_extended_list_print_h
diff --git a/level_3/fss_write/c/extended_list/private-write.c b/level_3/fss_write/c/extended_list/private-write.c
new file mode 100644 (file)
index 0000000..40219c1
--- /dev/null
@@ -0,0 +1,11 @@
+#include "extended_list.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/extended_list/private-write.h b/level_3/fss_write/c/extended_list/private-write.h
new file mode 100644 (file)
index 0000000..8e5cc56
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_extended_list_write_h
+#define _PRIVATE_fss_write_extended_list_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_extended_list_write_h
diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c
new file mode 100644 (file)
index 0000000..cde0e3d
--- /dev/null
@@ -0,0 +1,510 @@
+#include "fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_program_version_
+  const f_string_static_t fss_write_program_version_s = macro_f_string_static_t_initialize(FSS_WRITE_program_version_s, 0, FSS_WRITE_program_version_s_length);
+#endif // _di_fss_write_program_version_
+
+#ifndef _di_fss_write_program_name_
+  const f_string_static_t fss_write_program_name_s = macro_f_string_static_t_initialize(FSS_WRITE_program_name_s, 0, FSS_WRITE_program_name_s_length);
+  const f_string_static_t fss_write_program_name_long_s = macro_f_string_static_t_initialize(FSS_WRITE_program_name_long_s, 0, FSS_WRITE_program_name_long_s_length);
+#endif // _di_fss_write_program_name_
+
+#ifndef _di_fss_write_defines_
+  const f_string_static_t fss_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_WRITE_pipe_content_end_s, 0, FSS_WRITE_pipe_content_end_s_length);
+  const f_string_static_t fss_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_WRITE_pipe_content_ignore_s, 0, FSS_WRITE_pipe_content_ignore_s_length);
+  const f_string_static_t fss_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_WRITE_pipe_content_start_s, 0, FSS_WRITE_pipe_content_start_s_length);
+#endif // _di_fss_write_defines_
+
+#ifndef _di_fss_write_strings_
+  const f_string_static_t fss_write_string_two_s = macro_f_string_static_t_initialize(FSS_WRITE_string_two_s, 0, FSS_WRITE_string_two_s_length);
+#endif // _di_fss_write_strings_
+
+#ifndef _di_fss_write_parameters_
+  const f_string_static_t fss_write_short_as_s = macro_f_string_static_t_initialize(FSS_WRITE_short_as_s, 0, FSS_WRITE_short_as_s_length);
+  const f_string_static_t fss_write_short_content_s = macro_f_string_static_t_initialize(FSS_WRITE_short_content_s, 0, FSS_WRITE_short_content_s_length);
+  const f_string_static_t fss_write_short_double_s = macro_f_string_static_t_initialize(FSS_WRITE_short_double_s, 0, FSS_WRITE_short_double_s_length);
+  const f_string_static_t fss_write_short_file_s = macro_f_string_static_t_initialize(FSS_WRITE_short_file_s, 0, FSS_WRITE_short_file_s_length);
+  const f_string_static_t fss_write_short_ignore_s = macro_f_string_static_t_initialize(FSS_WRITE_short_ignore_s, 0, FSS_WRITE_short_ignore_s_length);
+  const f_string_static_t fss_write_short_object_s = macro_f_string_static_t_initialize(FSS_WRITE_short_object_s, 0, FSS_WRITE_short_object_s_length);
+  const f_string_static_t fss_write_short_partial_s = macro_f_string_static_t_initialize(FSS_WRITE_short_partial_s, 0, FSS_WRITE_short_partial_s_length);
+  const f_string_static_t fss_write_short_prepend_s = macro_f_string_static_t_initialize(FSS_WRITE_short_prepend_s, 0, FSS_WRITE_short_prepend_s_length);
+  const f_string_static_t fss_write_short_single_s = macro_f_string_static_t_initialize(FSS_WRITE_short_single_s, 0, FSS_WRITE_short_single_s_length);
+  const f_string_static_t fss_write_short_trim_s = macro_f_string_static_t_initialize(FSS_WRITE_short_trim_s, 0, FSS_WRITE_short_trim_s_length);
+
+  const f_string_static_t fss_write_long_as_s = macro_f_string_static_t_initialize(FSS_WRITE_long_as_s, 0, FSS_WRITE_long_as_s_length);
+  const f_string_static_t fss_write_long_content_s = macro_f_string_static_t_initialize(FSS_WRITE_long_content_s, 0, FSS_WRITE_long_content_s_length);
+  const f_string_static_t fss_write_long_double_s = macro_f_string_static_t_initialize(FSS_WRITE_long_double_s, 0, FSS_WRITE_long_double_s_length);
+  const f_string_static_t fss_write_long_file_s = macro_f_string_static_t_initialize(FSS_WRITE_long_file_s, 0, FSS_WRITE_long_file_s_length);
+  const f_string_static_t fss_write_long_ignore_s = macro_f_string_static_t_initialize(FSS_WRITE_long_ignore_s, 0, FSS_WRITE_long_ignore_s_length);
+  const f_string_static_t fss_write_long_object_s = macro_f_string_static_t_initialize(FSS_WRITE_long_object_s, 0, FSS_WRITE_long_object_s_length);
+  const f_string_static_t fss_write_long_partial_s = macro_f_string_static_t_initialize(FSS_WRITE_long_partial_s, 0, FSS_WRITE_long_partial_s_length);
+  const f_string_static_t fss_write_long_prepend_s = macro_f_string_static_t_initialize(FSS_WRITE_long_prepend_s, 0, FSS_WRITE_long_prepend_s_length);
+  const f_string_static_t fss_write_long_single_s = macro_f_string_static_t_initialize(FSS_WRITE_long_single_s, 0, FSS_WRITE_long_single_s_length);
+  const f_string_static_t fss_write_long_trim_s = macro_f_string_static_t_initialize(FSS_WRITE_long_trim_s, 0, FSS_WRITE_long_trim_s_length);
+#endif // _di_fss_write_parameters_
+
+#ifndef _di_fss_write_setting_delete_
+  f_status_t fss_write_setting_delete(fss_write_setting_t * const setting) {
+
+    if (!setting) return F_status_set_error(F_parameter);
+
+    f_string_dynamic_resize(0, &setting->escaped);
+    f_string_dynamic_resize(0, &setting->block);
+    f_string_dynamic_resize(0, &setting->buffer);
+    f_string_dynamic_resize(0, &setting->object);
+    f_string_dynamic_resize(0, &setting->content);
+    f_string_dynamic_resize(0, &setting->prepend);
+
+    f_string_ranges_resize(0, &setting->ignores);
+    f_string_dynamics_resize(0, &setting->objects);
+    f_string_dynamics_resize(0, &setting->contents);
+
+    return F_none;
+  }
+#endif // _di_fss_write_setting_delete_
+
+#ifndef _di_fss_write_setting_load_
+  void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    if (!main || !setting) return;
+
+    setting->flag = 0;
+
+    // Load parameters.
+    setting->status = f_console_parameter_process(arguments, &main->parameters);
+
+    if (F_status_is_error(setting->status)) {
+      fss_write_print_error(setting, main->error, "f_console_parameter_process");
+
+      return;
+    }
+
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
+
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_write_parameter_no_color_e, fss_write_parameter_light_e, fss_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
+
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
+
+        setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
+
+        if (F_status_is_error(setting->status)) {
+          fss_write_print_error(setting, main->error, "fll_program_parameter_process_context");
+
+          return;
+        }
+      }
+
+      if (main->parameters.array[fss_write_parameter_line_first_no_e].result & f_console_result_found_e) {
+        setting->line_first = f_string_empty_s;
+      }
+      else {
+        setting->line_first = f_string_eol_s;
+      }
+
+      if (main->parameters.array[fss_write_parameter_line_last_no_e].result & f_console_result_found_e) {
+        setting->line_last = f_string_empty_s;
+      }
+      else {
+        setting->line_last = f_string_eol_s;
+      }
+
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_write_parameter_verbosity_quiet_e, fss_write_parameter_verbosity_error_e, fss_write_parameter_verbosity_verbose_e, fss_write_parameter_verbosity_debug_e, fss_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
+
+        const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
+
+        setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
+
+        if (F_status_is_error(setting->status)) {
+          fss_write_print_error(setting, main->error, "fll_program_parameter_process_verbosity");
+
+          return;
+        }
+      }
+
+      if (main->parameters.array[fss_write_parameter_help_e].result & f_console_result_found_e) {
+        setting->flag |= fss_write_main_flag_help_e;
+
+        return;
+      }
+
+      if (main->parameters.array[fss_write_parameter_version_e].result & f_console_result_found_e) {
+        setting->flag |= fss_write_main_flag_version_e;
+
+        return;
+      }
+    }
+
+    main->output.to.id = F_type_descriptor_output_d;
+    main->output.to.stream = F_type_output_d;
+    main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+
+    if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_file_e].values.used) {
+      // @todo check the "-a/--as" and select format or fallback to FSS-0000 Basic (support either digits "0000"/"0001" or simple names "basic"/"basic_list".
+    // Fallback only happens if -a/--as is not disabled, otherwise the callback function should be pre-defined.
+    }
+    else if (main->parameters.array[fss_write_parameter_as_e].result & f_console_result_found_e) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fss_write_print_line_first_locked(setting, main->error);
+      fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s);
+      fss_write_print_line_last_locked(setting, main->error);
+
+      return;
+    }
+
+    if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_file_e].values.used) {
+      if (main->parameters.array[fss_write_parameter_file_e].values.used > 1) {
+        setting->status = F_status_set_error(F_parameter);
+
+        fss_write_print_line_first_locked(setting, main->error);
+        fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s);
+        fss_write_print_line_last_locked(setting, main->error);
+
+        return;
+      }
+
+      const f_array_length_t index = main->parameters.array[fss_write_parameter_file_e].values.array[0];
+
+      main->output.to.id = -1;
+      main->output.to.stream = 0;
+
+      setting->status = f_file_stream_open(main->parameters.arguments.array[index], f_string_empty_s, &main->output.to);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error_file(setting, main->error, "f_file_stream_open", main->parameters.arguments.array[index], f_file_operation_open_s, fll_error_file_type_file_e);
+
+        return;
+      }
+
+      setting->flag |= fss_write_main_flag_file_to_e;
+    }
+    else if (main->parameters.array[fss_write_parameter_file_e].result & f_console_result_found_e) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fss_write_print_line_first_locked(setting, main->error);
+      fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_file_s);
+      fss_write_print_line_last_locked(setting, main->error);
+
+      return;
+    }
+
+    if (main->parameters.array[fss_write_parameter_object_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_object_e].values.used) {
+      f_array_lengths_t * const values = &main->parameters.array[fss_write_parameter_object_e].values;
+
+      setting->objects.used = 0;
+
+      setting->status = f_string_dynamics_resize(values->used, &setting->objects);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error(setting, main->error, "f_string_dynamics_resize");
+
+        return;
+      }
+
+      // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
+      for (f_array_length_t index = 0; setting->objects.used < values->used; ) {
+
+        index = values->array[setting->objects.used];
+
+        setting->objects.array[setting->objects.used].string = main->parameters.arguments.array[index].string;
+        setting->objects.array[setting->objects.used].used = main->parameters.arguments.array[index].used;
+        setting->objects.array[setting->objects.used++].size = 0;
+      } // for
+
+      setting->flag |= fss_write_main_flag_object_e;
+    }
+    else if (main->parameters.array[fss_write_parameter_object_e].result & f_console_result_found_e) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fss_write_print_line_first_locked(setting, main->error);
+      fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s);
+      fss_write_print_line_last_locked(setting, main->error);
+
+      return;
+    }
+
+    if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_content_e].values.used) {
+      f_array_lengths_t * const values = &main->parameters.array[fss_write_parameter_content_e].values;
+
+      setting->contents.used = 0;
+
+      setting->status = f_string_dynamics_resize(values->used, &setting->contents);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error(setting, main->error, "f_string_dynamics_resize");
+
+        return;
+      }
+
+      // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
+      for (f_array_length_t index = 0; setting->contents.used < values->used; ) {
+
+        index = values->array[setting->contents.used];
+
+        setting->contents.array[setting->contents.used].string = main->parameters.arguments.array[index].string;
+        setting->contents.array[setting->contents.used].used = main->parameters.arguments.array[index].used;
+        setting->contents.array[setting->contents.used++].size = 0;
+      } // for
+
+      setting->flag |= fss_write_main_flag_content_e;
+    }
+    else if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_found_e) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fss_write_print_line_first_locked(setting, main->error);
+      fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s);
+      fss_write_print_line_last_locked(setting, main->error);
+
+      return;
+    }
+
+    if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_prepend_e].values.used) {
+      const f_array_length_t index = main->parameters.array[fss_write_parameter_prepend_e].values.array[main->parameters.array[fss_write_parameter_prepend_e].values.used - 1];
+
+      setting->prepend.used = 0;
+
+      setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->prepend);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error(setting, main->error, "f_string_dynamic_append_nulless");
+
+        return;
+      }
+
+      if (main->parameters.arguments.array[index].used) {
+        f_string_range_t range = macro_f_string_range_t_initialize2(main->parameters.arguments.array[index].used);
+        f_state_t state = f_state_t_initialize;
+
+        for (; range.start < main->parameters.arguments.array[index].used; range.start++) {
+
+          setting->status = f_fss_is_space(state, main->parameters.arguments.array[index], range);
+
+          if (F_status_is_error(setting->status)) {
+            fss_write_print_error(setting, main->error, "f_fss_is_space");
+
+            return;
+          }
+
+          if (setting->status == F_false) {
+            setting->status = F_status_set_error(F_parameter);
+
+            fss_write_print_error_prepend_only_whitespace(setting, main->error);
+
+            return;
+          }
+        } // for
+      }
+
+      setting->flag |= fss_write_main_flag_prepend_e;
+    }
+    else if (main->parameters.array[fss_write_parameter_prepend_e].result & f_console_result_found_e) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fss_write_print_line_first_locked(setting, main->error);
+      fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_prepend_s);
+      fss_write_print_line_last_locked(setting, main->error);
+
+      return;
+    }
+
+    if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_value_e && main->parameters.array[fss_write_parameter_ignore_e].values.used) {
+
+      if (main->parameters.array[fss_write_parameter_ignore_e].values.used % 2 != 0) {
+        setting->status = F_status_set_error(F_parameter);
+
+        fss_write_print_line_first_locked(setting, main->error);
+        fll_program_print_error_parameter_missing_value_requires_amount(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, fss_write_string_two_s);
+        fss_write_print_line_last_locked(setting, main->error);
+
+        return;
+      }
+
+      setting->ignores.used = 0;
+
+      setting->status = f_string_ranges_increase_by(main->parameters.array[fss_write_parameter_ignore_e].values.used / 2, &setting->ignores);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error(setting, main->error, "f_string_ranges_increase_by");
+
+        return;
+      }
+
+      f_array_length_t index = 0;
+
+      for (f_array_length_t i = 0; i < main->parameters.array[fss_write_parameter_ignore_e].values.used; i += 2) {
+
+        index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i];
+
+        setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignores.array[setting->ignores.used].start);
+
+        if (F_status_is_error(setting->status)) {
+          fss_write_print_line_first_locked(setting, main->error);
+          fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        index = main->parameters.array[fss_write_parameter_ignore_e].values.array[i + 1];
+
+        setting->status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->parameters.arguments.array[index], &setting->ignores.array[setting->ignores.used].stop);
+
+        if (F_status_is_error(setting->status)) {
+          fss_write_print_line_first_locked(setting, main->error);
+          fll_program_print_error_parameter_integer_not(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[index]);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        if (setting->ignores.array[setting->ignores.used].stop > setting->ignores.array[setting->ignores.used].start) {
+          setting->status = F_status_set_error(F_parameter);
+
+          fss_write_print_line_first_locked(setting, main->error);
+          fll_program_print_error_parameter_range_start_before_stop(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s, main->parameters.arguments.array[main->parameters.array[fss_write_parameter_ignore_e].values.array[i]], main->parameters.arguments.array[index]);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        ++setting->ignores.used;
+      } // for
+
+      setting->flag |= fss_write_main_flag_ignore_e;
+    }
+    else if (main->parameters.array[fss_write_parameter_ignore_e].result & f_console_result_found_e) {
+      setting->status = F_status_set_error(F_parameter);
+
+      fss_write_print_line_first_locked(setting, main->error);
+      fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_ignore_s);
+      fss_write_print_line_last_locked(setting, main->error);
+
+      return;
+    }
+
+    if (main->parameters.array[fss_write_parameter_partial_e].result & f_console_result_found_e) {
+      setting->flag |= fss_write_main_flag_partial_e;
+    }
+
+    if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e)) {
+      if (setting->flag & fss_write_main_flag_object_e) {
+        if (main->parameters.array[fss_write_parameter_object_e].locations.used != main->parameters.array[fss_write_parameter_object_e].values.used) {
+          setting->status = F_status_set_error(F_parameter);
+
+          fss_write_print_line_first_locked(setting, main->error);
+          fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_object_s);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        if (main->parameters.array[fss_write_parameter_content_e].locations.used != main->parameters.array[fss_write_parameter_content_e].values.used) {
+          setting->status = F_status_set_error(F_parameter);
+
+          fss_write_print_line_first_locked(setting, main->error);
+          fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_normal_s, fss_write_long_content_s);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        if (main->parameters.array[fss_write_parameter_object_e].locations.used != main->parameters.array[fss_write_parameter_content_e].locations.used && !(setting->flag & fss_write_main_flag_partial_e)) {
+          setting->status = F_status_set_error(F_parameter);
+
+          fss_write_print_line_first_locked(setting, main->error);
+          fll_program_print_error_parameter_both_specified_same_amount_without(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_object_s, fss_write_long_content_s, fss_write_long_partial_s);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        if ((setting->flag & fss_write_main_flag_content_e) && (setting->flag & fss_write_main_flag_partial_e)) {
+          if (main->parameters.array[fss_write_parameter_content_e].result & f_console_result_value_e) {
+            setting->status = F_status_set_error(F_parameter);
+
+            fss_write_print_line_first_locked(setting, main->error);
+            fll_program_print_error_parameter_cannot_use_with_xor(main->error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, fss_write_long_partial_s, fss_write_long_object_s, fss_write_long_content_s);
+            fss_write_print_line_last_locked(setting, main->error);
+
+            return;
+          }
+        }
+
+        if (setting->flag & fss_write_main_flag_content_e) {
+          f_array_length_t location_object = 0;
+          f_array_length_t location_content = 0;
+          f_array_length_t location_sub_object = 0;
+          f_array_length_t location_sub_content = 0;
+
+          for (f_array_length_t i = 0; i < main->parameters.array[fss_write_parameter_object_e].locations.used; ++i) {
+
+            location_object = main->parameters.array[fss_write_parameter_object_e].locations.array[i];
+            location_content = main->parameters.array[fss_write_parameter_content_e].locations.array[i];
+            location_sub_object = main->parameters.array[fss_write_parameter_object_e].locations_sub.array[i];
+            location_sub_content = main->parameters.array[fss_write_parameter_content_e].locations_sub.array[i];
+
+            if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
+              setting->status = F_status_set_error(F_parameter);
+
+              fss_write_print_line_first_locked(setting, main->error);
+              fss_write_print_error_object_not_before_content(setting, main->error);
+              fss_write_print_line_last_locked(setting, main->error);
+
+              break;
+            }
+          } // for
+        }
+      }
+    }
+
+    setting->quote = f_fss_quote_double_s;
+
+    if (main->parameters.array[fss_write_parameter_double_e].result & f_console_result_found_e) {
+      if (main->parameters.array[fss_write_parameter_single_e].result & f_console_result_found_e) {
+        if (main->parameters.array[fss_write_parameter_double_e].location < main->parameters.array[fss_write_parameter_single_e].location) {
+          setting->quote = f_fss_quote_single_s;
+        }
+      }
+    }
+    else if (main->parameters.array[fss_write_parameter_single_e].result & f_console_result_found_e) {
+      setting->quote = f_fss_quote_single_s;
+    }
+
+    if (main->parameters.array[fss_write_parameter_trim_e].result & f_console_result_found_e) {
+      setting->flag |= fss_write_main_flag_trim_e;
+    }
+
+    if (!(setting->flag & (fll_program_data_pipe_input_e | fss_write_main_flag_content_e | fss_write_parameter_object_e))) {
+      setting->status = F_data_not;
+    }
+  }
+#endif // _di_fss_write_setting_load_
+
+#ifndef _di_fss_write_setting_unload_
+  f_status_t fss_write_setting_unload(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    if (!main || !setting) return F_status_set_error(F_parameter);
+
+    fss_write_setting_delete(setting);
+
+    return F_none;
+  }
+#endif // _di_fss_write_setting_unload_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h
new file mode 100644 (file)
index 0000000..609eece
--- /dev/null
@@ -0,0 +1,424 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_common_h
+#define _fss_write_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The program version.
+ */
+#ifndef _di_fss_write_program_version_
+  #define FSS_WRITE_program_version_major_s F_string_ascii_0_s
+  #define FSS_WRITE_program_version_minor_s F_string_ascii_7_s
+  #define FSS_WRITE_program_version_micro_s F_string_ascii_0_s
+
+  #define FSS_WRITE_program_version_major_s_length F_string_ascii_0_s_length
+  #define FSS_WRITE_program_version_minor_s_length F_string_ascii_7_s_length
+  #define FSS_WRITE_program_version_micro_s_length F_string_ascii_0_s_length
+
+  #if !(defined(FSS_WRITE_program_version_nano_prefix_s) && defined(FSS_WRITE_program_version_nano_prefix_s_length))
+    #define FSS_WRITE_program_version_nano_prefix_s
+    #define FSS_WRITE_program_version_nano_prefix_s_length 0
+  #endif // !(defined(FSS_WRITE_program_version_nano_prefix_s) && defined(FSS_WRITE_program_version_nano_prefix_s_length))
+
+  #if !(defined(FSS_WRITE_program_version_nano_s) && defined(FSS_WRITE_program_version_nano_s_length))
+    #define FSS_WRITE_program_version_nano_s
+    #define FSS_WRITE_program_version_nano_s_length 0
+  #endif // !(defined(FSS_WRITE_program_version_nano_s) && defined(FSS_WRITE_program_version_nano_s_length))
+
+  #define FSS_WRITE_program_version_s FSS_WRITE_program_version_major_s F_string_ascii_period_s FSS_WRITE_program_version_minor_s F_string_ascii_period_s FSS_WRITE_program_version_micro_s FSS_WRITE_program_version_nano_prefix_s FSS_WRITE_program_version_nano_s
+
+  #define FSS_WRITE_program_version_s_length FSS_WRITE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_WRITE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_WRITE_program_version_micro_s_length + FSS_WRITE_program_version_nano_prefix_s_length + FSS_WRITE_program_version_nano_s_length
+
+  extern const f_string_static_t fss_write_program_version_s;
+#endif // _di_fss_write_program_version_
+
+/**
+ * The program name.
+ */
+#ifndef _di_fss_write_program_name_
+  #define FSS_WRITE_program_name_s      "fss_write"
+  #define FSS_WRITE_program_name_long_s "FSS Write"
+
+  #define FSS_WRITE_program_name_s_length      9
+  #define FSS_WRITE_program_name_long_s_length 9
+
+  extern const f_string_static_t fss_write_program_name_s;
+  extern const f_string_static_t fss_write_program_name_long_s;
+#endif // _di_fss_write_program_name_
+
+/**
+ * The program defines.
+ *
+ * payload_write_common_allocation_*:
+ *   - large: An allocation step used for buffers that are anticipated to have large buffers.
+ *   - small: An allocation step used for buffers that are anticipated to have small buffers.
+ */
+#ifndef _di_fss_write_defines_
+  #define fss_write_signal_check_d 20000
+
+  #define fss_write_common_allocation_large_d 2048
+  #define fss_write_common_allocation_small_d 128
+
+  #define FSS_WRITE_pipe_content_end_s    "\f"
+  #define FSS_WRITE_pipe_content_ignore_s "\v"
+  #define FSS_WRITE_pipe_content_start_s  "\b"
+
+  #define FSS_WRITE_pipe_content_end_s_length    1
+  #define FSS_WRITE_pipe_content_ignore_s_length 1
+  #define FSS_WRITE_pipe_content_start_s_length  1
+
+  extern const f_string_static_t fss_write_pipe_content_end_s;
+  extern const f_string_static_t fss_write_pipe_content_ignore_s;
+  extern const f_string_static_t fss_write_pipe_content_start_s;
+#endif // _di_fss_write_defines_
+
+/**
+ * A collection of static strings associated with FSS Payload Write.
+ */
+#ifndef _di_fss_write_strings_
+  #define FSS_WRITE_string_two_s "two"
+
+  #define FSS_WRITE_string_two_s_length 3
+
+  extern const f_string_static_t fss_write_string_two_s;
+#endif // _di_fss_write_strings_
+
+/**
+ * The main program parameters.
+ */
+#ifndef _di_fss_write_parameters_
+  #define FSS_WRITE_short_as_s      "a"
+  #define FSS_WRITE_short_content_s "c"
+  #define FSS_WRITE_short_double_s  "d"
+  #define FSS_WRITE_short_file_s    "f"
+  #define FSS_WRITE_short_ignore_s  "I"
+  #define FSS_WRITE_short_object_s  "o"
+  #define FSS_WRITE_short_partial_s "p"
+  #define FSS_WRITE_short_prepend_s "P"
+  #define FSS_WRITE_short_single_s  "s"
+  #define FSS_WRITE_short_trim_s    "T"
+
+  #define FSS_WRITE_long_as_s      "as"
+  #define FSS_WRITE_long_content_s "content"
+  #define FSS_WRITE_long_double_s  "double"
+  #define FSS_WRITE_long_file_s    "file"
+  #define FSS_WRITE_long_ignore_s  "ignore"
+  #define FSS_WRITE_long_object_s  "object"
+  #define FSS_WRITE_long_partial_s "partial"
+  #define FSS_WRITE_long_prepend_s "prepend"
+  #define FSS_WRITE_long_single_s  "single"
+  #define FSS_WRITE_long_trim_s    "trim"
+
+  #define FSS_WRITE_short_as_s_length      1
+  #define FSS_WRITE_short_content_s_length 1
+  #define FSS_WRITE_short_double_s_length  1
+  #define FSS_WRITE_short_file_s_length    1
+  #define FSS_WRITE_short_ignore_s_length  1
+  #define FSS_WRITE_short_object_s_length  1
+  #define FSS_WRITE_short_partial_s_length 1
+  #define FSS_WRITE_short_prepend_s_length 1
+  #define FSS_WRITE_short_single_s_length  1
+  #define FSS_WRITE_short_trim_s_length    1
+
+  #define FSS_WRITE_long_as_s_length      2
+  #define FSS_WRITE_long_content_s_length 7
+  #define FSS_WRITE_long_double_s_length  6
+  #define FSS_WRITE_long_file_s_length    4
+  #define FSS_WRITE_long_ignore_s_length  6
+  #define FSS_WRITE_long_object_s_length  6
+  #define FSS_WRITE_long_partial_s_length 7
+  #define FSS_WRITE_long_prepend_s_length 7
+  #define FSS_WRITE_long_single_s_length  6
+  #define FSS_WRITE_long_trim_s_length    4
+
+  extern const f_string_static_t fss_write_short_as_s;
+  extern const f_string_static_t fss_write_short_content_s;
+  extern const f_string_static_t fss_write_short_double_s;
+  extern const f_string_static_t fss_write_short_file_s;
+  extern const f_string_static_t fss_write_short_ignore_s;
+  extern const f_string_static_t fss_write_short_object_s;
+  extern const f_string_static_t fss_write_short_partial_s;
+  extern const f_string_static_t fss_write_short_prepend_s;
+  extern const f_string_static_t fss_write_short_single_s;
+  extern const f_string_static_t fss_write_short_trim_s;
+
+  extern const f_string_static_t fss_write_long_as_s;
+  extern const f_string_static_t fss_write_long_content_s;
+  extern const f_string_static_t fss_write_long_double_s;
+  extern const f_string_static_t fss_write_long_file_s;
+  extern const f_string_static_t fss_write_long_ignore_s;
+  extern const f_string_static_t fss_write_long_object_s;
+  extern const f_string_static_t fss_write_long_partial_s;
+  extern const f_string_static_t fss_write_long_prepend_s;
+  extern const f_string_static_t fss_write_long_single_s;
+  extern const f_string_static_t fss_write_long_trim_s;
+
+  enum {
+    fss_write_parameter_help_e,
+    fss_write_parameter_light_e,
+    fss_write_parameter_dark_e,
+    fss_write_parameter_no_color_e,
+    fss_write_parameter_verbosity_quiet_e,
+    fss_write_parameter_verbosity_error_e,
+    fss_write_parameter_verbosity_normal_e,
+    fss_write_parameter_verbosity_verbose_e,
+    fss_write_parameter_verbosity_debug_e,
+    fss_write_parameter_version_e,
+    fss_write_parameter_line_first_no_e,
+    fss_write_parameter_line_last_no_e,
+
+    fss_write_parameter_as_e,
+    fss_write_parameter_content_e,
+    fss_write_parameter_double_e,
+    fss_write_parameter_file_e,
+    fss_write_parameter_ignore_e,
+    fss_write_parameter_object_e,
+    fss_write_parameter_partial_e,
+    fss_write_parameter_prepend_e,
+    fss_write_parameter_single_e,
+    fss_write_parameter_trim_e,
+  };
+
+  #define fss_write_console_parameter_t_initialize \
+    { \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_no_color_s,      f_console_standard_long_no_color_s,      0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_line_last_no_s,  f_console_standard_long_line_last_no_s,  0, f_console_flag_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_write_short_as_s.string, fss_write_long_as_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_content_s.string, fss_write_long_content_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_double_s.string, fss_write_long_double_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_file_s.string, fss_write_long_file_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_ignore_s.string, fss_write_long_ignore_s.string, 0, 2, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_object_s.string, fss_write_long_object_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_partial_s.string, fss_write_long_partial_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_prepend_s.string, fss_write_long_prepend_s.string, 0, 1, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_single_s.string, fss_write_long_single_s.string, 0, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_write_short_trim_s.string, fss_write_long_trim_s.string, 0, 0, f_console_flag_normal_e), \
+    }
+
+  #define fss_write_total_parameters_d 22
+#endif // _di_fss_write_parameters_
+
+/**
+ * Flags used to represent flags passed to the main function.
+ *
+ * fss_write_main_flag_*_e:
+ *   - none:    No modes in use.
+ *   - content: The Content being written is specified.
+ *   - double:  Operate using double quotes.
+ *   - file_to: Using a specified destination file.
+ *   - help:    Print help.
+ *   - ignore:  Ignore a given range within a Content.
+ *   - object:  The Object being written is specified.
+ *   - partial: Do not write end of Object/Content character.
+ *   - prepend: Prepend the given white space characters to the start of each multi-line Content.
+ *   - single:  Operate using single quotes.
+ *   - trim:    Trim Object names.
+ *   - version: Print version.
+ */
+#ifndef _di_fss_write_main_flag_e_
+  enum {
+    fss_write_main_flag_none_e    = 0x0,
+    fss_write_main_flag_content_e = 0x1,
+    fss_write_main_flag_double_e  = 0x2,
+    fss_write_main_flag_file_to_e = 0x4,
+    fss_write_main_flag_help_e    = 0x8,
+    fss_write_main_flag_ignore_e  = 0x10,
+    fss_write_main_flag_object_e  = 0x20,
+    fss_write_main_flag_partial_e = 0x40,
+    fss_write_main_flag_prepend_e = 0x80,
+    fss_write_main_flag_single_e  = 0x100,
+    fss_write_main_flag_trim_e    = 0x200,
+    fss_write_main_flag_version_e = 0x400,
+  };
+#endif // _di_fss_write_main_flag_e_
+
+/**
+ * The fss payload write main program settings.
+ *
+ * This is passed to the program-specific main entry point to designate program settings.
+ * These program settings are often processed from the program arguments (often called the command line arguments).
+ *
+ * flag: Flags passed to the main function.
+ *
+ * status: The main status code, generally used by the load settings and main functions.
+ *
+ * state: The state data used when processing the FSS data.
+ * range: A range used as a buffer during processing.
+ *
+ * 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.
+ *
+ * quote: This holds the quote used during processing.
+ *
+ * escaped: A buffer used for escaping strings during processing.
+ * block:   A buffer used to storing one or more blocks while processing a file line by line.
+ * buffer:  A buffer used during processing the file.
+ * object:  A buffer used to hold an Object during processing.
+ * content: A buffer used to hold a Content during processing.
+ * prepend: A string to prepend to each multi-line Content.
+ *
+ * ignores:  An array of ranges passed as values to the "--ignore" parameter.
+ * objects:  An array of objects passed as values to the "--object" parameter.
+ * contents: An array of objects passed as values to the "--content" parameter and must match the length of objects.
+ *
+ * process_help:   Process help (generally printing help).
+ * process_normal: Process normally (data from parameters and files).
+ * process_pipe:   Process using the data from input pipe.
+ */
+#ifndef _di_fss_write_setting_t_
+  typedef struct {
+    uint16_t flag;
+
+    f_status_t status;
+
+    f_state_t state;
+    f_string_range_t range;
+
+    f_string_static_t line_first;
+    f_string_static_t line_last;
+
+    f_string_static_t quote;
+
+    f_string_dynamic_t escaped;
+    f_string_dynamic_t block;
+    f_string_dynamic_t buffer;
+    f_string_dynamic_t object;
+    f_string_dynamic_t content;
+    f_string_dynamic_t prepend;
+
+    f_string_ranges_t ignores;
+    f_string_dynamics_t objects;
+    f_string_dynamics_t contents;
+
+    void (*process_help)(fll_program_data_t * const main, fss_write_setting_t * const setting);
+    void (*process_normal)(fll_program_data_t * const main, fss_write_setting_t * const setting);
+    void (*process_pipe)(fll_program_data_t * const main, fss_write_setting_t * const setting);
+  } fss_write_setting_t;
+
+  #define fss_write_setting_t_initialize \
+    { \
+      fss_write_main_flag_none_e, \
+      F_none, \
+      macro_f_state_t_initialize(fss_write_common_allocation_large_d, fss_write_common_allocation_small_d, 0, 0, &fll_program_standard_signal_state, 0, 0, 0), \
+      f_string_range_t_initialize, \
+      f_string_static_t_initialize, \
+      f_string_static_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_ranges_t_initialize, \
+      f_string_dynamics_t_initialize, \
+      f_string_dynamics_t_initialize, \
+      0, \
+      0, \
+      0, \
+    }
+#endif // _di_fss_write_setting_t_
+
+/**
+ * Delete the program main setting data.
+ *
+ * @param setting
+ *   The program main setting data.
+ *
+ *   This does not alter setting.status.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_fss_write_setting_delete_
+  extern f_status_t fss_write_setting_delete(fss_write_setting_t * const setting);
+#endif // _di_fss_write_setting_delete_
+
+/**
+ * Perform the standard program setting load process.
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately retuns without doing anything.
+ *
+ * @param arguments
+ *   The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_data_not on success but nothing was provided to operate with.
+ *
+ *     Errors (with error bit) from: f_console_parameter_process().
+ *     Errors (with error bit) from: f_file_stream_open().
+ *     Errors (with error bit) from: f_string_dynamics_resize().
+ *     Errors (with error bit) from: fll_program_parameter_process_context().
+ *     Errors (with error bit) from: fll_program_parameter_process_verbosity().
+ *
+ * @see f_console_parameter_process()
+ * @see f_file_stream_open()
+ * @see f_string_dynamics_resize()
+ * @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity()
+ */
+#ifndef _di_fss_write_setting_load_
+  extern void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_setting_load_
+
+/**
+ * Perform the standard program setting unload process.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *   All buffers are deallocated.
+ *
+ *   This does not alter setting.status.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: utf8_setting_delete().
+ *
+ * @see utf8_setting_delete()
+ */
+#ifndef _di_fss_write_setting_unload_
+  extern f_status_t fss_write_setting_unload(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_setting_unload_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_common_h
diff --git a/level_3/fss_write/c/main/fss_write.c b/level_3/fss_write/c/main/fss_write.c
new file mode 100644 (file)
index 0000000..93779ee
--- /dev/null
@@ -0,0 +1,47 @@
+#include "fss_write.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_main_
+  void fss_write_main(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    if (!main || !setting || F_status_is_error(setting->status)) return;
+
+    setting->status = F_none;
+
+    if (setting->flag & fss_write_main_flag_help_e) {
+      fss_write_print_help(setting, main->message);
+
+      return;
+    }
+
+    if (setting->flag & fss_write_main_flag_version_e) {
+      fll_program_print_version(main->message, fss_write_program_version_s);
+
+      return;
+    }
+
+    setting->escaped.used = 0;
+
+    if (main->pipe & fll_program_data_pipe_input_e) {
+      setting->process_pipe(main, setting);
+      if (F_status_is_error(setting->status)) return;
+    }
+
+    if (setting->flag & (fss_write_main_flag_object_e | fss_write_main_flag_content_e)) {
+      setting->process_normal(main, setting);
+      if (F_status_is_error(setting->status)) return;
+    }
+
+    // Ensure a new line is always put at the end of the program execution, unless in quiet mode.
+    fss_write_print_line_last_locked(setting, main->message);
+  }
+#endif // _di_fss_write_main_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/main/fss_write.h b/level_3/fss_write/c/main/fss_write.h
new file mode 100644 (file)
index 0000000..b68c1d4
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for several FSS formats.
+ */
+#ifndef _fss_write_h
+#define _fss_write_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/basic_list.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/payload.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/common.h>
+#include <program/fss_write/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Execute main program.
+ *
+ * If main.signal is non-zero, then this blocks and handles the following signals:
+ *   - F_signal_abort
+ *   - F_signal_broken_pipe
+ *   - F_signal_hangup
+ *   - F_signal_interrupt
+ *   - F_signal_quit
+ *   - F_signal_termination
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_true on success when performing verification and verify passed.
+ *     F_false on success when performing verification and verify failed.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ */
+#ifndef _di_fss_write_main_
+  extern void fss_write_main(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_main_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_h
diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c
new file mode 100644 (file)
index 0000000..738bc2d
--- /dev/null
@@ -0,0 +1,46 @@
+#include "fss_write.h"
+#include "basic/basic.h"
+#include "basic_list/basic_list.h"
+#include "extended/extended.h"
+#include "extended_list/extended_list.h"
+#include "embedded_list/embedded_list.h"
+#include "payload/payload.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+
+  // Default to Basic.
+  setting.process_help = &fss_write_basic_print_help;
+  setting.process_pipe = &fss_write_basic_process_pipe;
+  setting.process_normal = &fss_write_basic_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/main/print.c b/level_3/fss_write/c/main/print.c
new file mode 100644 (file)
index 0000000..7a9bf5d
--- /dev/null
@@ -0,0 +1,186 @@
+#include "fss_write.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_print_error_
+  f_status_t fss_write_print_error(fss_write_setting_t * const setting, const fl_print_t print, const f_string_t function) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    fss_write_print_line_first_locked(setting, print);
+    fll_error_print(print, F_status_set_fine(setting->status), function, F_true);
+    fss_write_print_line_last_locked(setting, print);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_error_
+
+#ifndef _di_fss_write_print_error_file_
+  f_status_t fss_write_print_error_file(fss_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    fss_write_print_line_first_locked(setting, print);
+    fll_error_file_print(print, F_status_set_fine(setting->status), function, F_true, name, operation, type);
+    fss_write_print_line_last_locked(setting, print);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_error_file_
+
+#ifndef _di_fss_write_print_error_object_not_before_content_
+  f_status_t fss_write_print_error_object_not_before_content(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    f_file_stream_lock(print.to);
+
+    fl_print_format("%r%[%QEach '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error);
+    fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_object_s, print.set->notable);
+    fl_print_format("%[' parameter must be specified before a '%]", print.to, print.set->error, print.set->error);
+    fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_content_s, print.set->notable);
+    fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_error_object_not_before_content_
+
+#ifndef _di_fss_write_print_error_one_content_only_
+  f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    fll_print_format("%r%[%QThe %Q standard only supports one content per object.%]%r", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error, standard, f_string_eol_s);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_error_one_content_only_
+
+#ifndef _fss_write_print_error_prepend_only_whitespace_
+  f_status_t fss_write_print_error_prepend_only_whitespace(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    f_file_stream_lock(print.to);
+
+    fl_print_format("%r%[%QThe value for the parameter '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error);
+    fl_print_format("%[%r%r%]", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_prepend_s, print.set->notable);
+    fl_print_format("%[' must only contain white space.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _fss_write_print_error_prepend_only_whitespace_
+
+#ifndef _di_fss_write_print_error_unsupported_eol_
+  f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    f_file_stream_lock(print.to);
+
+    fl_print_format("%r%[%QThe %Q standard does not support end of line character '%]", print.to, f_string_eol_s, print.set->error, print.prefix, standard, print.set->error);
+    fl_print_format("%[\\n%]", print.to, print.set->notable, print.set->notable);
+    fl_print_format("%[' (%]", print.to, print.set->error, print.set->error);
+    fl_print_format("%[U+000A%]", print.to, print.set->notable, print.set->notable);
+    fl_print_format("%[) in objects.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s);
+
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_error_unsupported_eol_
+
+#ifndef _di_fss_write_print_help_
+  void fss_write_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    fll_program_print_help_option_standard(print);
+
+    f_print_dynamic_raw(f_string_eol_s, print.to);
+
+    fll_program_print_help_option(print, fss_write_short_file_s, fss_write_long_file_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "   Specify a file to send data to.");
+    fll_program_print_help_option(print, fss_write_short_content_s, fss_write_long_content_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "The Content to write.");
+    fll_program_print_help_option(print, fss_write_short_double_s, fss_write_long_double_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use double quotes (default).");
+    fll_program_print_help_option(print, fss_write_short_ignore_s, fss_write_long_ignore_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Ignore a given range within a Content.");
+    fll_program_print_help_option(print, fss_write_short_object_s, fss_write_long_object_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " The Object to write.");
+    fll_program_print_help_option(print, fss_write_short_partial_s, fss_write_long_partial_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Do not write end of Object/Content character.");
+    fll_program_print_help_option(print, fss_write_short_prepend_s, fss_write_long_prepend_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Prepend the given white space characters to the start of each multi-line Content.");
+    fll_program_print_help_option(print, fss_write_short_single_s, fss_write_long_single_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Use single quotes.");
+    fll_program_print_help_option(print, fss_write_short_trim_s, fss_write_long_trim_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "   Trim Object names.");
+
+    f_print_dynamic_raw(f_string_eol_s, print.to);
+    f_print_dynamic_raw(f_string_eol_s, print.to);
+  }
+#endif // _di_fss_write_print_help_
+
+#ifndef _di_fss_write_print_line_first_locked_
+  f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    if (!F_status_is_error(setting->status)) {
+      if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+    }
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_line_first_locked_
+
+#ifndef _di_fss_write_print_line_first_unlocked_
+  f_status_t fss_write_print_line_first_unlocked(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    if (!F_status_is_error(setting->status)) {
+      if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+    }
+
+    fll_print_dynamic_raw(setting->line_first, print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_line_first_unlocked_
+
+#ifndef _di_fss_write_print_line_last_locked_
+  f_status_t fss_write_print_line_last_locked(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    if (!F_status_is_error(setting->status)) {
+      if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+      if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not;
+    }
+
+    fll_print_dynamic_raw(setting->line_last, print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_line_last_locked_
+
+#ifndef _di_fss_write_print_line_last_unlocked_
+  f_status_t fss_write_print_line_last_unlocked(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+    if (!F_status_is_error(setting->status)) {
+      if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+      if (setting->flag & fss_write_main_flag_file_to_e) return F_output_not;
+    }
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_print_line_last_unlocked_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/main/print.h b/level_3/fss_write/c/main/print.h
new file mode 100644 (file)
index 0000000..f87a8bc
--- /dev/null
@@ -0,0 +1,248 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_print_h
+#define _fss_write_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print generic error message regarding a function failing in some way.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ * @see fll_error_print()
+ */
+#ifndef _di_fss_write_print_error_
+  extern f_status_t fss_write_print_error(fss_write_setting_t * const setting, const fl_print_t print, const f_string_t function);
+#endif // _di_fss_write_print_error_
+
+/**
+ * Print file related error or warning messages.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates how printing is to be performed.
+ * @param function
+ *   The name of the function where the error happened.
+ *   Set to 0 to disable.
+ * @param name
+ *   The name of the file or directory.
+ * @param operation
+ *   The operation that fails, such as 'create' or 'access'.
+ * @param type
+ *   A valid file type code from the fll_error_file_type enum.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ * @see fll_error_file_print()
+ */
+#ifndef _di_fss_write_print_error_file_
+  extern f_status_t fss_write_print_error_file(fss_write_setting_t * const setting, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
+#endif // _di_fss_write_print_error_file_
+
+/**
+ * Print error message about each Object parameter not being specified before a Content parameter.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_error_object_not_before_content_
+  extern f_status_t fss_write_print_error_object_not_before_content(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_error_object_not_before_content_
+
+/**
+ * Print an message about a multiple Content being unsupported.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ * @param standard
+ *   A string representing the standard name, such as "FSS-0000 (Basic)".
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_error_one_content_only_
+  extern f_status_t fss_write_print_error_one_content_only(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard);
+#endif // _di_fss_write_print_error_one_content_only_
+
+/**
+ * Print error when prepend parameter has something other than white space.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _fss_write_print_error_prepend_only_whitespace_
+  extern f_status_t fss_write_print_error_prepend_only_whitespace(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _fss_write_print_error_prepend_only_whitespace_
+
+/**
+ * Print an message about a parameter New Line character '\n' (U+000A) being unsupported.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ * @param standard
+ *   A string representing the standard name, such as "FSS-0000 (Basic)".
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_error_unsupported_eol_
+  extern f_status_t fss_write_print_error_unsupported_eol(fss_write_setting_t * const setting, const fl_print_t print, const f_string_static_t standard);
+#endif // _di_fss_write_print_error_unsupported_eol_
+
+/**
+ * Print standard parts of the help.
+ *
+ * This is expected to be called as part of the help printing and does not perform any locking.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ */
+#ifndef _di_fss_write_print_help_
+  extern void fss_write_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_help_
+
+/**
+ * Print first new line, unless verbosity says otherwise.
+ *
+ * This is generally either the first line in the program or the first line printed before an error message.
+ *
+ * This function locks and then unlocks the input stream when printing.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_line_first_locked_
+  extern f_status_t fss_write_print_line_first_locked(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_line_first_locked_
+
+/**
+ * Print first new line, unless verbosity says otherwise.
+ *
+ * This is generally either the first line in the program or the first line printed before an error message.
+ *
+ * This function neither locks nor unlocks the input stream.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_line_first_unlocked_
+  extern f_status_t fss_write_print_line_first_unlocked(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_line_first_unlocked_
+
+/**
+ * Print last new line when the main is complete, unless verbosity says otherwise.
+ *
+ * This is generally the very last line printed in the program.
+ *
+ * This function locks and then unlocks the input stream when printing.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_line_last_locked_
+  extern f_status_t fss_write_print_line_last_locked(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_line_last_locked_
+
+/**
+ * Print last new line when the main is complete, unless verbosity says otherwise.
+ *
+ * This is generally the very last line printed in the program.
+ *
+ * This function neither locks nor unlocks the input stream.
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates the how and where to print.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_print_line_last_unlocked_
+  extern f_status_t fss_write_print_line_last_unlocked(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_print_line_last_unlocked_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_print_h
diff --git a/level_3/fss_write/c/main/private-common.c b/level_3/fss_write/c/main/private-common.c
new file mode 100644 (file)
index 0000000..8ae3dfd
--- /dev/null
@@ -0,0 +1,10 @@
+#include "fss_write.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/main/private-common.h b/level_3/fss_write/c/main/private-common.h
new file mode 100644 (file)
index 0000000..d3b6b5e
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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/fss_write/c/main/private-write.c b/level_3/fss_write/c/main/private-write.c
new file mode 100644 (file)
index 0000000..e3c2ad5
--- /dev/null
@@ -0,0 +1,11 @@
+#include "fss_write.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/main/private-write.h b/level_3/fss_write/c/main/private-write.h
new file mode 100644 (file)
index 0000000..41cbaec
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_write_h
+#define _PRIVATE_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_write_h
diff --git a/level_3/fss_write/c/payload/common.c b/level_3/fss_write/c/payload/common.c
new file mode 100644 (file)
index 0000000..ad22798
--- /dev/null
@@ -0,0 +1,13 @@
+#include "payload.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_payload_strings_
+  const f_string_static_t fss_write_payload_standard_s = macro_f_string_static_t_initialize(FSS_WRITE_payload_standard_s, 0, FSS_WRITE_payload_standard_s_length);
+#endif // _di_fss_write_payload_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/payload/common.h b/level_3/fss_write/c/payload/common.h
new file mode 100644 (file)
index 0000000..6ea77f6
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * 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 _fss_write_payload_common_h
+#define _fss_write_payload_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The FSS-000E (Payload) specific strings.
+ */
+#ifndef _di_fss_write_payload_strings_
+  #define FSS_WRITE_payload_standard_s "FSS-000E (Payload)"
+
+  #define FSS_WRITE_payload_standard_s_length 18
+
+  extern const f_string_static_t fss_write_payload_standard_s;
+#endif // _di_fss_write_payload_strings_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_payload_common_h
diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c
new file mode 100644 (file)
index 0000000..2fc9773
--- /dev/null
@@ -0,0 +1,39 @@
+#include "payload.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;
+  fss_write_setting_t setting = fss_write_setting_t_initialize;
+  setting.state.data = (void *) &data;
+  setting.process_help = &fss_write_payload_print_help;
+  setting.process_pipe = &fss_write_payload_process_pipe;
+  setting.process_normal = &fss_write_payload_process_normal;
+
+  f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize;
+  data.parameters.array = parameters;
+  data.parameters.array[fss_write_parameter_as_e].flag |= f_console_flag_disable_e;
+  data.parameters.used = fss_write_total_parameters_d;
+  data.environment = envp;
+
+  if (f_pipe_input_exists()) {
+    data.pipe = fll_program_data_pipe_input_e;
+  }
+
+  fll_program_standard_set_up(&data);
+
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+
+    fss_write_setting_load(arguments, &data, &setting);
+  }
+
+  fss_write_main(&data, &setting);
+
+  fss_write_setting_unload(&data, &setting);
+
+  fll_program_data_delete(&data);
+
+  fll_program_standard_set_down(&data);
+
+  return F_status_is_error(setting.status) ? 1 : 0;
+}
diff --git a/level_3/fss_write/c/payload/payload.c b/level_3/fss_write/c/payload/payload.c
new file mode 100644 (file)
index 0000000..0730dde
--- /dev/null
@@ -0,0 +1,439 @@
+#include "fss_write_payload.h"
+#include "private-common.h"
+#include "private-payload.h"
+#include "../main/fss_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_payload_process_help_
+  void fss_write_payload_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    fss_write_payload_print_help(main, setting);
+  }
+#endif // _di_fss_write_payload_process_help_
+
+#ifndef _di_fss_write_payload_process_normal_
+  void fss_write_payload_process_normal(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    f_string_statics_t *objects = &setting->objects;
+    f_string_statics_t *contents = &setting->contents;
+    f_string_statics_t *data = &setting->objects;
+
+    if (setting->flag & fss_write_main_flag_partial_e) {
+      if (setting->flag & fss_write_main_flag_content_e) {
+        data = &setting->contents;
+        objects = 0;
+      }
+      else {
+        contents = 0;
+      }
+    }
+
+    for (f_array_length_t i = 0; i < data->used; ++i) {
+
+      if (!((++main->signal_check) % fss_write_signal_check_d)) {
+        if (fll_program_standard_signal_received(main)) {
+          setting->status = F_status_set_error(F_interrupt);
+
+          return;
+        }
+
+        main->signal_check = 0;
+      }
+
+      fss_write_payload_process_set(main, setting, objects ? &objects->array[i] : 0, contents ? &contents->array[i] : 0);
+      if (F_status_is_error(setting->status)) return;
+    } // for
+  }
+#endif // _di_fss_write_payload_process_normal_
+
+#ifndef _di_fss_write_payload_process_pipe_
+  void fss_write_payload_process_pipe(fll_program_data_t * const main, fss_write_setting_t * const setting) {
+
+    f_status_t status_pipe = F_none;
+    f_file_t input = f_file_t_initialize;
+    input.id = F_type_descriptor_input_d;
+    input.size_read = fss_write_common_allocation_large_d;
+
+    f_array_length_t total = 0;
+    f_array_length_t length = 0;
+    f_string_range_t range = f_string_range_t_initialize;
+
+    // 0x0 = nothing printed, 0x1 = something printed, 0x2 = "payload" matched.
+    uint8_t printed = 0;
+
+    // 0x0 = start new object/content set, 0x1 = processing object, 0x2 = processing content, 0x3 = end object/content set, 0x4 = processing payload content.
+    uint8_t state = 0;
+
+    for (;;) {
+
+      if (!((++main->signal_check) % fss_write_signal_check_d)) {
+        if (fll_program_standard_signal_received(main)) {
+          fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
+
+          setting->status = F_status_set_error(F_interrupt);
+
+          break;
+        }
+
+        main->signal_check = 0;
+      }
+
+      if (range.start > range.stop) {
+        if (status_pipe == F_none_eof) break;
+
+        setting->block.used = 0;
+
+        status_pipe = f_file_read_block(input, &setting->block);
+
+        if (F_status_is_error(status_pipe)) {
+          fss_write_print_error(setting, main->error, "f_file_read_block");
+
+          status_pipe = F_status_set_error(F_pipe);
+
+          break;
+        }
+
+        if (!setting->block.used) break;
+
+        range.start = 0;
+        range.stop = setting->block.used - 1;
+      }
+
+      if (!state || state == 0x1) {
+        if (!state) {
+          setting->object.used = 0;
+          setting->content.used = 0;
+
+          state = 0x1;
+        }
+
+        if (setting->object.used + setting->block.used > setting->object.size) {
+          setting->status = f_string_dynamic_increase_by(setting->block.used, &setting->object);
+
+          if (F_status_is_error(setting->status)) {
+            fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+
+            break;
+          }
+        }
+
+        for (; range.start <= range.stop; ++range.start) {
+
+          if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
+            state = 0x2;
+            ++range.start;
+
+            break;
+          }
+
+          if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
+            state = 0x3;
+            ++range.start;
+
+            break;
+          }
+
+          if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
+
+            // This is not used by objects.
+            continue;
+          }
+
+          setting->object.string[setting->object.used++] = setting->block.string[range.start];
+        } // for
+
+        if (F_status_is_error(setting->status)) break;
+
+        // If the start of content was not found, then fetch the next block.
+        if (state == 0x1) continue;
+
+        // If the end of the current block is reached, fetch the next block.
+        if (range.start > range.stop) continue;
+      }
+
+      if (state == 0x2) {
+        if (range.start <= range.stop) {
+          total = (range.stop - range.start) + 1;
+        }
+        else {
+          total = 0;
+        }
+
+        // When payload is provided, all data at this point is part of the payload until the end of the pipe.
+        if (fl_string_dynamic_compare(f_fss_string_payload_s, setting->object) == F_equal_to) {
+          if (total > 1) {
+            setting->status = f_string_dynamic_increase_by(total, &setting->content);
+
+            if (F_status_is_error(setting->status)) {
+              fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+
+              break;
+            }
+
+            memcpy(setting->content.string, setting->block.string + range.start, sizeof(f_char_t) * total);
+
+            setting->content.used += total;
+          }
+
+          state = 0x4;
+          printed |= 0x2;
+
+          // Designate to read next block from pipe.
+          range.start = 1;fss_write_payload_process_set
+          range.stop = 0;
+
+          continue;
+        }
+
+        if (total) {
+          setting->status = f_string_dynamic_increase_by(total, &setting->content);
+
+          if (F_status_is_error(setting->status)) {
+            fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+
+            break;
+          }
+
+          for (; range.start <= range.stop; ++range.start) {
+
+            if (setting->block.string[range.start] == fss_write_pipe_content_start_s.string[0]) {
+              setting->status = F_status_set_error(F_supported_not);
+
+              if (main->error.verbosity > f_console_verbosity_quiet_e) {
+                fss_write_print_line_first_locked(setting, main->error);
+                fss_write_print_error_one_content_only(setting, main->error, "FSS-000E (Payload)");
+                fss_write_print_line_last_locked(setting, main->error);
+              }
+
+              break;
+            }
+
+            if (setting->block.string[range.start] == fss_write_pipe_content_end_s.string[0]) {
+              state = 0x3;
+              ++range.start;
+
+              break;
+            }
+
+            if (setting->block.string[range.start] == fss_write_pipe_content_ignore_s.string[0]) {
+
+              // This is not used by this program.
+              continue;
+            }
+
+            setting->content.string[setting->content.used++] = setting->block.string[range.start];
+          } // for
+
+          if (F_status_is_error(setting->status)) break;
+        }
+        else {
+          state = 0x3;
+        }
+      }
+
+      if (state == 0x3) {
+        if (setting->flag & fss_write_main_flag_partial_e) {
+          if (setting->flag & fss_write_main_flag_content_e) {
+            fss_write_payload_process_set(main, setting, 0, &setting->content);
+          }
+          else {
+            fss_write_payload_process_set(main, setting, &setting->object, 0);
+          }
+        }
+        else {
+          fss_write_payload_process_set(main, setting, &setting->object, &setting->content);
+        }
+
+        if (F_status_is_error(setting->status)) break;
+
+        state = 0;
+        printed |= 0x1;
+
+        continue;
+      }
+
+      if (state == 0x4) {
+        if (setting->block.used && range.start <= range.stop) {
+          length = (range.stop - range.start) + 1;
+
+          setting->status = f_string_dynamic_increase_by(length + 1, &setting->content);
+
+          if (F_status_is_error(setting->status)) {
+            fss_write_print_error(setting, main->error, "f_string_dynamic_increase_by");
+
+            break;
+          }
+
+          memcpy(setting->content.string + range.start, setting->block.string, sizeof(f_char_t) * length);
+
+          setting->content.used += length;
+        }
+
+        // Designate to read next block from pipe.
+        range.start = 1;
+        range.stop = 0;
+      }
+    } // for
+
+    // If the pipe ended before finishing, then attempt to wrap up.
+    if (F_status_is_error_not(setting->status) && status_pipe == F_none_eof && state) {
+      if (setting->flag & fss_write_main_flag_partial_e) {
+        if (setting->flag & fss_write_main_flag_content_e) {
+          fss_write_payload_process_set(main, setting, 0, &setting->content);
+        }
+        else {
+          fss_write_payload_process_set(main, setting, &setting->object, 0);
+        }
+      }
+      else {
+        fss_write_payload_process_set(main, setting, &setting->object, &setting->content);
+      }
+
+      printed |= 0x1;
+    }
+
+    setting->block.used = 0;
+    setting->object.used = 0;
+    setting->content.used = 0;
+    setting->buffer.used = 0;
+
+    if (F_status_is_error_not(setting->status)) {
+      if (printed & 0x1) {
+        if (printed & 0x2) {
+          setting->status = F_payload;
+        }
+        else {
+          setting->status = F_none;
+        }
+      }
+      else {
+        setting->status = F_data_not;
+      }
+
+      // Print newline character to separate data printed from pipe.
+      if ((setting->flag & fss_write_main_flag_partial_e) && setting->objects.used) {
+        fll_print_dynamic(f_string_eol_s, main->output.to);
+      }
+      else if (setting->contents.used) {
+        fll_print_dynamic(f_fss_payload_header_close_s, main->output.to);
+      }
+    }
+  }
+#endif // _di_fss_write_payload_process_pipe_
+
+#ifndef _di_fss_write_payload_process_set_
+  void fss_write_payload_process_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t *object, const f_string_static_t *content) {
+
+    if (object) {
+      if (content) {
+        if (object->used) {
+          setting->range.start = 0;
+          setting->range.stop = object->used - 1;
+        }
+        else {
+          setting->range.start = 1;
+          setting->range.stop = 0;
+        }
+
+        setting->status = fll_fss_payload_write(*object, *content, setting->flag & fss_write_main_flag_trim_e, setting->flag & fss_write_main_flag_prepend_e ? &setting->prepend : 0, setting->state, &setting->buffer);
+
+        if (F_status_set_fine(setting->status) == F_none_eol) {
+          setting->status = F_status_set_error(F_supported_not);
+
+          fss_write_print_line_first_locked(setting, main->error);
+          fss_write_print_error_unsupported_eol(setting, main->error);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        if (F_status_is_error(setting->status)) {
+          fss_write_print_error(setting, main->error, "fll_fss_payload_write");
+
+          return;
+        }
+      }
+      else {
+        bool complete = f_fss_complete_none_e;
+
+        if (object->used) {
+          setting->range.start = 0;
+          setting->range.stop = object->used - 1;
+        }
+        else {
+          setting->range.start = 1;
+          setting->range.stop = 0;
+        }
+
+        if (content) {
+          if (main->parameters.array[fss_write_parameter_trim_e].result & f_console_result_found_e) {
+            complete = f_fss_complete_full_trim_e;
+          }
+          else {
+            complete = f_fss_complete_full_e;
+          }
+        }
+
+        setting->status = fl_fss_basic_list_object_write(*object, complete, setting->state, &setting->range, &setting->buffer);
+
+        if (F_status_set_fine(setting->status) == F_none_eol) {
+          setting->status = F_status_set_error(F_supported_not);
+
+          fss_write_print_line_first_locked(setting, main->error);
+          fss_write_print_error_unsupported_eol(setting, main->error);
+          fss_write_print_line_last_locked(setting, main->error);
+
+          return;
+        }
+
+        if (F_status_is_error(setting->status)) {
+          fss_write_print_error(setting, main->error, "fl_fss_basic_list_object_write");
+
+          return;
+        }
+      }
+    }
+    else if (content && content->used) {
+      setting->range.start = 0;
+      setting->range.stop = content->used - 1;
+
+      const f_string_static_t *prepend = 0;
+
+      if (setting->flag & fss_write_main_flag_prepend_e) {
+        const f_array_length_t index = main->parameters.array[fss_write_parameter_prepend_e].values.array[main->parameters.array[fss_write_parameter_prepend_e].values.used - 1];
+
+        prepend = &main->parameters.arguments.array[index];
+      }
+
+      setting->status = fl_fss_basic_list_content_write(*content, object ? f_fss_complete_full_e : f_fss_complete_none_e, prepend, setting->state, &setting->range, &setting->buffer);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error(setting, main->error, "fl_fss_payload_content_write");
+
+        return;
+      }
+    }
+
+    if (!object || !content) {
+      setting->status = f_string_dynamic_append(f_string_eol_s, &setting->buffer);
+
+      if (F_status_is_error(setting->status)) {
+        fss_write_print_error(setting, main->error, "f_string_dynamic_append");
+
+        return;
+      }
+    }
+
+    fll_print_dynamic(setting->buffer, main->output.to);
+
+    setting->buffer.used = 0;
+    setting->status = F_none;
+  }
+#endif // _di_fss_write_payload_process_set_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/payload/payload.h b/level_3/fss_write/c/payload/payload.h
new file mode 100644 (file)
index 0000000..cfe9440
--- /dev/null
@@ -0,0 +1,143 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * This program provides FSS write functionality for the FSS-000E Payload.
+ */
+#ifndef _fss_write_payload_h
+#define _fss_write_payload_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/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/signal.h>
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/fss/basic_list.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/payload.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// FSS Write includes.
+#include <program/fss_write/payload/common.h>
+#include <program/fss_write/main/common.h>
+#include <program/fss_write/payload/print.h>
+#include <program/fss_write/main/print.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Process help for FSS-000E (Payload).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ *
+ * @return
+ *   F_none on success.
+ *   F_failure (with error bit) for any other failure.
+ */
+#ifndef _di_fss_write_payload_process_help_
+  extern void fss_write_payload_process_help(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_payload_process_help_
+
+/**
+ * Process normally, writing to the output.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ */
+#ifndef _di_fss_write_payload_process_normal_
+  extern void fss_write_payload_process_normal(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_payload_process_normal_
+
+/**
+ * Process the pipe, reading from the pipe and writing to the output.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_data_not on success but pipe contained no relevant data.
+ *     F_payload on success and the payload has been printed.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ */
+#ifndef _di_fss_write_payload_process_pipe_
+  extern void fss_write_payload_process_pipe(fll_program_data_t * const main, fss_write_setting_t * const setting);
+#endif // _di_fss_write_payload_process_pipe_
+
+/**
+ * Process a given object and content, printing the FSS if valid or an error if invalid.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *     F_interrupt on (exit) signal received.
+ *
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
+ * @param object
+ *   The object to validate and print.
+ *   Set pointer address to 0 to not use.
+ * @param content
+ *   The content to escape and print.
+ *   Set pointer address to 0 to not use.
+ */
+#ifndef _di_fss_write_process_payload_set_
+  extern void fss_write_process_payload_set(fll_program_data_t * const main, fss_write_setting_t * const setting, const f_string_static_t *object, const f_string_static_t *content);
+#endif // _di_fss_write_process_payload_set_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_payload_h
diff --git a/level_3/fss_write/c/payload/print.c b/level_3/fss_write/c/payload/print.c
new file mode 100644 (file)
index 0000000..95335a7
--- /dev/null
@@ -0,0 +1,45 @@
+#include "payload.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fss_write_payload_print_help_
+  f_status_t fss_write_payload_print_help(fss_write_setting_t * const setting, const fl_print_t print) {
+
+    f_file_stream_lock(print.to);
+
+    f_print_dynamic_raw(setting->line_first, print.to);
+
+    fll_program_print_help_header(print, fss_write_program_name_long_s, fss_write_program_version_s);
+
+    fss_write_print_help(setting, print);
+
+    fll_program_print_help_usage(print, fss_write_program_name_s, f_string_empty_s);
+
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", print.to, f_string_eol_s, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+    fl_print_format("  The pipe uses the Form Feed character '%[\\f%]' (%[U+000C%]) to designate the end of the last Content.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+    fl_print_format("  The pipe uses the Vertical Line character '%[\\v%]' (%[U+000B%]) is used to ignore a Content range, which does nothing in this program.%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+    fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable);
+    fl_print_format(" or a Form Feed character '%[\\f%]' (%[U+000C%]).%r", print.to, print.set->notable, print.set->notable, print.set->notable, print.set->notable, f_string_eol_s);
+    fl_print_format("  The end of the pipe represents the end of any Object or Content.%r%r", print.to, f_string_eol_s, f_string_eol_s);
+
+    fl_print_format("  The FSS-000E (Payload) specification does not support quoted names, therefore the parameters '%[%r%r%]'", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_single_s, print.set->notable);
+    fl_print_format(" and '%[%r%r%]' do nothing.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_double_s, print.set->notable, f_string_eol_s, f_string_eol_s);
+
+    fl_print_format("  This program does not use the parameter '%[%r%r%]', which therefore does nothing.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, fss_write_long_ignore_s, print.set->notable, f_string_eol_s);
+    fl_print_format("  This parameter requires two values.%r", print.to, f_string_eol_s);
+
+    f_print_dynamic_raw(setting->line_last, print.to);
+
+    f_file_stream_flush(print.to);
+    f_file_stream_unlock(print.to);
+
+    return F_none;
+  }
+#endif // _di_fss_write_payload_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/payload/print.h b/level_3/fss_write/c/payload/print.h
new file mode 100644 (file)
index 0000000..99bfcee
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _fss_write_payload_print_h
+#define _fss_write_payload_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for FSS-000E (Payload).
+ *
+ * @param setting
+ *   The main program settings.
+ *
+ *   This does not alter setting.status.
+ * @param print
+ *   The output structure to print to.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fss_write_payload_print_help_
+  extern f_status_t fss_write_payload_print_help(fss_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_fss_write_payload_print_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fss_write_payload_print_h
diff --git a/level_3/fss_write/c/payload/private-common.c b/level_3/fss_write/c/payload/private-common.c
new file mode 100644 (file)
index 0000000..daf0cfd
--- /dev/null
@@ -0,0 +1,10 @@
+#include "payload.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/payload/private-common.h b/level_3/fss_write/c/payload/private-common.h
new file mode 100644 (file)
index 0000000..b6c0689
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_payload_common_h
+#define _PRIVATE_fss_write_payload_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_payload_common_h
diff --git a/level_3/fss_write/c/payload/private-print.c b/level_3/fss_write/c/payload/private-print.c
new file mode 100644 (file)
index 0000000..a0ccc02
--- /dev/null
@@ -0,0 +1,11 @@
+#include "payload.h"
+#include "private-common.h"
+#include "private-print.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/payload/private-print.h b/level_3/fss_write/c/payload/private-print.h
new file mode 100644 (file)
index 0000000..77d402f
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_payload_print_h
+#define _PRIVATE_fss_write_payload_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_payload_print_h
diff --git a/level_3/fss_write/c/payload/private-write.c b/level_3/fss_write/c/payload/private-write.c
new file mode 100644 (file)
index 0000000..920117d
--- /dev/null
@@ -0,0 +1,11 @@
+#include "payload.h"
+#include "private-common.h"
+#include "private-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fss_write/c/payload/private-write.h b/level_3/fss_write/c/payload/private-write.h
new file mode 100644 (file)
index 0000000..d04a353
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: FSS Write
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_fss_write_payload_write_h
+#define _PRIVATE_fss_write_payload_write_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_fss_write_payload_write_h
diff --git a/level_3/fss_write/data/build/defines b/level_3/fss_write/data/build/defines
new file mode 100644 (file)
index 0000000..c665317
--- /dev/null
@@ -0,0 +1,2 @@
+# fss-0000
+
diff --git a/level_3/fss_write/data/build/dependencies b/level_3/fss_write/data/build/dependencies
new file mode 100644 (file)
index 0000000..f853089
--- /dev/null
@@ -0,0 +1,26 @@
+# fss-0000
+
+f_type
+f_status
+f_memory
+f_string
+f_utf
+f_color
+f_console
+f_conversion
+f_directory
+f_environment
+f_file
+f_fss
+f_pipe
+f_print
+f_signal
+fl_conversion
+fl_fss
+fl_print
+fl_string
+fll_error
+fll_file
+fll_fss
+fll_print
+fll_program
diff --git a/level_3/fss_write/data/build/fakefile b/level_3/fss_write/data/build/fakefile
new file mode 100644 (file)
index 0000000..55ac977
--- /dev/null
@@ -0,0 +1,24 @@
+# fss-0005 iki-0002
+
+settings:
+  fail exit
+
+  compiler gcc
+  indexer ar
+  indexer_arguments rcs
+
+  environment PATH LD_LIBRARY_PATH
+
+main:
+  if parameter mode
+    operate using_mode
+  else
+    operate using_default
+
+using_default:
+  build settings
+  build settings.fss_write
+
+using_mode:
+  build settings parameter:'mode:value'
+  build settings.fss_status_code parameter:'mode:value'
diff --git a/level_3/fss_write/data/build/settings b/level_3/fss_write/data/build/settings
new file mode 100644 (file)
index 0000000..3cad9dc
--- /dev/null
@@ -0,0 +1,68 @@
+# fss-0001
+
+build_name fss_write
+
+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
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -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_library main/fss_write.c main/common.c main/print.c main/private-common.c main/private-write.c
+build_sources_library basic/fss_write.c basic/common.c basic/print.c basic/private-common.c basic/private-write.c basic/private-print.c
+build_sources_library basic_list/fss_write.c basic_list/common.c basic_list/print.c basic_list/private-common.c basic_list/private-write.c basic_list/private-print.c
+build_sources_library embedded_list/fss_write.c embedded_list/common.c embedded_list/print.c embedded_list/private-common.c embedded_list/private-write.c embedded_list/private-print.c
+build_sources_library extended/fss_write.c extended/common.c extended/print.c extended/private-common.c extended/private-write.c extended/private-print.c
+build_sources_library extended_list/fss_write.c extended_list/common.c extended_list/print.c extended_list/private-common.c extended_list/private-write.c extended_list/private-print.c
+build_sources_library payload/fss_write.c payload/common.c payload/print.c payload/private-common.c payload/private-write.c payload/private-print.c
+
+build_sources_program main/main.c
+
+build_sources_headers main/fss_write.h main/common.h main/print.h main/private-common.h main/private-write.h
+build_sources_headers basic/fss_write.h basic/common.h basic/print.h basic/private-common.h basic/private-write.h basic/private-print.h
+build_sources_headers basic_list/fss_write.h basic_list/common.h basic_list/print.h basic_list/private-common.h basic_list/private-write.h basic_list/private-print.h
+build_sources_headers embedded_list/fss_write.h embedded_list/common.h embedded_list/print.h embedded_list/private-common.h embedded_list/private-write.h embedded_list/private-print.h
+build_sources_headers extended/fss_write.h extended/common.h extended/print.h extended/private-common.h extended/private-write.h extended/private-print.h
+build_sources_headers extended_list/fss_write.h extended_list/common.h extended_list/print.h extended_list/private-common.h extended_list/private-write.h extended_list/private-print.h
+build_sources_headers payload/fss_write.h payload/common.h payload/print.h payload/private-common.h payload/private-write.h payload/private-print.h
+
+build_script yes
+build_shared yes
+build_static no
+
+path_headers program/fss_write
+
+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