Setup the most basic functionality.
Currently they are both performing iki_read functionality.
The two programs require a different data structure.
I need to plan on how to handle this.
I may end up using callbacks and possibly a void pointer for data.
--- /dev/null
+#include "eki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_iki_read_eki_s_
+ const f_string_static_t iki_read_program_name_s = macro_f_string_static_t_initialize_1(IKI_READ_program_name_s, 0, IKI_READ_program_name_s_length);
+ const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize_1(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length);
+#endif // _di_iki_read_eki_s_
+
+#ifndef _di_iki_read_eki_setting_load_
+ void iki_read_eki_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main) {
+
+ if (!main) return;
+
+ if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) return;
+ if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) return;
+ if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) return;
+ }
+#endif // _di_iki_read_eki_setting_load_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_eki_common_h
+#define _iki_read_eki_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The IKI read specific strings.
+ */
+#ifndef _di_iki_read_eki_s_
+ #define IKI_READ_program_name_s "eki_read"
+ #define IKI_READ_program_name_long_s "EKI Read"
+
+ #define IKI_READ_program_name_s_length 8
+ #define IKI_READ_program_name_long_s_length 8
+
+ extern const f_string_static_t iki_read_program_name_s;
+ extern const f_string_static_t iki_read_program_name_long_s;
+#endif // _di_iki_read_eki_s_
+
+/**
+ * Perform the program setting load process for IKI.
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately returns without doing anything.
+ *
+ * @param arguments
+ * The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ * The program and settings data.
+ *
+ * This alters main.setting.state.status:
+ * F_okay on success.
+ *
+ * Errors (with error bit) from: f_console_parameter_process().
+ * Errors (with error bit) from: f_file_stream_open().
+ * Errors (with error bit) from: fll_program_parameter_process_context().
+ * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard().
+ *
+ * @see f_console_parameter_process()
+ * @see f_file_stream_open()
+ * @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity_standard()
+ */
+#ifndef _di_iki_read_eki_setting_load_
+ extern void iki_read_eki_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main);
+#endif // _di_iki_read_eki_setting_load_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_eki_common_h
--- /dev/null
+#include "eki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the eki_read functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_eki_eki_read_h
+#define _iki_read_eki_eki_read_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Libc includes.
+#include <dirent.h>
+#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/compare.h>
+#include <fll/level_0/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/iki.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/rip.h>
+#include <fll/level_0/signal.h>
+
+#ifndef _di_thread_support_
+ #include <fll/level_0/thread.h>
+#endif // _di_thread_support_
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/iki.h>
+#include <fll/level_1/print.h>
+
+// FLL-2 includes.
+#include <fll/level_2/error.h>
+#include <fll/level_2/file.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// IKI Read includes.
+#include <program/iki_read/main/common/define.h>
+#include <program/iki_read/main/common/enumeration.h>
+#include <program/iki_read/main/common/print.h>
+#include <program/iki_read/main/common/string.h>
+#include <program/iki_read/main/common/type.h>
+#include <program/iki_read/main/common.h>
+#include <program/iki_read/main/identify.h>
+#include <program/iki_read/main/print/data.h>
+#include <program/iki_read/main/print/error.h>
+#include <program/iki_read/main/print/message.h>
+#include <program/iki_read/main/process.h>
+#include <program/iki_read/main/signal.h>
+#include <program/iki_read/main/thread.h>
+#include <program/iki_read/eki/common.h>
+#include <program/iki_read/eki/print.h>
+#include <program/iki_read/eki/process.h>
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_eki_eki_read_h
--- /dev/null
+#include "eki_read.h"
+#include "../main/iki_read.h"
+
+int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
+
+ iki_read_main_t data = iki_read_main_t_initialize;
+
+ data.program.debug.flag |= iki_read_print_flag_debug_d | iki_read_print_flag_out_d;
+ data.program.error.flag |= iki_read_print_flag_error_d | iki_read_print_flag_out_d;
+ data.program.output.flag |= iki_read_print_flag_out_d;
+ data.program.message.flag |= iki_read_print_flag_message_d | iki_read_print_flag_out_d;
+ data.program.warning.flag |= iki_read_print_flag_warning_d | iki_read_print_flag_out_d;
+ data.program.error.custom = (void *) &data;
+ data.program.debug.custom = (void *) &data;
+ data.program.message.custom = (void *) &data;
+ data.program.output.custom = (void *) &data;
+ data.program.warning.custom = (void *) &data;
+
+ data.setting.state.custom = (void *) &data;
+ data.setting.state.handle = &fll_program_standard_signal_handle;
+
+ data.callback.print_help = &iki_read_eki_print_message_help;
+ //data.callback.process_objects_content = &iki_read_eki_process_objects_content;
+
+ f_console_parameter_t parameters[] = iki_read_console_parameter_t_initialize;
+ data.program.parameters.array = parameters;
+ data.program.parameters.used = iki_read_parameter_total_d;
+ data.program.environment = envp;
+
+ if (f_pipe_input_exists()) {
+ data.program.pipe = fll_program_data_pipe_input_e;
+ }
+
+ fll_program_standard_set_up(&data.program);
+
+ f_file_umask_get(&data.program.umask);
+
+ #ifdef _di_thread_support_
+ {
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
+
+ iki_read_setting_load(arguments, &data, &iki_read_eki_setting_load);
+ }
+
+ iki_read_main(&data);
+ #else
+ {
+ f_thread_id_t id_signal;
+
+ memset(&id_signal, 0, sizeof(f_thread_id_t));
+
+ data.setting.state.status = f_thread_create(0, &id_signal, &iki_read_thread_signal, (void *) &data);
+
+ if (F_status_is_error(data.setting.state.status)) {
+ iki_read_print_error(&data.program.error, macro_iki_read_f(f_thread_create));
+ }
+ else {
+ {
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
+
+ iki_read_setting_load(arguments, &data, &iki_read_eki_setting_load);
+ }
+
+ if (!iki_read_signal_check(&data)) {
+ iki_read_main(&data);
+ }
+
+ f_thread_cancel(id_signal);
+ f_thread_join(id_signal, 0);
+ }
+ }
+ #endif // _di_thread_support_
+
+ iki_read_main_delete(&data);
+
+ fll_program_standard_set_down(&data.program);
+
+ return F_status_is_error(data.setting.state.status) ? 1 : 0;
+}
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the main functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_eki_main_h
+#define _iki_read_eki_main_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_eki_main_h
--- /dev/null
+#include "eki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_iki_read_eki_print_message_help_
+ void iki_read_eki_print_message_help(fl_print_t * const print) {
+
+ if (!print) return;
+
+ f_file_stream_lock(print->to);
+
+ fll_program_print_help_header(print, iki_read_program_name_long_s, iki_read_program_version_s);
+
+ iki_read_print_message_help(print);
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ fll_program_print_help_usage(print, iki_read_program_name_s, f_string_empty_s);
+
+ iki_read_print_message_help_note(print);
+
+ f_file_stream_flush(print->to);
+ f_file_stream_unlock(print->to);
+ }
+#endif // _di_iki_read_eki_print_message_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_eki_print_h
+#define _iki_read_eki_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for EKI read.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This does not alter print.custom.setting.state.status.
+ */
+#ifndef _di_iki_read_eki_print_message_help_
+ extern void iki_read_eki_print_message_help(fl_print_t * const print);
+#endif // _di_iki_read_eki_print_message_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_eki_print_h
--- /dev/null
+#include "eki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the process functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_eki_process_h
+#define _iki_read_eki_process_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_eki_process_h
--- /dev/null
+#include "iki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_iki_read_iki_s_
+ const f_string_static_t iki_read_program_name_s = macro_f_string_static_t_initialize_1(IKI_READ_program_name_s, 0, IKI_READ_program_name_s_length);
+ const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize_1(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length);
+#endif // _di_iki_read_iki_s_
+
+#ifndef _di_iki_read_iki_setting_load_
+ void iki_read_iki_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main) {
+
+ if (!main) return;
+
+ if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) return;
+ if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) return;
+ if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) return;
+ }
+#endif // _di_iki_read_iki_setting_load_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the common functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_iki_common_h
+#define _iki_read_iki_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The IKI read specific strings.
+ */
+#ifndef _di_iki_read_iki_s_
+ #define IKI_READ_program_name_s "iki_read"
+ #define IKI_READ_program_name_long_s "IKI Read"
+
+ #define IKI_READ_program_name_s_length 8
+ #define IKI_READ_program_name_long_s_length 8
+
+ extern const f_string_static_t iki_read_program_name_s;
+ extern const f_string_static_t iki_read_program_name_long_s;
+#endif // _di_iki_read_iki_s_
+
+/**
+ * Perform the program setting load process for IKI.
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately returns without doing anything.
+ *
+ * @param arguments
+ * The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ * The program and settings data.
+ *
+ * This alters main.setting.state.status:
+ * F_okay on success.
+ *
+ * Errors (with error bit) from: f_console_parameter_process().
+ * Errors (with error bit) from: f_file_stream_open().
+ * Errors (with error bit) from: fll_program_parameter_process_context().
+ * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard().
+ *
+ * @see f_console_parameter_process()
+ * @see f_file_stream_open()
+ * @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_verbosity_standard()
+ */
+#ifndef _di_iki_read_iki_setting_load_
+ extern void iki_read_iki_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main);
+#endif // _di_iki_read_iki_setting_load_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_iki_common_h
--- /dev/null
+#include "iki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the iki_read functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_iki_iki_read_h
+#define _iki_read_iki_iki_read_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Libc includes.
+#include <dirent.h>
+#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/compare.h>
+#include <fll/level_0/console.h>
+#include <fll/level_0/conversion.h>
+#include <fll/level_0/file.h>
+#include <fll/level_0/iki.h>
+#include <fll/level_0/pipe.h>
+#include <fll/level_0/print.h>
+#include <fll/level_0/rip.h>
+#include <fll/level_0/signal.h>
+
+#ifndef _di_thread_support_
+ #include <fll/level_0/thread.h>
+#endif // _di_thread_support_
+
+// FLL-1 includes.
+#include <fll/level_1/conversion.h>
+#include <fll/level_1/iki.h>
+#include <fll/level_1/print.h>
+
+// FLL-2 includes.
+#include <fll/level_2/error.h>
+#include <fll/level_2/file.h>
+#include <fll/level_2/print.h>
+#include <fll/level_2/program.h>
+
+// IKI Read includes.
+#include <program/iki_read/main/common/define.h>
+#include <program/iki_read/main/common/enumeration.h>
+#include <program/iki_read/main/common/print.h>
+#include <program/iki_read/main/common/string.h>
+#include <program/iki_read/main/common/type.h>
+#include <program/iki_read/main/common.h>
+#include <program/iki_read/main/identify.h>
+#include <program/iki_read/main/print/data.h>
+#include <program/iki_read/main/print/error.h>
+#include <program/iki_read/main/print/message.h>
+#include <program/iki_read/main/process.h>
+#include <program/iki_read/main/signal.h>
+#include <program/iki_read/main/thread.h>
+#include <program/iki_read/iki/common.h>
+#include <program/iki_read/iki/print.h>
+#include <program/iki_read/iki/process.h>
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_iki_iki_read_h
--- /dev/null
+#include "iki_read.h"
+#include "../main/iki_read.h"
+
+int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
+
+ iki_read_main_t data = iki_read_main_t_initialize;
+
+ data.program.debug.flag |= iki_read_print_flag_debug_d | iki_read_print_flag_out_d;
+ data.program.error.flag |= iki_read_print_flag_error_d | iki_read_print_flag_out_d;
+ data.program.output.flag |= iki_read_print_flag_out_d;
+ data.program.message.flag |= iki_read_print_flag_message_d | iki_read_print_flag_out_d;
+ data.program.warning.flag |= iki_read_print_flag_warning_d | iki_read_print_flag_out_d;
+ data.program.error.custom = (void *) &data;
+ data.program.debug.custom = (void *) &data;
+ data.program.message.custom = (void *) &data;
+ data.program.output.custom = (void *) &data;
+ data.program.warning.custom = (void *) &data;
+
+ data.setting.state.custom = (void *) &data;
+ data.setting.state.handle = &fll_program_standard_signal_handle;
+
+ data.callback.print_help = &iki_read_iki_print_message_help;
+ //data.callback.process_objects_content = &iki_read_iki_process_objects_content;
+
+ f_console_parameter_t parameters[] = iki_read_console_parameter_t_initialize;
+ data.program.parameters.array = parameters;
+ data.program.parameters.used = iki_read_parameter_total_d;
+ data.program.environment = envp;
+
+ if (f_pipe_input_exists()) {
+ data.program.pipe = fll_program_data_pipe_input_e;
+ }
+
+ fll_program_standard_set_up(&data.program);
+
+ f_file_umask_get(&data.program.umask);
+
+ #ifdef _di_thread_support_
+ {
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
+
+ iki_read_setting_load(arguments, &data, &iki_read_iki_setting_load);
+ }
+
+ iki_read_main(&data);
+ #else
+ {
+ f_thread_id_t id_signal;
+
+ memset(&id_signal, 0, sizeof(f_thread_id_t));
+
+ data.setting.state.status = f_thread_create(0, &id_signal, &iki_read_thread_signal, (void *) &data);
+
+ if (F_status_is_error(data.setting.state.status)) {
+ iki_read_print_error(&data.program.error, macro_iki_read_f(f_thread_create));
+ }
+ else {
+ {
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
+
+ iki_read_setting_load(arguments, &data, &iki_read_iki_setting_load);
+ }
+
+ if (!iki_read_signal_check(&data)) {
+ iki_read_main(&data);
+ }
+
+ f_thread_cancel(id_signal);
+ f_thread_join(id_signal, 0);
+ }
+ }
+ #endif // _di_thread_support_
+
+ iki_read_main_delete(&data);
+
+ fll_program_standard_set_down(&data.program);
+
+ return F_status_is_error(data.setting.state.status) ? 1 : 0;
+}
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the main functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_iki_main_h
+#define _iki_read_iki_main_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_iki_main_h
--- /dev/null
+#include "iki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_iki_read_iki_print_message_help_
+ void iki_read_iki_print_message_help(fl_print_t * const print) {
+
+ if (!print) return;
+
+ f_file_stream_lock(print->to);
+
+ fll_program_print_help_header(print, iki_read_program_name_long_s, iki_read_program_version_s);
+
+ iki_read_print_message_help(print);
+
+ f_print_dynamic_raw(f_string_eol_s, print->to);
+
+ fll_program_print_help_usage(print, iki_read_program_name_s, f_string_empty_s);
+
+ iki_read_print_message_help_note(print);
+
+ f_file_stream_flush(print->to);
+ f_file_stream_unlock(print->to);
+ }
+#endif // _di_iki_read_iki_print_message_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_iki_print_h
+#define _iki_read_iki_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print help for IKI read.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This does not alter print.custom.setting.state.status.
+ */
+#ifndef _di_iki_read_iki_print_message_help_
+ extern void iki_read_iki_print_message_help(fl_print_t * const print);
+#endif // _di_iki_read_iki_print_message_help_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_iki_print_h
--- /dev/null
+#include "iki_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: IKI Read
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the process functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _iki_read_iki_process_h
+#define _iki_read_iki_process_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _iki_read_iki_process_h
#endif
#ifndef _di_iki_read_setting_load_
- void iki_read_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main) {
+ void iki_read_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main, void (*callback)(const f_console_arguments_t arguments, iki_read_main_t * const main)) {
if (!main) return;
+ main->program.output.to.id = F_type_descriptor_output_d;
+ main->program.output.to.stream = F_type_output_d;
+ main->program.output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+
+ f_console_parameters_t * const parameters = &main->program.parameters;
+
main->setting.state.step_small = iki_read_allocation_console_d;
- f_console_parameter_process(arguments, &main->program.parameters, &main->setting.state, 0);
+ f_console_parameter_process(arguments, parameters, &main->setting.state, 0);
main->setting.state.step_small = iki_read_allocation_small_d;
return;
}
- if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) {
+ if (callback) {
+ callback(arguments, main);
+ if (F_status_is_error(main->setting.state.status)) return;
+
+ if (main->setting.state.status == F_done) {
+ main->setting.state.status = F_okay;
+
+ return;
+ }
+ }
+
+ if (parameters->array[f_console_standard_parameter_help_e].result & f_console_result_found_e) {
main->setting.flag |= iki_read_main_flag_help_d;
return;
}
- if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) {
+ if (parameters->array[f_console_standard_parameter_version_e].result & f_console_result_found_e) {
main->setting.flag |= iki_read_main_flag_version_d;
return;
}
- if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) {
+ if (parameters->array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) {
main->setting.flag |= iki_read_main_flag_copyright_d;
return;
main->setting.flag &= ~iki_read_main_flag_pipe_d;
}
- if (!(main->program.parameters.remaining.used || (main->program.pipe & fll_program_data_pipe_input_e))) {
+ if (!(parameters->remaining.used || (main->program.pipe & fll_program_data_pipe_input_e))) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_missing_file(&main->program.error);
return;
}
- if (main->program.parameters.array[iki_read_parameter_at_e].result & f_console_result_value_e) {
- if (main->program.parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
+ f_number_unsigned_t index = 0;
+ f_number_unsigned_t at = 0;
+ f_number_unsigned_t i = 0;
+ f_number_unsigned_t j = 0;
+
+ if (parameters->array[iki_read_parameter_at_e].result & f_console_result_value_e) {
+ if (parameters->array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_at_s, iki_read_long_whole_s);
return;
}
- const f_number_unsigned_t index = main->program.parameters.array[iki_read_parameter_at_e].values.array[main->program.parameters.array[iki_read_parameter_at_e].values.used - 1];
+ index = parameters->array[iki_read_parameter_at_e].values.array[parameters->array[iki_read_parameter_at_e].values.used - 1];
main->setting.at = 0;
- main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->program.parameters.arguments.array[index], &main->setting.at);
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[index], &main->setting.at);
// Negative numbers are not supported.
if (main->setting.state.status == F_number_negative) {
if (F_status_is_error(main->setting.state.status)) {
main->setting.state.status = F_status_set_error(F_parameter);
- fll_program_print_error_parameter_integer_not(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_at_s, main->program.parameters.arguments.array[index]);
+ fll_program_print_error_parameter_integer_not(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_at_s, parameters->arguments.array[index]);
return;
}
main->setting.flag |= iki_read_main_flag_at_d;
}
- else if (main->program.parameters.array[iki_read_parameter_at_e].result & f_console_result_found_e) {
+ else if (parameters->array[iki_read_parameter_at_e].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_at_s);
return;
}
- if (main->program.parameters.array[iki_read_parameter_line_e].result & f_console_result_value_e) {
- const f_number_unsigned_t index = main->program.parameters.array[iki_read_parameter_line_e].values.array[main->program.parameters.array[iki_read_parameter_line_e].values.used - 1];
+ if (parameters->array[iki_read_parameter_line_e].result & f_console_result_value_e) {
+ index = parameters->array[iki_read_parameter_line_e].values.array[parameters->array[iki_read_parameter_line_e].values.used - 1];
main->setting.line = 0;
- main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->program.parameters.arguments.array[index], &main->setting.line);
+ main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, parameters->arguments.array[index], &main->setting.line);
// Negative numbers are not supported.
if (main->setting.state.status == F_number_negative) {
if (F_status_is_error(main->setting.state.status)) {
main->setting.state.status = F_status_set_error(F_parameter);
- fll_program_print_error_parameter_integer_not(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_line_s, main->program.parameters.arguments.array[index]);
+ fll_program_print_error_parameter_integer_not(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_line_s, parameters->arguments.array[index]);
return;
}
main->setting.flag |= iki_read_main_flag_line_d;
}
- else if (main->program.parameters.array[iki_read_parameter_line_e].result & f_console_result_found_e) {
+ else if (parameters->array[iki_read_parameter_line_e].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_line_s);
return;
}
- if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) {
+ if (parameters->array[iki_read_parameter_name_e].result & f_console_result_value_e) {
main->setting.names.used = 0;
- main->setting.state.status = f_memory_array_increase_by(main->program.parameters.array[iki_read_parameter_name_e].values.used, sizeof(f_string_dynamic_t), (void **) &main->setting.names.array, &main->setting.names.used, &main->setting.names.size);
+ main->setting.state.status = f_memory_array_increase_by(parameters->array[iki_read_parameter_name_e].values.used, sizeof(f_string_dynamic_t), (void **) &main->setting.names.array, &main->setting.names.used, &main->setting.names.size);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(f_memory_array_increase_by));
}
// Distinctly append all names.
- f_number_unsigned_t i = 0;
- f_number_unsigned_t j = 0;
- f_number_unsigneds_t *values = &main->program.parameters.array[iki_read_parameter_name_e].values;
+ f_number_unsigneds_t *values = ¶meters->array[iki_read_parameter_name_e].values;
+
+ j = 0;
- for (; i < values->used; ++i) {
+ for (i = 0; i < values->used; ++i) {
for (j = 0; j < main->setting.names.used; ++j) {
- if (f_compare_dynamic(main->program.parameters.arguments.array[values->array[i]], main->setting.names.array[j]) == F_equal_to) break;
+ if (f_compare_dynamic(parameters->arguments.array[values->array[i]], main->setting.names.array[j]) == F_equal_to) break;
} // for
if (j < main->setting.names.used) continue;
main->setting.names.array[main->setting.names.used].used = 0;
- if (main->program.parameters.arguments.array[values->array[i]].used) {
- main->setting.state.status = f_string_dynamics_append(main->program.parameters.arguments.array[values->array[i]], &main->setting.names);
+ if (parameters->arguments.array[values->array[i]].used) {
+ main->setting.state.status = f_string_dynamics_append(parameters->arguments.array[values->array[i]], &main->setting.names);
if (F_status_is_error(main->setting.state.status)) break;
}
else {
main->setting.flag |= iki_read_main_flag_name_d;
}
- else if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_found_e) {
+ else if (parameters->array[iki_read_parameter_name_e].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_name_s);
return;
}
- if (main->program.parameters.array[iki_read_parameter_replace_e].result & f_console_result_found_e) {
- if (!(main->program.parameters.array[iki_read_parameter_replace_e].result & f_console_result_value_e) || (main->program.parameters.array[iki_read_parameter_replace_e].values.used % 2)) {
+ if (parameters->array[iki_read_parameter_replace_e].result & f_console_result_found_e) {
+ if (!(parameters->array[iki_read_parameter_replace_e].result & f_console_result_value_e) || (parameters->array[iki_read_parameter_replace_e].values.used % 2)) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_replace_s, iki_read_string_two_s);
main->setting.replace.used = 0;
- main->setting.state.status = f_memory_array_increase_by(main->program.parameters.array[iki_read_parameter_replace_e].values.used / 2, sizeof(f_string_map_t), (void **) &main->setting.replace.array, &main->setting.replace.used, &main->setting.replace.size);
+ main->setting.state.status = f_memory_array_increase_by(parameters->array[iki_read_parameter_replace_e].values.used / 2, sizeof(f_string_map_t), (void **) &main->setting.replace.array, &main->setting.replace.used, &main->setting.replace.size);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(f_memory_array_increase_by));
return;
}
- f_number_unsigned_t at = 0;
- f_number_unsigned_t index = 0;
- f_number_unsigned_t i = 0;
- f_number_unsigned_t j = 0;
+ at = 0;
+ j = 0;
- for (; i < main->program.parameters.array[iki_read_parameter_replace_e].values.used; ++i) {
+ for (i = 0; i < parameters->array[iki_read_parameter_replace_e].values.used; ++i) {
- index = main->program.parameters.array[iki_read_parameter_replace_e].values.array[i];
+ index = parameters->array[iki_read_parameter_replace_e].values.array[i];
// Replace any existing value so that each name exists only once.
for (j = 0; j < main->setting.replace.used; ++j) {
-
- if (f_compare_dynamic(main->program.parameters.arguments.array[index], main->setting.replace.array[j].key) == F_equal_to) {
- break;
- }
+ if (f_compare_dynamic(parameters->arguments.array[index], main->setting.replace.array[j].key) == F_equal_to) break;
} // for
at = j;
return;
}
- main->setting.replace.array[at].key.string = main->program.parameters.arguments.array[index].string;
- main->setting.replace.array[at].key.used = main->program.parameters.arguments.array[index].used;
+ main->setting.replace.array[at].key.string = parameters->arguments.array[index].string;
+ main->setting.replace.array[at].key.used = parameters->arguments.array[index].used;
main->setting.replace.array[at].key.size = 0;
- index = main->program.parameters.array[iki_read_parameter_replace_e].values.array[++i];
+ index = parameters->array[iki_read_parameter_replace_e].values.array[++i];
- main->setting.replace.array[at].value.string = main->program.parameters.arguments.array[index].string;
- main->setting.replace.array[at].value.used = main->program.parameters.arguments.array[index].used;
+ main->setting.replace.array[at].value.string = parameters->arguments.array[index].string;
+ main->setting.replace.array[at].value.used = parameters->arguments.array[index].used;
main->setting.replace.array[at].value.size = 0;
if (at == main->setting.replace.used) {
main->setting.flag |= iki_read_main_flag_replace_d;
}
- if (iki_read_setting_load_parameter_substitution(main, main->program.parameters.array[iki_read_parameter_reassign_e], iki_read_long_reassign_s, &main->setting.reassign)) {
+ if (iki_read_setting_load_parameter_substitution(main, parameters->array[iki_read_parameter_reassign_e], iki_read_long_reassign_s, &main->setting.reassign)) {
main->setting.flag |= iki_read_main_flag_reassign_d;
}
if (F_status_is_error(main->setting.state.status)) return;
- if (iki_read_setting_load_parameter_substitution(main, main->program.parameters.array[iki_read_parameter_substitute_e], iki_read_long_substitute_s, &main->setting.substitute)) {
+ if (iki_read_setting_load_parameter_substitution(main, parameters->array[iki_read_parameter_substitute_e], iki_read_long_substitute_s, &main->setting.substitute)) {
main->setting.flag |= iki_read_main_flag_substitute_d;
}
if (F_status_is_error(main->setting.state.status)) return;
- if (main->program.parameters.array[iki_read_parameter_wrap_e].result & f_console_result_found_e) {
- if (!(main->program.parameters.array[iki_read_parameter_wrap_e].result & f_console_result_value_e) || (main->program.parameters.array[iki_read_parameter_wrap_e].values.used % 3)) {
+ if (parameters->array[iki_read_parameter_wrap_e].result & f_console_result_found_e) {
+ if (!(parameters->array[iki_read_parameter_wrap_e].result & f_console_result_value_e) || (parameters->array[iki_read_parameter_wrap_e].values.used % 3)) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, iki_read_long_wrap_s, iki_read_string_three_s);
main->setting.wrap.used = 0;
- main->setting.state.status = f_memory_array_increase_by(main->program.parameters.array[iki_read_parameter_wrap_e].values.used / 3, sizeof(f_string_triple_t), (void **) &main->setting.wrap.array, &main->setting.wrap.used, &main->setting.wrap.size);
+ main->setting.state.status = f_memory_array_increase_by(parameters->array[iki_read_parameter_wrap_e].values.used / 3, sizeof(f_string_triple_t), (void **) &main->setting.wrap.array, &main->setting.wrap.used, &main->setting.wrap.size);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(f_memory_array_increase_by));
return;
}
- f_number_unsigned_t at = 0;
- f_number_unsigned_t index = 0;
- f_number_unsigned_t i = 0;
- f_number_unsigned_t j = 0;
+ at = 0;
+ j = 0;
- for (; i < main->program.parameters.array[iki_read_parameter_wrap_e].values.used; ++i) {
+ for (i = 0; i < parameters->array[iki_read_parameter_wrap_e].values.used; ++i) {
- index = main->program.parameters.array[iki_read_parameter_wrap_e].values.array[i];
+ index = parameters->array[iki_read_parameter_wrap_e].values.array[i];
// Replace any existing values so that each name exists only once.
for (j = 0; j < main->setting.wrap.used; ++j) {
-
- if (f_compare_dynamic(main->program.parameters.arguments.array[index], main->setting.wrap.array[j].a) == F_equal_to) {
- break;
- }
+ if (f_compare_dynamic(parameters->arguments.array[index], main->setting.wrap.array[j].a) == F_equal_to) break;
} // for
at = j;
return;
}
- main->setting.wrap.array[at].a.string = main->program.parameters.arguments.array[index].string;
- main->setting.wrap.array[at].a.used = main->program.parameters.arguments.array[index].used;
+ main->setting.wrap.array[at].a.string = parameters->arguments.array[index].string;
+ main->setting.wrap.array[at].a.used = parameters->arguments.array[index].used;
main->setting.wrap.array[at].a.size = 0;
- index = main->program.parameters.array[iki_read_parameter_wrap_e].values.array[++i];
+ index = parameters->array[iki_read_parameter_wrap_e].values.array[++i];
- main->setting.wrap.array[at].b.string = main->program.parameters.arguments.array[index].string;
- main->setting.wrap.array[at].b.used = main->program.parameters.arguments.array[index].used;
+ main->setting.wrap.array[at].b.string = parameters->arguments.array[index].string;
+ main->setting.wrap.array[at].b.used = parameters->arguments.array[index].used;
main->setting.wrap.array[at].b.size = 0;
- index = main->program.parameters.array[iki_read_parameter_wrap_e].values.array[++i];
+ index = parameters->array[iki_read_parameter_wrap_e].values.array[++i];
- main->setting.wrap.array[at].c.string = main->program.parameters.arguments.array[index].string;
- main->setting.wrap.array[at].c.used = main->program.parameters.arguments.array[index].used;
+ main->setting.wrap.array[at].c.string = parameters->arguments.array[index].string;
+ main->setting.wrap.array[at].c.used = parameters->arguments.array[index].used;
main->setting.wrap.array[at].c.size = 0;
if (at == main->setting.wrap.used) {
main->setting.flag |= iki_read_main_flag_wrap_d;
}
- if (main->program.parameters.array[iki_read_parameter_literal_e].result & f_console_result_found_e) {
+ if (parameters->array[iki_read_parameter_literal_e].result & f_console_result_found_e) {
const uint8_t ids[3] = {
iki_read_parameter_object_e,
iki_read_parameter_content_e,
iki_read_long_total_s,
};
- for (uint8_t i = 0; i < 3; ++i) {
+ for (uint8_t k = 0; k < 3; ++k) {
- if (main->program.parameters.array[ids[i]].result & f_console_result_found_e) {
+ if (parameters->array[ids[k]].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
- fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[i]);
+ fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_literal_s, names[k]);
return;
}
main->setting.flag |= iki_read_main_flag_literal_d;
}
- else if (main->program.parameters.array[iki_read_parameter_object_e].result & f_console_result_found_e) {
+ else if (parameters->array[iki_read_parameter_object_e].result & f_console_result_found_e) {
const uint8_t ids[2] = {
iki_read_parameter_content_e,
iki_read_parameter_total_e,
iki_read_long_total_s,
};
- for (uint8_t i = 0; i < 2; ++i) {
+ for (uint8_t k = 0; k < 2; ++k) {
- if (main->program.parameters.array[ids[i]].result & f_console_result_found_e) {
+ if (parameters->array[ids[k]].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
- fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[i]);
+ fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_object_s, names[k]);
return;
}
main->setting.flag |= iki_read_main_flag_object_d;
}
- else if (main->program.parameters.array[iki_read_parameter_content_e].result & f_console_result_found_e) {
- if (main->program.parameters.array[iki_read_parameter_total_e].result & f_console_result_found_e) {
+ else if (parameters->array[iki_read_parameter_content_e].result & f_console_result_found_e) {
+ if (parameters->array[iki_read_parameter_total_e].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_content_s, iki_read_long_total_s);
main->setting.flag |= iki_read_main_flag_content_d;
}
- else if (main->program.parameters.array[iki_read_parameter_total_e].result & f_console_result_found_e) {
- if (main->program.parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
+ else if (parameters->array[iki_read_parameter_total_e].result & f_console_result_found_e) {
+ if (parameters->array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
main->setting.state.status = F_status_set_error(F_parameter);
fll_program_print_error_parameter_cannot_use_with(&main->program.error, f_console_symbol_long_normal_s, f_console_symbol_long_normal_s, iki_read_long_total_s, iki_read_long_wrap_s);
main->setting.flag |= iki_read_main_flag_content_d;
}
- if (main->program.parameters.array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
+ if (parameters->array[iki_read_parameter_whole_e].result & f_console_result_found_e) {
main->setting.flag |= iki_read_main_flag_whole_d;
}
- if (main->program.parameters.remaining.used) {
+ if (parameters->remaining.used) {
main->setting.files.used = 0;
- main->setting.state.status = f_memory_arrays_resize(main->program.parameters.remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size, &f_string_dynamics_delete_callback);
+ main->setting.state.status = f_memory_arrays_resize(parameters->remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size, &f_string_dynamics_delete_callback);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(f_memory_arrays_resize));
return;
}
- f_number_unsigned_t index = 0;
+ index = 0;
- for (f_number_unsigned_t i = 0; i < main->program.parameters.remaining.used; ++i, ++main->setting.files.used) {
+ for (i = 0; i < parameters->remaining.used; ++i, ++main->setting.files.used) {
// Static strings are being used, so if a dynamic string exists (size > 0), then de-allocate it.
if (main->setting.files.array[main->setting.files.used].size) {
}
}
- index = main->program.parameters.remaining.array[i];
+ index = parameters->remaining.array[i];
- main->setting.files.array[main->setting.files.used].string = main->program.parameters.arguments.array[index].string;
- main->setting.files.array[main->setting.files.used].used = main->program.parameters.arguments.array[index].used;
+ main->setting.files.array[main->setting.files.used].string = parameters->arguments.array[index].string;
+ main->setting.files.array[main->setting.files.used].used = parameters->arguments.array[index].used;
main->setting.files.array[main->setting.files.used].size = 0;
main->setting.state.status = f_file_exists(main->setting.files.array[main->setting.files.used], F_true);
f_number_unsigned_t i = 0;
f_number_unsigned_t j = 0;
+ f_console_parameters_t * const parameters = &main->program.parameters;
+
for (; i < parameter.values.used; ++i) {
index = parameter.values.array[i];
// Replace any existing values so that each name and value pair exists only once.
for (j = 0; j < triple->used; ++j) {
- if (f_compare_dynamic(main->program.parameters.arguments.array[index], triple->array[j].a) == F_equal_to) {
- if (f_compare_dynamic(main->program.parameters.arguments.array[parameter.values.array[i + 1]], triple->array[j].b) == F_equal_to) {
+ if (f_compare_dynamic(parameters->arguments.array[index], triple->array[j].a) == F_equal_to) {
+ if (f_compare_dynamic(parameters->arguments.array[parameter.values.array[i + 1]], triple->array[j].b) == F_equal_to) {
break;
}
}
return F_false;
}
- triple->array[at].a.string = main->program.parameters.arguments.array[index].string;
- triple->array[at].a.used = main->program.parameters.arguments.array[index].used;
+ triple->array[at].a.string = parameters->arguments.array[index].string;
+ triple->array[at].a.used = parameters->arguments.array[index].used;
triple->array[at].a.size = 0;
index = parameter.values.array[++i];
- triple->array[at].b.string = main->program.parameters.arguments.array[index].string;
- triple->array[at].b.used = main->program.parameters.arguments.array[index].used;
+ triple->array[at].b.string = parameters->arguments.array[index].string;
+ triple->array[at].b.used = parameters->arguments.array[index].used;
triple->array[at].b.size = 0;
index = parameter.values.array[++i];
- triple->array[at].c.string = main->program.parameters.arguments.array[index].string;
- triple->array[at].c.used = main->program.parameters.arguments.array[index].used;
+ triple->array[at].c.string = parameters->arguments.array[index].string;
+ triple->array[at].c.used = parameters->arguments.array[index].used;
triple->array[at].c.size = 0;
if (at == triple->used) {
* Errors (with error bit) from: f_string_dynamic_append().
* Errors (with error bit) from: fll_program_parameter_process_context().
* Errors (with error bit) from: fll_program_parameter_process_verbosity_standard().
+ * @param callback
+ * (optional) Designate a function to call after performing the initial processing, but before printing help.
+ * If the function returns F_done, then this function immediately returns, resetting status to F_okay.
+ * Set to NULL to disable.
*
* @see f_console_parameter_process()
* @see f_file_exists()
* @see fll_program_parameter_process_verbosity_standard()
*/
#ifndef _di_iki_read_setting_load_
- extern void iki_read_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main);
+ extern void iki_read_setting_load(const f_console_arguments_t arguments, iki_read_main_t * const main, void (*callback)(const f_console_arguments_t arguments, iki_read_main_t * const main));
#endif // _di_iki_read_setting_load_
/**
const f_string_static_t iki_read_program_version_s = macro_f_string_static_t_initialize_1(IKI_READ_program_version_s, 0, IKI_READ_program_version_s_length);
#endif // _di_iki_read_program_version_s_
-#ifndef _di_iki_read_program_name_s_
- const f_string_static_t iki_read_program_name_s = macro_f_string_static_t_initialize_1(IKI_READ_program_name_s, 0, IKI_READ_program_name_s_length);
- const f_string_static_t iki_read_program_name_long_s = macro_f_string_static_t_initialize_1(IKI_READ_program_name_long_s, 0, IKI_READ_program_name_long_s_length);
-#endif // _di_iki_read_program_name_s_
-
#ifndef _di_iki_read_s_
const f_string_static_t iki_read_string_two_s = macro_f_string_static_t_initialize_1(IKI_READ_string_two_s, 0, IKI_READ_string_two_s_length);
const f_string_static_t iki_read_string_three_s = macro_f_string_static_t_initialize_1(IKI_READ_string_three_s, 0, IKI_READ_string_three_s_length);
#endif // _di_iki_read_program_version_s_
/**
- * The program name.
- */
-#ifndef _di_iki_read_program_name_s_
- #define IKI_READ_program_name_s "iki_read"
- #define IKI_READ_program_name_long_s "IKI Read"
-
- #define IKI_READ_program_name_s_length 8
- #define IKI_READ_program_name_long_s_length 8
-
- extern const f_string_static_t iki_read_program_name_s;
- extern const f_string_static_t iki_read_program_name_long_s;
-#endif // _di_iki_read_program_name_s_
-
-/**
- * A collection of static strings associated with IKI Read.
+ * Special strings used by this program.
*/
#ifndef _di_iki_read_s_
#define IKI_READ_string_two_s "two"
extern const f_string_static_t iki_read_string_two_s;
extern const f_string_static_t iki_read_string_three_s;
+
+ // These are defined by the individual programs.
+ extern const f_string_static_t iki_read_program_name_s;
+ extern const f_string_static_t iki_read_program_name_long_s;
#endif // _di_iki_read_s_
+/**
+ * A collection of static strings associated with IKI Read for substitutions.
+ */
#ifndef _di_iki_read_substitution_s_
#define IKI_READ_substitution_after_s "after"
#define IKI_READ_substitution_before_s "before"
extern "C" {
#endif
+#ifndef _di_iki_read_setting_delete_
+ void iki_read_cache_delete(iki_read_cache_t * const cache) {
+
+ if (!cache) return;
+
+ f_memory_array_resize(0, sizeof(f_char_t), (void **) &cache->buffer.string, &cache->buffer.used, &cache->buffer.size);
+ }
+#endif // _di_iki_read_cache_delete_
+
#ifndef _di_iki_read_main_delete_
void iki_read_main_delete(iki_read_main_t * const main) {
if (!main) return;
+ iki_read_cache_delete(&main->cache);
fll_program_data_delete(&main->program);
iki_read_setting_delete(&main->setting);
}
if (!setting) return;
- f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->buffer.string, &setting->buffer.used, &setting->buffer.size);
-
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &setting->names.array, &setting->names.used, &setting->names.size, &f_string_dynamics_delete_callback);
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &setting->files.array, &setting->files.used, &setting->files.size, &f_string_dynamics_delete_callback);
#endif
/**
- * The iki read main program settings.
+ * The IKI read main program cache.
+ *
+ * Properties:
+ * - buffer: A buffer used for loading the files and other miscellaneous tasks.
+ */
+#ifndef _di_iki_read_setting_t_
+ typedef struct {
+ f_string_dynamic_t buffer;
+ } iki_read_cache_t;
+
+ #define iki_read_cache_t_initialize \
+ { \
+ f_string_dynamic_t_initialize, \
+ }
+#endif // _di_iki_read_cache_t_
+
+/**
+ * The IKI write callbacks.
+ *
+ * Properties:
+ * - print_help: Print the main help message.
+ *
+ * - process_objects_content: Process an Objects and Content set.
+ */
+#ifndef _di_iki_read_callback_t_
+ typedef struct {
+ void (*print_help)(fl_print_t * const print);
+
+ void (*process_objects_content)(void * const main, const f_string_statics_t objects, const f_string_static_t content);
+ } iki_read_callback_t;
+
+ #define iki_read_callback_t_initialize \
+ { \
+ 0, \
+ 0, \
+ }
+#endif // _di_iki_read_callback_t_
+
+/**
+ * The IKI read 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).
* - at: The position representing the "at" index.
* - line: The position representing the "line" index.
*
- * - buffer: A buffer used for loading the files and other miscellaneous tasks.
* - name: A string representing the IKI vocabulary name being selected.
* - files: An array of all files to process (except for the input pipe).
*
f_number_unsigned_t at;
f_number_unsigned_t line;
- f_string_dynamic_t buffer;
f_string_dynamics_t names;
f_string_dynamics_t files;
macro_f_state_t_initialize_1(iki_read_allocation_large_d, iki_read_allocation_small_d, F_okay, 0, 0, 0, 0, 0, 0, 0), \
0, \
0, \
- f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_maps_t_initialize, \
*/
#ifndef _di_iki_read_main_t_
typedef struct {
+ iki_read_cache_t cache;
+ iki_read_callback_t callback;
fll_program_data_t program;
iki_read_setting_t setting;
} iki_read_main_t;
#define iki_read_main_t_initialize \
{ \
+ iki_read_cache_t_initialize, \
+ iki_read_callback_t_initialize, \
fll_program_data_t_initialize, \
iki_read_setting_t_initialize, \
}
#endif // _di_iki_read_main_t_
/**
+ * Delete the program cache data.
+ *
+ * @param cache
+ * The program cache data.
+ *
+ * Must not be NULL.
+ *
+ * This does not alter setting.state.status.
+ *
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_iki_read_setting_delete_
+ extern void iki_read_cache_delete(iki_read_cache_t * const cache);
+#endif // _di_iki_read_cache_delete_
+
+/**
* De-allocate main program data.
*
* @param main
j = main->setting.replace.used - 1;
do {
- if (f_compare_dynamic_partial_string(main->setting.replace.array[j].key.string, main->setting.buffer, main->setting.replace.array[j].key.used, main->setting.data.vocabulary.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(main->setting.replace.array[j].key.string, main->cache.buffer, main->setting.replace.array[j].key.used, main->setting.data.vocabulary.array[i]) == F_equal_to) {
main->setting.map_replaces[i] = j;
break;
j = main->setting.wrap.used - 1;
do {
- if (f_compare_dynamic_partial_string(main->setting.wrap.array[j].a.string, main->setting.buffer, main->setting.wrap.array[j].a.used, main->setting.data.vocabulary.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(main->setting.wrap.array[j].a.string, main->cache.buffer, main->setting.wrap.array[j].a.used, main->setting.data.vocabulary.array[i]) == F_equal_to) {
main->setting.map_wraps[i] = j;
break;
f_number_unsigned_t i = triple->used - 1;
do {
- if (f_compare_dynamic_partial_string(triple->array[i].a.string, main->setting.buffer, triple->array[i].a.used, name) == F_equal_to) {
- if (f_compare_dynamic_partial_string(triple->array[i].b.string, main->setting.buffer, triple->array[i].b.used, value) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(triple->array[i].a.string, main->cache.buffer, triple->array[i].a.used, name) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(triple->array[i].b.string, main->cache.buffer, triple->array[i].b.used, value) == F_equal_to) {
return i;
}
}
return;
}
- if (main->setting.flag & iki_read_main_flag_pipe_d) {
- f_file_t file = f_file_t_initialize;
+ f_file_t file = f_file_t_initialize;
+ if (main->setting.flag & iki_read_main_flag_pipe_d) {
file.id = F_type_descriptor_input_d;
- main->setting.buffer.used = 0;
+ main->cache.buffer.used = 0;
- main->setting.state.status = f_file_read(file, &main->setting.buffer);
+ main->setting.state.status = f_file_read(file, &main->cache.buffer);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error_file(&main->program.error, macro_iki_read_f(f_file_read), f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
}
if (F_status_is_error_not(main->setting.state.status) && main->setting.files.used) {
- f_file_t file = f_file_t_initialize;
off_t size_block = 0;
off_t size_file = 0;
off_t size_read = 0;
}
// Pre-allocate entire file buffer plus space for the terminating NULL.
- main->setting.state.status = f_memory_array_increase_by(size_file + 1, sizeof(f_char_t), (void **) &main->setting.buffer.string, &main->setting.buffer.used, &main->setting.buffer.size);
+ main->setting.state.status = f_memory_array_increase_by(size_file + 1, sizeof(f_char_t), (void **) &main->cache.buffer.string, &main->cache.buffer.used, &main->cache.buffer.size);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error_file(&main->program.error, macro_iki_read_f(f_memory_array_increase_by), main->setting.files.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
break;
}
- main->setting.state.status = f_file_stream_read_until(file, size_block, &main->setting.buffer);
+ main->setting.state.status = f_file_stream_read_until(file, size_block, &main->cache.buffer);
if (F_status_is_error(main->setting.state.status)) break;
} // for
iki_read_process_buffer(main);
if (F_status_is_error(main->setting.state.status)) break;
- main->setting.buffer.used = 0;
+ main->cache.buffer.used = 0;
} // for
if (F_status_is_error(main->setting.state.status)) {
else {
f_range_t range = macro_f_range_t_initialize_1(main->setting.data.variable.array[index].start, main->setting.data.content.array[index].start - 1);
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
f_print_dynamic(main->setting.reassign.array[at].c, main->program.output.to);
range.start = main->setting.data.content.array[index].stop + 1;
range.stop = main->setting.data.variable.array[index].stop;
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
}
return;
else {
f_range_t range = macro_f_range_t_initialize_1(main->setting.data.variable.array[index].start, main->setting.data.content.array[index].start - 1);
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
iki_read_print_data_wrap_prepend(&main->program.output, index);
range.start = main->setting.data.content.array[index].stop + 1;
range.stop = main->setting.data.variable.array[index].stop;
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
}
}
else if (main->setting.replace.used && main->setting.map_replaces[index] < main->setting.replace.used) {
else {
f_range_t range = macro_f_range_t_initialize_1(main->setting.data.variable.array[index].start, main->setting.data.content.array[index].start - 1);
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
iki_read_print_data_wrap_prepend(&main->program.output, index);
range.start = main->setting.data.content.array[index].stop + 1;
range.stop = main->setting.data.variable.array[index].stop;
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
}
}
else if (main->setting.flag & iki_read_main_flag_content_d) {
iki_read_print_data_wrap_prepend(&main->program.output, index);
- f_print_dynamic_partial(main->setting.buffer, main->setting.data.content.array[index], main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, main->setting.data.content.array[index], main->program.output.to);
iki_read_print_data_wrap_append(&main->program.output, index);
}
else if (main->setting.flag & iki_read_main_flag_object_d) {
- f_print_dynamic_partial(main->setting.buffer, main->setting.data.vocabulary.array[index], main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, main->setting.data.vocabulary.array[index], main->program.output.to);
}
else {
f_range_t range = macro_f_range_t_initialize_1(main->setting.data.variable.array[index].start, main->setting.data.content.array[index].start - 1);
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
iki_read_print_data_wrap_prepend(&main->program.output, index);
- f_print_dynamic_partial(main->setting.buffer, main->setting.data.content.array[index], main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, main->setting.data.content.array[index], main->program.output.to);
iki_read_print_data_wrap_append(&main->program.output, index);
range.start = main->setting.data.content.array[index].stop + 1;
range.stop = main->setting.data.variable.array[index].stop;
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
}
}
#endif // _di_iki_read_print_data_
#endif
#ifndef _di_iki_read_print_message_help_
- f_status_t iki_read_print_message_help(fl_print_t * const print) {
+ void iki_read_print_message_help(fl_print_t * const print) {
- if (!print) return F_status_set_error(F_output_not);
-
- f_file_stream_lock(print->to);
-
- fll_program_print_help_header(print, iki_read_program_name_long_s, iki_read_program_version_s);
+ if (!print) return;
fll_program_print_help_option_standard(print);
f_print_dynamic_raw(f_string_eol_s, print->to);
fll_program_print_help_usage(print, iki_read_program_name_s, fll_program_parameter_filenames_s);
+ }
+#endif // _di_iki_read_print_message_help_
+
+#ifndef _di_iki_read_print_message_help_note_
+ void iki_read_print_message_help_note(fl_print_t * const print) {
+
+ if (!print) return;
fl_print_format("%r %[Notes:%]%r", print->to, f_string_eol_s, print->set->important, print->set->important, f_string_eol_s);
fl_print_format(" This program will find and print Variables, Vocabularies, or Content following the IKI standard, without focusing on any particular Vocabulary specification.%r%r", print->to, f_string_eol_s, f_string_eol_s);
fl_print_format(" option takes priority over the %[%r%r%] option when matching the same Variable.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, iki_read_long_replace_s, print->set->notable, f_string_eol_s, f_string_eol_s);
fl_print_format(" The default behavior is to only display Content portion of the IKI Variable.%r", print->to, f_string_eol_s);
-
- f_file_stream_flush(print->to);
- f_file_stream_unlock(print->to);
-
- return F_okay;
}
-#endif // _di_iki_read_print_message_help_
+#endif // _di_iki_read_print_message_help_note_
#ifdef __cplusplus
} // extern "C"
* @param print
* The output structure to print to.
*
- * This does not alter print.custom.setting.state.status.
- *
- * @return
- * F_okay on success.
- * F_output_not on success, but no printing is performed.
+ * The print.custom is expected to be of type iki_read_main_t.
*
- * F_output_not (with error bit) if setting is NULL.
+ * This does not alter print.custom.setting.state.status.
*/
#ifndef _di_iki_read_print_message_help_
- extern f_status_t iki_read_print_message_help(fl_print_t * const print);
+ extern void iki_read_print_message_help(fl_print_t * const print);
#endif // _di_iki_read_print_message_help_
+/**
+ * Print standard parts of the help regarding notes.
+ *
+ * This is expected to be called as part of the help printing and does not perform any locking.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * The print.custom is expected to be of type iki_read_main_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ */
+#ifndef _di_iki_read_print_message_help_note_
+ extern void iki_read_print_message_help_note(fl_print_t * const print);
+#endif // _di_iki_read_print_message_help_note_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif
#ifndef _di_iki_read_process_line_
- void iki_read_process_line(iki_read_main_t * const main, f_range_t *range) {
+ void iki_read_process_line(iki_read_main_t * const main, f_range_t * const range) {
if (!(main->setting.flag & iki_read_main_flag_line_d)) {
main->setting.state.status = F_false;
range->start = 0;
if (main->setting.line) {
- for (; line < main->setting.line && range->start < main->setting.buffer.used; ++range->start) {
- if (main->setting.buffer.string[range->start] == f_string_eol_s.string[0]) ++line;
+ for (; line < main->setting.line && range->start < main->cache.buffer.used; ++range->start) {
+ if (main->cache.buffer.string[range->start] == f_string_eol_s.string[0]) ++line;
} // for
}
if (line == main->setting.line) {
// Find where the found line ends and set that as the range stop.
- for (range->stop = range->start; range->stop < main->setting.buffer.used; ++range->stop) {
- if (main->setting.buffer.string[range->stop] == f_string_eol_s.string[0]) break;
+ for (range->stop = range->start; range->stop < main->cache.buffer.used; ++range->stop) {
+ if (main->cache.buffer.string[range->stop] == f_string_eol_s.string[0]) break;
} // for
main->setting.state.status = F_true;
return;
}
- f_range_t buffer_range = macro_f_range_t_initialize_2(main->setting.buffer.used);
+ f_range_t buffer_range = macro_f_range_t_initialize_2(main->cache.buffer.used);
iki_read_process_line(main, &buffer_range);
if (main->setting.state.status == F_true) {
- if (buffer_range.start > main->setting.buffer.used) {
+ if (buffer_range.start > main->cache.buffer.used) {
main->setting.state.status = F_data_not;
return;
#endif // _di_iki_read_process_buffer_
#ifndef _di_iki_read_process_buffer_ranges_
- void iki_read_process_buffer_ranges(iki_read_main_t * const main, f_range_t *buffer_range) {
+ void iki_read_process_buffer_ranges(iki_read_main_t * const main, f_range_t * const buffer_range) {
- fl_iki_read(&main->setting.buffer, buffer_range, &main->setting.data, &main->setting.state);
+ fl_iki_read(&main->cache.buffer, buffer_range, &main->setting.data, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_read));
main->setting.map_wraps = wraps;
for (; i < main->setting.data.delimits.used; ++i) {
- main->setting.buffer.string[main->setting.data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
+ main->cache.buffer.string[main->setting.data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
} // for
iki_read_identify_alteration(main);
if (main->setting.flag & iki_read_main_flag_name_d) {
f_number_unsigned_t j = 0;
f_number_unsigned_t matches = 0;
- bool unmatched = F_true;
+ uint8_t unmatched = F_true;
f_file_stream_lock(main->program.output.to);
for (j = 0; j < main->setting.names.used; ++j) {
- if (f_compare_dynamic_partial_string(main->setting.names.array[j].string, main->setting.buffer, main->setting.names.array[j].used, main->setting.data.vocabulary.array[i]) == F_equal_to) {
+ if (f_compare_dynamic_partial_string(main->setting.names.array[j].string, main->cache.buffer, main->setting.names.array[j].used, main->setting.data.vocabulary.array[i]) == F_equal_to) {
unmatched = F_false;
if (main->setting.flag & iki_read_main_flag_at_d) {
f_range_t range = buffer_range;
- fl_iki_read(&main->setting.buffer, &range, &main->setting.data, &main->setting.state);
+ fl_iki_read(&main->cache.buffer, &range, &main->setting.data, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_read));
f_number_unsigned_t i = 0;
for (; i < main->setting.data.delimits.used; ++i) {
- main->setting.buffer.string[main->setting.data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
+ main->cache.buffer.string[main->setting.data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
} // for
if (!main->setting.data.variable.used) {
- fll_print_dynamic_partial(main->setting.buffer, buffer_range, main->program.output.to);
+ fll_print_dynamic_partial(main->cache.buffer, buffer_range, main->program.output.to);
main->setting.state.status = F_okay;
range.start = i;
range.stop = main->setting.data.variable.array[j].start - 1;
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
range.start = main->setting.data.variable.array[j].stop + 1;
range.stop = buffer_range.stop;
if (main->setting.names.used) {
for (k = 0; k < main->setting.names.used; ++k) {
- if (f_compare_dynamic_partial_string(main->setting.names.array[k].string, main->setting.buffer, main->setting.names.array[k].used, main->setting.data.vocabulary.array[j]) == F_equal_to) break;
+ if (f_compare_dynamic_partial_string(main->setting.names.array[k].string, main->cache.buffer, main->setting.names.array[k].used, main->setting.data.vocabulary.array[j]) == F_equal_to) break;
} // for
if (k < main->setting.names.used) {
if (i <= buffer_range.stop) {
range.start = i;
- f_print_dynamic_partial(main->setting.buffer, range, main->program.output.to);
+ f_print_dynamic_partial(main->cache.buffer, range, main->program.output.to);
}
f_file_stream_unlock(main->program.output.to);
#ifndef _di_iki_read_process_buffer_total_
void iki_read_process_buffer_total(iki_read_main_t * const main) {
- f_range_t range = macro_f_range_t_initialize_2(main->setting.buffer.used);
+ f_range_t range = macro_f_range_t_initialize_2(main->cache.buffer.used);
iki_read_process_line(main, &range);
if (main->setting.state.status == F_true) {
- if (range.start > main->setting.buffer.used) {
+ if (range.start > main->cache.buffer.used) {
fll_print_format("%r%r", main->program.output.to, f_string_ascii_0_s, f_string_eol_s);
main->setting.state.status = F_okay;
return;
}
- fl_iki_read(&main->setting.buffer, &range, &main->setting.data, &main->setting.state);
+ fl_iki_read(&main->cache.buffer, &range, &main->setting.data, &main->setting.state);
if (F_status_is_error(main->setting.state.status)) {
iki_read_print_error(&main->program.error, macro_iki_read_f(fl_iki_read));
f_number_unsigned_t total = 0;
for (; i < main->setting.data.delimits.used; ++i) {
- main->setting.buffer.string[main->setting.data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
+ main->cache.buffer.string[main->setting.data.delimits.array[i]] = f_iki_syntax_placeholder_s.string[0];
} // for
if (main->program.parameters.array[iki_read_parameter_name_e].result & f_console_result_value_e) {
for (j = 0; j < main->setting.data.vocabulary.used; ++j) {
- main->setting.state.status = f_compare_dynamic_partial(name, main->setting.buffer, range, main->setting.data.vocabulary.array[j]);
+ main->setting.state.status = f_compare_dynamic_partial(name, main->cache.buffer, range, main->setting.data.vocabulary.array[j]);
if (main->setting.state.status == F_equal_to) ++total;
} // for
*
* @param main
* The main program data.
- * @param setting
- * The main program settings.
+ *
+ * Must not be NULL.
*
* This alters setting.state.status:
* F_true is returned if the range is processed.
* The range value to represent the --line values.
*/
#ifndef _di_iki_read_process_line_
- extern void iki_read_process_line(iki_read_main_t * const main, f_range_t *range);
+ extern void iki_read_process_line(iki_read_main_t * const main, f_range_t * const range);
#endif // _di_iki_read_process_line_
/**
*
* @param main
* The main program data.
- * @param setting
- * The main program settings.
+ *
+ * Must not be NULL.
*
* This alters setting.state.status:
* F_okay on success.
*
* @param main
* The main program data.
- * @param setting
- * The main program settings.
+ *
+ * Must not be NULL.
* @param buffer_range
* The range within the buffer to process.
*
+ * Must not be NULL.
+ *
* @return
* F_okay on success.
* F_data_not on success, but nothing to print.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_ranges_
- extern void iki_read_process_buffer_ranges(iki_read_main_t * const main, f_range_t *buffer_range);
+ extern void iki_read_process_buffer_ranges(iki_read_main_t * const main, f_range_t * const buffer_range);
#endif // _di_iki_read_process_buffer_ranges_
/**
*
* @param main
* The main program data.
- * @param setting
- * The main program settings.
- * @param buffer_range
- * The range within the buffer to process.
+ *
+ * Must not be NULL.
*
* @return
* F_okay on success.
*
* @param main
* The main program data.
- * @param setting
- * The main program settings.
+ *
+ * Must not be NULL.
*
* @return
* F_okay on success.
environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH
main:
- build
+ build settings
+ build settings.eki_read
+ build settings.iki_read
install:
shell ./install.sh parameter:'work' parameter:'verbosity' parameter:'color'
+ shell ./install.sh parameter:'work' parameter:'verbosity' parameter:'color' -s data/build/settings.eki_read
+ shell ./install.sh parameter:'work' parameter:'verbosity' parameter:'color' -s data/build/settings.iki_read
help:
print
- print context:'title'Fakefile Options for IKI Read Program.context:'reset'
+ print context:'title'Fakefile Options for IKI Read Programs.context:'reset'
print
print The following operations are available\:
# fss-0001
#
+# Builds the main library of the project with all parts except "main" program related.
+#
# Modes:
# - android: Compile on an android system (using Termux; may need modification depending on the android system).
# - clang: Use CLang rather than the default, which is generally GCC.
build_sources_library main/iki_read.c main/common.c main/identify.c main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c main/print/data.c main/print/error.c main/print/message.c main/process.c main/signal.c main/thread.c
-build_sources_program main/main.c
-
build_sources_headers main/iki_read.h main/common.h main/identify.h main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h main/print/data.h main/print/error.h main/print/message.h main/process.h main/signal.h main/thread.h
build_sources_documentation man
build_static no
path_headers program/iki_read
-path_library_script script
-path_library_shared shared
-path_library_static static
-path_object_script script
-path_object_shared shared
-path_object_static static
-path_program_script script
-path_program_shared shared
-path_program_static static
has_path_standard yes
preserve_path_headers yes
--- /dev/null
+# fss-0001
+#
+# Builds the "eki_read" program.
+# This must be called after the "setting".
+#
+
+build_name eki_read
+
+version_major 0
+version_minor 7
+version_micro 0
+version_file micro
+version_target minor
+
+modes android clang coverage fanalyzer gcc gcc_13 individual individual_thread level monolithic test thread threadless
+modes_default monolithic thread gcc
+
+build_compiler gcc
+build_compiler-clang clang
+build_indexer ar
+build_indexer_arguments rcs
+build_language c
+
+build_libraries -lc -liki_read
+build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion -lfl_iki -lfl_print -lf_color -lf_compare -lf_console -lf_conversion -lf_file -lf_iki -lf_memory -lf_pipe -lf_print -lf_rip -lf_signal -lf_string -lf_type_array -lf_utf
+build_libraries-individual_thread -lf_thread
+build_libraries-level -lfll_2 -lfll_1 -lfll_0
+build_libraries-monolithic -lfll
+
+build_sources_program eki/main.c
+build_sources_program eki/common.c eki/eki_read.c eki/print.c eki/process.c
+
+build_sources_headers eki/common.h eki/eki_read.h eki/print.h eki/process.h
+
+build_sources_documentation man
+
+build_script yes
+build_shared yes
+build_static no
+
+path_headers program/iki_read
+
+has_path_standard yes
+preserve_path_headers yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+environment PATH LD_LIBRARY_PATH
+environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH
+
+#defines -D_di_libcap_
+defines -D_libcap_legacy_only_
+defines-android -D_di_f_thread_attribute_affinity_get_ -D_di_f_thread_attribute_affinity_set_ -D_di_f_thread_attribute_concurrency_get_ -D_di_f_thread_attribute_concurrency_set_ -D_di_f_thread_attribute_default_get_ -D_di_f_thread_attribute_default_set_ -D_di_f_thread_cancel_ -D_di_f_thread_cancel_state_set_ -D_di_f_thread_cancel_test_ -D_di_f_thread_join_try_ -D_di_f_thread_join_timed_ -D_pthread_mutex_prioceiling_unsupported_ -D_di_f_thread_semaphore_file_close_ -D_di_f_thread_semaphore_file_open_ -D_di_f_thread_semaphore_file_delete_ -D_di_f_thread_cancel_type_set_
+defines-thread -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
+defines-threadless -D_di_thread_support_
+
+flags -O2 -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses -Wno-missing-braces
+flags -fstack-clash-protection -fno-delete-null-pointer-checks
+flags -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
+flags-android -Wno-implicit-function-declaration -Wl,-z,norelro
+flags-clang -Wno-logical-op-parentheses
+flags-coverage -O0 --coverage -fprofile-abs-path -fprofile-dir=build/coverage/
+flags-fanalyzer -fanalyzer
+flags-gcc_13 -fstrict-flex-arrays=3
+flags-test -O0 -fstack-protector-strong -Wall
+flags-thread -pthread
+
+flags_library -fPIC
+flags_object -fPIC
+flags_program -fPIE
+flags_program-android -fPIE -Wl,-z,relro
--- /dev/null
+# fss-0001
+#
+# Builds the "iki_read" program.
+# This must be called after the "setting".
+#
+
+build_name iki_read
+
+version_major 0
+version_minor 7
+version_micro 0
+version_file micro
+version_target minor
+
+modes android clang coverage fanalyzer gcc gcc_13 individual individual_thread level monolithic test thread threadless
+modes_default monolithic thread gcc
+
+build_compiler gcc
+build_compiler-clang clang
+build_indexer ar
+build_indexer_arguments rcs
+build_language c
+
+build_libraries -lc -liki_read
+build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion -lfl_iki -lfl_print -lf_color -lf_compare -lf_console -lf_conversion -lf_file -lf_iki -lf_memory -lf_pipe -lf_print -lf_rip -lf_signal -lf_string -lf_type_array -lf_utf
+build_libraries-individual_thread -lf_thread
+build_libraries-level -lfll_2 -lfll_1 -lfll_0
+build_libraries-monolithic -lfll
+
+build_sources_program iki/main.c
+build_sources_program iki/common.c iki/iki_read.c iki/print.c iki/process.c
+
+build_sources_headers iki/common.h iki/iki_read.h iki/print.h iki/process.h
+
+build_sources_documentation man
+
+build_script yes
+build_shared yes
+build_static no
+
+path_headers program/iki_read
+
+has_path_standard yes
+preserve_path_headers yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+environment PATH LD_LIBRARY_PATH
+environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH
+
+#defines -D_di_libcap_
+defines -D_libcap_legacy_only_
+defines-android -D_di_f_thread_attribute_affinity_get_ -D_di_f_thread_attribute_affinity_set_ -D_di_f_thread_attribute_concurrency_get_ -D_di_f_thread_attribute_concurrency_set_ -D_di_f_thread_attribute_default_get_ -D_di_f_thread_attribute_default_set_ -D_di_f_thread_cancel_ -D_di_f_thread_cancel_state_set_ -D_di_f_thread_cancel_test_ -D_di_f_thread_join_try_ -D_di_f_thread_join_timed_ -D_pthread_mutex_prioceiling_unsupported_ -D_di_f_thread_semaphore_file_close_ -D_di_f_thread_semaphore_file_open_ -D_di_f_thread_semaphore_file_delete_ -D_di_f_thread_cancel_type_set_
+defines-thread -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
+defines-threadless -D_di_thread_support_
+
+flags -O2 -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses -Wno-missing-braces
+flags -fstack-clash-protection -fno-delete-null-pointer-checks
+flags -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
+flags-android -Wno-implicit-function-declaration -Wl,-z,norelro
+flags-clang -Wno-logical-op-parentheses
+flags-coverage -O0 --coverage -fprofile-abs-path -fprofile-dir=build/coverage/
+flags-fanalyzer -fanalyzer
+flags-gcc_13 -fstrict-flex-arrays=3
+flags-test -O0 -fstack-protector-strong -Wall
+flags-thread -pthread
+
+flags_library -fPIC
+flags_object -fPIC
+flags_program -fPIE
+flags_program-android -fPIE -Wl,-z,relro