]> Kevux Git Server - fll/commitdiff
Progress: Working on program related changes and fix version number.
authorKevin Day <thekevinday@gmail.com>
Mon, 22 Aug 2022 02:22:38 +0000 (21:22 -0500)
committerKevin Day <thekevinday@gmail.com>
Mon, 22 Aug 2022 02:45:21 +0000 (21:45 -0500)
Continuing work in regards to making program related changes.

I managed to miss another set of files that have version numbers.
I should probably write a script to consistently handle this in the future to avoid these kinds of simple mistakes.

Change the behavior of the color loaded to allow for more flexibility.
The previous design was a quickly put togethor hardcoded approach.
I want to get away from such practices.

Add missing dependency in f_color.

I am at a cross roads of flexibility and maintainability (as well as size).
The practice of always having and using a typedef allows for great flexibility (allows for easy hacking/modifications).
As per my practice, I should have explicit functions for allocating, deallocating, and similar functions.
These waste space, consume time writing, and consume maintainance related time.
I want to increase the maintainability of the project given that my current goals are far reaching.
This means that I should switch to existing typedefs for any simple data type (except for special cases like strings and f_string_t).
I am starting this conversion with f_color, using the uintX_t types rathe than custom types like f_color_mode_t.

Start using enumerations over define macros.

Make the console parameter processing functions more flexible by returning the decision at the index rather than the converted decision value.
This allows for the caller to know which index is used.
The caller can do more work based on this without having to do more looping.

Add line_first_no and line_last_no standard parameters.
These add more flexibility for special case scripting.
Many core printing functions now do not print the leading new line.
All programs must be updated accordingly.

Add and document new console parameter initialization macros.
Start a new style practice with the console arguments, based around these new macros.

The f_file_stream_flush() should not need f_file_t parameter to be a pointer.

The memory functions now return F_data_not in more situations that make sense.
When size is 0 for allocation functions, this should be a paameter error when doing parameter checking.

The pointer should be allowed to be NULL when allocating.

Some fll_program functions are supposed to be using private functions due to internal usage.

The standard help options now have a standard printing function.

The fll_program_parameter_process() is removed.
Instead, call f_console_parameter_process directly.
The color context handling is moved from the now deleted fll_program_parameter_process() into fll_program_parameter_process_context().

The fll_program_data_t now accepts a pointer to the environment variable array for representing the environment variables are start.
The fll_program_data_t now uses flags rather than a boolean to represent program pipe (allowing for more than just input pipe, in theory).

Add new status codes:
- F_help
- F_help_not

Major work is completed into making the utf8 program more flexible.
- Moved all parameter processing into utf8_setting_load() and provide utf8_setting_t.
- This allows for callers to manually configure the settings without performing parameter processing if so desired.
- Re-design printing logic to handle the line_first_no and line_last_no parameters.
- The status used by the utf8_main() is now in utf8_setting_t.

Related changes have been lazily applied to all other programs.
Once I am finished with utf8 (which I might already be), then I will beging moving to each next program.

267 files changed:
build/level_2/settings
build/monolithic/settings
level_0/f_account/data/build/settings
level_0/f_account/data/build/settings-mocks
level_0/f_account/data/build/settings-tests
level_0/f_capability/data/build/settings
level_0/f_capability/data/build/settings-mocks
level_0/f_capability/data/build/settings-tests
level_0/f_color/c/color.c
level_0/f_color/c/color.h
level_0/f_color/c/color/common.h
level_0/f_color/c/private-color.c
level_0/f_color/data/build/dependencies
level_0/f_color/data/build/settings
level_0/f_color/data/build/settings-mocks
level_0/f_color/data/build/settings-tests
level_0/f_console/c/console.c
level_0/f_console/c/console.h
level_0/f_console/c/console/common.c
level_0/f_console/c/console/common.h
level_0/f_console/data/build/settings
level_0/f_console/data/build/settings-tests
level_0/f_control_group/data/build/settings
level_0/f_control_group/data/build/settings-tests
level_0/f_conversion/data/build/settings
level_0/f_conversion/data/build/settings-mocks
level_0/f_conversion/data/build/settings-tests
level_0/f_directory/data/build/settings
level_0/f_directory/data/build/settings-mocks
level_0/f_directory/data/build/settings-tests
level_0/f_environment/data/build/settings
level_0/f_environment/data/build/settings-mocks
level_0/f_environment/data/build/settings-tests
level_0/f_execute/data/build/settings
level_0/f_execute/data/build/settings-tests
level_0/f_file/c/file.c
level_0/f_file/c/file.h
level_0/f_file/data/build/settings
level_0/f_file/data/build/settings-mocks
level_0/f_file/data/build/settings-tests
level_0/f_fss/data/build/settings
level_0/f_fss/data/build/settings-mocks
level_0/f_fss/data/build/settings-tests
level_0/f_iki/data/build/settings
level_0/f_iki/data/build/settings-tests
level_0/f_limit/data/build/settings
level_0/f_limit/data/build/settings-mocks
level_0/f_limit/data/build/settings-tests
level_0/f_memory/c/memory.c
level_0/f_memory/c/memory.h
level_0/f_memory/c/private-memory.c
level_0/f_memory/data/build/settings
level_0/f_path/data/build/settings
level_0/f_path/data/build/settings-mocks
level_0/f_path/data/build/settings-tests
level_0/f_pipe/data/build/settings
level_0/f_pipe/data/build/settings-mocks
level_0/f_pipe/data/build/settings-tests
level_0/f_print/c/print.c
level_0/f_print/data/build/settings
level_0/f_print/data/build/settings-mocks
level_0/f_print/data/build/settings-tests
level_0/f_serialize/data/build/settings
level_0/f_serialize/data/build/settings-mocks
level_0/f_serialize/data/build/settings-tests
level_0/f_signal/data/build/settings
level_0/f_signal/data/build/settings-mocks
level_0/f_signal/data/build/settings-tests
level_0/f_socket/data/build/settings
level_0/f_socket/data/build/settings-mocks
level_0/f_socket/data/build/settings-tests
level_0/f_status/c/status.h
level_0/f_status/data/build/settings
level_0/f_status_string/c/status_string.c
level_0/f_status_string/c/status_string.h
level_0/f_status_string/data/build/settings
level_0/f_status_string/data/build/settings-tests
level_0/f_status_string/tests/unit/c/test-status_string-to.c
level_0/f_string/c/string/common.h
level_0/f_string/c/string/private-dynamic.c
level_0/f_string/data/build/settings
level_0/f_string/data/build/settings-tests
level_0/f_thread/data/build/settings
level_0/f_thread/data/build/settings-mocks
level_0/f_thread/data/build/settings-tests
level_0/f_type/data/build/settings
level_0/f_type_array/data/build/settings
level_0/f_utf/data/build/settings
level_0/f_utf/data/build/settings-tests
level_1/fl_control_group/c/control_group.c
level_1/fl_control_group/data/build/settings
level_1/fl_conversion/data/build/settings
level_1/fl_directory/data/build/settings
level_1/fl_environment/data/build/settings
level_1/fl_execute/data/build/settings
level_1/fl_fss/data/build/settings
level_1/fl_iki/data/build/settings
level_1/fl_print/data/build/settings
level_1/fl_signal/data/build/settings
level_1/fl_string/data/build/settings
level_1/fl_utf/data/build/settings
level_1/fl_utf_file/data/build/settings
level_2/fll_control_group/data/build/settings
level_2/fll_error/c/error.c
level_2/fll_error/c/private-error.c
level_2/fll_error/c/private-error.h
level_2/fll_error/data/build/settings
level_2/fll_execute/data/build/settings
level_2/fll_file/data/build/settings
level_2/fll_fss/data/build/settings
level_2/fll_fss_status_string/data/build/settings
level_2/fll_iki/data/build/settings
level_2/fll_path/data/build/settings
level_2/fll_print/data/build/settings
level_2/fll_program/c/private-program.c [new file with mode: 0644]
level_2/fll_program/c/private-program.h [new file with mode: 0644]
level_2/fll_program/c/program.c
level_2/fll_program/c/program.h
level_2/fll_program/c/program/common.h
level_2/fll_program/data/build/settings
level_2/fll_status_string/c/status_string.c
level_2/fll_status_string/data/build/settings
level_2/fll_status_string/data/build/settings-tests
level_2/fll_status_string/tests/unit/c/test-status_string-from.c
level_3/byte_dump/c/byte_dump.c
level_3/byte_dump/c/byte_dump.h
level_3/byte_dump/c/common.h
level_3/byte_dump/c/main.c
level_3/byte_dump/data/build/settings
level_3/control/c/common.h
level_3/control/c/control.c
level_3/control/c/control.h
level_3/control/c/main.c
level_3/control/c/private-control.c
level_3/control/data/build/settings
level_3/controller/c/common.h
level_3/controller/c/controller.c
level_3/controller/c/controller.h
level_3/controller/c/controller/private-controller.c
level_3/controller/c/entry/private-entry_print.c
level_3/controller/c/lock/private-lock_print.c
level_3/controller/c/main.c
level_3/controller/c/rule/private-rule_print.c
level_3/controller/data/build/settings
level_3/fake/c/common.h
level_3/fake/c/fake.c
level_3/fake/c/fake.h
level_3/fake/c/main.c
level_3/fake/c/private-build.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-make-load_parameters.c
level_3/fake/c/private-make-operate.c
level_3/fake/c/private-make-operate_process_type.c
level_3/fake/c/private-print.c
level_3/fake/c/private-skeleton.c
level_3/fake/data/build/settings
level_3/firewall/c/common.h
level_3/firewall/c/firewall.c
level_3/firewall/c/firewall.h
level_3/firewall/c/main.c
level_3/firewall/c/private-firewall.c
level_3/firewall/data/build/settings
level_3/fss_basic_list_read/c/common.h
level_3/fss_basic_list_read/c/fss_basic_list_read.c
level_3/fss_basic_list_read/c/fss_basic_list_read.h
level_3/fss_basic_list_read/c/main.c
level_3/fss_basic_list_read/data/build/settings
level_3/fss_basic_list_write/c/common.h
level_3/fss_basic_list_write/c/fss_basic_list_write.c
level_3/fss_basic_list_write/c/fss_basic_list_write.h
level_3/fss_basic_list_write/c/main.c
level_3/fss_basic_list_write/data/build/settings
level_3/fss_basic_read/c/common.h
level_3/fss_basic_read/c/fss_basic_read.c
level_3/fss_basic_read/c/fss_basic_read.h
level_3/fss_basic_read/c/main.c
level_3/fss_basic_read/data/build/settings
level_3/fss_basic_write/c/common.h
level_3/fss_basic_write/c/fss_basic_write.c
level_3/fss_basic_write/c/fss_basic_write.h
level_3/fss_basic_write/c/main.c
level_3/fss_basic_write/data/build/settings
level_3/fss_embedded_list_read/c/common.h
level_3/fss_embedded_list_read/c/fss_embedded_list_read.c
level_3/fss_embedded_list_read/c/fss_embedded_list_read.h
level_3/fss_embedded_list_read/c/main.c
level_3/fss_embedded_list_read/c/private-common.h
level_3/fss_embedded_list_read/data/build/settings
level_3/fss_embedded_list_write/c/common.h
level_3/fss_embedded_list_write/c/fss_embedded_list_write.c
level_3/fss_embedded_list_write/c/fss_embedded_list_write.h
level_3/fss_embedded_list_write/c/main.c
level_3/fss_embedded_list_write/data/build/settings
level_3/fss_extended_list_read/c/common.h
level_3/fss_extended_list_read/c/fss_extended_list_read.c
level_3/fss_extended_list_read/c/fss_extended_list_read.h
level_3/fss_extended_list_read/c/main.c
level_3/fss_extended_list_read/data/build/settings
level_3/fss_extended_list_write/c/common.h
level_3/fss_extended_list_write/c/fss_extended_list_write.c
level_3/fss_extended_list_write/c/fss_extended_list_write.h
level_3/fss_extended_list_write/c/main.c
level_3/fss_extended_list_write/data/build/settings
level_3/fss_extended_read/c/common.h
level_3/fss_extended_read/c/fss_extended_read.c
level_3/fss_extended_read/c/fss_extended_read.h
level_3/fss_extended_read/c/main.c
level_3/fss_extended_read/data/build/settings
level_3/fss_extended_write/c/common.h
level_3/fss_extended_write/c/fss_extended_write.c
level_3/fss_extended_write/c/fss_extended_write.h
level_3/fss_extended_write/c/main.c
level_3/fss_extended_write/data/build/settings
level_3/fss_identify/c/common.h
level_3/fss_identify/c/fss_identify.c
level_3/fss_identify/c/fss_identify.h
level_3/fss_identify/c/main.c
level_3/fss_identify/data/build/settings
level_3/fss_payload_read/c/common.h
level_3/fss_payload_read/c/fss_payload_read.c
level_3/fss_payload_read/c/fss_payload_read.h
level_3/fss_payload_read/c/main.c
level_3/fss_payload_read/data/build/settings
level_3/fss_payload_write/c/common.h
level_3/fss_payload_write/c/fss_payload_write.c
level_3/fss_payload_write/c/fss_payload_write.h
level_3/fss_payload_write/c/main.c
level_3/fss_payload_write/data/build/settings
level_3/fss_status_code/c/common.h
level_3/fss_status_code/c/fss_status_code.c
level_3/fss_status_code/c/fss_status_code.h
level_3/fss_status_code/c/main.c
level_3/fss_status_code/data/build/settings
level_3/iki_read/c/common.h
level_3/iki_read/c/iki_read.c
level_3/iki_read/c/iki_read.h
level_3/iki_read/c/main.c
level_3/iki_read/data/build/settings
level_3/iki_write/c/common.h
level_3/iki_write/c/iki_write.c
level_3/iki_write/c/iki_write.h
level_3/iki_write/c/main.c
level_3/iki_write/c/private-write.c
level_3/iki_write/data/build/settings
level_3/status_code/c/common.h
level_3/status_code/c/main.c
level_3/status_code/c/status_code.c
level_3/status_code/c/status_code.h
level_3/status_code/data/build/settings
level_3/utf8/c/common.c
level_3/utf8/c/common.h
level_3/utf8/c/main.c
level_3/utf8/c/print.c [new file with mode: 0644]
level_3/utf8/c/print.h [new file with mode: 0644]
level_3/utf8/c/private-common.c
level_3/utf8/c/private-common.h
level_3/utf8/c/private-print.c [deleted file]
level_3/utf8/c/private-print.h [deleted file]
level_3/utf8/c/private-utf8.c
level_3/utf8/c/private-utf8.h
level_3/utf8/c/private-utf8_bytesequence.c
level_3/utf8/c/private-utf8_bytesequence.h
level_3/utf8/c/private-utf8_codepoint.c
level_3/utf8/c/private-utf8_codepoint.h
level_3/utf8/c/utf8.c
level_3/utf8/c/utf8.h
level_3/utf8/data/build/settings

index 5f160875ab10eac9b496979d7b58fa0486211cf8..6d66025d50fed84a8d7e1112a7bd21fc87b5b2e8 100644 (file)
@@ -30,7 +30,7 @@ build_sources_library fss_status_string.c
 build_sources_library iki.c private-iki.c
 build_sources_library path.c
 build_sources_library print.c
-build_sources_library program.c program/common.c
+build_sources_library program.c program/common.c private-program.c
 build_sources_library status_string.c
 
 build_sources_headers control_group.h
index 21d7d40250855f914a2221175e98f96ca94a4061..1c032a807cf152302af5e15c5846a2c205df5570 100644 (file)
@@ -67,7 +67,7 @@ build_sources_library level_2/fss_status_string.c
 build_sources_library level_2/iki.c level_2/private-iki.c
 build_sources_library level_2/path.c
 build_sources_library level_2/print.c
-build_sources_library level_2/program.c level_2/program/common.c
+build_sources_library level_2/program.c level_2/program/common.c level_2/private-program.c
 build_sources_library level_2/status_string.c
 
 build_sources_library-monolithic level_0/thread.c level_0/private-thread.c level_0/thread/attribute.c level_0/thread/barrier.c level_0/thread/barrier_attribute.c level_0/thread/condition.c level_0/thread/condition_attribute.c level_0/thread/id.c level_0/thread/key.c level_0/thread/lock.c level_0/thread/lock_attribute.c level_0/thread/mutex.c level_0/thread/mutex_attribute.c level_0/thread/once.c level_0/thread/semaphore.c level_0/thread/set.c level_0/thread/spin.c
index e510c61f4646abd57bb1ed9ef8127696b76cdc55..4891ccbcb3f9f5a9e7cb8ff463a7ce6f4e188e3a 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_account
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index c1967b3e632a8ad8df4cb4977017a8e2f2a09aaa..232bfb09c8cf02b7288cd41b43c14ad12b4a275c 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_account
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index b76b858736e2ae6ad9de667ec65ca063dd4818c5..c4d085e9a512e90125c82bfd54f5bc804795479f 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_account
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 37c47e1d81e849e52cc4005a3833a8afc669f9ab..49b221ae24fd431bc789b2bfd6e838c1cc6d02d9 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_capability
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 38ced6558f74a6775096653d50b65f79f2bad8a6..62232e996d49ab0232e0fbdd871589aa176965e4 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_capability
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 3d4edea1c3da2f147365e8808b577476ec2463e5..ad78a69af9509b93a51b1cadec3169edf3975d18 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_capability
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 0fbbc9fda4561be71ac1d03fdb6d507562d4b485..11279f98e5ab900e88d3fcf5fd117845fcbbcd58 100644 (file)
@@ -6,11 +6,118 @@ extern "C" {
 #endif
 
 #ifndef _di_f_color_load_context_
-  f_status_t f_color_load_context(const bool use_light_colors, f_color_context_t * const context) {
+  f_status_t f_color_load_context(const uint8_t mode, f_color_context_t * const context) {
     #ifndef _di_level_0_parameter_checking_
       if (!context) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
+    context->mode = mode;
+
+    if (mode == f_color_mode_color_not_e) {
+      macro_f_color_t_set_none(context->list);
+
+      context->format.begin = f_string_empty_s;
+      context->format.end = f_string_empty_s;
+      context->format.medium = f_string_empty_s;
+
+      context->set.error = f_color_set_empty_s;
+      context->set.important = f_color_set_empty_s;
+      context->set.normal = f_color_set_empty_s;
+      context->set.normal_reset = f_color_set_empty_s;
+      context->set.notable = f_color_set_empty_s;
+      context->set.reset = f_color_set_empty_s;
+      context->set.standout = f_color_set_empty_s;
+      context->set.success = f_color_set_empty_s;
+      context->set.title = f_color_set_empty_s;
+      context->set.warning = f_color_set_empty_s;
+
+      f_status_t status = F_none;
+
+      if (context->error.size) {
+        status = f_string_dynamic_resize(0, &context->error);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->error.used = 0;
+      }
+
+      if (context->important.size) {
+        status = f_string_dynamic_resize(0, &context->important);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->important.used = 0;
+      }
+
+      if (context->normal.size) {
+        status = f_string_dynamic_resize(0, &context->normal);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->normal.used = 0;
+      }
+
+      if (context->normal_reset.size) {
+        status = f_string_dynamic_resize(0, &context->normal_reset);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->normal_reset.used = 0;
+      }
+
+      if (context->notable.size) {
+        status = f_string_dynamic_resize(0, &context->notable);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->notable.used = 0;
+      }
+
+      if (context->reset.size) {
+        status = f_string_dynamic_resize(0, &context->reset);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->reset.used = 0;
+      }
+
+      if (context->standout.size) {
+        status = f_string_dynamic_resize(0, &context->standout);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->standout.used = 0;
+      }
+
+      if (context->success.size) {
+        status = f_string_dynamic_resize(0, &context->success);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->success.used = 0;
+      }
+
+      if (context->title.size) {
+        status = f_string_dynamic_resize(0, &context->title);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->title.used = 0;
+      }
+
+      if (context->warning.size) {
+        status = f_string_dynamic_resize(0, &context->warning);
+        if (F_status_is_error(status)) return status;
+      }
+      else {
+        context->warning.used = 0;
+      }
+
+      return F_none;
+    }
+
+    if (mode != f_color_mode_dark_e && mode != f_color_mode_light_e) return F_data_not;
+
     // Switch to the appropriate terminal color mode.
     {
       char *environment = getenv(f_color_terminal_name_s.string);
@@ -41,7 +148,7 @@ extern "C" {
       status = private_f_color_save_1(context->format, context->list.bold, &context->notable);
     }
 
-    if (use_light_colors) {
+    if (mode == f_color_mode_light_e) {
       if (F_status_is_error_not(status)) {
         status = private_f_color_save_2(context->format, context->list.bold, context->list.blue, &context->title);
       }
@@ -53,10 +160,6 @@ extern "C" {
       if (F_status_is_error_not(status)) {
         status = private_f_color_save_1(context->format, context->list.purple, &context->standout);
       }
-
-      if (F_status_is_error_not(status)) {
-        context->mode = F_color_mode_light_d;
-      }
     }
     else {
       if (F_status_is_error_not(status)) {
@@ -70,10 +173,6 @@ extern "C" {
       if (F_status_is_error_not(status)) {
         status = private_f_color_save_1(context->format, context->list.green, &context->standout);
       }
-
-      if (F_status_is_error_not(status)) {
-        context->mode = F_color_mode_dark_d;
-      }
     }
 
     if (F_status_is_error_not(status)) {
@@ -140,8 +239,10 @@ extern "C" {
       if (!buffer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    f_status_t status = f_string_dynamic_increase_by(format.begin.used + (format.medium.used * 2) + format.end.used + color1.used + color2.used + color3.used + 1, buffer);
-    if (F_status_is_error(status)) return status;
+    {
+      const f_status_t status = f_string_dynamic_increase_by(format.begin.used + (format.medium.used * 2) + format.end.used + color1.used + color2.used + color3.used + 1, buffer);
+      if (F_status_is_error(status)) return status;
+    }
 
     if (color1.used) {
       memcpy(buffer->string + buffer->used, color1.string, sizeof(f_char_t) * color1.used);
@@ -191,8 +292,10 @@ extern "C" {
       if (!buffer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    f_status_t status = f_string_dynamic_increase_by(format.begin.used + (format.medium.used * 3) + format.end.used + color1.used + color2.used + color3.used + color4.used + 1, buffer);
-    if (F_status_is_error(status)) return status;
+    {
+      const f_status_t status = f_string_dynamic_increase_by(format.begin.used + (format.medium.used * 3) + format.end.used + color1.used + color2.used + color3.used + color4.used + 1, buffer);
+      if (F_status_is_error(status)) return status;
+    }
 
     if (color1.used) {
       memcpy(buffer->string + buffer->used, color1.string, sizeof(f_char_t) * color1.used);
@@ -254,8 +357,10 @@ extern "C" {
       if (!buffer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    f_status_t status = f_string_dynamic_increase_by(format.begin.used + (format.medium.used * 4) + format.end.used + color1.used + color2.used + color3.used + color4.used + color5.used + 1, buffer);
-    if (F_status_is_error(status)) return status;
+    {
+      const f_status_t status = f_string_dynamic_increase_by(format.begin.used + (format.medium.used * 4) + format.end.used + color1.used + color2.used + color3.used + color4.used + color5.used + 1, buffer);
+      if (F_status_is_error(status)) return status;
+    }
 
     if (format.begin.used) {
       memcpy(buffer->string + buffer->used, format.begin.string, sizeof(f_char_t) * format.begin.used);
index 8292d011b16949f98009b726474128809b48e8a2..29a5606b7ff1e52991604d24072b9cdcfb2f7f72 100644 (file)
@@ -22,6 +22,7 @@
 #include <fll/level_0/type.h>
 #include <fll/level_0/status.h>
 #include <fll/level_0/memory.h>
+#include <fll/level_0/type_array.h>
 #include <fll/level_0/string.h>
 
 // FLL-0 color includes.
@@ -37,16 +38,22 @@ extern "C" {
  * This will handle the difference betweem xorg terminals and linux consoles.
  * If you wish to use non-standard colors either redefine this function or don't use it.
  *
+ * This only supports the following color modes:
+ *   - f_color_mode_color_not_e
+ *   - f_color_mode_dark_e
+ *   - f_color_mode_light_e
+ *
  * The default/fallback behavior is f_color_xterminal.
  *
- * @param use_light_colors
- *   Set to F_true to use colors for light backgrounds.
- *   Set to F_false to use colors for dark backgrounds.
+ * @param mode
+ *   The color mode to load.
  * @param context
  *   The color context the load the color codes into.
+ *   The context.mode is always set to the specified mode, even if it is not supported (except when there is an invalid parameter).
  *
  * @return
  *   F_none on success.
+ *   F_data_not on success but mode is f_color_mode_none_e or not a supported mode.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
@@ -57,7 +64,7 @@ extern "C" {
  * @see f_string_dynamic_increase_by()
  */
 #ifndef _di_f_color_load_context_
-  extern f_status_t f_color_load_context(const bool use_light_colors, f_color_context_t * const context);
+  extern f_status_t f_color_load_context(const uint8_t mode, f_color_context_t * const context);
 #endif // _di_f_color_load_context_
 
 /**
index d94073df11eba1e9c9408b00cc5a4411a1ac7de3..52099f21c24afeb8cdf1a305c3bca2e7ae3d2644 100644 (file)
@@ -31,7 +31,7 @@ extern "C" {
 /**
  * Define codes representing color sets.
  *
- * F_color_code_*:
+ * F_color_code_*_e:
  *   - none:      No color code set defined.
  *   - linux:     Linux terminal color code set.
  *   - xterminal: X-Terminal color code set.
@@ -39,9 +39,13 @@ extern "C" {
 #ifndef _di_f_color_code_t_
   typedef f_char_t f_color_code_t;
 
-  #define F_color_code_none_d      0
-  #define F_color_code_linux_d     1
-  #define F_color_code_xterminal_d 2
+  enum {
+    f_color_code_none_e = 0,
+    f_color_code_linux_e,
+    f_color_code_xterminal_e,
+  };
+
+  #define f_color_code_t_initialize f_color_code_none_e
 #endif // _di_f_color_code_t_
 
 /**
@@ -242,23 +246,21 @@ extern "C" {
 #endif // _di_f_color_string_s_
 
 /**
- * Specify color modes.
- *
  * Color modes communicate how the color is supposed to be.
  *
- * F_color_mode_*:
- *   - none:     define designates that there is no assigned mode (the mode is undefined).
- *   - no_color: define designates that the color mode is set to no color (disable colors).
- *   - dark:     define designates that the color mode is for dark backgrounds.
- *   - light:    define designates that the color mode is for light backgrounds.
+ * f_color_mode_*_e:
+ *   - none:      Designates that there is no assigned mode (the mode is undefined).
+ *   - color_not: Designates that the color mode is set to no color (disable colors).
+ *   - dark:      Designates that the color mode is for dark backgrounds.
+ *   - light:     Designates that the color mode is for light backgrounds.
  */
 #ifndef _di_f_color_mode_t_
-  typedef uint8_t f_color_mode_t;
-
-  #define F_color_mode_none_d     0
-  #define F_color_mode_no_color_d 1
-  #define F_color_mode_dark_d     2
-  #define F_color_mode_light_d    3
+  enum {
+    f_color_mode_none_e = 0,
+    f_color_mode_color_not_e,
+    f_color_mode_dark_e,
+    f_color_mode_light_e,
+  };
 #endif // _di_f_color_mode_t_
 
 /**
@@ -524,45 +526,45 @@ extern "C" {
     f_color_string_code_bright_white_bg_s, \
   }
 
-  #define macro_f_color_t_clear(color) \
-    macro_f_string_static_t_clear(color.reset) \
-    macro_f_string_static_t_clear(color.bold) \
-    macro_f_string_static_t_clear(color.underline) \
-    macro_f_string_static_t_clear(color.blink) \
-    macro_f_string_static_t_clear(color.reverse) \
-    macro_f_string_static_t_clear(color.conceal) \
-    macro_f_string_static_t_clear(color.black) \
-    macro_f_string_static_t_clear(color.red) \
-    macro_f_string_static_t_clear(color.green) \
-    macro_f_string_static_t_clear(color.yellow) \
-    macro_f_string_static_t_clear(color.blue) \
-    macro_f_string_static_t_clear(color.purple) \
-    macro_f_string_static_t_clear(color.teal) \
-    macro_f_string_static_t_clear(color.white) \
-    macro_f_string_static_t_clear(color.black_bg) \
-    macro_f_string_static_t_clear(color.red_bg) \
-    macro_f_string_static_t_clear(color.green_bg) \
-    macro_f_string_static_t_clear(color.yellow_bg) \
-    macro_f_string_static_t_clear(color.blue_bg) \
-    macro_f_string_static_t_clear(color.purple_bg) \
-    macro_f_string_static_t_clear(color.teal_bg) \
-    macro_f_string_static_t_clear(color.white_bg) \
-    macro_f_string_static_t_clear(color.bright_black) \
-    macro_f_string_static_t_clear(color.bright_red) \
-    macro_f_string_static_t_clear(color.bright_green) \
-    macro_f_string_static_t_clear(color.bright_yellow) \
-    macro_f_string_static_t_clear(color.bright_blue) \
-    macro_f_string_static_t_clear(color.bright_purple) \
-    macro_f_string_static_t_clear(color.bright_teal) \
-    macro_f_string_static_t_clear(color.bright_white) \
-    macro_f_string_static_t_clear(color.bright_black_bg) \
-    macro_f_string_static_t_clear(color.bright_red_bg) \
-    macro_f_string_static_t_clear(color.bright_green_bg) \
-    macro_f_string_static_t_clear(color.bright_yellow_bg) \
-    macro_f_string_static_t_clear(color.bright_blue_bg) \
-    macro_f_string_static_t_clear(color.bright_purple_bg) \
-    macro_f_string_static_t_clear(color.bright_teal_bg) \
-    macro_f_string_static_t_clear(color.bright_white_bg)
+  #define macro_f_color_t_set_none(color) \
+    color.reset = f_string_empty_s; \
+    color.bold = f_string_empty_s; \
+    color.underline = f_string_empty_s; \
+    color.blink = f_string_empty_s; \
+    color.reverse = f_string_empty_s; \
+    color.conceal = f_string_empty_s; \
+    color.black = f_string_empty_s; \
+    color.red = f_string_empty_s; \
+    color.green = f_string_empty_s; \
+    color.yellow = f_string_empty_s; \
+    color.blue = f_string_empty_s; \
+    color.purple = f_string_empty_s; \
+    color.teal = f_string_empty_s; \
+    color.white = f_string_empty_s; \
+    color.black_bg = f_string_empty_s; \
+    color.red_bg = f_string_empty_s; \
+    color.green_bg = f_string_empty_s; \
+    color.yellow_bg = f_string_empty_s; \
+    color.blue_bg = f_string_empty_s; \
+    color.purple_bg = f_string_empty_s; \
+    color.teal_bg = f_string_empty_s; \
+    color.white_bg = f_string_empty_s; \
+    color.bright_black = f_string_empty_s; \
+    color.bright_red = f_string_empty_s; \
+    color.bright_green = f_string_empty_s; \
+    color.bright_yellow = f_string_empty_s; \
+    color.bright_blue = f_string_empty_s; \
+    color.bright_purple = f_string_empty_s; \
+    color.bright_teal = f_string_empty_s; \
+    color.bright_white = f_string_empty_s; \
+    color.bright_black_bg = f_string_empty_s; \
+    color.bright_red_bg = f_string_empty_s; \
+    color.bright_green_bg = f_string_empty_s; \
+    color.bright_yellow_bg = f_string_empty_s; \
+    color.bright_blue_bg = f_string_empty_s; \
+    color.bright_purple_bg = f_string_empty_s; \
+    color.bright_teal_bg = f_string_empty_s; \
+    color.bright_white_bg = f_string_empty_s;
 
   #define macro_f_color_t_set_linux(color) \
     color.reset = f_color_string_code_reset_s; \
@@ -732,7 +734,6 @@ extern "C" {
     macro_f_color_set_t_clear(set.success) \
     macro_f_color_set_t_clear(set.title) \
     macro_f_color_set_t_clear(set.warning)
-
 #endif // _di_f_color_set_context_t_
 
 /**
@@ -760,7 +761,7 @@ extern "C" {
   typedef struct {
     f_color_t list;
     f_color_format_t format;
-    f_color_mode_t mode;
+    uint8_t mode;
     f_color_set_context_t set;
 
     f_string_dynamic_t error;
@@ -775,10 +776,11 @@ extern "C" {
     f_string_dynamic_t warning;
   } f_color_context_t;
 
+  // @todo create allocate/clear/etc... functions.
   #define f_color_context_t_initialize { \
     f_color_t_initialize_linux, \
     f_color_format_t_initialize_linux, \
-    F_color_mode_none_d, \
+    f_color_mode_none_e, \
     f_color_set_context_t_initialize, \
     f_string_dynamic_t_initialize, \
     f_string_dynamic_t_initialize, \
@@ -793,9 +795,9 @@ extern "C" {
   }
 
   #define macro_f_color_context_t_clear(context) \
-    macro_f_color_t_clear(context.list) \
+    macro_f_color_t_set_none(context.list) \
     macro_f_color_format_t_clear(context.format) \
-    context.mode = F_color_mode_none_d; \
+    context.mode = f_color_mode_none_e; \
     macro_f_color_set_context_t_clear(context.set) \
     macro_f_string_dynamic_t_clear(context.error) \
     macro_f_string_dynamic_t_clear(context.important) \
index 8dc843a5efcf5464c7f096836ab5aef1d88bac22..919994b3360591e390dce1f717e5e0b64a09c6d6 100644 (file)
@@ -8,8 +8,10 @@ extern "C" {
 #if !defined(_di_f_color_load_context_) || !defined(_di_f_color_save_1_)
   f_status_t private_f_color_save_1(const f_color_format_t format, const f_string_static_t color1, f_string_dynamic_t * const buffer) {
 
-    f_status_t status = f_string_dynamic_increase_by(format.begin.used + format.end.used + color1.used + 1, buffer);
-    if (F_status_is_error(status)) return status;
+    {
+      const f_status_t status = f_string_dynamic_increase_by(format.begin.used + format.end.used + color1.used + 1, buffer);
+      if (F_status_is_error(status)) return status;
+    }
 
     if (format.begin.used) {
       memcpy(buffer->string + buffer->used, format.begin.string, sizeof(f_char_t) * format.begin.used);
@@ -38,8 +40,10 @@ extern "C" {
 #if !defined(_di_f_color_load_context_) || !defined(_di_f_color_save_2_)
   f_status_t private_f_color_save_2(const f_color_format_t format, const f_string_static_t color1, const f_string_static_t color2, f_string_dynamic_t * const buffer) {
 
-    f_status_t status = f_string_dynamic_increase_by(format.begin.used + format.medium.used + format.end.used + color1.used + color2.used + 1, buffer);
-    if (F_status_is_error(status)) return status;
+    {
+      const f_status_t status = f_string_dynamic_increase_by(format.begin.used + format.medium.used + format.end.used + color1.used + color2.used + 1, buffer);
+      if (F_status_is_error(status)) return status;
+    }
 
     if (format.begin.used) {
       memcpy(buffer->string + buffer->used, format.begin.string, sizeof(f_char_t) * format.begin.used);
index d7982451c2bbeffe333ccd4738a6e98f3c11da92..0acb0c93d661ddb20cc0deab9419d9ab65262a8f 100644 (file)
@@ -4,3 +4,4 @@ f_type
 f_status
 f_memory
 f_string
+f_type_array
index a149d2c26841f80f3e6bf9559981bc1efd3f93aa..598417375312192b225090ae391b1a8c7f3946a7 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_color
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
@@ -18,7 +18,7 @@ build_indexer_arguments rcs
 build_language c
 
 build_libraries -lc
-build_libraries-individual -lf_memory -lf_string
+build_libraries-individual -lf_memory -lf_string -lf_type_array
 
 build_sources_library color.c private-color.c color/common.c
 
index 45cdebcc7abe4593bfa081ccea8b95c6dceab53d..37cb0da394414f3e501a623ef91ebb8228e83226 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_color
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 2631bb4faef985b43f0c33e181482ea02b3b4246..e66fc018eddfcded26332d571e3481e759d1f5ad 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_color
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index dbaf73e30d8ea6aa2740f642e8cbee32789aee69..1c405dca713d183283a38a1c078b78d14f7d9180 100644 (file)
@@ -10,9 +10,7 @@ extern "C" {
       if (!environment) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_f
 
-    if (!arguments.envp) {
-      return F_data_not;
-    }
+    if (!arguments.envp) return F_data_not;
 
     f_array_length_t total = 0;
 
@@ -20,9 +18,7 @@ extern "C" {
       ++total;
     } // while
 
-    if (!total) {
-      return F_data_not;
-    }
+    if (!total) return F_data_not;
 
     {
       const f_status_t status = f_string_maps_increase_by(total, environment);
@@ -114,47 +110,37 @@ extern "C" {
 #endif // _di_f_console_identify_
 
 #ifndef _di_f_console_parameter_prioritize_left_
-  f_status_t f_console_parameter_prioritize_left(const f_console_parameters_t parameters, const f_console_parameter_ids_t choices, f_console_parameter_id_t * const decision) {
+  f_status_t f_console_parameter_prioritize_left(const f_console_parameters_t parameters, const f_uint16s_t choices, f_array_length_t * const decision) {
     #ifndef _di_level_0_parameter_checking_
       if (!decision) return F_status_set_error(F_parameter);
-      if (!choices.id) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!choices.used) {
-      return F_data_not;
-    }
-
-    if (!parameters.used) {
-      return F_data_not;
-    }
+    if (!choices.used) return F_data_not;
+    if (!parameters.used) return F_data_not;
 
     f_array_length_t location = 0;
     f_array_length_t location_sub = 0;
-    f_console_parameter_id_t priority = 0;
+    f_array_length_t priority = 0;
 
     for (f_array_length_t i = 0; i < choices.used; ++i) {
 
-      if (choices.id[i] > parameters.used) {
-        return F_status_set_error(F_parameter);
-      }
+      if (choices.array[i] > parameters.used) return F_status_set_error(F_parameter);
 
-      if (parameters.array[choices.id[i]].result == f_console_result_found_e) {
-        if (!location || parameters.array[choices.id[i]].location < location) {
-          location = parameters.array[choices.id[i]].location;
-          location_sub = parameters.array[choices.id[i]].location_sub;
-          priority = choices.id[i];
+      if (parameters.array[choices.array[i]].result == f_console_result_found_e) {
+        if (!location || parameters.array[choices.array[i]].location < location) {
+          location = parameters.array[choices.array[i]].location;
+          location_sub = parameters.array[choices.array[i]].location_sub;
+          priority = i;
         }
-        else if (parameters.array[choices.id[i]].location == location && parameters.array[choices.id[i]].location_sub < location_sub) {
-          location_sub = parameters.array[choices.id[i]].location_sub;
-          priority = choices.id[i];
+        else if (parameters.array[choices.array[i]].location == location && parameters.array[choices.array[i]].location_sub < location_sub) {
+          location_sub = parameters.array[choices.array[i]].location_sub;
+          priority = i;
         }
       }
     } // for
 
     // The first parameter location (argc = 0) is the program name, therefore if the location is 0, then no matches were found.
-    if (!location) {
-      return F_data_not;
-    }
+    if (!location) return F_data_not;
 
     *decision = priority;
 
@@ -163,47 +149,37 @@ extern "C" {
 #endif // _di_f_console_parameter_prioritize_left_
 
 #ifndef _di_f_console_parameter_prioritize_right_
-  f_status_t f_console_parameter_prioritize_right(const f_console_parameters_t parameters, const f_console_parameter_ids_t choices, f_console_parameter_id_t * const decision) {
+  f_status_t f_console_parameter_prioritize_right(const f_console_parameters_t parameters, const f_uint16s_t choices, f_array_length_t * const decision) {
     #ifndef _di_level_0_parameter_checking_
       if (!decision) return F_status_set_error(F_parameter);
-      if (!choices.id) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!choices.used) {
-      return F_data_not;
-    }
-
-    if (!parameters.used) {
-      return F_data_not;
-    }
+    if (!choices.used) return F_data_not;
+    if (!parameters.used) return F_data_not;
 
     f_array_length_t location = 0;
     f_array_length_t location_sub = 0;
-    f_console_parameter_id_t priority = 0;
+    f_array_length_t priority = 0;
 
     for (f_array_length_t i = 0; i < choices.used; ++i) {
 
-      if (choices.id[i] > parameters.used) {
-        return F_status_set_error(F_parameter);
-      }
+      if (choices.array[i] > parameters.used) return F_status_set_error(F_parameter);
 
-      if (parameters.array[choices.id[i]].result == f_console_result_found_e) {
-        if (!location || parameters.array[choices.id[i]].location > location) {
-          location = parameters.array[choices.id[i]].location;
-          location_sub = parameters.array[choices.id[i]].location_sub;
-          priority = choices.id[i];
+      if (parameters.array[choices.array[i]].result == f_console_result_found_e) {
+        if (!location || parameters.array[choices.array[i]].location > location) {
+          location = parameters.array[choices.array[i]].location;
+          location_sub = parameters.array[choices.array[i]].location_sub;
+          priority = i;
         }
-        else if (parameters.array[choices.id[i]].location == location && parameters.array[choices.id[i]].location_sub > location_sub) {
-          location_sub = parameters.array[choices.id[i]].location_sub;
-          priority = choices.id[i];
+        else if (parameters.array[choices.array[i]].location == location && parameters.array[choices.array[i]].location_sub > location_sub) {
+          location_sub = parameters.array[choices.array[i]].location_sub;
+          priority = i;
         }
       }
     } // for
 
     // The first parameter location (argc = 0) is the program name, therefore if the location is 0, then no matches were found.
-    if (!location) {
-      return F_data_not;
-    }
+    if (!location) return F_data_not;
 
     *decision = priority;
 
@@ -219,14 +195,12 @@ extern "C" {
 
     parameters->arguments.used = 0;
 
-    if (!arguments.argc || !arguments.argv || !arguments.argv[0]) {
-      return F_data_not;
-    }
+    if (!arguments.argc || !arguments.argv || !arguments.argv[0]) return F_data_not;
 
     f_status_t status = f_string_dynamics_increase_by(arguments.argc, &parameters->arguments);
     if (F_status_is_error(status)) return status;
 
-    // Append the program name parameter.
+    // Append the program name parameter as a static string.
     parameters->arguments.array[parameters->arguments.used].string = arguments.argv[0];
     parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[0], F_console_parameter_size_d);
     parameters->arguments.array[parameters->arguments.used++].size = 0;
index 33129d68b0d9912abf61f17562c2e3039b2385b8..1a1ef5897bd276b013a9662ebfe623455ba3cc32 100644 (file)
@@ -86,17 +86,17 @@ extern "C" {
  *   An array of numeric ids, each representing a parameter within the parameters variable.
  *   The order does not matter.
  * @param decision
- *   The resulting decision.
+ *   The location in the choices array representing the decision.
  *   If none of the parameters are found, then this will not be updated (therefore it is safe to have it pre-initialized to the default).
  *
  * @return
  *   F_none on success.
- *   F_data_not if no parameters were found.
+ *   F_data_not if no parameters were matched with the available choices.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  */
 #ifndef _di_f_console_parameter_prioritize_left_
-  extern f_status_t f_console_parameter_prioritize_left(const f_console_parameters_t parameters, const f_console_parameter_ids_t choices, f_console_parameter_id_t * const decision);
+  extern f_status_t f_console_parameter_prioritize_left(const f_console_parameters_t parameters, const f_uint16s_t choices, f_array_length_t * const decision);
 #endif // _di_f_console_parameter_prioritize_left_
 
 /**
@@ -117,17 +117,17 @@ extern "C" {
  *   An array of numeric ids, each representing a parameter within the parameters variable.
  *   The order does not matter.
  * @param decision
- *   The resulting decision.
+ *   The location in the choices array representing the decision.
  *   If none of the parameters are found, then this will not be updated (therefore it is safe to have it pre-initialized to the default).
  *
  * @return
  *   F_none on success.
- *   F_data_not if no parameters were found.
+ *   F_data_not if no parameters were matched with the available choices.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  */
 #ifndef _di_f_console_parameter_prioritize_right_
-  extern f_status_t f_console_parameter_prioritize_right(const f_console_parameters_t parameters, const f_console_parameter_ids_t choices, f_console_parameter_id_t * const decision);
+  extern f_status_t f_console_parameter_prioritize_right(const f_console_parameters_t parameters, const f_uint16s_t choices, f_array_length_t * const decision);
 #endif // _di_f_console_parameter_prioritize_right_
 
 /**
index ea6a9e1f1f9a917a723a19f3790272b7a3507166..431417bf78f40ab0985570e0bc379610cc3e482b 100644 (file)
@@ -10,6 +10,8 @@ extern "C" {
   const f_string_static_t f_console_standard_short_error_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_error_s, 0, F_console_standard_short_error_s_length);
   const f_string_static_t f_console_standard_short_help_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_help_s, 0, F_console_standard_short_help_s_length);
   const f_string_static_t f_console_standard_short_light_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_light_s, 0, F_console_standard_short_light_s_length);
+  const f_string_static_t f_console_standard_short_line_first_no_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_line_first_no_s, 0, F_console_standard_short_line_first_no_s_length);
+  const f_string_static_t f_console_standard_short_line_last_no_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_line_last_no_s, 0, F_console_standard_short_line_last_no_s_length);
   const f_string_static_t f_console_standard_short_no_color_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_no_color_s, 0, F_console_standard_short_no_color_s_length);
   const f_string_static_t f_console_standard_short_normal_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_normal_s, 0, F_console_standard_short_normal_s_length);
   const f_string_static_t f_console_standard_short_quiet_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_short_quiet_s, 0, F_console_standard_short_quiet_s_length);
@@ -23,6 +25,8 @@ extern "C" {
   const f_string_static_t f_console_standard_long_error_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_error_s, 0, F_console_standard_long_error_s_length);
   const f_string_static_t f_console_standard_long_help_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_help_s, 0, F_console_standard_long_help_s_length);
   const f_string_static_t f_console_standard_long_light_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_light_s, 0, F_console_standard_long_light_s_length);
+  const f_string_static_t f_console_standard_long_line_first_no_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_line_first_no_s, 0, F_console_standard_long_line_first_no_s_length);
+  const f_string_static_t f_console_standard_long_line_last_no_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_line_last_no_s, 0, F_console_standard_long_line_last_no_s_length);
   const f_string_static_t f_console_standard_long_no_color_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_no_color_s, 0, F_console_standard_long_no_color_s_length);
   const f_string_static_t f_console_standard_long_normal_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_normal_s, 0, F_console_standard_long_normal_s_length);
   const f_string_static_t f_console_standard_long_quiet_s = macro_f_string_static_t_initialize((f_string_t) F_console_standard_long_quiet_s, 0, F_console_standard_long_quiet_s_length);
index 82a063b0b286227ec570aca10324b3b5e94b2751..c459873b4ebead6240a6093b5f715a9e858ad8f8 100644 (file)
@@ -82,14 +82,16 @@ extern "C" {
  * For example, a "+D +D" means more debug output than simply "+D".
  *
  * The verbosity interpretation used as the default for many of the level 3 programs in this process, is to treat verbosity modes as a scale from quiet to debug with quiet as the least verbose and debug as the most verbose.
- * This is not stricly a requirement, but expect level 3 projects to work this way.
+ * This is not strictly a requirement, but expect level 3 projects to work this way.
  *
  * The following options are subjective in interpretation of the verbosity but are expected to be follow the general interpretation:
- *   - debug:   Enable debugging, which will likely increase output verbosity.
- *   - error:   Similar to quiet, except that error messages are printed (this is less verbose than "normal").
- *   - normal:  Use normal printing (don't use debug/quiet/verbose).
- *   - quiet:   Decrease verbosity, print less, in some use cases this could mean printing nothing.
- *   - verbose: Increase verbosity, print more, in some use cases this could mean printing just about everything.
+ *   - debug:         Enable debugging, which will likely increase output verbosity.
+ *   - error:         Similar to quiet, except that error messages are printed (this is less verbose than "normal").
+ *   - normal:        Use normal printing (don't use debug/quiet/verbose).
+ *   - quiet:         Decrease verbosity, print less, in some use cases this could mean printing nothing.
+ *   - verbose:       Increase verbosity, print more, in some use cases this could mean printing just about everything.
+ *   - line_first_no: Don't print the first line if one is to be printed (useful in scripts) (may include error/warning messages).
+ *   - line_last_no:  Don't print the last line if one is to be printed (useful in scripts) (may include error/warning messages).
  *
  * The following are less subjective in interpretation but do allow some flexibility.
  *   - dark:     Do display color intended for dark backgrounds (often the default behavior) when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.)
@@ -108,63 +110,73 @@ extern "C" {
  *     - To avoid problems with the status code after a program is forcibly killed, the status_out environment variable should be cleared at program start.
  */
 #ifndef _di_f_console_standard_s_
-  #define F_console_standard_short_dark_s       "d"
-  #define F_console_standard_short_debug_s      "D"
-  #define F_console_standard_short_error_s      "E"
-  #define F_console_standard_short_help_s       "h"
-  #define F_console_standard_short_light_s      "l"
-  #define F_console_standard_short_no_color_s   "n"
-  #define F_console_standard_short_normal_s     "N"
-  #define F_console_standard_short_quiet_s      "Q"
-  #define F_console_standard_short_status_in_s  "s"
-  #define F_console_standard_short_status_out_s "S"
-  #define F_console_standard_short_verbose_s    "V"
-  #define F_console_standard_short_version_s    "v"
-
-  #define F_console_standard_short_dark_s_length       1
-  #define F_console_standard_short_debug_s_length      1
-  #define F_console_standard_short_error_s_length      1
-  #define F_console_standard_short_help_s_length       1
-  #define F_console_standard_short_light_s_length      1
-  #define F_console_standard_short_no_color_s_length   1
-  #define F_console_standard_short_normal_s_length     1
-  #define F_console_standard_short_quiet_s_length      1
-  #define F_console_standard_short_status_in_s_length  1
-  #define F_console_standard_short_status_out_s_length 1
-  #define F_console_standard_short_verbose_s_length    1
-  #define F_console_standard_short_version_s_length    1
-
-  #define F_console_standard_long_dark_s       "dark"
-  #define F_console_standard_long_debug_s      "debug"
-  #define F_console_standard_long_error_s      "error"
-  #define F_console_standard_long_help_s       "help"
-  #define F_console_standard_long_light_s      "light"
-  #define F_console_standard_long_no_color_s   "no_color"
-  #define F_console_standard_long_normal_s     "normal"
-  #define F_console_standard_long_quiet_s      "quiet"
-  #define F_console_standard_long_status_in_s  "status_in"
-  #define F_console_standard_long_status_out_s "status_out"
-  #define F_console_standard_long_verbose_s    "verbose"
-  #define F_console_standard_long_version_s    "version"
-
-  #define F_console_standard_long_dark_s_length       4
-  #define F_console_standard_long_debug_s_length      5
-  #define F_console_standard_long_error_s_length      5
-  #define F_console_standard_long_help_s_length       4
-  #define F_console_standard_long_light_s_length      5
-  #define F_console_standard_long_no_color_s_length   8
-  #define F_console_standard_long_normal_s_length     6
-  #define F_console_standard_long_quiet_s_length      5
-  #define F_console_standard_long_status_in_s_length  9
-  #define F_console_standard_long_status_out_s_length 10
-  #define F_console_standard_long_verbose_s_length    7
-  #define F_console_standard_long_version_s_length    7
+  #define F_console_standard_short_dark_s          "d"
+  #define F_console_standard_short_debug_s         "D"
+  #define F_console_standard_short_error_s         "E"
+  #define F_console_standard_short_help_s          "h"
+  #define F_console_standard_short_light_s         "l"
+  #define F_console_standard_short_line_first_no_s "F"
+  #define F_console_standard_short_line_last_no_s  "L"
+  #define F_console_standard_short_no_color_s      "n"
+  #define F_console_standard_short_normal_s        "N"
+  #define F_console_standard_short_quiet_s         "Q"
+  #define F_console_standard_short_status_in_s     "s"
+  #define F_console_standard_short_status_out_s    "S"
+  #define F_console_standard_short_verbose_s       "V"
+  #define F_console_standard_short_version_s       "v"
+
+  #define F_console_standard_short_dark_s_length          1
+  #define F_console_standard_short_debug_s_length         1
+  #define F_console_standard_short_error_s_length         1
+  #define F_console_standard_short_help_s_length          1
+  #define F_console_standard_short_light_s_length         1
+  #define F_console_standard_short_line_first_no_s_length 1
+  #define F_console_standard_short_line_last_no_s_length  1
+  #define F_console_standard_short_no_color_s_length      1
+  #define F_console_standard_short_normal_s_length        1
+  #define F_console_standard_short_quiet_s_length         1
+  #define F_console_standard_short_status_in_s_length     1
+  #define F_console_standard_short_status_out_s_length    1
+  #define F_console_standard_short_verbose_s_length       1
+  #define F_console_standard_short_version_s_length       1
+
+  #define F_console_standard_long_dark_s          "dark"
+  #define F_console_standard_long_debug_s         "debug"
+  #define F_console_standard_long_error_s         "error"
+  #define F_console_standard_long_help_s          "help"
+  #define F_console_standard_long_light_s         "light"
+  #define F_console_standard_long_line_first_no_s "line_first_no"
+  #define F_console_standard_long_line_last_no_s  "line_last_no"
+  #define F_console_standard_long_no_color_s      "no_color"
+  #define F_console_standard_long_normal_s        "normal"
+  #define F_console_standard_long_quiet_s         "quiet"
+  #define F_console_standard_long_status_in_s     "status_in"
+  #define F_console_standard_long_status_out_s    "status_out"
+  #define F_console_standard_long_verbose_s       "verbose"
+  #define F_console_standard_long_version_s       "version"
+
+  #define F_console_standard_long_dark_s_length          4
+  #define F_console_standard_long_debug_s_length         5
+  #define F_console_standard_long_error_s_length         5
+  #define F_console_standard_long_help_s_length          4
+  #define F_console_standard_long_light_s_length         5
+  #define F_console_standard_long_line_first_no_s_length 13
+  #define F_console_standard_long_line_last_no_s_length  12
+  #define F_console_standard_long_no_color_s_length      8
+  #define F_console_standard_long_normal_s_length        6
+  #define F_console_standard_long_quiet_s_length         5
+  #define F_console_standard_long_status_in_s_length     9
+  #define F_console_standard_long_status_out_s_length    10
+  #define F_console_standard_long_verbose_s_length       7
+  #define F_console_standard_long_version_s_length       7
 
   extern const f_string_static_t f_console_standard_short_dark_s;
   extern const f_string_static_t f_console_standard_short_debug_s;
   extern const f_string_static_t f_console_standard_short_error_s;
   extern const f_string_static_t f_console_standard_short_help_s;
   extern const f_string_static_t f_console_standard_short_light_s;
+  extern const f_string_static_t f_console_standard_short_line_first_no_s;
+  extern const f_string_static_t f_console_standard_short_line_last_no_s;
   extern const f_string_static_t f_console_standard_short_no_color_s;
   extern const f_string_static_t f_console_standard_short_normal_s;
   extern const f_string_static_t f_console_standard_short_quiet_s;
@@ -178,6 +190,8 @@ extern "C" {
   extern const f_string_static_t f_console_standard_long_error_s;
   extern const f_string_static_t f_console_standard_long_help_s;
   extern const f_string_static_t f_console_standard_long_light_s;
+  extern const f_string_static_t f_console_standard_long_line_first_no_s;
+  extern const f_string_static_t f_console_standard_long_line_last_no_s;
   extern const f_string_static_t f_console_standard_long_no_color_s;
   extern const f_string_static_t f_console_standard_long_normal_s;
   extern const f_string_static_t f_console_standard_long_quiet_s;
@@ -268,6 +282,14 @@ extern "C" {
  * locations:     All locations within argv where this parameter is found (order is preserved).
  * locations_sub: All sub-locations within argv where this parameter is found (order is preserved).
  * values:        An array of locations representing where in the argv[] the values arguments are found.
+ *
+ * The macro_f_console_parameter_t_initialize() all arguments.
+ * The macro_f_console_parameter_t_initialize2() reduced arguments.
+ * The macro_f_console_parameter_t_initialize3() reduced arguments, strings are of f_string_static_t, has short, long, and other.
+ * The macro_f_console_parameter_t_initialize4() reduced arguments, strings are of f_string_static_t, has short and long.
+ * The macro_f_console_parameter_t_initialize5() reduced arguments, strings are of f_string_static_t, has short.
+ * The macro_f_console_parameter_t_initialize6() reduced arguments, strings are of f_string_static_t, has long.
+ * The macro_f_console_parameter_t_initialize7() reduced arguments, strings are of f_string_static_t, has other.
  */
 #ifndef _di_f_console_parameter_t_
   typedef struct {
@@ -300,7 +322,22 @@ extern "C" {
     f_array_lengths_t_initialize, \
   }
 
-  #define macro_f_console_parameter_t_initialize(symbol_short, symbol_long, symbol_other, values_total, type_value) { \
+  #define macro_f_console_parameter_t_initialize(symbol_short, symbol_long, symbol_other, values_total, type_value, result, location, location_sub, locations, locations_sub, values) { \
+    symbol_short, \
+    symbol_long, \
+    symbol_other, \
+    values_total, \
+    type_value, \
+    result, \
+    total, \
+    location, \
+    location_sub, \
+    locations, \
+    locations_sub, \
+    values, \
+  }
+
+  #define macro_f_console_parameter_t_initialize2(symbol_short, symbol_long, symbol_other, values_total, type_value) { \
     symbol_short, \
     symbol_long, \
     symbol_other, \
@@ -314,19 +351,74 @@ extern "C" {
     f_array_lengths_t_initialize, \
   }
 
-  #define macro_f_console_parameter_t_initialize2(symbol_short, symbol_long, symbol_other, values_total, type_value, result, location, location_sub, locations, locations_sub, values) { \
-    symbol_short, \
-    symbol_long, \
-    symbol_other, \
+  #define macro_f_console_parameter_t_initialize3(symbol_short, symbol_long, symbol_other, values_total, type_value) { \
+    symbol_short.string, \
+    symbol_long.string, \
+    symbol_other.string, \
     values_total, \
     type_value, \
-    result, \
-    total, \
-    location, \
-    location_sub, \
-    locations, \
-    locations_sub, \
-    values, \
+    f_console_result_none_e, \
+    0, \
+    0, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+  }
+
+  #define macro_f_console_parameter_t_initialize4(symbol_short, symbol_long, values_total, type_value) { \
+    symbol_short.string, \
+    symbol_long.string, \
+    0, \
+    values_total, \
+    type_value, \
+    f_console_result_none_e, \
+    0, \
+    0, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+  }
+
+  #define macro_f_console_parameter_t_initialize5(symbol_short, values_total, type_value) { \
+    symbol_short.string, \
+    0, \
+    0, \
+    values_total, \
+    type_value, \
+    f_console_result_none_e, \
+    0, \
+    0, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+  }
+
+  #define macro_f_console_parameter_t_initialize6(symbol_long, values_total, type_value) { \
+    0, \
+    symbol_long.string, \
+    0, \
+    values_total, \
+    type_value, \
+    f_console_result_none_e, \
+    0, \
+    0, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+  }
+
+  #define macro_f_console_parameter_t_initialize7(symbol_other, values_total, type_value) { \
+    0, \
+    0, \
+    symbol_other.string, \
+    values_total, \
+    type_value, \
+    f_console_result_none_e, \
+    0, \
+    0, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
+    f_array_lengths_t_initialize, \
   }
 #endif // _di_f_console_parameter_t_
 
@@ -358,41 +450,15 @@ extern "C" {
 #endif // _di_f_console_parameters_t_
 
 /**
- * Provide a helper structure for references and processing standard C main() arguments.
- *
- * The f_console_parameter_id_t is designed to be used for the enums to represent any given parameter by the ID.
- */
-#ifndef _di_f_console_parameter_id_t_
-  typedef uint16_t f_console_parameter_id_t;
-
-  #define f_console_parameter_id_t_initialize 0
-
-  #define macro_f_console_parameter_id_t_initialize(id) id
-#endif // _di_f_console_parameter_id_t_
-
-/**
- * The f_console_parameter_ids_t is designed for passing this to a function as a single argument.
- *
- * id:   An array of f_console_parameter_id_t whose size is defined by the "used" property.
- * used: The total number of ids in the id array.
- */
-#ifndef _di_f_console_parameter_ids_t_
-  typedef struct {
-    f_console_parameter_id_t *id;
-
-    f_array_length_t used;
-  } f_console_parameter_ids_t;
-
-  #define f_console_parameter_ids_t_initialize { 0, 0 }
-
-  #define macro_f_console_parameter_ids_t_initialize(id, used) { id, used }
-#endif // _di_f_console_parameter_ids_t_
-
-/**
  * Provide a helper structure for referencing the argc and argv standard main arguments.
  *
  * This is intended to only store the argc and argv and should not be treated as dynamic.
  *
+ * argc: The total number of arguments in argv.
+ *
+ * argv: An array of strings representing arguments passed to some program.
+ * envp: Any array of strings representing all environment variables at the time the program is called.
+ *
  * macro_f_console_arguments_t_initialize() initializes the structure.
  */
 #ifndef _di_f_console_arguments_t_
index 1b7901f7ec3143e86ae40ed25086da50eb178ec7..66d4a6abbd826b85f90cf32c14d3d83939e5baf0 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_console
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index a0a824137dec58e74c23c26848523e814c3c5f7d..8e39803c06b19d4d8945480a90ca423c993cda04 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_console
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index a61e4c0cca48bf464ed7f2ec5a64dcd3385b1774..dd6280a33cd4d0d971941e918a6b2a63c593c5b7 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_control_group
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0daed427e4e1f1525777964a3752a9aba08d341f..e3fbf41bc42f72f304388d448224c6100a0d062f 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_control_group
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index c43f5118a4bd1ea1e2cc80bf6f37bd799ca90068..71d353331ebc84f74f6159ee8c4ac5c7770cab4f 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_conversion
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 1041c2f9d4f7e99df5adaa2a2d7a9e71e8bdca4d..b1fbe604c430616c99ce483aaaa5907c834d1a16 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_conversion
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 58a3e4b5c055eaf0719d61679b704bb97d1e919c..4d347d71f2ec4a14f14f9b12a35a77c06202fac6 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_conversion
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index c3fa67ffb4db9fc46d0f692374ed9739246a9a15..28b9b23ef325ec20b63967479b1afdf450decf61 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_directory
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index a72b88e64da3158726ac89d2b851438a2ad77a40..50189b99af0b693cadbf8cf022a13291387a1d75 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_directory
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 6338b40d2834954d11bbc4b715d8cc868916a5d7..74365cce54388a035b0ab3c58cbc404488287c48 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_directory
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 20be8d85245a5614fa6ca4bdcd85eb6d6ded388a..8645103de3a39d74e3288d69412f22e5fcefb1d7 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_environment
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 2c7f99bbf55795f9994d5d3f807cb61a154af47f..3b3e0b3a9e3bd7825f542a8484760612d2a2f5d0 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_environment
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 212b25812ffc1629d0b2307ced18194a70590a36..e89e53d886ae152387adf7bad0e32e41b5659774 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_environment
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 4d92ae2576980468896356fc185738411fc253e6..4ea2d96c1cf0e294faf0de5b62fcc9439242f166 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_execute
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 9f9628e0738dc838ce893476f4ae3df008ee67ce..2c6e0a0feef3c40a6eabc52a8dcf8eaf934f3780 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_execute
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 7d24c963f482041324c1197ab0a0293f202e9c20..c17666961aedd7a9aa317990f935e68bbc0c3ac2 100644 (file)
@@ -1956,15 +1956,12 @@ extern "C" {
 #endif // _di_f_file_stream_close_
 
 #ifndef _di_f_file_stream_flush_
-  f_status_t f_file_stream_flush(f_file_t * const file) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!file) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+  f_status_t f_file_stream_flush(const f_file_t file) {
 
-    if (!file->stream) return F_stream_not;
+    if (!file.stream) return F_stream_not;
 
     // Only 0 is considered a success and so any non-zero value could be an error.
-    if (fflush(file->stream) != 0) {
+    if (fflush(file.stream) != 0) {
       if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
       if (errno == EBADF) return F_status_set_error(F_file_descriptor);
       if (errno == EFAULT) return F_status_set_error(F_buffer);
index fffd3012d3853963d95c8896824fc500f48ee75b..949ccf691c3c74abb8a49e3cf2939bab752bc227 100644 (file)
@@ -2111,7 +2111,7 @@ extern "C" {
  * @see fflush()
  */
 #ifndef _di_f_file_stream_flush_
-  extern f_status_t f_file_stream_flush(f_file_t * const file);
+  extern f_status_t f_file_stream_flush(const f_file_t file);
 #endif // _di_f_file_stream_flush_
 
 /**
index 11a72ecc89b5ad1853af7c9502f57388ac21639c..5e7561e540a1b2a220b1586edbf6c2d934869a0a 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_file
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 9062ac4fe279bcb3290bc72dcbd5b11173a9c45a..d467aacf9b923a5fdf9ee90d1ee50b11ff87e84a 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_file
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index c20c420690a72d3182486704f7dd06552f8fc713..24d8ea55e0d4c3810beadf2d64c45abb486e912b 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_file
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index db653dc30647045391a3842cb7105502ee00ca7b..26b026257e43f182d733c4f163d7eeacb2a950dd 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_fss
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 83150cc43babe31b18bc2fd3177c500ce1e25b3d..590a3d7c673a0aa83a604171eb436bbf31b798b4 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_fss
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index d53dfcd881b49fc777efb955240a3efc0d470efb..5a430ac137c1a0256fc65c79ec609c502ec8ff17 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_fss
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 283b28e42dcb169295242b45d0375a26aaeedeb4..38b3b9d79fb66c00e262fbfc4f47bb27c6c2fbf0 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_iki
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 08e96191da9997e400eeda5b55f1d39d66f3e3b0..e58d1f1ed8be2b4b296daec804df2158febc4dec 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_iki
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index b337686eb65fd054bf76a6c3c86d0a7561165209..0704ca4aa7221b96b1aaf4e5f3ccd5b2b5e5f9eb 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_limit
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index d0ef9df145f83fef8b54199e3800492d0f10d457..3877d93b91a8ba73affd99f8739e003af5947c9a 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_limit
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index ad1ab85eddddf8eb5f6a6e8081da30d782ad142f..d9e50531519a1b1967d6c9711b61dc315bb1ba15 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_limit
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index eb228f467c5c5b6c57e27dbc379c185e903f4b32..d6d3b59894b5877274bc6ffad2a5f37a35786f2b 100644 (file)
@@ -6,16 +6,19 @@ extern "C" {
 #endif
 
 #ifndef _di_f_memory_adjust_
-  f_status_t f_memory_adjust(const size_t old_length, const size_t new_length, const size_t size, void ** const pointer) {
+  f_status_t f_memory_adjust(const size_t length_old, const size_t length_new, const size_t size, void ** const pointer) {
     #ifndef _di_level_0_parameter_checking_
       if (!size) return F_status_set_error(F_parameter);
       if (!pointer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
+    // Prevent double-frees and unnecessary frees.
+    if (!*pointer && !length_new || length_old == length_new) return F_data_not;
+
     #ifdef _f_memory_FORCE_fast_memory_
-      return private_f_memory_resize(old_length, new_length, size, pointer);
+      return private_f_memory_resize(length_old, length_new, size, pointer);
     #else // _f_memory_FORCE_fast_memory_
-      return private_f_memory_adjust(old_length, new_length, size, pointer);
+      return private_f_memory_adjust(length_old, length_new, size, pointer);
     #endif // _f_memory_FORCE_fast_memory_
   }
 #endif // _di_f_memory_adjust_
@@ -23,13 +26,12 @@ extern "C" {
 #ifndef _di_f_memory_delete_
   f_status_t f_memory_delete(const size_t length, const size_t size, void ** const pointer) {
     #ifndef _di_level_0_parameter_checking_
+      if (!size) return F_status_set_error(F_parameter);
       if (!pointer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
     // Prevent double-frees.
-    if (!*pointer || !size) {
-      return F_data_not;
-    }
+    if (!*pointer) return F_data_not;
 
     #ifdef _f_memory_FORCE_secure_memory_
       if (!length) {
@@ -54,9 +56,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     // Prevent double-frees.
-    if (!*pointer) {
-      return F_data_not;
-    }
+    if (!*pointer) return F_data_not;
 
     #ifndef _f_memory_FORCE_fast_memory_
       if (!length) {
@@ -80,16 +80,10 @@ extern "C" {
       if (!pointer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    // prevent double-allocations.
-    if (*pointer || !length) {
-      return F_data_not;
-    }
-
-    *pointer = calloc(length, size);
+    // Prevent double-allocations and unnecessary frees.
+    if (*pointer || !length) return F_data_not;
 
-    if (*pointer) {
-      return F_none;
-    }
+    if (*pointer = calloc(length, size)) return F_none;
 
     return F_status_set_error(F_memory_not);
   }
@@ -100,26 +94,21 @@ extern "C" {
   f_status_t f_memory_new_aligned(const size_t length, const size_t alignment, void ** const pointer) {
     #ifndef _di_level_0_parameter_checking_
       if (!alignment) return F_status_set_error(F_parameter);
-      if (!pointer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    // Prevent double-allocations.
-    if (*pointer || !length) {
-      return F_data_not;
-    }
+    // Prevent double-allocations and unnecessary frees.
+    if (*pointer || !length) return F_data_not;
 
     #ifdef _f_memory_USE_posix_memalign_
       const int result = posix_memalign(pointer, alignment, length);
 
       if (result) {
-        if (result == EINVAL) {
-          return F_status_set_error(F_parameter);
-        }
+        if (result == EINVAL) return F_status_set_error(F_parameter);
 
         return F_status_set_error(F_memory_not);
       }
     #else
-      void *result = aligned_alloc(alignment, length);
+      void * const result = aligned_alloc(alignment, length);
 
       if (result) {
         *pointer = result;
@@ -141,16 +130,19 @@ extern "C" {
 #endif // _di_f_memory_new_aligned_
 
 #ifndef _di_f_memory_resize_
-  f_status_t f_memory_resize(const size_t old_length, const size_t new_length, const size_t size, void ** const pointer) {
+  f_status_t f_memory_resize(const size_t length_old, const size_t length_new, const size_t size, void ** const pointer) {
     #ifndef _di_level_0_parameter_checking_
       if (!size) return F_status_set_error(F_parameter);
       if (!pointer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
+    // Prevent double-frees and unnecessary frees.
+    if (!*pointer && !length_new || length_old == length_new) return F_data_not;
+
     #ifdef _f_memory_FORCE_secure_memory_
-      return private_f_memory_adjust(old_length, new_length, size, pointer);
+      return private_f_memory_adjust(length_old, length_new, size, pointer);
     #else // _f_memory_FORCE_secure_memory_
-      return private_f_memory_resize(old_length, new_length, size, pointer);
+      return private_f_memory_resize(length_old, length_new, size, pointer);
     #endif // _f_memory_FORCE_secure_memory_
   }
 #endif // _di_f_memory_resize_
index de2b970eaf2ed36e3a05ca8cade2a04e564fb70e..d285ad45ff28062401fe28de020657c96a35494f 100644 (file)
@@ -34,9 +34,9 @@ extern "C" {
  *
  * The pointer address might be changed by realloc().
  *
- * @param old_length
+ * @param length_old
  *   The total number of blocks representing the length to be resized from.
- * @param new_length
+ * @param length_new
  *   The total number of blocks representing the length to be resized to.
  * @param size
  *   The block size, in bytes (size * length = allocated size).
@@ -55,7 +55,7 @@ extern "C" {
  * @see realloc()
  */
 #ifndef _di_f_memory_adjust_
-  extern f_status_t f_memory_adjust(const size_t old_length, const size_t new_length, const size_t size, void ** const pointer);
+  extern f_status_t f_memory_adjust(const size_t length_old, const size_t length_new, const size_t size, void ** const pointer);
 #endif // _di_f_memory_adjust_
 
 /**
@@ -174,9 +174,9 @@ extern "C" {
  *
  * The pointer address might be changed by realloc().
  *
- * @param old_length
+ * @param length_old
  *   The total number of blocks representing the length to be resized from.
- * @param new_length
+ * @param length_new
  *   The total number of blocks representing the length to be resized to.
  * @param size
  *   The block size, in bytes (size * length = allocated size).
@@ -195,7 +195,7 @@ extern "C" {
  * @see realloc()
  */
 #ifndef _di_f_memory_resize_
-  extern f_status_t f_memory_resize(const size_t old_length, const size_t new_length, const size_t size, void ** const pointer);
+  extern f_status_t f_memory_resize(const size_t length_old, const size_t length_new, const size_t size, void ** const pointer);
 #endif // _di_f_memory_resize_
 
 #ifdef __cplusplus
index 7d057f83fd1616058ce48d993dcd0515a995712c..8838c77a769552f870484334aaf11bba00260bc0 100644 (file)
@@ -8,9 +8,7 @@ extern "C" {
 #if !defined(_di_f_memory_adjust_) || !defined(_di_f_memory_structure_adjust_) || !defined(_di_f_memory_structure_decimate_by_)
   f_status_t private_f_memory_adjust(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) {
 
-    if (length_old == length_new) {
-      return F_data_not;
-    }
+    if (length_old == length_new) return F_data_not;
 
     if (*pointer) {
       if (length_old) {
@@ -23,7 +21,7 @@ extern "C" {
       }
 
       if (length_new) {
-        void *new_pointer = realloc(*pointer, type_size * length_new);
+        void * const new_pointer = realloc(*pointer, type_size * length_new);
 
         if (new_pointer) {
           if (length_new > length_old) {
@@ -49,10 +47,7 @@ extern "C" {
     }
     else if (length_new) {
       *pointer = calloc(type_size, length_new);
-
-      if (*pointer) {
-        return F_none;
-      }
+      if (*pointer) return F_none;
     }
     else {
       return F_data_not;
@@ -65,13 +60,9 @@ extern "C" {
 #if !defined(_di_f_memory_resize_) || !defined(_di_memory_structure_decrease_by_) || !defined(_di_memory_structure_increase_) || !defined(_di_memory_structure_increase_by_) || !defined(_di_f_memory_structure_resize_)
   f_status_t private_f_memory_resize(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) {
 
-    if (length_old == length_new) {
-      return F_data_not;
-    }
-
     if (*pointer) {
       if (length_new) {
-        void *new_pointer = realloc(*pointer, type_size * length_new);
+        void * const new_pointer = realloc(*pointer, type_size * length_new);
 
         if (new_pointer) {
           if (length_new > length_old) {
@@ -97,10 +88,7 @@ extern "C" {
     }
     else if (length_new) {
       *pointer = calloc(type_size, length_new);
-
-      if (*pointer) {
-        return F_none;
-      }
+      if (*pointer) return F_none;
     }
     else {
       return F_data_not;
index 0328eb805d565865a419063fc6db6bc9a72d2625..cce19b49ca9fba18f5bad4789c478115093bb41a 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_memory
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 9122a333a4aaf4d7d090c98c708401230635f5b2..df45624c4ba749a9a2f43fbf7d262c5fed237408 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_path
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 6dbb759de5582bcb899cbcf3d38d894035701b84..355518aa985fc46f980b680c1c4ec553aa51a5d0 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_path
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index baad1ef4e92faa2076ed75edfcbaf026d3bfa2b3..f2e833691c109c09f60cf6f2d9b0404d2ced66f0 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_path
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 7dbeecb8b6e5ee2b0c7f15484548fa159144654f..bd5c4d66d7d925cf38507ca9054c8aa90cfe2a88 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_pipe
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index fb72ca825eb5cb93f8492e68ff0fb03365e415b1..41dc565a0ce16a0870c87f37076b0b34f009295d 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_pipe
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 759fbcd5f992702a53420f7cddcfb6ee1f33056b..a82a23f2e2a9da79b590e91ea85fc119fdfca8b0 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_pipe
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 2ef492dc9e6908f3962d1e113816a659205e920b..a9df658b5c707e33c13a4c8a9893a4426bdfd2a7 100644 (file)
@@ -37,9 +37,7 @@ static inline f_status_t private_inline_f_print_write_unlocked(const f_string_t
       if (!stream) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!length || !string) {
-      return F_data_not;
-    }
+    if (!length || !string) return F_data_not;
 
     return private_f_print(string, length, stream);
   }
@@ -195,9 +193,7 @@ static inline f_status_t private_inline_f_print_write_unlocked(const f_string_t
       if (!stream) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!buffer.used || !buffer.string) {
-      return F_data_not;
-    }
+    if (!buffer.used || !buffer.string) return F_data_not;
 
     return private_f_print_raw(buffer.string, buffer.used, stream);
   }
@@ -209,9 +205,7 @@ static inline f_status_t private_inline_f_print_write_unlocked(const f_string_t
       if (!stream) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!buffer.used || !buffer.string) {
-      return F_data_not;
-    }
+    if (!buffer.used || !buffer.string) return F_data_not;
 
     return private_f_print_raw_safely(buffer.string, buffer.used, stream);
   }
@@ -223,9 +217,7 @@ static inline f_status_t private_inline_f_print_write_unlocked(const f_string_t
       if (!stream) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!buffer.used || !buffer.string) {
-      return F_data_not;
-    }
+    if (!buffer.used || !buffer.string) return F_data_not;
 
     return private_f_print_safely(buffer.string, buffer.used, stream);
   }
@@ -237,9 +229,7 @@ static inline f_status_t private_inline_f_print_write_unlocked(const f_string_t
       if (!stream) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!length || !string) {
-      return F_data_not;
-    }
+    if (!length || !string) return F_data_not;
 
     return private_f_print_except(string, offset, length, except, stream);
   }
index e12f57b8d4684392d5bdba02cf38dab3c91156cb..a99372e06df1d5c68f57e90db55d8116303f7181 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_print
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0633159aa54535a7aabf18d9750511ecdedd89ea..57e99d2ad072aaa84243f093369192fcfeb61769 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_print
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 5eb1c838acc4e8229765f84653dc1e0a32b24663..30199ec2a362a3bf34d795be94320d42362b0e80 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_print
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 779f2a921b012cbee1ea0e1d086720f8b49d38d1..fb49775545a79c89fd4b314c5c99f449e2df0bb1 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_serialize
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 65eb10cd95c9504e48c0c6984988cafe8f9f3c26..13e04daeb870c8610daee1c85b59880835385ba1 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_serialize
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 13f59b79f7a60281754453e0a0161a3e02fbf9bd..679b72d01ffd4deaf9e5b60e0dbb71325e3d52eb 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_serialize
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 5d298cb5215747f3f85ca476ed2f4b682371be37..a31340626feda89742fc70114b6b24ee66439871 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_signal
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 7d16e7ef79c09818f0f9e694391a9379563a9687..149929a41431e4d52db7249d556598091f761606 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_signal
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 81937d1c0f7cc18dda9cd396b92cae32c3a99e75..4ca9bb6174dd20263dd4d7e73dce8cb4a6201ee6 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_signal
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index fe6ed1a27559baf2d0c5c4395f4b16293f401d26..01eb206d1617318519360e7c78e93f0d6da78959 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_socket
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 66d7625e2dd17890dedb72bbbf7348dc23705032..6b2e0bcbcceacdcedaf5e1ba07cbff51c18dfef8 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_socket
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 96c3649069f0d11f723375f3ef35fca7f0c565dd..d844cec067611e12a6a4d7fe402eee46df37baba 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_socket
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 7f69d4b8fd20d4bd477e87739147f2b8b8885799..2b897fad3742632593a25d682333a1ef8e730bb5 100644 (file)
@@ -319,6 +319,8 @@ extern "C" {
       F_halt_not,
       F_header,
       F_header_not,
+      F_help,
+      F_help_not,
       F_ignore,
       F_ignore_not,
       F_implemented,
index 9e4c46499d497e25f18c0774995aaf30fa53be41..687007646c581d0426a3efa8230494e490b1e4a0 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_status
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 3d7098d9602c7e8183af19b2f75ab36239616b2f..20d64578af45edf2db86742fb54cd1c1f32d33ef 100644 (file)
@@ -193,6 +193,8 @@ extern "C" {
     const f_string_static_t f_status_halt_not_s = macro_f_string_static_t_initialize(F_status_halt_not_s, 0, F_status_halt_not_s_length);
     const f_string_static_t f_status_header_s = macro_f_string_static_t_initialize(F_status_header_s, 0, F_status_header_s_length);
     const f_string_static_t f_status_header_not_s = macro_f_string_static_t_initialize(F_status_header_not_s, 0, F_status_header_not_s_length);
+    const f_string_static_t f_status_help_s = macro_f_string_static_t_initialize(F_status_help_s, 0, F_status_help_s_length);
+    const f_string_static_t f_status_help_not_s = macro_f_string_static_t_initialize(F_status_help_not_s, 0, F_status_help_not_s_length);
     const f_string_static_t f_status_ignore_s = macro_f_string_static_t_initialize(F_status_ignore_s, 0, F_status_ignore_s_length);
     const f_string_static_t f_status_ignore_not_s = macro_f_string_static_t_initialize(F_status_ignore_not_s, 0, F_status_ignore_not_s_length);
     const f_string_static_t f_status_implemented_s = macro_f_string_static_t_initialize(F_status_implemented_s, 0, F_status_implemented_s_length);
index 8c052275a9e3d0368b36758e62bc5c780fab41c8..b8199dd39be2b40b166201acedd2d1743075fb27 100644 (file)
@@ -346,6 +346,8 @@ extern "C" {
     #define F_status_halt_not_s          "F_halt_not"
     #define F_status_header_s            "F_header"
     #define F_status_header_not_s        "F_header_not"
+    #define F_status_help_s              "F_help"
+    #define F_status_help_not_s          "F_help_not"
     #define F_status_ignore_s            "F_ignore"
     #define F_status_ignore_not_s        "F_ignore_not"
     #define F_status_implemented_s       "F_implemented"
@@ -640,6 +642,8 @@ extern "C" {
     #define F_status_halt_not_s_length          10
     #define F_status_header_s_length            8
     #define F_status_header_not_s_length        12
+    #define F_status_help_s_length              6
+    #define F_status_help_not_s_length          10
     #define F_status_ignore_s_length            8
     #define F_status_ignore_not_s_length        12
     #define F_status_implemented_s_length       13
@@ -936,6 +940,8 @@ extern "C" {
     extern const f_string_static_t f_status_halt_not_s;
     extern const f_string_static_t f_status_header_s;
     extern const f_string_static_t f_status_header_not_s;
+    extern const f_string_static_t f_status_help_s;
+    extern const f_string_static_t f_status_help_not_s;
     extern const f_string_static_t f_status_ignore_s;
     extern const f_string_static_t f_status_ignore_not_s;
     extern const f_string_static_t f_status_implemented_s;
index 6039e4a6921d87ef44901465ee08f26e622698c9..8f422ef81a8c59c20b47f51ef46e982488a58766 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_status_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index f76569145805eaa11235923a38e89886f5d5374d..361106b2ecbc2ee94f66dfc4592eac48f9e79825 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_status_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index b62b3aa5d963946fe47579594af91ce48de70747..80f7e62fc658de594bb0556b1d7a6a4adac0e819 100644 (file)
@@ -207,6 +207,8 @@ void test__f_status_string_to__works(void **state) {
     F_group_not,
     F_halt,
     F_halt_not,
+    F_help,
+    F_help_not,
     F_header,
     F_header_not,
     F_ignore,
@@ -797,6 +799,8 @@ void test__f_status_string_to__works(void **state) {
     f_status_group_not_s,
     f_status_halt_s,
     f_status_halt_not_s,
+    f_status_help_s,
+    f_status_help_not_s,
     f_status_header_s,
     f_status_header_not_s,
     f_status_ignore_s,
@@ -1209,7 +1213,7 @@ void test__f_status_string_to__works(void **state) {
     f_status_status_code_last_s,
   };
 
-  for (uint16_t i = 0; i < 587; ++i) {
+  for (uint16_t i = 0; i < 589; ++i) {
 
     f_string_static_t result = f_string_static_t_initialize;
 
index 0805548acb997d04df2568ef75fe3fed4e479c40..af95eed5c5cf156d76edeb0ab08316ccf22038ce 100644 (file)
@@ -78,8 +78,8 @@ extern "C" {
  * GCC errors such as: "warning: assignment discards â€˜const’ qualifier from pointer target type [-Wdiscarded-qualifiers]" can be avoided using this.
  *
  * Do not confuse this with "const f_string_static_t".
- * When "const f_string_static_t * xxx" is passed to a function, then "xxx" cannot be changed.
- * When "f_string_constant_t xxx" is passed to a function, then "xxx" can be changed.
+ * When "const f_string_t xxx" is passed to a function, then "xxx" cannot be changed.
+ * When "f_string_constant_t xxx" is passed to a function, then "xxx" can be changed.
  */
 #ifndef _di_f_string_constant_t_
   typedef const f_char_t *f_string_constant_t;
@@ -89,7 +89,7 @@ extern "C" {
   #define macro_f_string_constant_t_initialize(string) string
 
   #define macro_f_string_constant_t_clear(string) string = 0;
-#endif // _di_f_string_t_
+#endif // _di_f_string_constant_t_
 
 #ifdef __cplusplus
 } // extern "C"
index b4520665a7c7a82f8e8ac9ed29f5e5c3f1ddc43a..43a3edf0e17a6be4645e253facc6be6b91343186 100644 (file)
@@ -56,9 +56,7 @@ extern "C" {
 #if !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
   f_status_t private_f_string_dynamics_adjust(const f_array_length_t length, f_string_dynamics_t * const dynamics) {
 
-    if (dynamics->used + length > F_array_length_t_size_d) {
-      return F_status_set_error(F_array_too_large);
-    }
+    if (dynamics->used + length > F_array_length_t_size_d) return F_status_set_error(F_array_too_large);
 
     f_status_t status = F_none;
 
@@ -132,9 +130,7 @@ extern "C" {
 #if !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) || !defined(f_string_map_multis_append)
   f_status_t private_f_string_dynamics_resize(const f_array_length_t length, f_string_dynamics_t * const dynamics) {
 
-    if (dynamics->used + length > F_array_length_t_size_d) {
-      return F_status_set_error(F_array_too_large);
-    }
+    if (dynamics->used + length > F_array_length_t_size_d) return F_status_set_error(F_array_too_large);
 
     f_status_t status = F_none;
 
@@ -160,9 +156,7 @@ extern "C" {
 #if !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
   f_status_t private_f_string_dynamicss_adjust(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) {
 
-    if (dynamicss->used + length > F_array_length_t_size_d) {
-      return F_status_set_error(F_array_too_large);
-    }
+    if (dynamicss->used + length > F_array_length_t_size_d) return F_status_set_error(F_array_too_large);
 
     f_status_t status = F_none;
 
@@ -188,9 +182,7 @@ extern "C" {
 #if !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_) || !defined(_di_f_string_dynamicss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
   f_status_t private_f_string_dynamicss_resize(const f_array_length_t length, f_string_dynamicss_t * const dynamicss) {
 
-    if (dynamicss->used + length > F_array_length_t_size_d) {
-      return F_status_set_error(F_array_too_large);
-    }
+    if (dynamicss->used + length > F_array_length_t_size_d) return F_status_set_error(F_array_too_large);
 
     f_status_t status = F_none;
 
index e3867e6f8ed04f481c8e248e644c9daf45d0cb22..9fcd0793ada8a2a6c3a3b51f325b9d7f7f2177d1 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 7eaa546f5c1061119b1fbec072f1f86b9979dc1f..03ef484f06a07999c6f063326b132f16ebd93b7f 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index e0f21bd8da506742473730187a976eba296cc7f7..ae880cbd9df4dbe935575b2bbaf6861864c635cc 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_thread
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 4efb2c0f7b8078a3a6df43696a2e8214e0cc0478..45b3dfc7cc98efaf038d96900d6a651c01ae3b24 100644 (file)
@@ -13,7 +13,7 @@
 build_name f_thread
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index ab916e5c840e8c58ae18f25c7efa0907be229fd0..a9ad8fe51e6d1ea92c0ba983e89eb89f53bcdc2c 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_thread
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index b7b4ba6efb734201d1dce3964736a21fee863b3e..93052a9e5124538959b044f05c0bb5523fda80e9 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_type
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index cf7f7f1a5adcfe677c11deb65f9241cfdd51cb4c..7b52ecca56537a1bd7a7b470c5fb4bb052ea17e0 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_type_array
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 7f90ad2b7cd891d4df2e0e65d3a9703760d85f4e..b88b6b74d3c08da200fe67e6b24610261b7b8c65 100644 (file)
@@ -3,7 +3,7 @@
 build_name f_utf
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index cb2591be13f004eac048e566864c7f060543d3c5..b2c5f4b8ecdf75324478100d0a83e79271d2e52b 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-f_utf
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 9df8727f085038f9d10e2f368a80277b032b5ea9..513f5a056b8fe1c5f7ee59e50eab76a1c5e928b7 100644 (file)
@@ -48,7 +48,7 @@ extern "C" {
 
       fprintf(file.stream, "%d", id);
 
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
       status = f_file_stream_close(&file);
       if (F_status_is_error(status)) break;
     } // for
index c0da86076450264493f008943ab4cd2062b0b1c7..dae1699b804c6e06f1129c4860784feaba1322c7 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_control_group
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 84a88ab0974af195728fbb1748e039cc4a3be71f..92f5206a65749b019f13a90fc0d5c666c31611c5 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_conversion
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 306ad6b58e8e50cf8da11df9ea9a603d5e965377..c28aa8149380213d61d9e783333682e9e210d3f7 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_directory
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index c06f37693c0d81b6e26f0a7d755936f654bf8e4c..09a1e42d3646f76f7d901befe2b78198f0448e46 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_environment
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 6e0b71f1da48967a2fa3911b8a84f2d1df099525..af96f4f31c5d368cd7400e2cd1461e1b31408b60 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_execute
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index a660a2ffb5c45b97b09f69376b55f74c2883536d..7a9076189cf51d8568f6f6c9e4fd0c3feb1bb2c2 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_fss
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0646c7b2993659490bd0763ae5fa279d82189a7d..b1877661a8b4667616de0854449bf001b41f5bea 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_iki
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 26434c29fc31fcb7e81b591ed92f139fae733d21..3f7ccc4323113eff80289af7b243811917032b0d 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_print
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 497e60a6db8d7f58854d5ad9ff8dbf4465454e66..49aff3a14ad9ab20809d83290c7fb157eeee023e 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_signal
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 39d2e19c01390e6e655bf25503762f22a88deff0..75fc00071af375f76c8162b7a40b833e6bfaa36c 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 3f8d5c5f14098973bf29bac1f78429175efd852f..2c3435e742d09a54a71b11c80a9c72441ed1492f 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_utf
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 5ad6add4142e519a0259d2c6f77c2baee4f14814..aa8a51ede046da681008bb59fbd3c33114c6af54 100644 (file)
@@ -3,7 +3,7 @@
 build_name fl_utf_file
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 84ed69d4c3a5beea6407755802fbf71e4d877de8..dd5ef54ae767a340665356b032b22233a6c98452 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_control_group
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 00b69f859a5711604a6655ad873ddb5b919bef4d..f48a32e42c2bc7aae285b4e2170cfef462e59d15 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QAccess denied while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QAccess denied while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -48,7 +48,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QCurrent user is not allowed to use the given group while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QCurrent user is not allowed to use the given group while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -62,7 +62,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QCurrent user is not allowed to use the given owner while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QCurrent user is not allowed to use the given owner while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -76,7 +76,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid directory while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QInvalid directory while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -90,7 +90,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', not empty.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -104,7 +104,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFailed to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QFailed to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', already in an error state.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -118,7 +118,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFailed to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QFailed to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -132,7 +132,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', failed to close.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -146,7 +146,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', is closed.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -160,7 +160,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFile descriptor error while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QFile descriptor error while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -174,7 +174,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QMax file descriptors reached while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QMax file descriptors reached while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -188,7 +188,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid file descriptor while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QInvalid file descriptor while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -202,7 +202,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', %Q is empty.%]%r", print.to.stream, print.context, type_name, print.context, f_string_eol_s);
 
@@ -216,7 +216,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', flush failed.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -230,7 +230,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', found.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -244,7 +244,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', could not find.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -258,7 +258,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', already open.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -272,7 +272,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QMax open files reached while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QMax open files reached while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -286,7 +286,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QOverflow while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QOverflow while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -300,7 +300,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', purge failed.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -314,7 +314,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QRead failed while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QRead failed while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -328,7 +328,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QSeek failed while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QSeek failed while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -342,7 +342,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QStat failed while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QStat failed while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -356,7 +356,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QSynchronize failed while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QSynchronize failed while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -370,7 +370,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFailed to %Q %Q, the path '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[' is an unknown file type.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -384,7 +384,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUTF failure while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUTF failure while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -398,7 +398,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid UTF while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QInvalid UTF while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -412,7 +412,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnderflow while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnderflow while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -426,7 +426,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFailed to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QFailed to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', write failure.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -440,7 +440,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QLoop while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QLoop while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -454,7 +454,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid %Q name '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, type_name, print.context);
+        fl_print_format("%[%QInvalid %Q name '%]", print.to.stream, print.context, print.prefix, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -468,7 +468,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QNumber overflow while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QNumber overflow while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -482,7 +482,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QNumber underflow while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QNumber underflow while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -496,7 +496,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid parameter", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QInvalid parameter", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -514,7 +514,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QProhibited by system while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QProhibited by system while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -528,7 +528,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', %Q is read only.%]%r", print.to.stream, print.context, type_name, print.context, f_string_eol_s);
 
@@ -542,7 +542,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+        fl_print_format("%[%QUnable to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
         fl_print_format("%[', %Q is write only.%]%r", print.to.stream, print.context, type_name, print.context, f_string_eol_s);
 
@@ -557,7 +557,7 @@ extern "C" {
         if (print.verbosity != f_console_verbosity_quiet_e) {
           flockfile(print.to.stream);
 
-          fl_print_format("%r%[%QInvalid or missing directory in path while trying to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+          fl_print_format("%[%QInvalid or missing directory in path while trying to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
           fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
           fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -571,7 +571,7 @@ extern "C" {
         if (print.verbosity != f_console_verbosity_quiet_e) {
           flockfile(print.to.stream);
 
-          fl_print_format("%r%[%QFailed to %Q %Q, the path '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+          fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
           fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
           fl_print_format("%[' is a directory.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -586,7 +586,7 @@ extern "C" {
         if (print.verbosity != f_console_verbosity_quiet_e) {
           flockfile(print.to.stream);
 
-          fl_print_format("%r%[%QFailed to %Q %Q, the path '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+          fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
           fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
           fl_print_format("%[' is a file.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -602,7 +602,7 @@ extern "C" {
         if (print.verbosity != f_console_verbosity_quiet_e) {
           flockfile(print.to.stream);
 
-          fl_print_format("%r%[%QFailed to %Q %Q '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+          fl_print_format("%[%QFailed to %Q %Q '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
           fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
           fl_print_format("%[' due to an invalid directory in the path.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -616,7 +616,7 @@ extern "C" {
         if (print.verbosity != f_console_verbosity_quiet_e) {
           flockfile(print.to.stream);
 
-          fl_print_format("%r%[%QFailed to %Q %Q, the path '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, operation, type_name, print.context);
+          fl_print_format("%[%QFailed to %Q %Q, the path '%]", print.to.stream, print.context, print.prefix, operation, type_name, print.context);
           fl_print_format("%[%Q%]", print.to.stream, print.notable, name, print.notable);
           fl_print_format("%[' is a %Q.%]%r", print.to.stream, print.context, status == F_file_type_pipe ? fll_error_file_type_pipe_s : fll_error_file_type_socket_s, print.context, f_string_eol_s);
 
@@ -638,7 +638,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QThe argument for the parameter '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%QThe argument for the parameter '%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, parameter, print.notable);
         fl_print_format("%[' must not be an empty string.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
 
@@ -652,7 +652,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QThe argument '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%QThe argument '%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
         fl_print_format("%[' is not a valid number for the parameter '%]", print.to.stream, print.context, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, parameter, print.notable);
@@ -668,7 +668,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QThe argument '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%QThe argument '%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
         fl_print_format("%[' is negative, which is not allowed for the parameter '%]", print.to.stream, print.context, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, parameter, print.notable);
@@ -684,7 +684,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QThe argument '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%QThe argument '%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
         fl_print_format("%[' is too large for the parameter '%]", print.to.stream, print.context, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, parameter, print.notable);
@@ -700,7 +700,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QThe argument '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%QThe argument '%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
         fl_print_format("%[' is positive, which is not allowed for the parameter '%]", print.to.stream, print.context, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, parameter, print.notable);
@@ -716,7 +716,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QThe argument '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%QThe argument '%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
         fl_print_format("%[' is too small for the parameter '%]", print.to.stream, print.context, print.context);
         fl_print_format("%[%Q%]", print.to.stream, print.notable, parameter, print.notable);
index a8d7bc7066e7d325d937bea12094e47b658919de..b56531358e6bb97d48f6032eec65d130ca82a62d 100644 (file)
@@ -12,7 +12,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QAccess denied", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QAccess denied", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -28,7 +28,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QMaximum array length reached", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QMaximum array length reached", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -44,7 +44,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QMaximum buffer length reached", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QMaximum buffer length reached", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -60,7 +60,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QAn error has occurred", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QAn error has occurred", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -76,7 +76,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFile not found", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QFile not found", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -92,7 +92,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUnable to allocate memory", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QUnable to allocate memory", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -108,7 +108,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid parameter", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QInvalid parameter", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -124,7 +124,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QMaximum string length reached", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QMaximum string length reached", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -140,7 +140,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid UTF-8 character found", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QInvalid UTF-8 character found", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -156,7 +156,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QUTF-8 character (fragment) found", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QUTF-8 character (fragment) found", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -172,7 +172,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInvalid (incomplete) UTF-8 character found", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QInvalid (incomplete) UTF-8 character found", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -196,7 +196,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QFailure", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QFailure", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -212,7 +212,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QSignal received", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QSignal received", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -228,7 +228,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%QInterrupt signal received", print.to.stream, f_string_eol_s, print.context, print.prefix);
+        fl_print_format("%[%QInterrupt signal received", print.to.stream, print.context, print.prefix);
 
         private_fll_error_print_function(print, function);
 
@@ -244,7 +244,7 @@ extern "C" {
       if (print.verbosity != f_console_verbosity_quiet_e) {
         flockfile(print.to.stream);
 
-        fl_print_format("%r%[%Q(%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
+        fl_print_format("%[%Q(%]", print.to.stream, print.context, print.prefix, print.context);
         fl_print_format("%[%ui%]%[)", print.to.stream, print.notable, status, print.notable, print.context);
 
         private_fll_error_print_function(print, function);
index 143e020062ca1cf622d07d65e0d45372314839bf..857460a020623c4712897e9c995faad109812e60 100644 (file)
@@ -16,7 +16,7 @@ extern "C" {
 #endif
 
 /**
- * Private implementation of private_fll_error_print().
+ * Private implementation of fll_error_print().
  *
  * Intended to be shared to each of the different implementation variations.
  *
@@ -61,7 +61,7 @@ extern "C" {
  * @see fll_error_file_print()
  */
 #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_)
-  void private_fll_error_print_function(const fl_print_t print, const char *function) F_attribute_visibility_internal_d;
+  extern void private_fll_error_print_function(const fl_print_t print, const char *function) F_attribute_visibility_internal_d;
 #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_)
 
 #ifdef __cplusplus
index c9014d106bd49f35c7f3104cdefb9441e81e2414..5fd28d3196e27c9f951953dc0fc47b7becb953fb 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_error
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index dbf1312c4eec90494628acf9562a612c874174ef..ec1d751462892d94b49bd489f2ae7552679b1e16 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_execute
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 4807a5fb8ee8413d3905655aa8d478e544981c57..dc6d19409c59f5493fd2b88b075402d40fad0f16 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_file
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index bd6edadc2386625bbad7cda88eaaa6a299862a41..168c4b7d8e4cabca31bcd6989b6db68a88e3dfbe 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_fss
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index e7e2f696cf6e4ed36055b7bd54a106698c677d6c..56db0c0a4d9c65048a49fc32e94a674a3093ad5a 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_fss_status_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 329cf77f00a42f72654f16ba1f8ab2adda059109..d46f4568d90526573f7e76694ced6dca83b70a57 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_iki
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 042971ea334656f49ab4b2f82783a285f5d848b3..dc00f9e8f6062557ed99d57eb186b15f9641b5d0 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_path
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 7e70960970c71ef6d2a6ea18e0584f9eb032f6d0..641e4b2b3c837c722b46ac5bd86a7a9e30742914 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_print
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
diff --git a/level_2/fll_program/c/private-program.c b/level_2/fll_program/c/private-program.c
new file mode 100644 (file)
index 0000000..2971f69
--- /dev/null
@@ -0,0 +1,69 @@
+#include "program.h"
+#include "private-program.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
+  f_status_t private_fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) {
+
+    fl_print_format("%r  %Q%[%Q%]", output.stream, f_string_eol_s, symbol_short, context.set.standout, option_short, context.set.standout);
+    fl_print_format(", %Q%[%Q%]  %S", output.stream, symbol_long, context.set.standout, option_long, context.set.standout, description);
+
+    return F_none;
+  }
+#endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
+
+#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+  uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const main) {
+
+    if (!main || main->signal.id == -1) return 0;
+
+    struct signalfd_siginfo information;
+
+    memset(&information, 0, sizeof(struct signalfd_siginfo));
+
+    if (f_signal_read(main->signal, 0, &information) == F_signal) {
+      switch (information.ssi_signo) {
+        case F_signal_abort:
+        case F_signal_broken_pipe:
+        case F_signal_hangup:
+        case F_signal_interrupt:
+        case F_signal_quit:
+        case F_signal_termination:
+          main->signal_received = information.ssi_signo;
+
+          return information.ssi_signo;
+      }
+    }
+
+    return 0;
+  }
+#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+
+#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_)
+  void private_fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) {
+
+    context->set.error = f_color_set_empty_s;
+    context->set.important = f_color_set_empty_s;
+    context->set.normal = f_color_set_empty_s;
+    context->set.normal_reset = f_color_set_empty_s;
+    context->set.notable = f_color_set_empty_s;
+    context->set.reset = f_color_set_empty_s;
+    context->set.standout = f_color_set_empty_s;
+    context->set.success = f_color_set_empty_s;
+    context->set.title = f_color_set_empty_s;
+    context->set.warning = f_color_set_empty_s;
+
+    if (sets) {
+      for (f_array_length_t i = 0; sets[i]; ++i) {
+        *sets[i] = f_color_set_empty_s;
+      } // for
+    }
+  }
+#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_2/fll_program/c/private-program.h b/level_2/fll_program/c/private-program.h
new file mode 100644 (file)
index 0000000..79c86da
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+ * FLL - Level 2
+ *
+ * Project: Program
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * These are provided for internal reduction in redundant code.
+ * These should not be exposed/used outside of this project.
+ */
+#ifndef _PRIVATE_FLL_program_h
+#define _PRIVATE_FLL_program_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print standard help option.
+ *
+ * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
+ *
+ * @param output
+ *   The file stream to output to.
+ * @param context
+ *   The color context.
+ * @param option_short
+ *   The short name of the option.
+ * @param option_long
+ *   The long name of the option.
+ * @param symbol_short
+ *   The short symbol of the option.
+ * @param symbol_long
+ *   The long symbol of the option.
+ * @param description
+ *   A desciption associated with the option.
+ *
+ * @return
+ *   F_none on success.
+ *
+ * @see f_print_terminated()
+ * @see fl_print_format()
+ *
+ * @see fll_program_print_help_option()
+ * @see fll_program_print_help_option_standard()
+ */
+#if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
+  extern f_status_t private_fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
+
+/**
+ * Private implementation of fll_program_standard_signal_received().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param main
+ *   The main program data.
+ *
+ * @return
+ *   A positive number representing a valid signal on signal received.
+ *   0 on no signal received or when main is NULL.
+ *
+ * @see f_signal_read()
+ *
+ * @see fll_program_standard_signal_received()
+ * @see fll_program_standard_signal_state()
+ */
+#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+  uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+
+/**
+ * Private implementation of fll_program_parameter_process_empty().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param context
+ *   The primary color context to assign.
+ * @param sets
+ *   (optional) A NULL terminated array representing additional sets to assign as empty.
+ *   Set to NULL to not use.
+ *
+ * @see fll_program_parameter_process_context()
+ * @see fll_program_parameter_process_empty()
+ */
+#if !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_)
+  extern void private_fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_empty_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_FLL_program_h
index 902e7ca9ddbc629aa0eb4653917424138ef028ad..7ba650fc278829a190c39ed33ca6ce69475ebc2b 100644 (file)
@@ -1,4 +1,5 @@
 #include "program.h"
+#include "private-program.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -7,7 +8,7 @@ extern "C" {
 #ifndef _di_fll_program_print_help_header_
   f_status_t fll_program_print_help_header(const f_file_t output, const f_color_context_t context, const f_string_static_t name, const f_string_static_t version) {
 
-    fl_print_format("%r %[%Q%]%r", output.stream, f_string_eol_s, context.set.title, name, context.set.title, f_string_eol_s);
+    fl_print_format(" %[%Q%]%r", output.stream, context.set.title, name, context.set.title, f_string_eol_s);
     fl_print_format("  %[Version %Q%]%r", output.stream, context.set.notable, version, context.set.notable, f_string_eol_s);
 
     fl_print_format("%r %[Available Options:%] ", output.stream, f_string_eol_s, context.set.important, context.set.important);
@@ -19,12 +20,29 @@ extern "C" {
 #ifndef _di_fll_program_print_help_option_
   f_status_t fll_program_print_help_option(const f_file_t output, const f_color_context_t context, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) {
 
-    fl_print_format("%r  %Q%[%Q%]", output.stream, f_string_eol_s, symbol_short, context.set.standout, option_short, context.set.standout);
-    fl_print_format(", %Q%[%Q%]  %S", output.stream, symbol_long, context.set.standout, option_long, context.set.standout, description);
+    return private_fll_program_print_help_option(output, context, option_short, option_long, symbol_short, symbol_long, description);
+  }
+#endif // _di_fll_program_print_help_option_
+
+#ifndef _di_fll_program_print_help_option_standard_
+  f_status_t fll_program_print_help_option_standard(const f_file_t output, const f_color_context_t context) {
+
+    private_fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "         Print this help message.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "         Output using colors that show up better on dark backgrounds.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "        Output using colors that show up better on light backgrounds.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "     Do not print using color.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "        Decrease verbosity, silencing most output.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "        Decrease verbosity, using only error output.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "       Set verbosity to normal.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "      Increase verbosity beyond normal output.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "        Enable debugging, significantly increasing verbosity beyond normal output.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "      Print only the version number.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Disable printing of first line.");
+    private_fll_program_print_help_option(output, context, f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Disable printing of last line.");
 
     return F_none;
   }
-#endif // _di_fll_program_print_help_option_
+#endif // _di_fll_program_print_help_option_standard_
 
 #ifndef _di_fll_program_print_help_option_long_
   f_status_t fll_program_print_help_option_long(const f_file_t output, const f_color_context_t context, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description) {
@@ -56,7 +74,7 @@ extern "C" {
       fl_print_format(" %[[%] %Q %[]%]", output.stream, context.set.notable, context.set.notable, parameters, context.set.notable, context.set.notable);
     }
 
-    fl_print_format("%r%r", output.stream, f_string_eol_s, f_string_eol_s);
+    f_print_dynamic_raw(f_string_eol_s, output.stream);
 
     return F_none;
   }
@@ -72,34 +90,37 @@ extern "C" {
   }
 #endif // _di_fll_program_print_version_
 
-#ifndef _di_fll_program_parameter_process_
-  f_status_t fll_program_parameter_process(const f_console_arguments_t arguments, const f_console_parameter_ids_t choices, const bool right, fll_program_data_t * const main) {
-
-    f_status_t status = f_console_parameter_process(arguments, &main->parameters);
-    if (F_status_is_error(status)) return status;
+#ifndef _di_fll_program_parameter_process_context_
+  f_status_t fll_program_parameter_process_context(const f_uint16s_t choices, const uint8_t modes[], const bool right, fll_program_data_t * const main) {
 
     {
-      f_console_parameter_id_t decision = choices.id[2];
+      if (choices.used) {
+        f_status_t status = F_none;
+        f_array_length_t decision = 0;
 
-      if (right) {
-        status = f_console_parameter_prioritize_right(main->parameters, choices, &decision);
-      }
-      else {
-        status = f_console_parameter_prioritize_left(main->parameters, choices, &decision);
-      }
+        if (right) {
+          status = f_console_parameter_prioritize_right(main->parameters, choices, &decision);
+        }
+        else {
+          status = f_console_parameter_prioritize_left(main->parameters, choices, &decision);
+        }
 
-      if (F_status_is_error(status)) return status;
+        if (F_status_is_error(status)) return status;
 
-      // Load colors unless told not to.
-      if (decision == choices.id[0]) {
-        main->context.mode = F_color_mode_no_color_d;
+        if (status == F_data_not) {
+          main->context.mode = modes[choices.used - 1];
+        }
+        else {
+          main->context.mode = modes[decision];
+        }
+
+        if (main->context.mode == f_color_mode_dark_e || main->context.mode == f_color_mode_light_e) {
+          status = f_color_load_context(main->context.mode, &main->context);
+          if (F_status_is_error(status)) return status;
+        }
       }
       else {
-        // @todo update this once macro_f_color_context_t_new is turned into a function.
-        macro_f_color_context_t_new(status, main->context);
-        if (F_status_is_error(status)) return status;
-
-        status = f_color_load_context(decision == choices.id[1], &main->context);
+        main->context.mode = f_color_mode_color_not_e;
       }
     }
 
@@ -124,50 +145,50 @@ extern "C" {
     else {
       f_color_set_t *sets[] = { &main->message.context, &main->message.notable, &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
 
-      fll_program_parameter_process_empty(&main->context, sets);
+      private_fll_program_parameter_process_empty(&main->context, sets);
     }
 
     return F_none;
   }
-#endif // _di_fll_program_parameter_process_
+#endif // _di_fll_program_parameter_process_context_
 
 #ifndef _di_fll_program_parameter_process_empty_
-  void fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) {
-
-    context->set.error = f_color_set_empty_s;
-    context->set.important = f_color_set_empty_s;
-    context->set.normal = f_color_set_empty_s;
-    context->set.normal_reset = f_color_set_empty_s;
-    context->set.notable = f_color_set_empty_s;
-    context->set.reset = f_color_set_empty_s;
-    context->set.standout = f_color_set_empty_s;
-    context->set.success = f_color_set_empty_s;
-    context->set.title = f_color_set_empty_s;
-    context->set.warning = f_color_set_empty_s;
-
-    if (sets) {
-      for (f_array_length_t i = 0; sets[i]; ++i) {
-        *sets[i] = f_color_set_empty_s;
-      } // for
-    }
+  f_status_t fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]) {
+    #ifndef _di_level_2_parameter_checking_
+      if (!context) return F_status_set_error(F_parameter);
+      if (!sets) return F_status_set_error(F_parameter);
+    #endif // _di_level_2_parameter_checking_
+
+    private_fll_program_parameter_process_empty(context, sets);
+
+    return F_none;
   }
 #endif // _di_fll_program_parameter_process_empty_
 
 #ifndef _di_fll_program_parameter_process_verbosity_
-  f_status_t fll_program_parameter_process_verbosity(const f_console_parameter_ids_t choices, const bool right, const uint8_t verbosity[], fll_program_data_t * const main) {
+  f_status_t fll_program_parameter_process_verbosity(const f_uint16s_t choices, const uint8_t verbosity[], const bool right, fll_program_data_t * const main) {
+    #ifndef _di_level_2_parameter_checking_
+      if (!main) return F_status_set_error(F_parameter);
+    #endif // _di_level_2_parameter_checking_
 
-    f_console_parameter_id_t choice = 0;
+    if (!choices.used) return F_data_not;
 
-    const f_status_t status = right ?
-      f_console_parameter_prioritize_right(main->parameters, choices, &choice) :
-      f_console_parameter_prioritize_left(main->parameters, choices, &choice);
+    f_array_length_t choice = 0;
 
-    if (F_status_is_error(status)) return status;
+    {
+      const f_status_t status = right ? f_console_parameter_prioritize_right(main->parameters, choices, &choice) : f_console_parameter_prioritize_left(main->parameters, choices, &choice);
+
+      if (F_status_is_error(status)) return status;
+
+      if (status == F_data_not) {
+        choice = choices.used - 1;
+      }
+    }
 
     main->message.verbosity = verbosity[choice];
-    main->output.verbosity = verbosity[choice];
-    main->error.verbosity = verbosity[choice];
-    main->warning.verbosity = verbosity[choice];
+    main->output.verbosity = main->message.verbosity;
+    main->error.verbosity = main->message.verbosity;
+    main->warning.verbosity = main->message.verbosity;
 
     return F_none;
   }
@@ -181,7 +202,6 @@ extern "C" {
     #endif // _di_level_2_parameter_checking_
 
     f_status_t status = F_none;
-
     const f_array_length_t start = destination->used;
 
     for (f_array_length_t i = 0; i < values.used; ++i) {
@@ -204,9 +224,10 @@ extern "C" {
       }
     } // for
 
-    if (status == F_none && start == destination->used) return F_data_not;
+    if (F_status_is_error(status)) return status;
+    if (start == destination->used) return F_data_not;
 
-    return status;
+    return F_none;
   }
 #endif // _di_fll_program_parameter_additional_append_
 
@@ -218,7 +239,6 @@ extern "C" {
     #endif // _di_level_2_parameter_checking_
 
     f_status_t status = F_none;
-
     const f_array_length_t start = destination->used;
 
     for (f_array_length_t i = 0; i < values.used; ++i) {
@@ -229,9 +249,10 @@ extern "C" {
       }
     } // for
 
-    if (status == F_none && start == destination->used) return F_data_not;
+    if (F_status_is_error(status)) return status;
+    if (start == destination->used) return F_data_not;
 
-    return status;
+    return F_none;
   }
 #endif // _di_fll_program_parameter_additional_mash_
 
@@ -265,9 +286,10 @@ extern "C" {
       }
     } // for
 
-    if (status == F_none && start == destination->used) return F_data_not;
+    if (F_status_is_error(status)) return status;
+    if (start == destination->used) return F_data_not;
 
-    return status;
+    return F_none;
   }
 #endif // _di_fll_program_parameter_additional_rip_
 
@@ -279,7 +301,6 @@ extern "C" {
     #endif // _di_level_2_parameter_checking_
 
     f_status_t status = F_none;
-
     const f_array_length_t start = destination->used;
     f_string_dynamic_t ripped = f_string_dynamic_t_initialize;
 
@@ -300,9 +321,10 @@ extern "C" {
 
     f_string_dynamic_resize(0, &ripped);
 
-    if (status == F_none && start == destination->used) return F_data_not;
+    if (F_status_is_error(status)) return status;
+    if (start == destination->used) return F_data_not;
 
-    return status;
+    return F_none;
   }
 #endif // _di_fll_program_parameter_additional_rip_mash_
 
@@ -326,7 +348,7 @@ extern "C" {
 #ifndef _di_fll_program_standard_set_down_
   f_status_t fll_program_standard_set_down(fll_program_data_t * const main) {
     #ifndef _di_level_2_parameter_checking_
-      if (!signal) return F_status_set_error(F_parameter);
+      if (!main) return F_status_set_error(F_parameter);
     #endif // _di_level_2_parameter_checking_
 
     // The fclose() calls have undefined behavior when closing an already closed file.
@@ -337,7 +359,7 @@ extern "C" {
 
     if (main->message.to.id == -1) {
       if (main->message.to.stream != 0 && main->message.to.stream != F_type_error_d && main->message.to.stream != F_type_input_d && main->message.to.stream != F_type_output_d) {
-        f_file_stream_flush(&main->message.to);
+        f_file_stream_flush(main->message.to);
 
         flag |= 0x1;
       }
@@ -353,7 +375,7 @@ extern "C" {
     if (main->output.to.id == -1) {
       if (main->output.to.stream && main->output.to.stream != main->message.to.stream) {
         if (main->output.to.stream != F_type_error_d && main->output.to.stream != F_type_input_d && main->output.to.stream != F_type_output_d) {
-          f_file_stream_flush(&main->output.to);
+          f_file_stream_flush(main->output.to);
 
           flag |= 0x2;
         }
@@ -370,7 +392,7 @@ extern "C" {
     if (main->error.to.id == -1) {
       if (main->error.to.stream && main->error.to.stream != main->message.to.stream && main->error.to.stream != main->output.to.stream) {
         if (main->error.to.stream != F_type_error_d && main->error.to.stream != F_type_input_d && main->error.to.stream != F_type_output_d) {
-          f_file_stream_flush(&main->error.to);
+          f_file_stream_flush(main->error.to);
 
           flag |= 0x4;
         }
@@ -387,7 +409,7 @@ extern "C" {
     if (main->warning.to.id == -1) {
       if (main->warning.to.stream && main->warning.to.stream != main->message.to.stream && main->warning.to.stream != main->output.to.stream && main->warning.to.stream != main->error.to.stream) {
         if (main->warning.to.stream != F_type_error_d && main->warning.to.stream != F_type_input_d && main->warning.to.stream != F_type_output_d) {
-          f_file_stream_flush(&main->warning.to);
+          f_file_stream_flush(main->warning.to);
 
           flag |= 0x8;
         }
@@ -405,7 +427,7 @@ extern "C" {
     if (main->debug.to.id == -1) {
       if (main->debug.to.stream && main->debug.to.stream != main->message.to.stream && main->debug.to.stream != main->output.to.stream && main->debug.to.stream != main->error.to.stream && main->debug.to.stream != main->warning.to.stream) {
         if (main->debug.to.stream != F_type_error_d && main->debug.to.stream != F_type_input_d && main->debug.to.stream != F_type_output_d) {
-          f_file_stream_flush(&main->debug.to);
+          f_file_stream_flush(main->debug.to);
 
           flag |= 0x10;
         }
@@ -469,7 +491,7 @@ extern "C" {
       file.stream = F_type_output_d;
       flag |= 0x1;
 
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
     }
     else {
       if (F_type_descriptor_output_d != -1) {
@@ -484,7 +506,7 @@ extern "C" {
       file.stream = F_type_error_d;
       flag |= 0x2;
 
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
     }
     else {
       if (F_type_descriptor_error_d != -1) {
@@ -499,7 +521,7 @@ extern "C" {
       file.stream = F_type_input_d;
       flag |= 0x4;
 
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
     }
     else {
       if (F_type_descriptor_input_d != -1) {
@@ -601,45 +623,26 @@ extern "C" {
 #endif // _di_fll_program_standard_set_up_
 
 #ifndef _di_fll_program_standard_signal_received_
-  f_status_t fll_program_standard_signal_received(fll_program_data_t * const main) {
-
-    if (!main || main->signal.id == -1) return F_false;
-
-    struct signalfd_siginfo information;
-
-    memset(&information, 0, sizeof(struct signalfd_siginfo));
-
-    if (f_signal_read(main->signal, 0, &information) == F_signal) {
-      switch (information.ssi_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->signal_received = information.ssi_signo;
-
-          return information.ssi_signo;
-      }
-    }
+  uint32_t fll_program_standard_signal_received(fll_program_data_t * const main) {
+    #ifndef _di_level_2_parameter_checking_
+      if (!main) return 0;
+    #endif // _di_level_2_parameter_checking_
 
-    return F_false;
+    return private_fll_program_standard_signal_received(main);
   }
 #endif // _di_fss_basic_read_signal_received_
 
 #ifndef _di_fll_program_standard_signal_state_
   f_status_t fll_program_standard_signal_state(void * const state, void * const internal) {
 
-    if (!state) {
-      return F_interrupt_not;
-    }
+    if (!state) return F_interrupt_not;
 
     f_state_t *state_ptr = (f_state_t *) state;
     if (!state_ptr->custom) return F_interrupt_not;
 
     fll_program_data_t *custom = (fll_program_data_t *) state_ptr->custom;
 
-    custom->signal_received = fll_program_standard_signal_received(custom);
+    custom->signal_received = private_fll_program_standard_signal_received(custom);
 
     if (custom->signal_received == F_signal_abort || custom->signal_received == F_signal_broken_pipe || custom->signal_received == F_signal_hangup || custom->signal_received == F_signal_interrupt || custom->signal_received == F_signal_quit || custom->signal_received == F_signal_termination) {
       return F_status_set_error(F_interrupt);
index 078456afb6b67db919ac972b5b197dd1a8092bdd..22a71cee158af2c7c097dafeef3e16d240e58458 100644 (file)
@@ -141,6 +141,26 @@ extern "C" {
 #endif // _di_fll_program_print_help_option_other_
 
 /**
+ * Print all standard help options.
+ *
+ * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
+ *
+ * @param output
+ *   The file stream to output to.
+ * @param context
+ *   The color context.
+ *
+ * @return
+ *   F_none on success.
+ *
+ * @see f_print_terminated()
+ * @see fl_print_format()
+ */
+#ifndef _di_fll_program_print_help_option_standard_
+  extern f_status_t fll_program_print_help_option_standard(const f_file_t output, const f_color_context_t context);
+#endif // _di_fll_program_print_help_option_standard_
+
+/**
  * Print standard help usage.
  *
  * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
@@ -186,13 +206,17 @@ extern "C" {
 #endif // _di_fll_program_print_version_
 
 /**
- * Perform basic parameter loading, including initialization of color context.
+ * Determine the color context from the parameters and then set the color context based on the choice.
+ *
+ * This will allow for the color context and the color sets to be safely used when colors are disabled.
  *
- * @param arguments
- *   The parameters passed to the process.
  * @param choices
- *   A set of the color options: no-color option, light-color option, dark-color option.
- *   This must have its used size set to 3 and the ids are expected to be in this order: no_color, light, and dark.
+ *   An array of color modes.
+ *   The default, if no mode is specified, will be the last value in the array.
+ * @param modes
+ *   An array designating the context modes associated with each choice.
+ *   This must exactly match the size of the choices array.
+ *   No bounds checking is performed.
  * @param right
  *   If TRUE, use the right-most parameter on conflict.
  *   If FALSE, use the left-most parameter on conflict.
@@ -208,17 +232,15 @@ extern "C" {
  *
  *   Errors (with error bit) from: f_console_parameter_prioritize_left().
  *   Errors (with error bit) from: f_console_parameter_prioritize_right().
- *   Errors (with error bit) from: f_console_parameter_process().
  *   Errors (with error bit) from: f_color_load_context().
  *
  * @see f_console_parameter_prioritize_left()
  * @see f_console_parameter_prioritize_right()
- * @see f_console_parameter_process()
  * @see f_color_load_context()
  */
-#ifndef _di_fll_program_parameter_process_
-  extern f_status_t fll_program_parameter_process(const f_console_arguments_t arguments, const f_console_parameter_ids_t choices, const bool right, fll_program_data_t * const main);
-#endif // _di_fll_program_parameter_process_
+#ifndef _di_fll_program_parameter_process_context_
+  extern f_status_t fll_program_parameter_process_context(const f_uint16s_t choices, const uint8_t modes[], const bool right, fll_program_data_t * const main);
+#endif // _di_fll_program_parameter_process_context_
 
 /**
  * Set the provided context to empty along with all additional color sets.
@@ -230,9 +252,14 @@ extern "C" {
  * @param sets
  *   (optional) A NULL terminated array representing additional sets to assign as empty.
  *   Set to NULL to not use.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
  */
 #ifndef _di_fll_program_parameter_process_empty_
-  extern void fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]);
+  extern f_status_t fll_program_parameter_process_empty(f_color_context_t * const context, f_color_set_t * const sets[]);
 #endif // _di_fll_program_parameter_process_empty_
 
 /**
@@ -240,18 +267,22 @@ extern "C" {
  *
  * @param choices
  *   The available choices based on parameter ids.
- * @param right
- *   If TRUE, use the right-most parameter on conflict.
- *   If FALSE, use the left-most parameter on conflict.
+ *   The default, if no verbosity is specified, will be the last value in the array.
  * @param verbosity
  *   An array designating what to set the verbosity to based on the choice made.
  *   This must exactly match the size of the choices array.
  *   No bounds checking is performed.
+ * @param right
+ *   If TRUE, use the right-most parameter on conflict.
+ *   If FALSE, use the left-most parameter on conflict.
  * @param main
  *   The main program data.
  *
  * @return
  *   F_none on success.
+ *   F_data_not on success but choices.used is 0.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
  *
  *   Errors (with error bit) from: f_console_parameter_prioritize_left().
  *   Errors (with error bit) from: f_console_parameter_prioritize_right().
@@ -260,7 +291,7 @@ extern "C" {
  * @see f_console_parameter_prioritize_right()
  */
 #ifndef _di_fll_program_parameter_process_verbosity_
-  extern f_status_t fll_program_parameter_process_verbosity(const f_console_parameter_ids_t choices, const bool right, const uint8_t verbosity[], fll_program_data_t * const main);
+  extern f_status_t fll_program_parameter_process_verbosity(const f_uint16s_t choices, const uint8_t verbosity[], const bool right, fll_program_data_t * const main);
 #endif // _di_fll_program_parameter_process_verbosity_
 
 /**
@@ -473,13 +504,13 @@ extern "C" {
  *
  * @return
  *   A positive number representing a valid signal on signal received.
- *   F_false on no signal received or when main is NULL.
+ *   0 on no signal received or when main is NULL.
  *
  * @see f_signal_read()
  */
-#ifndef _di_fss_basic_read_signal_received_
-  extern f_status_t fll_program_standard_signal_received(fll_program_data_t * const main);
-#endif // _di_fss_basic_read_signal_received_
+#ifndef _di_fll_program_standard_signal_received_
+  extern uint32_t fll_program_standard_signal_received(fll_program_data_t * const main);
+#endif // _di_fll_program_standard_signal_received_
 
 /**
  * Standardized callback for checking for interrupts via the f_state_t interrupt callback.
@@ -496,6 +527,8 @@ extern "C" {
  *
  * When one of the above signals is both blocked and received, then this calls fll_program_standard_signal_received().
  *
+ * As a callback, this does not perform the standard parameter checking.
+ *
  * @param state
  *   The state data.
  *   This must be of type (f_state_t *).
index b31c7106e4b9513fcc231167b9d2a33c8a72c8dc..283a6696cf983a2ef04c182e32a6adc913035e11 100644 (file)
@@ -55,7 +55,8 @@ extern "C" {
  * The umask() has design flaws as per specification that requires the umask be changed to read the value!
  * As a work-around, a umask variable is provided here so that umask() only ever need be called once.
  *
- * parameters: The state of pre-defined parameters passed to the program.
+ * parameters:  The state of pre-defined parameters passed to the program.
+ * environment: Environment variables passed to the program.
  *
  * umask: The umask settings, needed for avoiding calls to umask() to read the current umask.
  * pid:   The PID of the program.
@@ -76,6 +77,7 @@ extern "C" {
 #ifndef _di_fll_program_data_t_
   typedef struct {
     f_console_parameters_t parameters;
+    const f_string_t *     environment;
 
     mode_t umask;
     pid_t pid;
@@ -101,6 +103,7 @@ extern "C" {
       0, \
       0, \
       0, \
+      0, \
       fll_program_data_pipe_none_e, \
       0, \
       0, \
@@ -113,7 +116,9 @@ extern "C" {
       f_color_context_t_initialize, \
     }
 
-  #define macro_fll_program_data_t_initialize(umask, pid, child, pipe, signal_received, signal_check, signal, message, output, error, warning, debug, context) { \
+  #define macro_fll_program_data_t_initialize(parameters, environment, umask, pid, child, pipe, signal_received, signal_check, signal, message, output, error, warning, debug, context) { \
+    parameters, \
+    environment, \
     umask, \
     pid, \
     child, \
index c1aebaf65fe30726396b9f6560b6d7b17e9670ae..76dcafb2580b056828f43613fdd411f2ff5dcf0c 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_program
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
@@ -20,7 +20,7 @@ build_language c
 build_libraries -lc
 build_libraries-individual -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_print -lf_signal -lf_string -lf_type_array -lf_utf
 
-build_sources_library program.c program/common.c
+build_sources_library program.c program/common.c private-program.c
 
 build_sources_headers program.h program/common.h
 
index 981f5166e7b723c6d210691d07d1b32112a43869..0da83004cb14aa057fb04d04296043526f3bdb0b 100644 (file)
@@ -1116,6 +1116,18 @@ extern "C" {
         return F_none;
       }
 
+      if (fl_string_dynamic_compare(name, f_status_help_s) == F_equal_to) {
+        *code = F_help;
+
+        return F_none;
+      }
+
+      if (fl_string_dynamic_compare(name, f_status_help_not_s) == F_equal_to) {
+        *code = F_help_not;
+
+        return F_none;
+      }
+
       if (fl_string_dynamic_compare(name, f_status_ignore_s) == F_equal_to) {
         *code = F_ignore;
 
index 6219da9b420a727e8345bd93d5c6707a7fbfedbc..d3970d428bcbcd700090468c3e67d21a24e6aa16 100644 (file)
@@ -3,7 +3,7 @@
 build_name fll_status_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 2c8f21d73fd380ffa35b2b5af179bd9430e58f2b..7ddb2d2b1c08e564a61ec815b7e671daa6a4919d 100644 (file)
@@ -8,7 +8,7 @@
 build_name test-fll_status_string
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file major
 version_target major
index 585e37f90b1ccb147ce41f4ed0728778b175152a..529a76a800d5dd4d5d8167a2d1bb8de58b763dbe 100644 (file)
@@ -225,6 +225,8 @@ void test__fll_status_string_from__works(void **state) {
     F_halt_not,
     F_header,
     F_header_not,
+    F_help,
+    F_help_not,
     F_ignore,
     F_ignore_not,
     F_implemented,
@@ -815,6 +817,8 @@ void test__fll_status_string_from__works(void **state) {
     f_status_halt_not_s,
     f_status_header_s,
     f_status_header_not_s,
+    f_status_help_s,
+    f_status_help_not_s,
     f_status_ignore_s,
     f_status_ignore_not_s,
     f_status_implemented_s,
@@ -1225,7 +1229,7 @@ void test__fll_status_string_from__works(void **state) {
     f_status_status_code_last_s,
   };
 
-  for (uint16_t i = 0; i < 587; ++i) {
+  for (uint16_t i = 0; i < 589; ++i) {
 
     f_status_t result = F_none;
 
index 427bc3461ad37bd0ac05f4df90a66d7675527b2b..bbeb216b0400f2cd88bfae1563755fa86e6db7d7 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, byte_dump_program_name_long_s, byte_dump_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -57,6 +52,10 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, byte_dump_program_name_s, fll_program_parameter_filenames_s);
 
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fl_print_format("  When using the %[%r%r%] option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_text_s, context.set.notable, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the %[%r%r%] option is used).%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_placeholder_s, context.set.notable, f_string_eol_s, f_string_eol_s);
@@ -65,9 +64,13 @@ extern "C" {
 
     fl_print_format("  When %[%r%r%] is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, context.set.notable, f_string_eol_s, f_string_eol_s);
 
-    fl_print_format("  When using the %[%r%r%] option, invalid Unicode will fallback to being displayed using one of the other modes.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_unicode_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  When using the %[%r%r%] option, invalid Unicode will fallback to being displayed using one of the other modes.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_unicode_s, context.set.notable, f_string_eol_s);
 
-    fflush(file.stream);
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -75,82 +78,50 @@ extern "C" {
 #endif // _di_byte_dump_print_help_
 
 #ifndef _di_byte_dump_main_
-  f_status_t byte_dump_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t byte_dump_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    // Identify priority of color parameters.
-    {
-      f_console_parameter_id_t ids[3] = { byte_dump_parameter_no_color_e, byte_dump_parameter_light_e, byte_dump_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { byte_dump_parameter_no_color_e, byte_dump_parameter_light_e, byte_dump_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
-
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
-
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        return F_status_set_error(status);
+          return;
+        }
       }
-    }
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { byte_dump_parameter_verbosity_quiet_e, byte_dump_parameter_verbosity_error_e, byte_dump_parameter_verbosity_normal_e, byte_dump_parameter_verbosity_verbose_e, byte_dump_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { byte_dump_parameter_verbosity_quiet_e, byte_dump_parameter_verbosity_error_e, byte_dump_parameter_verbosity_verbose_e, byte_dump_parameter_verbosity_debug_e, byte_dump_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == byte_dump_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == byte_dump_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == byte_dump_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == byte_dump_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == byte_dump_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -160,9 +131,9 @@ extern "C" {
 
     // Identify priority of mode parameters.
     {
-      f_console_parameter_id_t ids[5] = { byte_dump_parameter_hexidecimal_e, byte_dump_parameter_duodecimal_e, byte_dump_parameter_octal_e, byte_dump_parameter_binary_e, byte_dump_parameter_decimal_e };
-      f_console_parameter_id_t choice = byte_dump_parameter_hexidecimal_e;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      uint16_t choices_array[5] = { byte_dump_parameter_hexidecimal_e, byte_dump_parameter_duodecimal_e, byte_dump_parameter_octal_e, byte_dump_parameter_binary_e, byte_dump_parameter_decimal_e };
+      f_array_length_t choice = 0;
+      const f_uint16s_t choices = macro_f_uint16s_t_initialize(choices_array, 0, 5);
 
       status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
 
@@ -172,28 +143,28 @@ extern "C" {
         return F_status_set_error(status);
       }
 
-      if (choice == byte_dump_parameter_hexidecimal_e) {
+      if (choices.array[choice] == byte_dump_parameter_hexidecimal_e) {
         data.mode = byte_dump_mode_hexidecimal_e;
       }
-      else if (choice == byte_dump_parameter_duodecimal_e) {
+      else if (choices.array[choice] == byte_dump_parameter_duodecimal_e) {
         data.mode = byte_dump_mode_duodecimal_e;
       }
-      else if (choice == byte_dump_parameter_octal_e) {
+      else if (choices.array[choice] == byte_dump_parameter_octal_e) {
         data.mode = byte_dump_mode_octal_e;
       }
-      else if (choice == byte_dump_parameter_binary_e) {
+      else if (choices.array[choice] == byte_dump_parameter_binary_e) {
         data.mode = byte_dump_mode_binary_e;
       }
-      else if (choice == byte_dump_parameter_decimal_e) {
+      else if (choices.array[choice] == byte_dump_parameter_decimal_e) {
         data.mode = byte_dump_mode_decimal_e;
       }
     }
 
     // Identify priority of presentation parameters.
     {
-      f_console_parameter_id_t ids[3] = { byte_dump_parameter_normal_e, byte_dump_parameter_simple_e, byte_dump_parameter_classic_e };
-      f_console_parameter_id_t choice = byte_dump_parameter_normal_e;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+      uint16_t choices_array[3] = { byte_dump_parameter_normal_e, byte_dump_parameter_simple_e, byte_dump_parameter_classic_e };
+      f_array_length_t choice = 0;
+      const f_uint16s_t choices = macro_f_uint16s_t_initialize(choices_array, 0, 3);
 
       status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
 
@@ -203,22 +174,22 @@ extern "C" {
         return F_status_set_error(status);
       }
 
-      if (choice == byte_dump_parameter_normal_e) {
+      if (choices.array[choice] == byte_dump_parameter_normal_e) {
         data.presentation = byte_dump_presentation_normal_e;
       }
-      else if (choice == byte_dump_parameter_simple_e) {
+      else if (choices.array[choice] == byte_dump_parameter_simple_e) {
         data.presentation = byte_dump_presentation_simple_e;
       }
-      else if (choice == byte_dump_parameter_classic_e) {
+      else if (choices.array[choice] == byte_dump_parameter_classic_e) {
         data.presentation = byte_dump_presentation_classic_e;
       }
     }
 
     // Identify priority of narrow and wide parameters.
     {
-      f_console_parameter_id_t ids[2] = { byte_dump_parameter_narrow_e, byte_dump_parameter_wide_e };
-      f_console_parameter_id_t choice = byte_dump_parameter_wide_e;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 2);
+      uint16_t choices_array[2] = { byte_dump_parameter_narrow_e, byte_dump_parameter_wide_e };
+      f_array_length_t choice = byte_dump_parameter_wide_e;
+      const f_uint16s_t choices = macro_f_uint16s_t_initialize(choices_array, 0, 2);
 
       status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
 
@@ -228,12 +199,12 @@ extern "C" {
         return F_status_set_error(status);
       }
 
-      if (choice == byte_dump_parameter_narrow_e) {
+      if (choices.array[choice] == byte_dump_parameter_narrow_e) {
         if (data.options & byte_dump_option_wide_d) {
           data.options -= byte_dump_option_wide_d;
         }
       }
-      else if (choice == byte_dump_parameter_wide_e) {
+      else if (choices.array[choice] == byte_dump_parameter_wide_e) {
         data.options |= byte_dump_option_wide_d;
       }
     }
@@ -252,7 +223,7 @@ extern "C" {
       return F_none;
     }
 
-    if (main->parameters.remaining.used || main->process_pipe) {
+    if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
       if (main->parameters.array[byte_dump_parameter_width_e].result == f_console_result_found_e) {
         flockfile(main->error.to.stream);
 
@@ -389,7 +360,7 @@ extern "C" {
         data.last = (data.last - data.first) + 1;
       }
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -498,7 +469,7 @@ extern "C" {
 
           status = byte_dump_file(&data, data.argv[main->parameters.remaining.array[counter]], file);
 
-          f_file_stream_flush(&file);
+          f_file_stream_flush(file);
           f_file_stream_close(&file);
 
           if (F_status_is_error(status)) {
index 64403f96f5b8bce017b748a8d53f2bb68a123daa..f25b91a734e410ea48a6f3118635b149878a35de 100644 (file)
@@ -95,7 +95,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_byte_dump_main_
-  extern f_status_t byte_dump_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t byte_dump_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_byte_dump_main_
 
 #ifdef __cplusplus
index ba8abf70ef9ba3e591ba560c82b2333060a66d89..17e88a91c23963c6d689fea0e891b9204d9a5413 100644 (file)
@@ -283,6 +283,8 @@ extern "C" {
     byte_dump_parameter_verbosity_verbose_e,
     byte_dump_parameter_verbosity_debug_e,
     byte_dump_parameter_version_e,
+    byte_dump_parameter_line_first_no_e,
+    byte_dump_parameter_line_last_no_e,
 
     byte_dump_parameter_binary_e,
     byte_dump_parameter_decimal_e,
@@ -307,35 +309,38 @@ extern "C" {
 
   #define byte_dump_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_binary_s.string, byte_dump_long_binary_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_decimal_s.string, byte_dump_long_decimal_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_duodecimal_s.string, byte_dump_long_duodecimal_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_hexidecimal_s.string, byte_dump_long_hexidecimal_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_octal_s.string, byte_dump_long_octal_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_unicode_s.string, byte_dump_long_unicode_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_first_s.string, byte_dump_long_first_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_last_s.string, byte_dump_long_last_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_narrow_s.string, byte_dump_long_narrow_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_placeholder_s.string, byte_dump_long_placeholder_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_text_s.string, byte_dump_long_text_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_wide_s.string, byte_dump_long_wide_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(byte_dump_short_width_s.string, byte_dump_long_width_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, byte_dump_long_normal_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, byte_dump_long_simple_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, byte_dump_long_classic_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_binary_s.string, byte_dump_long_binary_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_decimal_s.string, byte_dump_long_decimal_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_duodecimal_s.string, byte_dump_long_duodecimal_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_hexidecimal_s.string, byte_dump_long_hexidecimal_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_octal_s.string, byte_dump_long_octal_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_unicode_s.string, byte_dump_long_unicode_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_first_s.string, byte_dump_long_first_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_last_s.string, byte_dump_long_last_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_narrow_s.string, byte_dump_long_narrow_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_placeholder_s.string, byte_dump_long_placeholder_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_text_s.string, byte_dump_long_text_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_wide_s.string, byte_dump_long_wide_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(byte_dump_short_width_s.string, byte_dump_long_width_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, byte_dump_long_normal_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, byte_dump_long_simple_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, byte_dump_long_classic_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define byte_dump_total_parameters_d 26
+  #define byte_dump_total_parameters_d 28
 #endif // _di_byte_dump_parameters_
 
 #ifdef __cplusplus
index 586e425e82c1579fc6641ac19f76c0d5147dd74b..f05e1b093ad9fc9767313b90f45df6fad2ed8839 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = byte_dump_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = byte_dump_main(&data, &arguments);
+  const f_status_t status = byte_dump_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 23c99f9e3f2bf98f5eaba8e91c2a4a9dd15ad246..348b33894764d54340cd23f3744eb576122b83c1 100644 (file)
@@ -3,7 +3,7 @@
 build_name byte_dump
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index ce5386d10ef396af2c849cfc9166c872e0e7bc60..1e77a7d65ea3541375b7b9b4cc1a8fc0bcfa0d2a 100644 (file)
@@ -104,6 +104,8 @@ extern "C" {
     control_parameter_verbosity_verbose_e,
     control_parameter_verbosity_debug_e,
     control_parameter_version_e,
+    control_parameter_line_first_no_e,
+    control_parameter_line_last_no_e,
 
     control_parameter_name_e,
     control_parameter_return_e,
@@ -113,23 +115,26 @@ extern "C" {
 
   #define control_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(control_short_name_s.string, control_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(control_short_return_s.string, control_long_return_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(control_short_settings_s.string, control_long_settings_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(control_short_socket_s.string, control_long_socket_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(control_short_name_s.string, control_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(control_short_return_s.string, control_long_return_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(control_short_settings_s.string, control_long_settings_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(control_short_socket_s.string, control_long_socket_s.string, 0, 1, f_console_type_normal_e), \
     }
 
-  #define control_total_parameters_d 14
+  #define control_total_parameters_d 16
 #endif // _di_control_parameters_
 
 /**
index 4958d1c36530de34fd6a21b658f20a641a64f61b..91c9c21025f9e8828c4f3d1b8b6cdabb1903ace1 100644 (file)
@@ -12,17 +12,13 @@ extern "C" {
 
     flockfile(main->output.to.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(main->output.to, main->context, control_program_name_long_s, control_program_version_s);
 
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not main->output.to in color.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal main->output.to.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(main->output.to, context);
 
     f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
 
@@ -33,7 +29,7 @@ extern "C" {
 
     fll_program_print_help_usage(main->output.to, main->context, control_program_name_s, control_action_s);
 
-    fl_print_format("  When the %[%r%r%] parameter represents a directory path then the file name is generated from either the", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, control_long_socket_s, main->context.set.notable);
+    fl_print_format("%r  When the %[%r%r%] parameter represents a directory path then the file name is generated from either the", main->output.to.stream, f_string_eol_s, main->context.set.notable, f_console_symbol_long_enable_s, control_long_socket_s, main->context.set.notable);
     fl_print_format(" %[%r%r%] parameter or from the control settings file.%r%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, control_long_name_s, main->context.set.notable, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  A rule action allows for either the full rule path, such as '%[boot/root%]'", main->output.to.stream, main->context.set.notable, main->context.set.notable);
@@ -42,9 +38,13 @@ extern "C" {
 
     fl_print_format("  The %[%r%r%] parameter is intended to be used for scripting and is of the form \"response [type] [action] [status]\".%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, control_long_return_s, main->context.set.notable, f_string_eol_s);
     fl_print_format("  Be sure to use the %[%r%r%] parameter to suppress output when using this in scripting.%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_disable_s, f_console_standard_long_quiet_s, main->context.set.notable, f_string_eol_s);
-    fl_print_format("  No response is returned on program errors, especially those errors that prevent communicating to the controller.%r%r", main->output.to.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  No response is returned on program errors, especially those errors that prevent communicating to the controller.%r", main->output.to.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+    //}
 
-    fflush(main->output.to.stream);
+    f_file_stream_flush(main->output.to.stream);
     funlockfile(main->output.to.stream);
 
     return F_none;
@@ -52,84 +52,50 @@ extern "C" {
 #endif // _di_control_print_help_
 
 #ifndef _di_control_main_
-  f_status_t control_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t control_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { control_parameter_no_color_e, control_parameter_light_e, control_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
-
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { control_parameter_no_color_e, control_parameter_light_e, control_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-      if (F_status_is_error(status)) {
-        if (main->error.verbosity != f_console_verbosity_quiet_e) {
-          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
-          fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
+          return;
         }
-
-        return F_status_set_error(status);
       }
-    }
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { control_parameter_verbosity_quiet_e, control_parameter_verbosity_error_e, control_parameter_verbosity_normal_e, control_parameter_verbosity_verbose_e, control_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { control_parameter_verbosity_quiet_e, control_parameter_verbosity_error_e, control_parameter_verbosity_verbose_e, control_parameter_verbosity_debug_e, control_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == control_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == control_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == control_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == control_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == control_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -182,7 +148,7 @@ extern "C" {
     }
 
     if (F_status_is_error_not(status)) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         control_print_error_pipe_supported_not(main);
 
         status = F_status_set_error(F_supported_not);
index 697122cf25852e1d79bbad3128c6a247bb00b9ea..a1f387d892ee6e1cd98fe1845f5287dcbcb2dd7e 100644 (file)
@@ -96,7 +96,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_control_main_
-  extern f_status_t control_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t control_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_control_main_
 
 #ifdef __cplusplus
index fa54ef2c68e20ee38917e30335665d09c9c7c1e7..4c909ac2fd3c5ca4e728a7165586e5130bd66e20 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = control_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = control_main(&data, &arguments);
+  const f_status_t status = control_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 87ceae8b9a8f0a26dc2d812940c32595d56b4c84..3b6d494b20f48cca39d9d5978d1d1bd225b68869 100644 (file)
@@ -642,7 +642,7 @@ extern "C" {
 
       status = f_file_stream_read(file, &data->cache.large);
 
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
       f_file_stream_close(&file);
 
       if (F_status_is_error(status)) {
index 764b8652015a9afd2a6cc5c2922f06676eb5b579..39ea2d1bdd8cb212561c9018575542ae9c372146 100644 (file)
@@ -3,7 +3,7 @@
 build_name control
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index d4d64e610b94e1992c4d472b366c0d1ca3b9f98b..be9d88c44cc6f7606265a40ce8a9d076aaac65c8 100644 (file)
@@ -126,6 +126,8 @@ extern "C" {
     controller_parameter_verbosity_verbose_e,
     controller_parameter_verbosity_debug_e,
     controller_parameter_version_e,
+    controller_parameter_line_first_no_e,
+    controller_parameter_line_last_no_e,
 
     controller_parameter_cgroup_e,
     controller_parameter_daemon_e,
@@ -141,29 +143,32 @@ extern "C" {
 
   #define controller_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(controller_short_cgroup_s.string, controller_long_cgroup_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_daemon_s.string, controller_long_daemon_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_init_s.string, controller_long_init_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_interruptible_s.string, controller_long_interruptible_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_pid_s.string, controller_long_pid_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_settings_s.string, controller_long_settings_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_simulate_s.string, controller_long_simulate_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_socket_s.string, controller_long_socket_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_uninterruptible_s.string, controller_long_uninterruptible_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(controller_short_validate_s.string, controller_long_validate_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(controller_short_cgroup_s.string, controller_long_cgroup_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_daemon_s.string, controller_long_daemon_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_init_s.string, controller_long_init_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_interruptible_s.string, controller_long_interruptible_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_pid_s.string, controller_long_pid_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_settings_s.string, controller_long_settings_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_simulate_s.string, controller_long_simulate_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_socket_s.string, controller_long_socket_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_uninterruptible_s.string, controller_long_uninterruptible_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(controller_short_validate_s.string, controller_long_validate_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define controller_total_parameters_d 20
+  #define controller_total_parameters_d 22
 #endif // _di_controller_parameters_
 
 /**
@@ -187,7 +192,6 @@ extern "C" {
  * output:                     The output file for general printing.
  * parameters:                 The state of pre-defined parameters passed to the program.
  * pid:                        The PID of the program.
- * process_pipe:               Designate whether or not to process the input pipe.
  * program_name:               The name of the program.
  * program_name_long:          The long name of the program.
  * signal:                     The process signal management structure.
@@ -198,7 +202,6 @@ extern "C" {
   typedef struct {
     f_console_parameters_t parameters;
 
-    bool process_pipe;
     bool as_init;
 
     fl_print_t output;
@@ -235,7 +238,6 @@ extern "C" {
     { \
       f_console_parameters_t_initialize, \
       F_false, \
-      F_false, \
       fl_print_t_initialize, \
       macro_fl_print_t_initialize_error(), \
       macro_fl_print_t_initialize_warning(), \
index 500f7ddaa92bc2681c45bc4f4280a232ffdcf2c5..8c3daf3fdec59186dba705034f078d9d420e41f5 100644 (file)
@@ -17,17 +17,13 @@ extern "C" {
 
     controller_lock_print(main->output.to, 0);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(main->output.to, main->context, *main->program_name_long, controller_program_version_s);
 
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not main->output.to in color.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity beyond normal main->output.to.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal main->output.to.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal main->output.to.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, increasing verbosity beyond normal main->output.to.");
-    fll_program_print_help_option(main->output.to, main->context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(main->output.to, context);
 
     f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
 
@@ -44,14 +40,18 @@ extern "C" {
 
     fll_program_print_help_usage(main->output.to, main->context, *main->program_name, controller_entry_s);
 
-    fl_print_format("  When both the %[%r%r%] parameter and the", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_simulate_s, main->context.set.notable);
+    fl_print_format("%r  When both the %[%r%r%] parameter and the", main->output.to.stream, f_string_eol_s, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_simulate_s, main->context.set.notable);
     fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%r%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_validate_s, main->context.set.notable, f_string_eol_s, f_string_eol_s);
 
     const f_string_static_t interruptable = main->as_init ? controller_long_uninterruptible_s : controller_long_interruptible_s;
 
     fl_print_format("  The default interrupt behavior is to operate as if the %[%r%r%] parameter is passed.%r%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, interruptable, main->context.set.notable, f_string_eol_s, f_string_eol_s);
 
-    fl_print_format("  Specify an empty string for the %[%r%r%] parameter to disable pid file creation for this program.%r%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_pid_s, main->context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  Specify an empty string for the %[%r%r%] parameter to disable pid file creation for this program.%r", main->output.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, controller_long_pid_s, main->context.set.notable, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+    //}
 
     controller_unlock_print_flush(main->output.to, 0);
 
@@ -60,84 +60,50 @@ extern "C" {
 #endif // _di_controller_print_help_
 
 #ifndef _di_controller_main_
-  f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { controller_parameter_no_color_e, controller_parameter_light_e, controller_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { controller_parameter_no_color_e, controller_parameter_light_e, controller_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
-
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-      if (F_status_is_error(status)) {
-        if (main->error.verbosity != f_console_verbosity_quiet_e) {
-          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
-          fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
+          return;
         }
-
-        return F_status_set_error(status);
       }
-    }
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { controller_parameter_verbosity_quiet_e, controller_parameter_verbosity_error_e, controller_parameter_verbosity_normal_e, controller_parameter_verbosity_verbose_e, controller_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { controller_parameter_verbosity_quiet_e, controller_parameter_verbosity_error_e, controller_parameter_verbosity_verbose_e, controller_parameter_verbosity_debug_e, controller_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == controller_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == controller_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == controller_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == controller_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == controller_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
index a0c020563f61bd74620f357b9ae86b59fcfa41f0..3e3e0322a38f71f8275290064a8c2c03e8f5e51b 100644 (file)
@@ -125,7 +125,7 @@ extern "C" {
  * @see controller_main_delete()
  */
 #ifndef _di_controller_main_
-  extern f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t arguments);
 #endif // _di_controller_main_
 
 #ifdef __cplusplus
index e739ddd1042feda775e02b63c44106d66f0e3bfa..1570655a1a0f84ee1dc895818838bc7154fd27de 100644 (file)
@@ -94,7 +94,7 @@ extern "C" {
 
     if (F_status_is_error(status)) {
       if (!required && F_status_set_fine(status) == F_file_found_not) {
-        f_file_stream_flush(&file);
+        f_file_stream_flush(file);
         f_file_stream_close(&file);
 
         return F_file_found_not;
@@ -114,7 +114,7 @@ extern "C" {
       }
     }
 
-    f_file_stream_flush(&file);
+    f_file_stream_flush(file);
     f_file_stream_close(&file);
 
     if (F_status_is_error_not(status)) {
@@ -177,7 +177,7 @@ extern "C" {
 
     fll_print_format("%i%r", file.stream, pid, f_string_eol_s);
 
-    f_file_stream_flush(&file);
+    f_file_stream_flush(file);
     f_file_stream_close(&file);
 
     if (F_status_is_error(status)) return status;
@@ -205,7 +205,7 @@ extern "C" {
     status = f_file_stream_read(pid_file, &pid_buffer);
 
     if (F_status_is_error_not(status)) {
-      status = f_file_stream_flush(&pid_file);
+      status = f_file_stream_flush(pid_file);
     }
 
     if (F_status_is_error_not(status)) {
@@ -262,7 +262,7 @@ extern "C" {
     status = f_file_stream_read(pid_file, &pid_buffer);
 
     if (F_status_is_error_not(status)) {
-      status = f_file_stream_flush(&pid_file);
+      status = f_file_stream_flush(pid_file);
     }
 
     if (F_status_is_error_not(status)) {
index 35bbee9db2d915bb4c403e9a641d324fcdb10707..c545a04967353b84e29ed1e0a0df05d89217a44f 100644 (file)
@@ -133,9 +133,9 @@ extern "C" {
 
     controller_lock_print(print.to, thread);
 
-    fl_print_format("%r%[%Q%r setting%S '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, is_entry ? controller_Entry_s : controller_Exit_s, before, print.context);
-    fl_print_format("%[%/Q%]", print.to.stream, print.notable, cache->buffer_file, range, print.notable);
-    fl_print_format("%['%S.%]%r", print.to.stream, print.context, after, print.context, f_string_eol_s);
+    fl_print_format("%r%[%Q%r setting%S '%]", print.to, f_string_eol_s, print.context, print.prefix, is_entry ? controller_Entry_s : controller_Exit_s, before, print.context);
+    fl_print_format("%[%/Q%]", print.to, print.notable, cache->buffer_file, range, print.notable);
+    fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s);
 
     controller_entry_print_error_cache(is_entry, print, cache->action);
 
index f3e0bcb71f2317c71de4de9527ba60b842093f91..5613eece6906060af133a67d359a6096de54fb55 100644 (file)
@@ -15,28 +15,28 @@ extern "C" {
     if (print.verbosity != f_console_verbosity_quiet_e) {
       controller_lock_print(print.to, thread);
 
-      fl_print_format("%r%[%QThe pid file '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-      fl_print_format("%['Critical failure while attempting to establish '%]", print.to.stream, print.context, print.context);
-      fl_print_format("%[%r lock%]", print.to.stream, print.notable, read ? f_file_operation_read_s : f_file_operation_write_s, print.notable);
+      fl_print_format("%r%[%QThe pid file '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+      fl_print_format("%['Critical failure while attempting to establish '%]", print.to, print.context, print.context);
+      fl_print_format("%[%r lock%]", print.to, print.notable, read ? f_file_operation_read_s : f_file_operation_write_s, print.notable);
 
       if (status != F_failure) {
-        fl_print_format(" %['due to%] ", print.to.stream, print.context, print.context);
+        fl_print_format(" %['due to%] ", print.to, print.context, print.context);
 
         if (status == F_parameter) {
-          fl_print_format("%[Invalid Parameter%]", print.to.stream, print.notable, print.notable);
+          fl_print_format("%[Invalid Parameter%]", print.to, print.notable, print.notable);
         }
         else if (status == F_deadlock) {
-          fl_print_format("%[Deadlock%]", print.to.stream, print.notable, print.notable);
+          fl_print_format("%[Deadlock%]", print.to, print.notable, print.notable);
         }
         else if (status == F_resource_not) {
-          fl_print_format("%[Too Many Locks%]", print.to.stream, print.notable, print.notable);
+          fl_print_format("%[Too Many Locks%]", print.to, print.notable, print.notable);
         }
         else {
-          fl_print_format("%[Unknown Error%]", print.to.stream, print.notable, print.notable);
+          fl_print_format("%[Unknown Error%]", print.to, print.notable, print.notable);
         }
       }
 
-      fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+      fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s);
 
       controller_unlock_print_flush(print.to, thread);
     }
@@ -57,7 +57,7 @@ extern "C" {
 #ifndef _di_controller_unlock_print_flush_
   void controller_unlock_print_flush(const f_file_t to, controller_thread_t * const thread) {
 
-    fflush(to.stream);
+    f_file_stream_flush(to.stream);
     funlockfile(to.stream);
 
     if (thread) {
index 2de5fd9811f777d04a365733c47a999a8f8c6266..39d9cda8d89f54b7ac0c615dee514ed989d2c300 100644 (file)
@@ -11,12 +11,12 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = controller_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
   data.pid = getpid();
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
   f_file_umask_get(&data.umask);
 
@@ -41,11 +41,11 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
     data.as_init = F_false;
   #endif // _controller_as_init_
 
-  const f_status_t status = controller_main(&data, &arguments);
+  const f_status_t status = controller_main(&data, arguments);
 
   controller_main_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   // When the child process exits, it must return the code to the parent so the parent knows how to handle the exit.
   if (status == F_child) {
index 0f6a7301956d4ca42b85f6c8fd153e4f5dd13db8..8602e92b399f3780ddb6089d62511bd3880edefe 100644 (file)
@@ -34,29 +34,29 @@ extern "C" {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
 
-    fl_print_format("%r%[%QWhile processing ", print.to.stream, f_string_eol_s, print.context, print.prefix);
+    fl_print_format("%r%[%QWhile processing ", print.to, f_string_eol_s, print.context, print.prefix);
 
     if (cache.name_action.used) {
-      fl_print_format("%r '%]", print.to.stream, item ? controller_action_s : controller_value_s, print.context);
-      fl_print_format("%[%Q%]", print.to.stream, print.notable, cache.name_action, print.notable);
-      fl_print_format("%[' on line%] ", print.to.stream, print.context, print.context);
-      fl_print_format("%[%un%]", print.to.stream, print.notable, cache.line_action, print.notable);
-      fl_print_format("%[ for ", print.to.stream, print.context);
+      fl_print_format("%r '%]", print.to, item ? controller_action_s : controller_value_s, print.context);
+      fl_print_format("%[%Q%]", print.to, print.notable, cache.name_action, print.notable);
+      fl_print_format("%[' on line%] ", print.to, print.context, print.context);
+      fl_print_format("%[%un%]", print.to, print.notable, cache.line_action, print.notable);
+      fl_print_format("%[ for ", print.to, print.context);
     }
 
     if (cache.name_item.used) {
-      fl_print_format("rule %r '%]", print.to.stream, item ? controller_item_s : controller_settings_s, print.context);
-      fl_print_format("%[%Q%]", print.to.stream, print.notable, cache.name_item, print.notable);
-      fl_print_format("%[' on line%] ", print.to.stream, print.context, print.context);
-      fl_print_format("%[%un%]", print.to.stream, print.notable, cache.line_item, print.notable);
-      fl_print_format("%[ for ", print.to.stream, print.context);
+      fl_print_format("rule %r '%]", print.to, item ? controller_item_s : controller_settings_s, print.context);
+      fl_print_format("%[%Q%]", print.to, print.notable, cache.name_item, print.notable);
+      fl_print_format("%[' on line%] ", print.to, print.context, print.context);
+      fl_print_format("%[%un%]", print.to, print.notable, cache.line_item, print.notable);
+      fl_print_format("%[ for ", print.to, print.context);
     }
 
     if (cache.name_file.used) {
-      fl_print_format("rule file '%]%[%Q%]%['", print.to.stream, print.context, print.notable, cache.name_file, print.notable, print.context);
+      fl_print_format("rule file '%]%[%Q%]%['", print.to, print.context, print.notable, cache.name_file, print.notable, print.context);
     }
 
-    fl_print_format(".%]%r", print.to.stream, print.context, f_string_eol_s);
+    fl_print_format(".%]%r", print.to, print.context, f_string_eol_s);
   }
 #endif // _di_controller_rule_print_error_cache_
 
@@ -333,9 +333,9 @@ extern "C" {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
 
-    fl_print_format("%r%[%QThe rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-    fl_print_format("%[%Q%]", print.to.stream, print.notable, alias, print.notable);
-    fl_print_format("%[' is not designating a pid file.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe rule '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+    fl_print_format("%[%Q%]", print.to, print.notable, alias, print.notable);
+    fl_print_format("%[' is not designating a pid file.%]%r", print.to, print.context, print.context, f_string_eol_s);
   }
 #endif // _di_controller_rule_action_print_error_missing_pid_
 
@@ -344,9 +344,9 @@ extern "C" {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
 
-    fl_print_format("%r%[%QThe %r rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, need_want_wish, print.context);
-    fl_print_format("%[%Q%]", print.to.stream, print.notable, value, print.notable);
-    fl_print_format("%[' %S.%]%r", print.to.stream, print.context, why, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe %r rule '%]", print.to, f_string_eol_s, print.context, print.prefix, need_want_wish, print.context);
+    fl_print_format("%[%Q%]", print.to, print.notable, value, print.notable);
+    fl_print_format("%[' %S.%]%r", print.to, print.context, why, print.context, f_string_eol_s);
   }
 #endif // _di_controller_rule_item_print_error_need_want_wish_
 
@@ -355,9 +355,9 @@ extern "C" {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
 
-    fl_print_format("%r%[%QThe rule '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-    fl_print_format("%[%Q%]", print.to.stream, print.notable, alias, print.notable);
-    fl_print_format("%[' is no longer loaded.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe rule '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+    fl_print_format("%[%Q%]", print.to, print.notable, alias, print.notable);
+    fl_print_format("%[' is no longer loaded.%]%r", print.to, print.context, print.context, f_string_eol_s);
   }
 #endif // _di_controller_rule_item_print_error_rule_not_loaded_
 
@@ -376,7 +376,7 @@ extern "C" {
 
     controller_lock_print(print.to, thread);
 
-    fl_print_format("%r%[%QRule setting %S.%]%r", print.to.stream, f_string_eol_s, print.context, print.prefix, message, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QRule setting %S.%]%r", print.to, f_string_eol_s, print.context, print.prefix, message, print.context, f_string_eol_s);
 
     controller_rule_print_error_cache(print, cache->action, F_false);
 
@@ -399,9 +399,9 @@ extern "C" {
 
     controller_lock_print(print.to, thread);
 
-    fl_print_format("%r%[%QRule setting%S '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, before, print.context);
-    fl_print_format("%[%/Q%]", print.to.stream, print.notable, cache->buffer_item, range, print.notable);
-    fl_print_format("%['%S.%]%r", print.to.stream, print.context, after, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QRule setting%S '%]", print.to, f_string_eol_s, print.context, print.prefix, before, print.context);
+    fl_print_format("%[%/Q%]", print.to, print.notable, cache->buffer_item, range, print.notable);
+    fl_print_format("%['%S.%]%r", print.to, print.context, after, print.context, f_string_eol_s);
 
     controller_rule_print_error_cache(print, cache->action, F_false);
 
index 13108f7d17d328db5faa50553251a17d29165647..299a0b2f6107a070d54aa66eff94ec0af02e7727 100644 (file)
@@ -3,7 +3,7 @@
 build_name controller
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 67cb929667c7de6acc38b4c3acdf3135d00c1a0f..3dc0044c256fe177ae54e2a9221f8152a3981ab2 100644 (file)
@@ -391,6 +391,8 @@ extern "C" {
     fake_parameter_verbosity_verbose_e,
     fake_parameter_verbosity_debug_e,
     fake_parameter_version_e,
+    fake_parameter_line_first_no_e,
+    fake_parameter_line_last_no_e,
 
     fake_parameter_define_e,
     fake_parameter_fakefile_e,
@@ -418,38 +420,41 @@ extern "C" {
 
   #define fake_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fake_short_define_s.string, fake_long_define_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_fakefile_s.string, fake_long_fakefile_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_mode_s.string, fake_long_mode_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_process_s.string, fake_long_process_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_settings_s.string, fake_long_settings_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_path_build_s.string, fake_long_path_build_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_path_data_s.string, fake_long_path_data_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_path_sources_s.string, fake_long_path_sources_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fake_short_path_work_s.string, fake_long_path_work_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, fake_long_documents_disabled_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, fake_long_documents_enabled_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, fake_long_shared_disabled_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, fake_long_shared_enabled_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, fake_long_static_disabled_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, fake_long_static_enabled_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_build_s.string, 0, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_clean_s.string, 0, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_make_s.string, 0, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, fake_other_operation_skeleton_s.string, 0, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fake_short_define_s.string, fake_long_define_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_fakefile_s.string, fake_long_fakefile_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_mode_s.string, fake_long_mode_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_process_s.string, fake_long_process_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_settings_s.string, fake_long_settings_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_path_build_s.string, fake_long_path_build_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_path_data_s.string, fake_long_path_data_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_path_sources_s.string, fake_long_path_sources_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fake_short_path_work_s.string, fake_long_path_work_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, fake_long_documents_disabled_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, fake_long_documents_enabled_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, fake_long_shared_disabled_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, fake_long_shared_enabled_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, fake_long_static_disabled_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, fake_long_static_enabled_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, fake_other_operation_build_s.string, 0, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, fake_other_operation_clean_s.string, 0, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, fake_other_operation_make_s.string, 0, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, fake_other_operation_skeleton_s.string, 0, f_console_type_other_e), \
     }
 
-  #define fake_total_parameters_d 29
+  #define fake_total_parameters_d 31
 #endif // _di_fake_parameters_
 
 #ifdef __cplusplus
index b3f7a9a4da4d5a154cc9eeafbb26c76bd6823154..273d14652a6bbe2dbc5fa7c00365580cd6d73a0b 100644 (file)
@@ -18,18 +18,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fake_program_name_long_s, fake_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -64,7 +59,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fake_program_name_s, fake_program_help_parameters_s);
 
-    fl_print_format("  When performing the %[%r%] operation, the", file.stream, context.set.notable, fake_other_operation_build_s, context.set.notable);
+    fl_print_format("%r  When performing the %[%r%] operation, the", file.stream, f_string_eol_s, context.set.notable, fake_other_operation_build_s, context.set.notable);
     fl_print_format(" %[%r%r%] parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_mode_s, context.set.notable, f_string_eol_s);
 
     fl_print_format("  For example, when a %[%r%]", file.stream, context.set.notable, fake_make_parameter_variable_mode_s, context.set.notable);
@@ -80,8 +75,13 @@ extern "C" {
     fl_print_format(" '%[./my_fakefile%]' is used if found, but if it is not found then no other paths are attempted.%r%r", file.stream, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  When piping data to this program, the piped data is treated as if it were prepended to the %[%r%]", file.stream, context.set.notable, fake_make_parameter_variable_fakefile_s, context.set.notable);
-    fl_print_format("or the %[%r%], depending on the operation.%r%r", file.stream, context.set.notable, fake_make_parameter_variable_settings_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format("or the %[%r%], depending on the operation.%r", file.stream, context.set.notable, fake_make_parameter_variable_settings_s, context.set.notable, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -89,82 +89,50 @@ extern "C" {
 #endif // _di_fake_print_help_
 
 #ifndef _di_fake_main_
-  f_status_t fake_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fake_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    // Load all parameters and identify priority of color parameters.
-    {
-      f_console_parameter_id_t ids[3] = { fake_parameter_no_color_e, fake_parameter_light_e, fake_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fake_parameter_no_color_e, fake_parameter_light_e, fake_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
-
-        return status;
-      }
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fake_parameter_verbosity_quiet_e, fake_parameter_verbosity_error_e, fake_parameter_verbosity_normal_e, fake_parameter_verbosity_verbose_e, fake_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fake_parameter_verbosity_quiet_e, fake_parameter_verbosity_error_e, fake_parameter_verbosity_verbose_e, fake_parameter_verbosity_debug_e, fake_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fake_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fake_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fake_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fake_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fake_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -277,7 +245,7 @@ extern "C" {
     else {
       operations[0] = fake_operation_make_e;
 
-      if (!main->process_pipe && main->parameters.remaining.used) {
+      if (!(main->pipe & fll_program_data_pipe_input_e) && main->parameters.remaining.used) {
         status = F_status_set_error(F_parameter);
 
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
@@ -322,7 +290,7 @@ extern "C" {
       {
         uint8_t i = 0;
 
-        if (main->process_pipe && !(data.flag & fake_data_flag_has_operation_e)) {
+        if ((main->pipe & fll_program_data_pipe_input_e) && !(data.flag & fake_data_flag_has_operation_e)) {
           data.file_data_build_fakefile.used = 0;
 
           status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
@@ -354,7 +322,7 @@ extern "C" {
 
                 status = fake_validate_parameter_paths(&data);
 
-                if (F_status_is_error_not(status) && !main->process_pipe) {
+                if (F_status_is_error_not(status) && !(main->pipe & fll_program_data_pipe_input_e)) {
                   f_string_static_t *path = 0;
 
                   if (operations[i] == fake_operation_build_e) {
@@ -406,7 +374,7 @@ extern "C" {
               }
 
               if (F_status_is_error_not(status)) {
-                status = fake_build_operate(&data, 0, main->process_pipe);
+                status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
               }
             }
             else if (data.operation == fake_operation_clean_e) {
index 63e22860dbef61e8db0e727740dda2fac6d3e5e5..7c7a32640cfdf4a752893505fd2c1279b0272044 100644 (file)
@@ -136,7 +136,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_main_
-  extern f_status_t fake_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fake_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fake_main_
 
 /**
index 1b4ad4fb503e9ab0b73356d3c02c4cb3c2c99d06..75db8a37c94bdc992bb02a82b6a228c6c9f265c1 100644 (file)
@@ -24,18 +24,18 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fake_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
   f_file_umask_get(&data.umask);
 
-  const f_status_t status = fake_main(&data, &arguments);
+  const f_status_t status = fake_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (status == F_child) {
     exit(data.child);
index 9204fd67adb1cd341449b78bf329cd1f416ada70..df4bc55b1ce4a301e1d9a8b675d53f4a598cb4d9 100644 (file)
@@ -560,7 +560,7 @@ extern "C" {
     *status = fll_execute_arguments_add(fake_other_operation_build_s, &arguments);
 
     // Ensure console color mode is passed to the scripts so that they can also react to color mode.
-    if (F_status_is_error_not(*status) && data->main->context.mode != F_color_mode_none_d) {
+    if (F_status_is_error_not(*status) && data->main->context.mode != f_color_mode_none_e) {
       f_string_static_t argument = f_string_static_t_initialize;
       argument.used = f_console_symbol_short_disable_s.used + f_console_standard_short_dark_s.used;
 
@@ -570,13 +570,13 @@ extern "C" {
 
       memcpy(argument_string, f_console_symbol_short_disable_s.string, sizeof(f_char_t) * f_console_symbol_short_disable_s.used);
 
-      if (data->main->context.mode == F_color_mode_dark_d) {
+      if (data->main->context.mode == f_color_mode_dark_e) {
         memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_dark_s.string, sizeof(f_char_t) * f_console_standard_short_dark_s.used);
       }
-      else if (data->main->context.mode == F_color_mode_light_d) {
+      else if (data->main->context.mode == f_color_mode_light_e) {
         memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_light_s.string, sizeof(f_char_t) * f_console_standard_short_light_s.used);
       }
-      else if (data->main->context.mode == F_color_mode_no_color_d) {
+      else if (data->main->context.mode == f_color_mode_color_not_e) {
         memcpy(argument_string + f_console_symbol_short_disable_s.used, f_console_standard_short_no_color_s.string, sizeof(f_char_t) * f_console_standard_short_no_color_s.used);
       }
 
index e2f10c13af6f6b482c6f93d01ed1b0c47715350e..a847f01bdcc6b1846726fb95e9f89baf292344d7 100644 (file)
@@ -131,7 +131,7 @@ extern "C" {
         name_function = "f_file_read";
         status = f_file_read(file, buffer);
 
-        f_file_stream_flush(&file);
+        f_file_stream_flush(file);
         f_file_stream_close(&file);
       }
     }
@@ -569,7 +569,7 @@ extern "C" {
 
     uint8_t parameters_required[] = {
       F_false,
-      data->main->process_pipe ? F_false : F_true,
+      (data->main->pipe & fll_program_data_pipe_input_e) ? F_false : F_true,
       F_false,
     };
 
@@ -651,19 +651,19 @@ extern "C" {
 
 #ifndef _di_fake_verbose_print_clone_
   void fake_verbose_print_clone(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) {
-    fll_print_format("Cloned '%Q' to '%Q'.%r", output.stream, source, destination, f_string_eol_s);
+    fll_print_format("Cloned '%Q' to '%Q'.%r", output, source, destination, f_string_eol_s);
   }
 #endif // _di_fake_verbose_print_clone_
 
 #ifndef _di_fake_verbose_print_copy_
   void fake_verbose_print_copy(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) {
-    fll_print_format("Copied '%Q' to '%Q'.%r", output.stream, source, destination, f_string_eol_s);
+    fll_print_format("Copied '%Q' to '%Q'.%r", output, source, destination, f_string_eol_s);
   }
 #endif // _di_fake_verbose_print_copy_
 
 #ifndef _di_fake_verbose_print_move_
   void fake_verbose_print_move(const f_file_t output, const f_string_static_t source, const f_string_static_t destination) {
-    fll_print_format("Moved '%Q' to '%Q'.%r", output.stream, source, destination, f_string_eol_s);
+    fll_print_format("Moved '%Q' to '%Q'.%r", output, source, destination, f_string_eol_s);
   }
 #endif // _di_fake_verbose_print_move_
 
index 16d3e8d920e1d98d02a9c961b8fc8b06ec886c1a..6ebcae2e05e00ebc111dc134a1a09358f23ed223 100644 (file)
@@ -11,7 +11,7 @@ extern "C" {
 
     if (F_status_is_error(*status)) return;
 
-    if (data_make->main->context.mode != F_color_mode_none_d) {
+    if (data_make->main->context.mode != f_color_mode_none_e) {
       *status = f_string_dynamics_increase_by(fake_default_allocation_small_d, &data_make->parameter.color);
 
       if (F_status_is_error_not(*status)) {
@@ -24,7 +24,7 @@ extern "C" {
         return;
       }
 
-      if (data_make->main->context.mode == F_color_mode_no_color_d) {
+      if (data_make->main->context.mode == f_color_mode_color_not_e) {
         if (data_make->main->parameters.array[fake_parameter_no_color_e].type == f_console_type_normal_e) {
           *status = f_string_dynamic_append(f_console_symbol_short_enable_s, &data_make->parameter.color.array[data_make->parameter.color.used]);
         }
@@ -36,7 +36,7 @@ extern "C" {
           *status = f_string_dynamic_append(f_console_standard_short_no_color_s, &data_make->parameter.color.array[data_make->parameter.color.used]);
         }
       }
-      else if (data_make->main->context.mode == F_color_mode_dark_d) {
+      else if (data_make->main->context.mode == f_color_mode_dark_e) {
         if (data_make->main->parameters.array[fake_parameter_dark_e].type == f_console_type_normal_e) {
           *status = f_string_dynamic_append(f_console_symbol_short_enable_s, &data_make->parameter.color.array[data_make->parameter.color.used]);
         }
index f1ac0c4913079838b77202d2e425471bc6627a90..d869d4df9f189117a0f2516871bf7c99d5312ccb 100644 (file)
@@ -86,7 +86,7 @@ extern "C" {
 
     fake_make_load_parameters(&data_make, &status);
 
-    fake_make_load_fakefile(&data_make, data_make.main->process_pipe, &status);
+    fake_make_load_fakefile(&data_make, main->pipe & fll_program_data_pipe_input_e, &status);
 
     if (F_status_is_error(status)) {
       fake_make_data_delete(&data_make);
@@ -152,7 +152,7 @@ extern "C" {
       }
     }
 
-    f_file_stream_flush(&data_make.path.top);
+    f_file_stream_flush(data_make.path.top);
     f_file_stream_close(&data_make.path.top);
 
     f_array_lengths_resize(0, &section_stack);
index a2a60d80a0e850db4686dbbfb6e49208bb9200cd..530ac34064334755168de0bcfb501ed1a30b35ad 100644 (file)
@@ -1964,7 +1964,7 @@ extern "C" {
       else {
         status = F_none;
 
-        f_file_stream_flush(&file);
+        f_file_stream_flush(file);
         f_file_stream_close(&file);
       }
     }
@@ -2026,7 +2026,7 @@ extern "C" {
         } // for
       }
 
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
       f_file_stream_close(&file);
     }
 
index 57916b42a134572c5ae852b10efbbbf6a53ffcaf..d2d06f309dd473fd4842c7f492ed6cec7bb05fa3 100644 (file)
@@ -376,13 +376,13 @@ extern "C" {
 
     flockfile(print.to.stream);
 
-    fl_print_format("%r%[%QThe section operation '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-    fl_print_format("%[%/Q%]", print.to.stream, print.notable, buffer, operation_name, print.notable);
-    fl_print_format("%[' from section '%]", print.to.stream, print.context, print.context);
-    fl_print_format("%[%/Q%]", print.to.stream, print.notable, buffer, section_name, print.notable);
-    fl_print_format("%[' on line%] ", print.to.stream, print.context, print.context);
-    fl_print_format("%[%un%]", print.to.stream, print.notable, line, print.notable);
-    fl_print_format(" %[failed.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe section operation '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+    fl_print_format("%[%/Q%]", print.to, print.notable, buffer, operation_name, print.notable);
+    fl_print_format("%[' from section '%]", print.to, print.context, print.context);
+    fl_print_format("%[%/Q%]", print.to, print.notable, buffer, section_name, print.notable);
+    fl_print_format("%[' on line%] ", print.to, print.context, print.context);
+    fl_print_format("%[%un%]", print.to, print.notable, line, print.notable);
+    fl_print_format(" %[failed.%]%r", print.to, print.context, print.context, f_string_eol_s);
 
     funlockfile(print.to.stream);
   }
@@ -395,13 +395,13 @@ extern "C" {
 
     flockfile(print.to.stream);
 
-    fl_print_format("%r%[%QThe argument '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-    fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
-    fl_print_format("%[' is not not valid and may only be one of either '%]", print.to.stream, print.context, print.context);
-    fl_print_format("%[%r%]", print.to.stream, print.notable, fake_make_operation_argument_force_s, print.notable);
-    fl_print_format("%[' or '%]", print.to.stream, print.context, print.context);
-    fl_print_format("%[%r%]", print.to.stream, print.notable, fake_make_operation_argument_strict_s, print.notable);
-    fl_print_format("%['.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe argument '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+    fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable);
+    fl_print_format("%[' is not not valid and may only be one of either '%]", print.to, print.context, print.context);
+    fl_print_format("%[%r%]", print.to, print.notable, fake_make_operation_argument_force_s, print.notable);
+    fl_print_format("%[' or '%]", print.to, print.context, print.context);
+    fl_print_format("%[%r%]", print.to, print.notable, fake_make_operation_argument_strict_s, print.notable);
+    fl_print_format("%['.%]%r", print.to, print.context, print.context, f_string_eol_s);
 
     funlockfile(print.to.stream);
 
@@ -415,9 +415,9 @@ extern "C" {
 
     flockfile(print.to.stream);
 
-    fl_print_format("%r%[%QThe point file '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-    fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
-    fl_print_format("%[' already exists.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe point file '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+    fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable);
+    fl_print_format("%[' already exists.%]%r", print.to, print.context, print.context, f_string_eol_s);
 
     funlockfile(print.to.stream);
 
@@ -431,9 +431,9 @@ extern "C" {
 
     flockfile(print.to.stream);
 
-    fl_print_format("%r%[%QThe target file '%]", print.to.stream, f_string_eol_s, print.context, print.prefix, print.context);
-    fl_print_format("%[%Q%]", print.to.stream, print.notable, argument, print.notable);
-    fl_print_format("%[' does not exist.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+    fl_print_format("%r%[%QThe target file '%]", print.to, f_string_eol_s, print.context, print.prefix, print.context);
+    fl_print_format("%[%Q%]", print.to, print.notable, argument, print.notable);
+    fl_print_format("%[' does not exist.%]%r", print.to, print.context, print.context, f_string_eol_s);
 
     funlockfile(print.to.stream);
 
index edd32a70b2e52f950907b0b85b06261bedf85933..28d68d2844fb7c1b7e9067a8d215d74849c382a7 100644 (file)
@@ -274,7 +274,7 @@ extern "C" {
         if (F_status_is_error(status)) {
           fll_error_file_print(data->main->error, F_status_set_fine(status), "f_file_write", F_true, path, fake_common_file_populate_pre_s, fll_error_file_type_file_e);
 
-          f_file_stream_flush(&file);
+          f_file_stream_flush(file);
           f_file_stream_close(&file);
 
           return status;
@@ -284,7 +284,7 @@ extern "C" {
           fll_print_format("File '%Q' pre-populated.%r", data->main->output.to.stream, path, f_string_eol_s);
         }
 
-        f_file_stream_flush(&file);
+        f_file_stream_flush(file);
         f_file_stream_close(&file);
       }
     }
index bfd161f18718473e599beecbf936bc5649690404..f776a894b849b0988dbca492e22cd061ec0b8d76 100644 (file)
@@ -3,7 +3,7 @@
 build_name fake
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 77fb5c9022a27b56163150c78c4bdfec134d3723..410a4bc306fdc1406b5d3d98121cb71cf82c171b 100644 (file)
@@ -357,6 +357,8 @@ extern "C" {
     firewall_parameter_verbosity_verbose_e,
     firewall_parameter_verbosity_debug_e,
     firewall_parameter_version_e,
+    firewall_parameter_line_first_no_e,
+    firewall_parameter_line_last_no_e,
 
     firewall_parameter_command_start_e,
     firewall_parameter_command_stop_e,
@@ -384,24 +386,27 @@ extern "C" {
 
   #define firewall_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(0, 0, firewall_command_start_s.string, F_false, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, firewall_command_stop_s.string, F_false, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, firewall_command_restart_s.string, F_false, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, firewall_command_lock_s.string, F_false, f_console_type_other_e), \
-      macro_f_console_parameter_t_initialize(0, 0, firewall_command_show_s.string, F_false, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(0, 0, firewall_command_start_s.string, F_false, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, firewall_command_stop_s.string, F_false, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, firewall_command_restart_s.string, F_false, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, firewall_command_lock_s.string, F_false, f_console_type_other_e), \
+      macro_f_console_parameter_t_initialize2(0, 0, firewall_command_show_s.string, F_false, f_console_type_other_e), \
     }
 
-  #define firewall_total_parameters_d 15
+  #define firewall_total_parameters_d 17
 #endif // _di_firewall_defines_
 
 #ifdef __cplusplus
index 49fa48cb8eb2960181a19b7fdd3d8da6b72fb65a..7bb364e372eac0c70bbc8797f95d695b7dd73f23 100644 (file)
@@ -17,18 +17,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, firewall_program_name_long_s, firewall_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     fl_print_format("%r%r %[Commands:%] ", file.stream, f_string_eol_s, f_string_eol_s, context.set.important, context.set.important);
     fl_print_format("%r  %[%r%]    Turn on the firewall.", file.stream, f_string_eol_s, context.set.standout, firewall_command_start_s, context.set.standout);
@@ -39,6 +34,11 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, firewall_program_name_s, firewall_program_help_parameters_s);
 
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -46,74 +46,52 @@ extern "C" {
 #endif // _di_firewall_print_help_
 
 #ifndef _di_firewall_main_
-  f_status_t firewall_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t firewall_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
     main->child = 0;
 
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
+
     {
-      f_console_parameter_id_t ids[3] = { firewall_parameter_no_color_e, firewall_parameter_light_e, firewall_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { firewall_parameter_no_color_e, firewall_parameter_light_e, firewall_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
+          return;
+        }
       }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
 
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { firewall_parameter_verbosity_quiet_e, firewall_parameter_verbosity_error_e, firewall_parameter_verbosity_verbose_e, firewall_parameter_verbosity_debug_e, firewall_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      if (F_status_is_error(status)) return status;
-    }
+        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 };
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { firewall_parameter_verbosity_quiet_e, firewall_parameter_verbosity_error_e, firewall_parameter_verbosity_normal_e, firewall_parameter_verbosity_verbose_e, firewall_parameter_verbosity_debug_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 4);
-      f_console_parameter_id_t choice = 0;
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-      if (F_status_is_error(status)) return status;
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == firewall_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == firewall_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == firewall_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == firewall_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == firewall_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
index 23e80007c9331e6447be30b3a72a3d0143281ae7..37032a5f9a90772bd0e4e6c88de4f258dcef2f51 100644 (file)
@@ -93,7 +93,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_firewall_main_
-  extern f_status_t firewall_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t firewall_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_firewall_main_
 
 #ifdef __cplusplus
index cb52c88295650de522552f7a81877773c268a5e8..6a931ef8d21043c569747002606f39b14d690254 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = firewall_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = firewall_main(&data, &arguments);
+  const f_status_t status = firewall_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (status == F_child) {
     exit(data.child);
index c52005fdadf1ff5eddb1402e487cc76bc0546c4e..0a63bd53e80a46787a17aa268af1445a675d4015 100644 (file)
@@ -80,7 +80,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca
 
     ip_list.used = 0;
 
-    // Process chain rule
+    // Process chain rule.
     if (fl_string_dynamic_compare_string(local->buffer.string + local->rule_objects.array[i].start, firewall_chain_s, length) == F_equal_to) {
       if (chain == firewall_chain_custom_id_e) {
 
@@ -578,13 +578,13 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca
               firewall_print_error_on_unhandled(data->main->error, "f_file_open", F_status_set_fine(status));
             }
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
           }
           else {
             status = f_file_read(file, &local_buffer);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             if (F_status_is_error(status)) {
@@ -1160,7 +1160,7 @@ f_status_t firewall_buffer_rules(firewall_data_t * const data, const f_string_st
 
   status = f_file_read(file, &local->buffer);
 
-  f_file_stream_flush(&file);
+  f_file_stream_flush(file);
   f_file_stream_close(&file);
 
   if (F_status_is_error(status)) {
index 1c938fdd5051500098186fd4de3951fc3b450429..223d8678865545cb49fc230dbb1f5337ac40aeb7 100644 (file)
@@ -3,7 +3,7 @@
 build_name firewall
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index e7a5851a37f471363e26a023cd4ec624b7bd0da3..d5b5285e7b73d67649541cbd68456c676391e9be 100644 (file)
@@ -195,6 +195,8 @@ extern "C" {
     fss_basic_list_read_parameter_verbosity_verbose_e,
     fss_basic_list_read_parameter_verbosity_debug_e,
     fss_basic_list_read_parameter_version_e,
+    fss_basic_list_read_parameter_line_first_no_e,
+    fss_basic_list_read_parameter_line_last_no_e,
 
     fss_basic_list_read_parameter_at_e,
     fss_basic_list_read_parameter_content_e,
@@ -214,33 +216,36 @@ extern "C" {
 
   #define fss_basic_list_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_at_s.string, fss_basic_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_content_s.string, fss_basic_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_columns_s.string, fss_basic_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_delimit_s.string, fss_basic_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_depth_s.string, fss_basic_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_empty_s.string, fss_basic_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_line_s.string, fss_basic_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_name_s.string, fss_basic_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_object_s.string, fss_basic_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_pipe_s.string, fss_basic_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_original_s.string, fss_basic_list_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_select_s.string, fss_basic_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_total_s.string, fss_basic_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_read_short_trim_s.string, fss_basic_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_at_s.string, fss_basic_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_content_s.string, fss_basic_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_columns_s.string, fss_basic_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_delimit_s.string, fss_basic_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_depth_s.string, fss_basic_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_empty_s.string, fss_basic_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_line_s.string, fss_basic_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_name_s.string, fss_basic_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_object_s.string, fss_basic_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_pipe_s.string, fss_basic_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_original_s.string, fss_basic_list_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_select_s.string, fss_basic_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_total_s.string, fss_basic_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_read_short_trim_s.string, fss_basic_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_basic_list_read_total_parameters_d 24
+  #define fss_basic_list_read_total_parameters_d 26
 #endif // _di_fss_basic_list_read_parameters_
 
 /**
index edd21887dab0c81abf5f1af5672ff2970f427088..53f2c8eebad027b09d1b56765af525f6979db376 100644 (file)
@@ -12,18 +12,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_basic_list_read_program_name_long_s, fss_basic_list_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -44,7 +39,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_basic_list_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
 
     fl_print_format("  This program will print the Content associated with the given Object and Content main based on the FSS-0002 Basic List standard.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
@@ -110,8 +105,13 @@ extern "C" {
     fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable);
     fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s);
     fl_print_format("  The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s);
-    fl_print_format("  This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This is not to be confused with a depth.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -119,77 +119,50 @@ extern "C" {
 #endif // _di_fss_basic_list_read_print_help_
 
 #ifndef _di_fss_basic_list_read_main_
-  f_status_t fss_basic_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_basic_list_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_basic_list_read_parameter_no_color_e, fss_basic_list_read_parameter_light_e, fss_basic_list_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = { ids, 3 };
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_basic_list_read_parameter_no_color_e, fss_basic_list_read_parameter_light_e, fss_basic_list_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_basic_list_read_parameter_verbosity_quiet_e, fss_basic_list_read_parameter_verbosity_error_e, fss_basic_list_read_parameter_verbosity_normal_e, fss_basic_list_read_parameter_verbosity_verbose_e, fss_basic_list_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_basic_list_read_parameter_verbosity_quiet_e, fss_basic_list_read_parameter_verbosity_error_e, fss_basic_list_read_parameter_verbosity_verbose_e, fss_basic_list_read_parameter_verbosity_debug_e, fss_basic_list_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_basic_list_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_basic_list_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_basic_list_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_basic_list_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_basic_list_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -219,7 +192,7 @@ extern "C" {
     data.files.array[0].range.start = 1;
     data.files.array[0].range.stop = 0;
 
-    if (main->parameters.remaining.used || main->process_pipe) {
+    if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
       {
         const f_array_length_t parameter_code[] = {
           fss_basic_list_read_parameter_at_e,
@@ -495,7 +468,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -564,7 +537,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -591,7 +564,7 @@ extern "C" {
             if (F_status_is_error(status)) {
               fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-              f_file_stream_flush(&file);
+              f_file_stream_flush(file);
               f_file_stream_close(&file);
 
               break;
@@ -612,7 +585,7 @@ extern "C" {
               if (F_status_is_error(status)) break;
             } // for
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             if (F_status_is_error(status)) {
@@ -641,7 +614,7 @@ extern "C" {
           }
         } // for
 
-        f_file_stream_flush(&file);
+        f_file_stream_flush(file);
         f_file_stream_close(&file);
       }
 
index a92e7b883fa1bb208517c0570f94abd544a6f670..857aca433a103c0821908bc03a732639a1871863 100644 (file)
@@ -91,7 +91,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_basic_list_read_main_
-  extern f_status_t fss_basic_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_basic_list_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_basic_list_read_main_
 
 #ifdef __cplusplus
index 0ded01b2404f16423bc755005b90dde140b0f4e4..eac0224161840569fac561b6566daacf4e5673af 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_basic_list_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_basic_list_read_main(&data, &arguments);
+  const f_status_t status = fss_basic_list_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 53aa7908e8efb7cb162332795199d4e01e57949a..1bd1919749ef7e36b16cbea7d10d68e45385e533 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_basic_list_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index ac1a6b2df7d2cc7620949f1f81c45f7423c58c49..3a7985b269e5f288b727c7ea28178bf03a717fc5 100644 (file)
@@ -165,6 +165,8 @@ extern "C" {
     fss_basic_list_write_parameter_verbosity_verbose_e,
     fss_basic_list_write_parameter_verbosity_debug_e,
     fss_basic_list_write_parameter_version_e,
+    fss_basic_list_write_parameter_line_first_no_e,
+    fss_basic_list_write_parameter_line_last_no_e,
 
     fss_basic_list_write_parameter_file_e,
     fss_basic_list_write_parameter_content_e,
@@ -179,28 +181,31 @@ extern "C" {
 
   #define fss_basic_list_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_file_s.string, fss_basic_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_content_s.string, fss_basic_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_double_s.string, fss_basic_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_ignore_s.string, fss_basic_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_object_s.string, fss_basic_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_partial_s.string, fss_basic_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_prepend_s.string, fss_basic_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_single_s.string, fss_basic_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_list_write_short_trim_s.string, fss_basic_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_file_s.string, fss_basic_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_content_s.string, fss_basic_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_double_s.string, fss_basic_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_ignore_s.string, fss_basic_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_object_s.string, fss_basic_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_partial_s.string, fss_basic_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_prepend_s.string, fss_basic_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_single_s.string, fss_basic_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_list_write_short_trim_s.string, fss_basic_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_basic_list_write_total_parameters_d 19
+  #define fss_basic_list_write_total_parameters_d 21
 #endif // _di_fss_basic_list_write_parameters_
 
 #ifdef __cplusplus
index 6a91c6f9e4db88baef5bc7403cf9ad87ac8cbe91..3c233d0a64bb0c1fb1a9c786e47c68d0041dc635 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_basic_list_write_program_name_long_s, fss_basic_list_write_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -38,7 +33,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_basic_list_write_program_name_s, f_string_empty_s);
 
-    fl_print_format("  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, f_string_eol_s, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
     fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
@@ -49,8 +44,13 @@ extern "C" {
     fl_print_format(" and '%[%r%r%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_double_s, context.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", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, context.set.notable, f_string_eol_s);
-    fl_print_format("  This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This parameter requires two values.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -58,77 +58,50 @@ extern "C" {
 #endif // _di_fss_basic_list_write_print_help_
 
 #ifndef _di_fss_basic_list_write_main_
-  f_status_t fss_basic_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_basic_list_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_basic_list_write_parameter_no_color_e, fss_basic_list_write_parameter_light_e, fss_basic_list_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_basic_list_write_parameter_no_color_e, fss_basic_list_write_parameter_light_e, fss_basic_list_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_basic_list_write_parameter_verbosity_quiet_e, fss_basic_list_write_parameter_verbosity_error_e, fss_basic_list_write_parameter_verbosity_normal_e, fss_basic_list_write_parameter_verbosity_verbose_e, fss_basic_list_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_basic_list_write_parameter_verbosity_quiet_e, fss_basic_list_write_parameter_verbosity_error_e, fss_basic_list_write_parameter_verbosity_verbose_e, fss_basic_list_write_parameter_verbosity_debug_e, fss_basic_list_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_basic_list_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_basic_list_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_basic_list_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_basic_list_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_basic_list_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -269,7 +242,7 @@ extern "C" {
           }
         }
       }
-      else if (!main->process_pipe) {
+      else if (!(main->pipe & fll_program_data_pipe_input_e)) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
 
@@ -285,7 +258,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         if (main->parameters.array[fss_basic_list_write_parameter_partial_e].result == f_console_result_found_e) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
             flockfile(main->error.to.stream);
@@ -411,7 +384,7 @@ extern "C" {
     f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
 
     if (F_status_is_error_not(status)) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         status = fss_basic_list_write_process_pipe(main, output, quoted, &buffer);
 
         if (F_status_is_error(status)) {
@@ -514,7 +487,7 @@ extern "C" {
     }
 
     if (main->parameters.array[fss_basic_list_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&output);
+      f_file_stream_flush(output);
       f_file_stream_close(&output);
     }
 
index 68a293b31762534142ccb83c34558f198d9597db..7e896fcc3700c891c4e476c80da84e9342f34c06 100644 (file)
@@ -83,7 +83,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_basic_list_write_main_
-  extern f_status_t fss_basic_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_basic_list_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_basic_list_write_main_
 
 #ifdef __cplusplus
index 5135c63dca70e15311cc0ebeeea655e859aafc71..180951474fbd94ca44b7a93d7c26350df2c4c83b 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_basic_list_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_basic_list_write_main(&data, &arguments);
+  const f_status_t status = fss_basic_list_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 536e7a4b4595353f8b862a9d09aca9d845979679..2168e1469d917ed4445a48fd5d01b44c8e920ff3 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_basic_list_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 5a1735efd81fc69c42b486a29f98a238226c1edd..33b2f016997093bfd04fde35924f9666a1c4de49 100644 (file)
@@ -195,6 +195,8 @@ extern "C" {
     fss_basic_read_parameter_verbosity_verbose_e,
     fss_basic_read_parameter_verbosity_debug_e,
     fss_basic_read_parameter_version_e,
+    fss_basic_read_parameter_line_first_no_e,
+    fss_basic_read_parameter_line_last_no_e,
 
     fss_basic_read_parameter_at_e,
     fss_basic_read_parameter_content_e,
@@ -214,33 +216,36 @@ extern "C" {
 
   #define fss_basic_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_at_s.string, fss_basic_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_content_s.string, fss_basic_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_columns_s.string, fss_basic_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_delimit_s.string, fss_basic_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_depth_s.string, fss_basic_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_empty_s.string, fss_basic_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_line_s.string, fss_basic_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_name_s.string, fss_basic_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_object_s.string, fss_basic_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_pipe_s.string, fss_basic_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_original_s.string, fss_basic_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_select_s.string, fss_basic_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_total_s.string, fss_basic_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_read_short_trim_s.string, fss_basic_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_at_s.string, fss_basic_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_content_s.string, fss_basic_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_columns_s.string, fss_basic_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_delimit_s.string, fss_basic_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_depth_s.string, fss_basic_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_empty_s.string, fss_basic_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_line_s.string, fss_basic_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_name_s.string, fss_basic_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_object_s.string, fss_basic_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_pipe_s.string, fss_basic_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_original_s.string, fss_basic_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_select_s.string, fss_basic_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_total_s.string, fss_basic_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_read_short_trim_s.string, fss_basic_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_basic_read_total_parameters_d 24
+  #define fss_basic_read_total_parameters_d 26
 #endif // _di_fss_basic_read_parameters_
 
 /**
index 7bbce28b94bde5b65ebc82e8a7be0146c74ed2e2..71a178b3062a03b57d844401c4e161831b5bb444 100644 (file)
@@ -12,18 +12,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_basic_read_program_name_long_s, fss_basic_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -44,7 +39,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_basic_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
 
     fl_print_format("  This program will print the Content associated with the given Object and Content main based on the FSS-0000 Basic standard.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
@@ -110,8 +105,13 @@ extern "C" {
     fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, context.set.notable);
     fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s);
     fl_print_format("  The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s);
-    fl_print_format("  This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This is not to be confused with a depth.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -119,77 +119,50 @@ extern "C" {
 #endif // _di_fss_basic_read_print_help_
 
 #ifndef _di_fss_basic_read_main_
-  f_status_t fss_basic_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_basic_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_basic_read_parameter_no_color_e, fss_basic_read_parameter_light_e, fss_basic_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_basic_read_parameter_no_color_e, fss_basic_read_parameter_light_e, fss_basic_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_basic_read_parameter_verbosity_quiet_e, fss_basic_read_parameter_verbosity_error_e, fss_basic_read_parameter_verbosity_normal_e, fss_basic_read_parameter_verbosity_verbose_e, fss_basic_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_basic_read_parameter_verbosity_quiet_e, fss_basic_read_parameter_verbosity_error_e, fss_basic_read_parameter_verbosity_verbose_e, fss_basic_read_parameter_verbosity_debug_e, fss_basic_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_basic_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_basic_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_basic_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_basic_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_basic_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -219,7 +192,7 @@ extern "C" {
     data.files.array[0].range.start = 1;
     data.files.array[0].range.stop = 0;
 
-    if (main->parameters.remaining.used || main->process_pipe) {
+    if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
       {
         const f_array_length_t parameter_code[] = {
           fss_basic_read_parameter_at_e,
@@ -503,7 +476,7 @@ extern "C" {
         } // for
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -571,7 +544,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -598,7 +571,7 @@ extern "C" {
             if (F_status_is_error(status)) {
               fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-              f_file_stream_flush(&file);
+              f_file_stream_flush(file);
               f_file_stream_close(&file);
 
               break;
@@ -619,7 +592,7 @@ extern "C" {
               if (F_status_is_error(status)) break;
             } // for
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             if (F_status_is_error(status)) {
index 7a3b50cc14df55317f5b15613bd7023782fc56f7..aac0e6b7889b837df8d280672b280db4801eafe5 100644 (file)
@@ -91,7 +91,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_basic_read_main_
-  extern f_status_t fss_basic_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_basic_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_basic_read_main_
 
 #ifdef __cplusplus
index cdddcca9a8c2dc9f0809352a37ba8cb95eff5e11..ddd18479b4f416fbaa709e641978ea14723f7ec5 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_basic_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_basic_read_main(&data, &arguments);
+  const f_status_t status = fss_basic_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 065c6d205f2de3f6080242e1a91f197ecc7df2b2..081696b9a35063fc5e62b3bd21949bbbecb25764 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_basic_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 095e366799ae2e8f88939d86c7f3660c6982f9a5..c0764f4d0bfc8a982aabcc79f9ea25942ec8b948 100644 (file)
@@ -165,6 +165,8 @@ extern "C" {
     fss_basic_write_parameter_verbosity_verbose_e,
     fss_basic_write_parameter_verbosity_debug_e,
     fss_basic_write_parameter_version_e,
+    fss_basic_write_parameter_line_first_no_e,
+    fss_basic_write_parameter_line_last_no_e,
 
     fss_basic_write_parameter_file_e,
     fss_basic_write_parameter_content_e,
@@ -179,28 +181,31 @@ extern "C" {
 
   #define fss_basic_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_file_s.string, fss_basic_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_content_s.string, fss_basic_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_double_s.string, fss_basic_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_ignore_s.string, fss_basic_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_object_s.string, fss_basic_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_partial_s.string, fss_basic_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_prepend_s.string, fss_basic_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_single_s.string, fss_basic_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_basic_write_short_trim_s.string, fss_basic_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_file_s.string, fss_basic_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_content_s.string, fss_basic_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_double_s.string, fss_basic_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_ignore_s.string, fss_basic_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_object_s.string, fss_basic_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_partial_s.string, fss_basic_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_prepend_s.string, fss_basic_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_single_s.string, fss_basic_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_basic_write_short_trim_s.string, fss_basic_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_basic_write_total_parameters_d 18
+  #define fss_basic_write_total_parameters_d 20
 #endif // _di_fss_basic_write_parameters_
 
 #ifdef __cplusplus
index 5f05c505a974d8fac3eb26cb70e6803300747313..448fdd61082e2cd6503fe400ecbf11746cb3a844 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_basic_write_program_name_long_s, fss_basic_write_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -38,7 +33,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_basic_write_program_name_s, f_string_empty_s);
 
-    fl_print_format("  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, f_string_eol_s, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
     fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
@@ -49,8 +44,13 @@ extern "C" {
     fl_print_format(" does nothing.%r%r", file.stream, 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", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, context.set.notable, f_string_eol_s);
-    fl_print_format("  This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This parameter requires two values.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -58,77 +58,50 @@ extern "C" {
 #endif // _di_fss_basic_write_print_help_
 
 #ifndef _di_fss_basic_write_main_
-  f_status_t fss_basic_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_basic_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_basic_write_parameter_no_color_e, fss_basic_write_parameter_light_e, fss_basic_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_basic_write_parameter_no_color_e, fss_basic_write_parameter_light_e, fss_basic_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_basic_write_parameter_verbosity_quiet_e, fss_basic_write_parameter_verbosity_error_e, fss_basic_write_parameter_verbosity_normal_e, fss_basic_write_parameter_verbosity_verbose_e, fss_basic_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_basic_write_parameter_verbosity_quiet_e, fss_basic_write_parameter_verbosity_error_e, fss_basic_write_parameter_verbosity_verbose_e, fss_basic_write_parameter_verbosity_debug_e, fss_basic_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_basic_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_basic_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_basic_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_basic_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_basic_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -267,7 +240,7 @@ extern "C" {
           }
         }
       }
-      else if (!main->process_pipe) {
+      else if (!(main->pipe & fll_program_data_pipe_input_e)) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
 
@@ -283,7 +256,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         if (main->parameters.array[fss_basic_write_parameter_partial_e].result == f_console_result_found_e) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
             flockfile(main->error.to.stream);
@@ -410,7 +383,7 @@ extern "C" {
     f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
 
     if (F_status_is_error_not(status)) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         status = fss_basic_write_process_pipe(main, output, quote, &buffer);
 
         if (F_status_is_error(status)) {
@@ -505,7 +478,7 @@ extern "C" {
     }
 
     if (main->parameters.array[fss_basic_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&output);
+      f_file_stream_flush(output);
       f_file_stream_close(&output);
     }
 
index 41ff14b5a8d02e314658020c43cac630c9e70291..21d11c969a5ef45ad7f83ebab63f9313f79555ea 100644 (file)
@@ -83,7 +83,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_basic_write_main_
-  extern f_status_t fss_basic_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_basic_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_basic_write_main_
 
 #ifdef __cplusplus
index 059d3fa465c54370f70c971bd9c60a2274cc6128..0c1a9a5bde970413c49bfcfc9cd7e997d5773fb6 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_basic_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_basic_write_main(&data, &arguments);
+  const f_status_t status = fss_basic_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 023953c2bd08a1553b2f348cd2a6ed6f104ad5a4..12f063769ca0a6cf072f4c5f4a0bd464200cfb60 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_basic_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0b6b9d96b1380a92d0f7090a0f2d68102a3b3d31..70f025ad4231c893950d5482424d308786ae66be 100644 (file)
@@ -195,6 +195,8 @@ extern "C" {
     fss_embedded_list_read_parameter_verbosity_verbose_e,
     fss_embedded_list_read_parameter_verbosity_debug_e,
     fss_embedded_list_read_parameter_version_e,
+    fss_embedded_list_read_parameter_line_first_no_e,
+    fss_embedded_list_read_parameter_line_last_no_e,
 
     fss_embedded_list_read_parameter_at_e,
     fss_embedded_list_read_parameter_content_e,
@@ -214,33 +216,36 @@ extern "C" {
 
   #define fss_embedded_list_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_embedded_list_read_total_parameters_d 24
+  #define fss_embedded_list_read_total_parameters_d 26
 #endif // _di_fss_embedded_list_read_parameters_
 
 /**
index 2762431a5cbec6d60ef7f0177f8f9702b6a7e10b..3eb1dba0342d0a09ff54c5f14fae0c1e378b7b5e 100644 (file)
@@ -12,18 +12,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_embedded_list_read_program_name_long_s, fss_embedded_list_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -44,7 +39,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_embedded_list_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
 
     fl_print_format("  This program will print the Content associated with the given Object and Content main based on the FSS-0008 Embedded List standard.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
@@ -109,8 +104,13 @@ extern "C" {
     fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, context.set.notable);
     fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s);
     fl_print_format("  The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s);
-    fl_print_format("  This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This is not to be confused with a depth.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -118,77 +118,50 @@ extern "C" {
 #endif // _di_fss_embedded_list_read_print_help_
 
 #ifndef _di_fss_embedded_list_read_main_
-  f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_embedded_list_read_parameter_no_color_e, fss_embedded_list_read_parameter_light_e, fss_embedded_list_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_embedded_list_read_parameter_no_color_e, fss_embedded_list_read_parameter_light_e, fss_embedded_list_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_embedded_list_read_parameter_verbosity_quiet_e, fss_embedded_list_read_parameter_verbosity_error_e, fss_embedded_list_read_parameter_verbosity_verbose_e, fss_embedded_list_read_parameter_verbosity_debug_e, fss_embedded_list_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_embedded_list_read_parameter_verbosity_quiet_e, fss_embedded_list_read_parameter_verbosity_error_e, fss_embedded_list_read_parameter_verbosity_normal_e, fss_embedded_list_read_parameter_verbosity_verbose_e, fss_embedded_list_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 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 };
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
-
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_embedded_list_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_embedded_list_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_embedded_list_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_embedded_list_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_embedded_list_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -224,7 +197,7 @@ extern "C" {
       }
     }
 
-    if (main->parameters.remaining.used > 0 || main->process_pipe) {
+    if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) {
       if (main->parameters.array[fss_embedded_list_read_parameter_at_e].result == f_console_result_found_e) {
         flockfile(main->error.to.stream);
 
@@ -396,7 +369,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -457,7 +430,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -469,7 +442,7 @@ extern "C" {
               fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
             }
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             continue;
@@ -494,7 +467,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -515,7 +488,7 @@ extern "C" {
             if (F_status_is_error(status)) break;
           } // for
 
-          f_file_stream_flush(&file);
+          f_file_stream_flush(file);
           f_file_stream_close(&file);
 
           if (F_status_is_error(status)) {
index 240f759330980a774c3213766687111ee6a7e219..f6e853d6c9764039ae39cfe8ad285a8f83ee1d7b 100644 (file)
@@ -91,7 +91,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_embedded_list_read_main_
-  extern f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_embedded_list_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_embedded_list_read_main_
 
 #ifdef __cplusplus
index 66a29c5bc9a34cea8aed7c24682df485d5be04e7..fa84dae30e653e246a00f97736ca8ecb39ceb600 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_embedded_list_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_embedded_list_read_main(&data, &arguments);
+  const f_status_t status = fss_embedded_list_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 2d4b07a2aab337b4421d9c454acb757a4f1bcdc4..30ef1431a49993ccf9302323c27c06d861054be2 100644 (file)
@@ -120,8 +120,13 @@ extern "C" {
 /**
  * The program data.
  *
- * process_pipe: Designate whether or not to process the input pipe.
- * context:      The color context.
+ * main:
+ * argv:
+ *
+ * buffer:
+ * nest:
+ * delimit_mode:
+ * delimit_depth:
  */
 #ifndef _di_fss_embedded_list_read_data_t_
   typedef struct {
index 794154991a3d1c5ce607a919310c50418efbfd2a..d00cd4677b52c0939dd68bf90b6e0505570697fd 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_embedded_list_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0bdc22ebe2ca0ad6d4d8518c8d53ad1d508bc7fc..6351e65117c5909a597eb02d4f7dba948c5e8559 100644 (file)
@@ -165,6 +165,8 @@ extern "C" {
     fss_embedded_list_write_parameter_verbosity_verbose_e,
     fss_embedded_list_write_parameter_verbosity_debug_e,
     fss_embedded_list_write_parameter_version_e,
+    fss_embedded_list_write_parameter_line_first_no_e,
+    fss_embedded_list_write_parameter_line_last_no_e,
 
     fss_embedded_list_write_parameter_file_e,
     fss_embedded_list_write_parameter_content_e,
@@ -179,28 +181,31 @@ extern "C" {
 
   #define fss_embedded_list_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_file_s.string, fss_embedded_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_content_s.string, fss_embedded_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_double_s.string, fss_embedded_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_ignore_s.string, fss_embedded_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_object_s.string, fss_embedded_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_partial_s.string, fss_embedded_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_prepend_s.string, fss_embedded_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_single_s.string, fss_embedded_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_embedded_list_write_short_trim_s.string, fss_embedded_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_file_s.string, fss_embedded_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_content_s.string, fss_embedded_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_double_s.string, fss_embedded_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_ignore_s.string, fss_embedded_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_object_s.string, fss_embedded_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_partial_s.string, fss_embedded_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_prepend_s.string, fss_embedded_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_single_s.string, fss_embedded_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_embedded_list_write_short_trim_s.string, fss_embedded_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_embedded_list_write_total_parameters_d 19
+  #define fss_embedded_list_write_total_parameters_d 21
 #endif // _di_fss_embedded_list_write_parameters_
 
 #ifdef __cplusplus
index 67d5f89502dd0796fb81d2b45bac46beec14467a..ddfb5f1d5f60f11f82d478f6b88e183a4a603ff9 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_embedded_list_write_program_name_long_s, fss_embedded_list_write_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -38,7 +33,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_embedded_list_write_program_name_s, f_string_empty_s);
 
-    fl_print_format("  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, f_string_eol_s, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.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 (use this both before and after the range).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
     fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
@@ -52,8 +47,13 @@ extern "C" {
     fl_print_format("  This parameter requires two values.%r", file.stream, f_string_eol_s);
     fl_print_format("  This parameter is not used for ignoring anything from the input pipe.%r", file.stream, f_string_eol_s);
     fl_print_format("  This parameter must be specified after a '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable);
-    fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, context.set.notable, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -61,77 +61,50 @@ extern "C" {
 #endif // _di_fss_embedded_list_write_print_help_
 
 #ifndef _di_fss_embedded_list_write_main_
-  f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_embedded_list_write_parameter_no_color_e, fss_embedded_list_write_parameter_light_e, fss_embedded_list_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    setting->status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(setting->status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_embedded_list_write_parameter_no_color_e, fss_embedded_list_write_parameter_light_e, fss_embedded_list_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_embedded_list_write_parameter_verbosity_quiet_e, fss_embedded_list_write_parameter_verbosity_error_e, fss_embedded_list_write_parameter_verbosity_normal_e, fss_embedded_list_write_parameter_verbosity_verbose_e, fss_embedded_list_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_embedded_list_write_parameter_verbosity_quiet_e, fss_embedded_list_write_parameter_verbosity_error_e, fss_embedded_list_write_parameter_verbosity_verbose_e, fss_embedded_list_write_parameter_verbosity_debug_e, fss_embedded_list_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_embedded_list_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_embedded_list_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_embedded_list_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_embedded_list_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_embedded_list_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -270,7 +243,7 @@ extern "C" {
           }
         }
       }
-      else if (!main->process_pipe) {
+      else if (!(main->pipe & fll_program_data_pipe_input_e)) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
 
@@ -286,7 +259,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         if (main->parameters.array[fss_embedded_list_write_parameter_partial_e].result == f_console_result_found_e) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
             flockfile(main->error.to.stream);
@@ -414,7 +387,7 @@ extern "C" {
     if (F_status_is_error_not(status)) {
       f_string_ranges_t ignore = f_string_ranges_t_initialize;
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         status = fss_embedded_list_write_process_pipe(main, output, quote, &buffer, &ignore);
 
         if (F_status_is_error(status) && F_status_set_fine(status) != F_interrupt) {
@@ -520,7 +493,7 @@ extern "C" {
     }
 
     if (main->parameters.array[fss_embedded_list_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&output);
+      f_file_stream_flush(output);
       f_file_stream_close(&output);
     }
 
index 9cc40c75eeb66eeb20ee556b24413f369a03bf5e..23002ef003eca51121a7993b03671d3639011ae1 100644 (file)
@@ -86,7 +86,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_embedded_list_write_main_
-  extern f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_embedded_list_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_embedded_list_write_main_
 
 #ifdef __cplusplus
index 257b8a2c6dff900d374c73400f14aabc928635df..bd708bdb85d605d92cda669357b6a5fe9daa5268 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_embedded_list_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_embedded_list_write_main(&data, &arguments);
+  const f_status_t status = fss_embedded_list_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 4020d7761bb9823641dc6f89ab71aef8eca615ff..ee5cdf493b917f8d37a5cc37e00de9f72c9d5791 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_embedded_list_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 5a0f78bd25f7bfaac632e35749d42b0acb895211..59b7d8e72e0096ae9785943815c840bba97d31f4 100644 (file)
@@ -195,6 +195,8 @@ extern "C" {
     fss_extended_list_read_parameter_verbosity_verbose_e,
     fss_extended_list_read_parameter_verbosity_debug_e,
     fss_extended_list_read_parameter_version_e,
+    fss_extended_list_read_parameter_line_first_no_e,
+    fss_extended_list_read_parameter_line_last_no_e,
 
     fss_extended_list_read_parameter_at_e,
     fss_extended_list_read_parameter_content_e,
@@ -214,33 +216,36 @@ extern "C" {
 
   #define fss_extended_list_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_at_s.string, fss_extended_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_content_s.string, fss_extended_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_columns_s.string, fss_extended_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_delimit_s.string, fss_extended_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_depth_s.string, fss_extended_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_empty_s.string, fss_extended_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_line_s.string, fss_extended_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_name_s.string, fss_extended_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_object_s.string, fss_extended_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_pipe_s.string, fss_extended_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_original_s.string, fss_extended_list_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_select_s.string, fss_extended_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_total_s.string, fss_extended_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_read_short_trim_s.string, fss_extended_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_at_s.string, fss_extended_list_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_content_s.string, fss_extended_list_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_columns_s.string, fss_extended_list_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_delimit_s.string, fss_extended_list_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_depth_s.string, fss_extended_list_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_empty_s.string, fss_extended_list_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_line_s.string, fss_extended_list_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_name_s.string, fss_extended_list_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_object_s.string, fss_extended_list_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_pipe_s.string, fss_extended_list_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_original_s.string, fss_extended_list_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_select_s.string, fss_extended_list_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_total_s.string, fss_extended_list_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_read_short_trim_s.string, fss_extended_list_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_extended_list_read_total_parameters_d 24
+  #define fss_extended_list_read_total_parameters_d 26
 #endif // _di_fss_extended_list_read_parameters_
 
 /**
index aa23486660d0eb422310aea9ac4040469042f0c2..9981c39672586fbbc55ef7e58690848beac3e994 100644 (file)
@@ -12,18 +12,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_extended_list_read_program_name_long_s, fss_extended_list_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -44,7 +39,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_extended_list_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
 
     fl_print_format("  This program will print the Content associated with the given Object and Content main based on the FSS-0003 Extended List standard.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
@@ -110,8 +105,13 @@ extern "C" {
     fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, context.set.notable);
     fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s);
     fl_print_format("  The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s);
-    fl_print_format("  This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This is not to be confused with a depth.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -119,77 +119,50 @@ extern "C" {
 #endif // _di_fss_extended_list_read_print_help_
 
 #ifndef _di_fss_extended_list_read_main_
-  f_status_t fss_extended_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_extended_list_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_extended_list_read_parameter_no_color_e, fss_extended_list_read_parameter_light_e, fss_extended_list_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = { ids, 3 };
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_extended_list_read_parameter_no_color_e, fss_extended_list_read_parameter_light_e, fss_extended_list_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_extended_list_read_parameter_verbosity_quiet_e, fss_extended_list_read_parameter_verbosity_error_e, fss_extended_list_read_parameter_verbosity_normal_e, fss_extended_list_read_parameter_verbosity_verbose_e, fss_extended_list_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_extended_list_read_parameter_verbosity_quiet_e, fss_extended_list_read_parameter_verbosity_error_e, fss_extended_list_read_parameter_verbosity_verbose_e, fss_extended_list_read_parameter_verbosity_debug_e, fss_extended_list_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_extended_list_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_extended_list_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_extended_list_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_extended_list_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_extended_list_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -219,7 +192,7 @@ extern "C" {
     data.files.array[0].range.start = 1;
     data.files.array[0].range.stop = 0;
 
-    if (main->parameters.remaining.used || main->process_pipe) {
+    if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
       {
         const f_array_length_t parameter_code[] = {
           fss_extended_list_read_parameter_at_e,
@@ -503,7 +476,7 @@ extern "C" {
         } // for
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -571,7 +544,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -598,7 +571,7 @@ extern "C" {
             if (F_status_is_error(status)) {
               fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-              f_file_stream_flush(&file);
+              f_file_stream_flush(file);
               f_file_stream_close(&file);
 
               break;
@@ -619,7 +592,7 @@ extern "C" {
               if (F_status_is_error(status)) break;
             } // for
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             if (F_status_is_error(status)) {
index 8b30ff138b9cfbedbdbe6dfa154c295f2ebb8265..847c84596fbbb3cc98368e1e7f8f664521f40bd8 100644 (file)
@@ -91,7 +91,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_extended_list_read_main_
-  extern f_status_t fss_extended_list_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_extended_list_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_extended_list_read_main_
 
 #ifdef __cplusplus
index fa5f77e710fad3943c775c30710f714110b837d7..30e46c99039119f2d16afa656a93ade9a2c05320 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_extended_list_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_extended_list_read_main(&data, &arguments);
+  const f_status_t status = fss_extended_list_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index ff6750213e3fe79696da2f791927a530b04ee8c9..683d0db2f0f72ec14719a037bc256fc309606c02 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_extended_list_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index c44b2430ac4cd2194b99f097ba124ab9f5e528be..b80105eba393c203a3cb4942d5196809bdbaeee7 100644 (file)
@@ -165,6 +165,8 @@ extern "C" {
     fss_extended_list_write_parameter_verbosity_verbose_e,
     fss_extended_list_write_parameter_verbosity_debug_e,
     fss_extended_list_write_parameter_version_e,
+    fss_extended_list_write_parameter_line_first_no_e,
+    fss_extended_list_write_parameter_line_last_no_e,
 
     fss_extended_list_write_parameter_file_e,
     fss_extended_list_write_parameter_content_e,
@@ -179,28 +181,31 @@ extern "C" {
 
   #define fss_extended_list_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_file_s.string, fss_extended_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_content_s.string, fss_extended_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_double_s.string, fss_extended_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_ignore_s.string, fss_extended_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_object_s.string, fss_extended_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_partial_s.string, fss_extended_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_prepend_s.string, fss_extended_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_single_s.string, fss_extended_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_list_write_short_trim_s.string, fss_extended_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_file_s.string, fss_extended_list_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_content_s.string, fss_extended_list_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_double_s.string, fss_extended_list_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_ignore_s.string, fss_extended_list_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_object_s.string, fss_extended_list_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_partial_s.string, fss_extended_list_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_prepend_s.string, fss_extended_list_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_single_s.string, fss_extended_list_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_list_write_short_trim_s.string, fss_extended_list_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_extended_list_write_total_parameters_d 19
+  #define fss_extended_list_write_total_parameters_d 21
 #endif // _di_fss_extended_list_write_parameters_
 
 /**
index 46062759315153e273de421cb1e4790d672b2283..a82340b2f93aef076456916aa9db20fec8a642d3 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_extended_list_write_program_name_long_s, fss_extended_list_write_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -38,7 +33,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_extended_list_write_program_name_s, f_string_empty_s);
 
-    fl_print_format("  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, f_string_eol_s, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.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 (use this both before and after the range).%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
     fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
@@ -52,8 +47,13 @@ extern "C" {
     fl_print_format("  This parameter requires two values.%r", file.stream, f_string_eol_s);
     fl_print_format("  This parameter is not used for ignoring anything from the input pipe.%r", file.stream, f_string_eol_s);
     fl_print_format("  This parameter must be specified after a '%[%r%r%]'", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable);
-    fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format(" parameter and this applies only to the Content represented by that specific '%[%r%r%]' parameter.%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, context.set.notable, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -61,77 +61,50 @@ extern "C" {
 #endif // _di_fss_extended_list_write_print_help_
 
 #ifndef _di_fss_extended_list_write_main_
-  f_status_t fss_extended_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_extended_list_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_extended_list_write_parameter_no_color_e, fss_extended_list_write_parameter_light_e, fss_extended_list_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    setting->status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(setting->status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_extended_list_write_parameter_no_color_e, fss_extended_list_write_parameter_light_e, fss_extended_list_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_extended_list_write_parameter_verbosity_quiet_e, fss_extended_list_write_parameter_verbosity_error_e, fss_extended_list_write_parameter_verbosity_normal_e, fss_extended_list_write_parameter_verbosity_verbose_e, fss_extended_list_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_extended_list_write_parameter_verbosity_quiet_e, fss_extended_list_write_parameter_verbosity_error_e, fss_extended_list_write_parameter_verbosity_verbose_e, fss_extended_list_write_parameter_verbosity_debug_e, fss_extended_list_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_extended_list_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_extended_list_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_extended_list_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_extended_list_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_extended_list_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -269,7 +242,7 @@ extern "C" {
           }
         }
       }
-      else if (!main->process_pipe) {
+      else if (!(main->pipe & fll_program_data_pipe_input_e)) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
 
@@ -285,7 +258,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         if (main->parameters.array[fss_extended_list_write_parameter_partial_e].result == f_console_result_found_e) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
             flockfile(main->error.to.stream);
@@ -413,7 +386,7 @@ extern "C" {
     if (F_status_is_error_not(status)) {
       f_string_ranges_t ignore = f_string_ranges_t_initialize;
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         status = fss_extended_list_write_process_pipe(main, output, quote, &buffer, &ignore);
 
         if (F_status_is_error(status)) {
@@ -519,7 +492,7 @@ extern "C" {
     }
 
     if (main->parameters.array[fss_extended_list_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&output);
+      f_file_stream_flush(output);
       f_file_stream_close(&output);
     }
 
index 6baf360d8d517df78c076e71e69bd96244b1dc5e..ce18f5b60d0c041926f1ce5cfbd0b5afd86f7aae 100644 (file)
@@ -84,7 +84,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_extended_list_write_main_
-  extern f_status_t fss_extended_list_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_extended_list_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_extended_list_write_main_
 
 #ifdef __cplusplus
index 46280945b08e1ba78e7e7f4591ccc7250f2af462..6814f7d9270fe9a2a868f17c6704cd47ea740c47 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_extended_list_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_extended_list_write_main(&data, &arguments);
+  const f_status_t status = fss_extended_list_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 95a8f80ee9d314999d376199f0219de5ff56aff5..c8ca91170462ae89a5dd5918c5a99264c2376ae3 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_extended_list_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0a2aef11b25c70d57ccbd1e52de147fe14f7b901..e4a38b6089ffa544af46a300f9aa2a9bc492ea4c 100644 (file)
@@ -195,6 +195,8 @@ extern "C" {
     fss_extended_read_parameter_verbosity_verbose_e,
     fss_extended_read_parameter_verbosity_debug_e,
     fss_extended_read_parameter_version_e,
+    fss_extended_read_parameter_line_first_no_e,
+    fss_extended_read_parameter_line_last_no_e,
 
     fss_extended_read_parameter_at_e,
     fss_extended_read_parameter_content_e,
@@ -214,33 +216,35 @@ extern "C" {
 
   #define fss_extended_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_at_s.string, fss_extended_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_content_s.string, fss_extended_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_columns_s.string, fss_extended_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_delimit_s.string, fss_extended_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_depth_s.string, fss_extended_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_empty_s.string, fss_extended_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_line_s.string, fss_extended_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_name_s.string, fss_extended_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_object_s.string, fss_extended_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_pipe_s.string, fss_extended_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_original_s.string, fss_extended_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_select_s.string, fss_extended_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_total_s.string, fss_extended_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_read_short_trim_s.string, fss_extended_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_content_s.string, fss_extended_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_columns_s.string, fss_extended_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_delimit_s.string, fss_extended_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_depth_s.string, fss_extended_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_empty_s.string, fss_extended_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_line_s.string, fss_extended_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_name_s.string, fss_extended_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_object_s.string, fss_extended_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_pipe_s.string, fss_extended_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_original_s.string, fss_extended_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_select_s.string, fss_extended_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_total_s.string, fss_extended_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_read_short_trim_s.string, fss_extended_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_extended_read_total_parameters_d 24
+  #define fss_extended_read_total_parameters_d 26
 #endif // _di_fss_extended_read_parameters_
 
 /**
index 27d029af26e1dddad89298568762508ed40f2202..4226bb8ca52859dcb090a0bc5272bdbaa904e8c1 100644 (file)
@@ -12,18 +12,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_extended_read_program_name_long_s, fss_extended_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -44,7 +39,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_extended_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
 
     fl_print_format("  This program will print the Content associated with the given Object and Content main based on the FSS-0001 Extended standard.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
@@ -110,8 +105,13 @@ extern "C" {
     fl_print_format(" and %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, context.set.notable);
     fl_print_format(" refer to a Content column.%r", file.stream, f_string_eol_s);
     fl_print_format("  The word \"column\" is being loosely defined to refer to a specific Content.%r", file.stream, f_string_eol_s);
-    fl_print_format("  This is not to be confused with a depth.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This is not to be confused with a depth.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -119,77 +119,50 @@ extern "C" {
 #endif // _di_fss_extended_read_print_help_
 
 #ifndef _di_fss_extended_read_main_
-  f_status_t fss_extended_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_extended_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_extended_read_parameter_no_color_e, fss_extended_read_parameter_light_e, fss_extended_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_extended_read_parameter_no_color_e, fss_extended_read_parameter_light_e, fss_extended_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_extended_read_parameter_verbosity_quiet_e, fss_extended_read_parameter_verbosity_error_e, fss_extended_read_parameter_verbosity_normal_e, fss_extended_read_parameter_verbosity_verbose_e, fss_extended_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_extended_read_parameter_verbosity_quiet_e, fss_extended_read_parameter_verbosity_error_e, fss_extended_read_parameter_verbosity_verbose_e, fss_extended_read_parameter_verbosity_debug_e, fss_extended_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_extended_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_extended_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_extended_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_extended_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_extended_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -219,7 +192,7 @@ extern "C" {
     data.files.array[0].range.start = 1;
     data.files.array[0].range.stop = 0;
 
-    if (main->parameters.remaining.used || main->process_pipe) {
+    if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
       {
         const f_array_length_t parameter_code[] = {
           fss_extended_read_parameter_at_e,
@@ -502,7 +475,7 @@ extern "C" {
         } // for
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -570,7 +543,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -597,7 +570,7 @@ extern "C" {
             if (F_status_is_error(status)) {
               fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-              f_file_stream_flush(&file);
+              f_file_stream_flush(file);
               f_file_stream_close(&file);
 
               break;
@@ -618,7 +591,7 @@ extern "C" {
               if (F_status_is_error(status)) break;
             } // for
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             if (F_status_is_error(status)) {
index 1a7c657057a0602a9833ac79288ef70c5949972b..bbdd1bf07e414987fd91773ee793c89a65a1f28d 100644 (file)
@@ -91,7 +91,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_extended_read_main_
-  extern f_status_t fss_extended_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_extended_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_extended_read_main_
 
 #ifdef __cplusplus
index ca654302d622e8844d389ceb1b1467e16c2adbca..95d7a453c3659cff812dbf73fa491c7417009879 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_extended_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_extended_read_main(&data, &arguments);
+  const f_status_t status = fss_extended_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index dd87c480516b819e080a284c2e430218957e2452..7b6720a8956a5de524c35df2038daff46db3d7fb 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_extended_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 4e3b7b9b85abeb33b76a0285b076cfd243b324ce..3ba6427dbdae97e502aed65ea8261c49b04e152a 100644 (file)
@@ -165,6 +165,8 @@ extern "C" {
     fss_extended_write_parameter_verbosity_verbose_e,
     fss_extended_write_parameter_verbosity_debug_e,
     fss_extended_write_parameter_version_e,
+    fss_extended_write_parameter_line_first_no_e,
+    fss_extended_write_parameter_line_last_no_e,
 
     fss_extended_write_parameter_file_e,
     fss_extended_write_parameter_content_e,
@@ -179,28 +181,31 @@ extern "C" {
 
   #define fss_extended_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_file_s.string, fss_extended_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_content_s.string, fss_extended_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_double_s.string, fss_extended_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_ignore_s.string, fss_extended_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_object_s.string, fss_extended_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_partial_s.string, fss_extended_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_prepend_s.string, fss_extended_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_single_s.string, fss_extended_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_extended_write_short_trim_s.string, fss_extended_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_file_s.string, fss_extended_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_content_s.string, fss_extended_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_double_s.string, fss_extended_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_ignore_s.string, fss_extended_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_object_s.string, fss_extended_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_partial_s.string, fss_extended_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_prepend_s.string, fss_extended_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_single_s.string, fss_extended_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_extended_write_short_trim_s.string, fss_extended_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_extended_write_total_parameters_d 18
+  #define fss_extended_write_total_parameters_d 20
 #endif // _di_fss_extended_write_parameters_
 
 #ifdef __cplusplus
index 12f2f30683f8619a60132236cbed8fb870dd0b57..9ecf12e97bc816b5c79a1375525918d3a4ad0f0c 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_extended_write_program_name_long_s, fss_extended_write_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -38,7 +33,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_extended_write_program_name_s, f_string_empty_s);
 
-    fl_print_format("  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, f_string_eol_s, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
     fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
@@ -49,8 +44,13 @@ extern "C" {
     fl_print_format(" does nothing.%r%r", file.stream, 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", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, context.set.notable, f_string_eol_s);
-    fl_print_format("  This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This parameter requires two values.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -58,77 +58,50 @@ extern "C" {
 #endif // _di_fss_extended_write_print_help_
 
 #ifndef _di_fss_extended_write_main_
-  f_status_t fss_extended_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_extended_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_extended_write_parameter_no_color_e, fss_extended_write_parameter_light_e, fss_extended_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_extended_write_parameter_no_color_e, fss_extended_write_parameter_light_e, fss_extended_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_extended_write_parameter_verbosity_quiet_e, fss_extended_write_parameter_verbosity_error_e, fss_extended_write_parameter_verbosity_normal_e, fss_extended_write_parameter_verbosity_verbose_e, fss_extended_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_extended_write_parameter_verbosity_quiet_e, fss_extended_write_parameter_verbosity_error_e, fss_extended_write_parameter_verbosity_verbose_e, fss_extended_write_parameter_verbosity_debug_e, fss_extended_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_extended_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_extended_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_extended_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_extended_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_extended_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -280,7 +253,7 @@ extern "C" {
           }
         }
       }
-      else if (!main->process_pipe) {
+      else if (!(main->pipe & fll_program_data_pipe_input_e)) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
 
@@ -296,7 +269,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         if (main->parameters.array[fss_extended_write_parameter_partial_e].result == f_console_result_found_e) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
             flockfile(main->error.to.stream);
@@ -426,7 +399,7 @@ extern "C" {
     if (F_status_is_error_not(status)) {
       f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         status = fss_extended_write_process_pipe(main, output, quote, &buffer);
 
         if (F_status_is_error(status)) {
@@ -574,7 +547,7 @@ extern "C" {
     }
 
     if (main->parameters.array[fss_extended_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&output);
+      f_file_stream_flush(output);
       f_file_stream_close(&output);
     }
 
index be78bb58e9ca3ad9d930720988ecdbfab6c6ff0f..b444dfd30d12294f1b9ea976a743ee12bdcc6756 100644 (file)
@@ -84,7 +84,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_extended_write_main_
-  extern f_status_t fss_extended_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_extended_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_extended_write_main_
 
 #ifdef __cplusplus
index cd8acc425a7d39a06e578f00b28f027f4c5a9c61..48d1286f8d83004c8dd89175e3f8f7215c6080ce 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_extended_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_extended_write_main(&data, &arguments);
+  const f_status_t status = fss_extended_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 4b11c00d404df626f5baa91779a6e43b6aa4c61d..151ed40043705b73e15634e04c96514e571375c6 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_extended_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 0fac600bb91853a4c35ef0fe4a537885aae31286..38764dd3a4d5b252a32b085d3a118f5f19f8fb12 100644 (file)
@@ -117,6 +117,8 @@ extern "C" {
     fss_identify_parameter_verbosity_verbose_e,
     fss_identify_parameter_verbosity_debug_e,
     fss_identify_parameter_version_e,
+    fss_identify_parameter_line_first_no_e,
+    fss_identify_parameter_line_last_no_e,
 
     fss_identify_parameter_content_e,
     fss_identify_parameter_line_e,
@@ -127,24 +129,27 @@ extern "C" {
 
   #define fss_identify_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_identify_short_content_s.string, fss_identify_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_identify_short_line_s.string, fss_identify_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_identify_short_name_s.string, fss_identify_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_identify_short_object_s.string, fss_identify_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_identify_short_total_s.string, fss_identify_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_identify_short_content_s.string, fss_identify_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_identify_short_line_s.string, fss_identify_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_identify_short_name_s.string, fss_identify_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_identify_short_object_s.string, fss_identify_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_identify_short_total_s.string, fss_identify_long_total_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_identify_total_parameters_d 15
+  #define fss_identify_total_parameters_d 17
 #endif // _di_fss_identify_parameters_
 
 #ifdef __cplusplus
index f2b1d2953a0fd51e50b2bd10f0c940f3415b64c7..f42a1ffdf94afead6aa33d2ff792d6ba91bb0969 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_identify_program_name_long_s, fss_identify_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -37,7 +32,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_identify_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format("  The %[%r%r%] parameter refers to the file lines and not the lines in a given file.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format("%r  The %[%r%r%] parameter refers to the file lines and not the lines in a given file.%r%r", file.stream, f_string_eol_s, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, context.set.notable, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  If neither the %[%r%r%] nor", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_object_s, context.set.notable);
     fl_print_format(" %[%r%r%] are specified, then the default behavior is to print both.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_identify_long_content_s, context.set.notable, f_string_eol_s, f_string_eol_s);
@@ -50,8 +45,13 @@ extern "C" {
     fl_print_format(" where the Object, is a machine-name representing the name and may only consist of \"word\" characters and the Content is a 4-digit hexidecimal number representing a particular variant of the Object.%r", file.stream, f_string_eol_s);
     fl_print_format("  This identifier, if provided, must exist on the first line in a file and must begin with the pound character: '#'.%r", file.stream, f_string_eol_s);
     fl_print_format("  Whitespace must follow this pound character.%r", file.stream, f_string_eol_s);
-    fl_print_format("  There may be multiple Object and Content pairs, separated by white space, such as: \"# fss-0002 fss-0000 iki-0002\".%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  There may be multiple Object and Content pairs, separated by white space, such as: \"# fss-0002 fss-0000 iki-0002\".%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -59,84 +59,50 @@ extern "C" {
 #endif // _di_fss_identify_print_help_
 
 #ifndef _di_fss_identify_main_
-  f_status_t fss_identify_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_identify_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_identify_parameter_no_color_e, fss_identify_parameter_light_e, fss_identify_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
-
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_identify_parameter_no_color_e, fss_identify_parameter_light_e, fss_identify_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-      if (F_status_is_error(status)) {
-        if (main->error.verbosity != f_console_verbosity_quiet_e) {
-          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
-          fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
+          return;
         }
-
-        return F_status_set_error(status);
       }
-    }
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_identify_parameter_verbosity_quiet_e, fss_identify_parameter_verbosity_error_e, fss_identify_parameter_verbosity_normal_e, fss_identify_parameter_verbosity_verbose_e, fss_identify_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_identify_parameter_verbosity_quiet_e, fss_identify_parameter_verbosity_error_e, fss_identify_parameter_verbosity_verbose_e, fss_identify_parameter_verbosity_debug_e, fss_identify_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_identify_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_identify_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_identify_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_identify_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_identify_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -271,7 +237,7 @@ extern "C" {
     f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
     f_file_t file = f_file_t_initialize;
 
-    if (F_status_is_error_not(status) && main->process_pipe) {
+    if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
       file.id = F_type_descriptor_input_d;
       file.stream = F_type_input_d;
       file.size_read = 512;
@@ -319,7 +285,7 @@ extern "C" {
           }
         }
 
-        f_file_stream_flush(&file);
+        f_file_stream_flush(file);
         f_file_stream_close(&file);
 
         if (F_status_is_error(status)) break;
index 22e608fca30ae0977a7dfd5cadd970a9f0b0a445..501d1576bd3bbbb256ee1bfdeeb3364ee0b785e0 100644 (file)
@@ -89,7 +89,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_identify_main_
-  extern f_status_t fss_identify_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_identify_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_identify_main_
 
 #ifdef __cplusplus
index a8274e2d371c77ba5c460f222813d498df091113..1b697b8020cd67e92425579dd172bc6aeb71383b 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_identify_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_identify_main(&data, &arguments);
+  const f_status_t status = fss_identify_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index a6d1206050f71376966f2cc6cbe671391904431f..a016bd40fb619264c7aa27ce395fc72689828101 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_identify
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 6224e2659391065fad56942a1aa9b22d1bdf27de..186be3c4b8e50fad2413e223186c28b352ca7715 100644 (file)
@@ -189,6 +189,8 @@ extern "C" {
     fss_payload_read_parameter_verbosity_verbose_e,
     fss_payload_read_parameter_verbosity_debug_e,
     fss_payload_read_parameter_version_e,
+    fss_payload_read_parameter_line_first_no_e,
+    fss_payload_read_parameter_line_last_no_e,
 
     fss_payload_read_parameter_at_e,
     fss_payload_read_parameter_content_e,
@@ -208,33 +210,36 @@ extern "C" {
 
   #define fss_payload_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_at_s.string, fss_payload_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_content_s.string, fss_payload_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_columns_s.string, fss_payload_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_delimit_s.string, fss_payload_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_depth_s.string, fss_payload_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_empty_s.string, fss_payload_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_line_s.string, fss_payload_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_name_s.string, fss_payload_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_object_s.string, fss_payload_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_pipe_s.string, fss_payload_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_original_s.string, fss_payload_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_select_s.string, fss_payload_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_total_s.string, fss_payload_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_read_short_trim_s.string, fss_payload_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_at_s.string, fss_payload_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_content_s.string, fss_payload_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_columns_s.string, fss_payload_read_long_columns_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_delimit_s.string, fss_payload_read_long_delimit_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_depth_s.string, fss_payload_read_long_depth_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_empty_s.string, fss_payload_read_long_empty_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_line_s.string, fss_payload_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_name_s.string, fss_payload_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_object_s.string, fss_payload_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_pipe_s.string, fss_payload_read_long_pipe_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_original_s.string, fss_payload_read_long_original_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_select_s.string, fss_payload_read_long_select_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_total_s.string, fss_payload_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_read_short_trim_s.string, fss_payload_read_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_payload_read_total_parameters_d 24
+  #define fss_payload_read_total_parameters_d 26
 #endif // _di_fss_payload_read_parameters_
 
 /**
index c2a9e2162395d0e5fa42864e9f1b64433e101988..01cfa0cf04ffdcd0b3f0ba331ec5989ca33b317b 100644 (file)
@@ -21,18 +21,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_payload_read_program_name_long_s, fss_payload_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -53,7 +48,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_payload_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
 
     fl_print_format("  This program will print the Content associated with the given Object and Content main based on the FSS-000E Payload standard.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
@@ -129,8 +124,13 @@ extern "C" {
     fl_print_format("  The Content of the explicit Object of", file.stream);
     fl_print_format(" '%[%r%]'", file.stream, context.set.notable, f_fss_string_payload_s, context.set.notable, f_string_eol_s);
     fl_print_format(" will not contain any Content close pipe control codes when using", file.stream);
-    fl_print_format(" %[%r%r%].%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format(" %[%r%r%].%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, context.set.notable, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -138,77 +138,50 @@ extern "C" {
 #endif // _di_fss_payload_read_print_help_
 
 #ifndef _di_fss_payload_read_main_
-  f_status_t fss_payload_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_payload_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_payload_read_parameter_no_color_e, fss_payload_read_parameter_light_e, fss_payload_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = { ids, 3 };
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_payload_read_parameter_no_color_e, fss_payload_read_parameter_light_e, fss_payload_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_payload_read_parameter_verbosity_quiet_e, fss_payload_read_parameter_verbosity_error_e, fss_payload_read_parameter_verbosity_normal_e, fss_payload_read_parameter_verbosity_verbose_e, fss_payload_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_payload_read_parameter_verbosity_quiet_e, fss_payload_read_parameter_verbosity_error_e, fss_payload_read_parameter_verbosity_verbose_e, fss_payload_read_parameter_verbosity_debug_e, fss_payload_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_payload_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_payload_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_payload_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_payload_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_payload_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -238,7 +211,7 @@ extern "C" {
     data.files.array[0].range.start = 1;
     data.files.array[0].range.stop = 0;
 
-    if (main->parameters.remaining.used || main->process_pipe) {
+    if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
       {
         const f_array_length_t parameter_code[] = {
           fss_payload_read_parameter_at_e,
@@ -534,7 +507,7 @@ extern "C" {
         } // for
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -602,7 +575,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -629,7 +602,7 @@ extern "C" {
             if (F_status_is_error(status)) {
               fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-              f_file_stream_flush(&file);
+              f_file_stream_flush(file);
               f_file_stream_close(&file);
 
               break;
@@ -650,7 +623,7 @@ extern "C" {
               if (F_status_is_error(status)) break;
             } // for
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             if (F_status_is_error(status)) {
index c317d33b628fc854637300a74ae403d9d2b0f0b4..1aaca7ea4e712ef64fed92fa4204fd6724b5a43e 100644 (file)
@@ -92,7 +92,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_payload_read_main_
-  extern f_status_t fss_payload_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_payload_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_payload_read_main_
 
 #ifdef __cplusplus
index b908e0e6de2b0092bada4c904ae721a82b9d606d..c4e4387a7959395d7d7edefbac247c8b909dea2a 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_payload_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_payload_read_main(&data, &arguments);
+  const f_status_t status = fss_payload_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index b0e12b9edc7ee9751d67f2e207795f600aff86d3..cb89eb06ff8780c9fdbcafb0bfb9657a0563cca3 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_payload_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index f5475859241aa4fdc89ac41c3dd04d62c34c005a..5f8126f9516b061143b386b97a26f86dfa39c2e4 100644 (file)
@@ -153,6 +153,8 @@ extern "C" {
     fss_payload_write_parameter_verbosity_verbose_e,
     fss_payload_write_parameter_verbosity_debug_e,
     fss_payload_write_parameter_version_e,
+    fss_payload_write_parameter_line_first_no_e,
+    fss_payload_write_parameter_line_last_no_e,
 
     fss_payload_write_parameter_file_e,
     fss_payload_write_parameter_content_e,
@@ -167,28 +169,31 @@ extern "C" {
 
   #define fss_payload_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, F_false, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_file_s.string, fss_payload_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_content_s.string, fss_payload_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_double_s.string, fss_payload_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_ignore_s.string, fss_payload_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_object_s.string, fss_payload_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_partial_s.string, fss_payload_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_prepend_s.string, fss_payload_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_single_s.string, fss_payload_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_payload_write_short_trim_s.string, fss_payload_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_file_s.string, fss_payload_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_content_s.string, fss_payload_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_double_s.string, fss_payload_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_ignore_s.string, fss_payload_write_long_ignore_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_object_s.string, fss_payload_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_partial_s.string, fss_payload_write_long_partial_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_prepend_s.string, fss_payload_write_long_prepend_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_single_s.string, fss_payload_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_payload_write_short_trim_s.string, fss_payload_write_long_trim_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_payload_write_total_parameters_d 19
+  #define fss_payload_write_total_parameters_d 21
 #endif // _di_fss_payload_write_parameters_
 
 #ifdef __cplusplus
index 1534628ed058beccfb8bac1e0b025925494189a6..1cc34ec241a94cf31a9acb03deb0ff456e55cadb 100644 (file)
@@ -20,18 +20,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_payload_write_program_name_long_s, fss_payload_write_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -47,7 +42,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_payload_write_program_name_s, f_string_empty_s);
 
-    fl_print_format("  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
+    fl_print_format("%r  The pipe uses the Backspace character '%[\\b%]' (%[U+0008%]) to designate the start of a Content.%r", file.stream, f_string_eol_s, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.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", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s);
     fl_print_format("  For the pipe, an Object is terminated by either a Backspace character '%[\\b%]' (%[U+0008%])", file.stream, context.set.notable, context.set.notable, context.set.notable, context.set.notable);
@@ -58,8 +53,13 @@ extern "C" {
     fl_print_format(" and '%[%r%r%]' do nothing.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_double_s, context.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", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, context.set.notable, f_string_eol_s);
-    fl_print_format("  This parameter requires two values.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  This parameter requires two values.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -67,77 +67,50 @@ extern "C" {
 #endif // _di_fss_payload_write_print_help_
 
 #ifndef _di_fss_payload_write_main_
-  f_status_t fss_payload_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_payload_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_payload_write_parameter_no_color_e, fss_payload_write_parameter_light_e, fss_payload_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    setting->status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(setting->status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_payload_write_parameter_no_color_e, fss_payload_write_parameter_light_e, fss_payload_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
-
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_payload_write_parameter_verbosity_quiet_e, fss_payload_write_parameter_verbosity_error_e, fss_payload_write_parameter_verbosity_normal_e, fss_payload_write_parameter_verbosity_verbose_e, fss_payload_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_payload_write_parameter_verbosity_quiet_e, fss_payload_write_parameter_verbosity_error_e, fss_payload_write_parameter_verbosity_verbose_e, fss_payload_write_parameter_verbosity_debug_e, fss_payload_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == fss_payload_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_payload_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_payload_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_payload_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_payload_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -277,7 +250,7 @@ extern "C" {
           }
         }
       }
-      else if (!main->process_pipe) {
+      else if (!(main->pipe & fll_program_data_pipe_input_e)) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
 
@@ -293,7 +266,7 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
 
-      if (F_status_is_error_not(status) && main->process_pipe) {
+      if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
         if (main->parameters.array[fss_payload_write_parameter_partial_e].result == f_console_result_found_e) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
             flockfile(main->error.to.stream);
@@ -420,7 +393,7 @@ extern "C" {
     if (F_status_is_error_not(status)) {
       f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         status = fss_payload_write_process_pipe(main, output, quote, &buffer);
 
         if (F_status_is_error(status)) {
@@ -518,7 +491,7 @@ extern "C" {
     }
 
     if (main->parameters.array[fss_payload_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&output);
+      f_file_stream_flush(output);
       f_file_stream_close(&output);
     }
 
index b7fecdd0e82525333a279d09f81788028cd62cfe..da56d81667e456ee6f6d1404a4110b70463f7d49 100644 (file)
@@ -84,7 +84,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_payload_write_main_
-  extern f_status_t fss_payload_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_payload_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_payload_write_main_
 
 #ifdef __cplusplus
index 56c7ca2d14449a27d04ec94ca9a37ce0724a3aa4..5a9452cf1e11f0743ec88b0e08cd41da6f7c2a5e 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_payload_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_payload_write_main(&data, &arguments);
+  const f_status_t status = fss_payload_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 095c0a2c670b180726f93da1e839c6e96df7d93e..84c0b5ae1ac5f2d7e7df675bbfad7cab8664b0ab 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_payload_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index dd90b5bc76bd40a0f5b314e3e68b1de36bcbd648..5f531b766b2f2a98f422c68e42688a2d2df53aaa 100644 (file)
@@ -121,6 +121,8 @@ extern "C" {
     fss_status_code_parameter_verbosity_verbose_e,
     fss_status_code_parameter_verbosity_debug_e,
     fss_status_code_parameter_version_e,
+    fss_status_code_parameter_line_first_no_e,
+    fss_status_code_parameter_line_last_no_e,
 
     fss_status_code_parameter_fine_e,
     fss_status_code_parameter_warning_e,
@@ -130,23 +132,26 @@ extern "C" {
 
   #define fss_status_code_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(fss_status_code_short_fine_s.string, fss_status_code_long_fine_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_status_code_short_warning_s.string, fss_status_code_long_warning_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_status_code_short_error_s.string, fss_status_code_long_error_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(fss_status_code_short_number_s.string, fss_status_code_long_number_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(fss_status_code_short_fine_s.string, fss_status_code_long_fine_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_status_code_short_warning_s.string, fss_status_code_long_warning_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_status_code_short_error_s.string, fss_status_code_long_error_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(fss_status_code_short_number_s.string, fss_status_code_long_number_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define fss_status_code_total_parameters_d 14
+  #define fss_status_code_total_parameters_d 16
 #endif // _di_fss_status_code_defines_
 
 #ifdef __cplusplus
index a880d7aeaa2726929ae4f199b71cfc5cba886b0a..c84f07c1cd8129c4068d41642a8072c6dc25909c 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, fss_status_code_program_name_long_s, fss_status_code_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -33,6 +28,11 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, fss_status_code_program_name_s, fss_status_code_program_help_parameters_s);
 
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -40,77 +40,50 @@ extern "C" {
 #endif // _di_fss_status_code_print_help_
 
 #ifndef _di_fss_status_code_main_
-  f_status_t fss_status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t fss_status_code_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { fss_status_code_parameter_no_color_e, fss_status_code_parameter_light_e, fss_status_code_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { fss_status_code_parameter_no_color_e, fss_status_code_parameter_light_e, fss_status_code_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { fss_status_code_parameter_verbosity_quiet_e, fss_status_code_parameter_verbosity_error_e, fss_status_code_parameter_verbosity_verbose_e, fss_status_code_parameter_verbosity_debug_e, fss_status_code_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { fss_status_code_parameter_verbosity_quiet_e, fss_status_code_parameter_verbosity_error_e, fss_status_code_parameter_verbosity_normal_e, fss_status_code_parameter_verbosity_verbose_e, fss_status_code_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 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 };
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-        return status;
-      }
-
-      if (choice == fss_status_code_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == fss_status_code_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == fss_status_code_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == fss_status_code_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == fss_status_code_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -169,7 +142,7 @@ extern "C" {
       return F_status_set_error(status);
     }
 
-    if (main->parameters.remaining.used == 0 && !main->process_pipe) {
+    if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) {
       fll_print_format("%[You failed to specify an error code.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
 
       return F_status_set_error(F_parameter);
@@ -178,7 +151,7 @@ extern "C" {
     f_status_t status2 = F_none;
 
     if (main->parameters.array[fss_status_code_parameter_number_e].result == f_console_result_found_e) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         // @todo call fss_status_code_process_number() here for all main from pipe that is space separated.
       }
 
@@ -210,7 +183,7 @@ extern "C" {
       }
     }
     else if (main->parameters.array[fss_status_code_parameter_error_e].result == f_console_result_found_e || main->parameters.array[fss_status_code_parameter_warning_e].result == f_console_result_found_e || main->parameters.array[fss_status_code_parameter_fine_e].result == f_console_result_found_e) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         // @todo call fss_status_code_process_check() here for all main from pipe that is space separated.
       }
 
@@ -242,7 +215,7 @@ extern "C" {
       }
     }
     else {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         // @todo call fss_status_code_process_normal() here for all main from pipe that is space separated.
       }
 
index dc6f69eaf9850091c5a8271206f757208329af2f..be8a2ce41cec683167776b10b0d80deda78efd9e 100644 (file)
@@ -86,7 +86,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fss_status_code_main_
-  extern f_status_t fss_status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t fss_status_code_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_fss_status_code_main_
 
 #ifdef __cplusplus
index 387dd27312a89f52cf999c5a4cc087cd64674aed..3cff8f6899f3aa5dbd242f66d9b9bff4e2f9bc50 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = fss_status_code_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = fss_status_code_main(&data, &arguments);
+  const f_status_t status = fss_status_code_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status) || status == F_false) return 1;
 
index c67be3706a7bc18bf18ab3816799e2af8469dbce..703e58072dbbad9e5b846aeb279c248acf9297bd 100644 (file)
@@ -3,7 +3,7 @@
 build_name fss_status_code
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index b5b5a4c2fc26a8720e2e85ef185f74f6907bca5c..945aa8bd81442b7044b8d605cb8df2c60313a83d 100644 (file)
@@ -160,6 +160,8 @@ extern "C" {
     iki_read_parameter_verbosity_verbose_e,
     iki_read_parameter_verbosity_debug_e,
     iki_read_parameter_version_e,
+    iki_read_parameter_line_first_no_e,
+    iki_read_parameter_line_last_no_e,
 
     iki_read_parameter_at_e,
     iki_read_parameter_content_e,
@@ -176,30 +178,34 @@ extern "C" {
 
   #define iki_read_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_at_s.string, iki_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_content_s.string, iki_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_line_s.string, iki_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_literal_s.string, iki_read_long_literal_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_name_s.string, iki_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_object_s.string, iki_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_replace_s.string, iki_read_long_replace_s.string, 0, 2, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_substitute_s.string, iki_read_long_substitute_s.string, 0, 3, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_total_s.string, iki_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_whole_s.string, iki_read_long_whole_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_read_short_wrap_s.string, iki_read_long_wrap_s.string, 0, 3, f_console_type_normal_e), \
+      mac
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(iki_read_short_at_s.string, iki_read_long_at_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_content_s.string, iki_read_long_content_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_line_s.string, iki_read_long_line_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_literal_s.string, iki_read_long_literal_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_name_s.string, iki_read_long_name_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_object_s.string, iki_read_long_object_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_replace_s.string, iki_read_long_replace_s.string, 0, 2, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_substitute_s.string, iki_read_long_substitute_s.string, 0, 3, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_total_s.string, iki_read_long_total_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_whole_s.string, iki_read_long_whole_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_read_short_wrap_s.string, iki_read_long_wrap_s.string, 0, 3, f_console_type_normal_e), \
     }
 
-  #define iki_read_total_parameters_d 21
+  #define iki_read_total_parameters_d 23
 #endif // _di_iki_read_parameters_
 
 #ifndef _di_iki_read_substitution_t_
index ad8981c511f294dcde5601633d5d5054e3b182bb..927eea770f5f63c8651fb8c2cfac200511145cfe 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, iki_read_program_name_long_s, iki_read_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -46,7 +41,7 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, iki_read_program_name_s, fll_program_parameter_filenames_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.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", file.stream, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  The %[%r%r%] option requires 2 additional parameters:", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_replace_s, context.set.notable);
@@ -91,8 +86,13 @@ extern "C" {
     fl_print_format("  The %[%r%r%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_wrap_s, context.set.notable);
     fl_print_format(" option is ignored when the %[%r%r%] option is matching the same variable.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.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%r", file.stream, 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", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -100,85 +100,50 @@ extern "C" {
 #endif // _di_iki_read_print_help_
 
 #ifndef _di_iki_read_main_
-  f_status_t iki_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t iki_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { iki_read_parameter_no_color_e, iki_read_parameter_light_e, iki_read_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
-
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
-
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { iki_read_parameter_no_color_e, iki_read_parameter_light_e, iki_read_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        if (main->error.verbosity == f_console_verbosity_verbose_e) {
-          fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
+          return;
         }
-
-        return F_status_set_error(status);
       }
-    }
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { iki_read_parameter_verbosity_quiet_e, iki_read_parameter_verbosity_error_e, iki_read_parameter_verbosity_normal_e, iki_read_parameter_verbosity_verbose_e, iki_read_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { iki_read_parameter_verbosity_quiet_e, iki_read_parameter_verbosity_error_e, iki_read_parameter_verbosity_verbose_e, iki_read_parameter_verbosity_debug_e, iki_read_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == iki_read_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == iki_read_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == iki_read_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == iki_read_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == iki_read_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -204,7 +169,7 @@ extern "C" {
       return F_none;
     }
 
-    if (main->parameters.remaining.used > 0 || main->process_pipe) {
+    if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) {
       if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_found_e) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
@@ -408,7 +373,7 @@ extern "C" {
         return F_status_set_error(F_parameter);
       }
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         f_file_t file = f_file_t_initialize;
 
         file.id = F_type_descriptor_input_d;
@@ -464,7 +429,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -472,7 +437,7 @@ extern "C" {
 
           // Skip past empty files.
           if (!size_file) {
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             continue;
@@ -494,7 +459,7 @@ extern "C" {
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, data.argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
 
-            f_file_stream_flush(&file);
+            f_file_stream_flush(file);
             f_file_stream_close(&file);
 
             break;
@@ -515,7 +480,7 @@ extern "C" {
             if (F_status_is_error(status)) break;
           } // for
 
-          f_file_stream_flush(&file);
+          f_file_stream_flush(file);
           f_file_stream_close(&file);
 
           if (F_status_is_error(status)) {
index af94894a3ccad65b72c5e809974149a253d384c5..79d0f5f385a86821afdfcf674079cd5c9805853c 100644 (file)
@@ -94,7 +94,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_iki_read_main_
-  extern f_status_t iki_read_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t iki_read_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_iki_read_main_
 
 #ifdef __cplusplus
index edff724b60dac51958c6af74b75b541f93261027..56ed1be02fb5c6f98696680f56739bb739545d61 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = iki_read_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = iki_read_main(&data, &arguments);
+  const f_status_t status = iki_read_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 5c82ebe44f27da0c5799c8490cd610924768b0ff..f3e93fd0922f91d6b7baa5ee589d92263e02a925 100644 (file)
@@ -3,7 +3,7 @@
 build_name iki_read
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 8ee5b10413fa0bae8f6e5790b9caf92758ac8a2c..c2562cecf06a59bebb7e84556cb25fe220806596 100644 (file)
@@ -117,6 +117,8 @@ extern "C" {
     iki_write_parameter_verbosity_verbose_e,
     iki_write_parameter_verbosity_debug_e,
     iki_write_parameter_version_e,
+    iki_write_parameter_line_first_no_e,
+    iki_write_parameter_line_last_no_e,
 
     iki_write_parameter_file_e,
     iki_write_parameter_content_e,
@@ -127,24 +129,27 @@ extern "C" {
 
   #define iki_write_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(iki_write_short_file_s.string, iki_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_write_short_content_s.string, iki_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_write_short_double_s.string, iki_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_write_short_object_s.string, iki_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(iki_write_short_single_s.string, iki_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(iki_write_short_file_s.string, iki_write_long_file_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_write_short_content_s.string, iki_write_long_content_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_write_short_double_s.string, iki_write_long_double_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_write_short_object_s.string, iki_write_long_object_s.string, 0, 1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(iki_write_short_single_s.string, iki_write_long_single_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define iki_write_total_parameters_d 15
+  #define iki_write_total_parameters_d 17
 #endif // _di_iki_write_parameters_
 
 #ifdef __cplusplus
index e50f74ded4559637023c826d10df397df1d8fb5a..2497a3cb5a3a40f9e93eaa24ba01b96dd8c75fcd 100644 (file)
@@ -11,6 +11,10 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, iki_write_program_name_long_s, iki_write_program_version_s);
 
     fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
@@ -34,14 +38,19 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, iki_write_program_name_s, f_string_empty_s);
 
-    fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
+    fl_print_format("%r %[Notes:%]%r", file.stream, f_string_eol_s, context.set.important, context.set.important, f_string_eol_s);
     fl_print_format("  This program will accept Object and Content strings to generate an IKI string, such as %[object:\"content\"%].%r", file.stream, context.set.notable, context.set.notable, f_string_eol_s);
 
     fl_print_format("  Each object must have a Content (and each Content must have an Object).%r%r", file.stream, f_string_eol_s, f_string_eol_s);
 
     fl_print_format("  When piping main to this program, a single form-feed character (\\f) must be used to separate each Object from each Content.%r", file.stream, f_string_eol_s);
-    fl_print_format("  Furthermore, each Object must be followed by a Content.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  Furthermore, each Object must be followed by a Content.%r", file.stream, f_string_eol_s);
+
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
 
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -49,84 +58,50 @@ extern "C" {
 #endif // _di_iki_write_print_help_
 
 #ifndef _di_iki_write_main_
-  f_status_t iki_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t iki_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { iki_write_parameter_no_color_e, iki_write_parameter_light_e, iki_write_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
-
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { iki_write_parameter_no_color_e, iki_write_parameter_light_e, iki_write_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        fll_program_parameter_process_empty(&main->context, sets);
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-      if (F_status_is_error(status)) {
-        if (main->error.verbosity != f_console_verbosity_quiet_e) {
-          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
-          f_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
+          return;
         }
-
-        return F_status_set_error(status);
       }
-    }
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { iki_write_parameter_verbosity_quiet_e, iki_write_parameter_verbosity_error_e, iki_write_parameter_verbosity_normal_e, iki_write_parameter_verbosity_verbose_e, iki_write_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { iki_write_parameter_verbosity_quiet_e, iki_write_parameter_verbosity_error_e, iki_write_parameter_verbosity_verbose_e, iki_write_parameter_verbosity_debug_e, iki_write_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        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 };
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-        return status;
-      }
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-      if (choice == iki_write_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == iki_write_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == iki_write_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == iki_write_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == iki_write_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -229,7 +204,7 @@ extern "C" {
       status = F_status_set_error(F_parameter);
     }
 
-    if (F_status_is_error_not(status) && !main->process_pipe) {
+    if (F_status_is_error_not(status) && !(main->pipe & fll_program_data_pipe_input_e)) {
       if (main->parameters.array[iki_write_parameter_object_e].result != f_console_result_additional_e && main->parameters.array[iki_write_parameter_content_e].result != f_console_result_additional_e) {
         if (main->error.verbosity != f_console_verbosity_quiet_e) {
           flockfile(main->error.to.stream);
@@ -283,7 +258,7 @@ extern "C" {
     if (F_status_is_error_not(status)) {
       f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
 
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         f_file_t pipe = f_file_t_initialize;
 
         pipe.id = F_type_descriptor_input_d;
@@ -455,7 +430,7 @@ extern "C" {
     }
 
     if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_additional_e) {
-      f_file_stream_flush(&file);
+      f_file_stream_flush(file);
       f_file_stream_close(&file);
     }
 
index d254f9231cb1b9bb9cca120bb1c05a97db869a37..58fab705b460fb17a1c97b5a43cd00fa4a66d5b6 100644 (file)
@@ -94,7 +94,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_iki_write_main_
-  extern f_status_t iki_write_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t iki_write_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_iki_write_main_
 
 #ifdef __cplusplus
index 4b140dcfa4eaa79705d6fd641c17135b81dacf34..f6b68d1fd9696d0075ba95197cd0df9637464acf 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = iki_write_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = iki_write_main(&data, &arguments);
+  const f_status_t status = iki_write_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 28c197641361d325496dea690e8e523a9fd0d3f1..0cc2b77dd0c2b22b6bdb57cbefadb27284556f99 100644 (file)
@@ -54,7 +54,7 @@ extern "C" {
       return F_status_set_error(F_failure);
     }
 
-    fl_print_format("%Q%r%r%Q%r", output.stream, object, f_iki_syntax_separator_s, data->quote, *escaped, data->quote);
+    fl_print_format("%Q%r%r%Q%r", output, object, f_iki_syntax_separator_s, data->quote, *escaped, data->quote);
 
     return F_none;
   }
index e473975939216c2cc116ff18ba454dbbde569b33..4f280213e338c2131699df5c61fca4d3110fa115 100644 (file)
@@ -3,7 +3,7 @@
 build_name iki_write
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index 09ab645ae9f8ec0fce7463e3b7a1043845b24539..1d77a4b7905b533004f0948837ade039b9cd7ae0 100644 (file)
@@ -121,6 +121,8 @@ extern "C" {
     status_code_parameter_verbosity_verbose_e,
     status_code_parameter_verbosity_debug_e,
     status_code_parameter_version_e,
+    status_code_parameter_line_first_no_e,
+    status_code_parameter_line_last_no_e,
 
     status_code_parameter_fine_e,
     status_code_parameter_warning_e,
@@ -130,23 +132,26 @@ extern "C" {
 
   #define status_code_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(status_code_short_fine_s.string, status_code_long_fine_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(status_code_short_warning_s.string, status_code_long_warning_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(status_code_short_error_s.string, status_code_long_error_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(status_code_short_number_s.string, status_code_long_number_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize2(status_code_short_fine_s.string, status_code_long_fine_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(status_code_short_warning_s.string, status_code_long_warning_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(status_code_short_error_s.string, status_code_long_error_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize2(status_code_short_number_s.string, status_code_long_number_s.string, 0, 0, f_console_type_normal_e), \
     }
 
-  #define status_code_total_parameters_d 14
+  #define status_code_total_parameters_d 16
 #endif // _di_status_code_parameters_
 
 #ifdef __cplusplus
index 9326cb70df32ff555cb3535f5bb32f39196c0818..98802168b84be894f2eb8d6d456efa18a5fdd9aa 100644 (file)
@@ -10,16 +10,16 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
   data.parameters.used = status_code_total_parameters_d;
 
   if (f_pipe_input_exists()) {
-    data.process_pipe = F_true;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  const f_status_t status = status_code_main(&data, &arguments);
+  const f_status_t status = status_code_main(&data, arguments);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
   if (F_status_is_error(status)) return 1;
 
index 8c5ee203eb1042c3351e16d9fdd6f4effaa4a028..620d0e8d3d3b38df131b5a22d6c5b339c1fb7c56 100644 (file)
@@ -11,18 +11,13 @@ extern "C" {
 
     flockfile(file.stream);
 
+    //if (!(setting->flag & XXX_main_flag_line_first_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
     fll_program_print_help_header(file, context, status_code_program_name_long_s, status_code_program_version_s);
 
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
+    fll_program_print_help_option_standard(file, context);
 
     f_print_dynamic_raw(f_string_eol_s, file.stream);
 
@@ -33,6 +28,11 @@ extern "C" {
 
     fll_program_print_help_usage(file, context, status_code_program_name_s, status_code_program_help_parameters_s);
 
+    //if (!(setting->flag & XXX_main_flag_line_last_no_e)) {
+      f_print_dynamic_raw(f_string_eol_s, file.stream);
+    //}
+
+    f_file_stream_flush(file);
     funlockfile(file.stream);
 
     return F_none;
@@ -40,77 +40,50 @@ extern "C" {
 #endif // _di_status_code_print_help_
 
 #ifndef _di_status_code_main_
-  f_status_t status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments) {
+  f_status_t status_code_main(fll_program_data_t * const main, const f_console_arguments_t arguments) {
 
     f_status_t status = F_none;
 
-    {
-      f_console_parameter_id_t ids[3] = { status_code_parameter_no_color_e, status_code_parameter_light_e, status_code_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
+    // Load parameters.
+    status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(status)) return;
 
-      status = fll_program_parameter_process(*arguments, &main->parameters, choices, F_true, &main->context);
+    {
+      f_array_length_t choice = 0;
+      f_uint16s_t choices = f_uint16s_t_initialize;
 
-      main->output.set = &main->context.set;
-      main->error.set = &main->context.set;
-      main->warning.set = &main->context.set;
+      // Identify and prioritize "color context" parameters.
+      {
+        uint16_t choices_array[3] = { status_code_parameter_no_color_e, status_code_parameter_light_e, status_code_parameter_dark_e };
+        choices.array = choices_array;
+        choices.used = 3;
 
-      if (main->context.set.error.before) {
-        main->output.context = f_color_set_empty_s;
-        main->output.notable = main->context.set.notable;
+        const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
 
-        main->error.context = main->context.set.error;
-        main->error.notable = main->context.set.notable;
+        status = fll_program_parameter_process_context(choices, modes, F_true, main);
 
-        main->warning.context = main->context.set.warning;
-        main->warning.notable = main->context.set.notable;
-      }
-      else {
-        f_color_set_t *sets[] = { &main->output.context, &main->output.notable, &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
 
-        fll_program_parameter_process_empty(&main->context, sets);
+          return;
+        }
       }
 
-      if (F_status_is_error(status)) return status;
-    }
+      // Identify and prioritize "verbosity" parameters.
+      {
+        uint16_t choices_array[5] = { status_code_parameter_verbosity_quiet_e, status_code_parameter_verbosity_error_e, status_code_parameter_verbosity_verbose_e, status_code_parameter_verbosity_debug_e, status_code_parameter_verbosity_normal_e };
+        choices.array = choices_array;
+        choices.used = 5;
 
-    // Identify priority of verbosity related parameters.
-    {
-      f_console_parameter_id_t ids[5] = { status_code_parameter_verbosity_quiet_e, status_code_parameter_verbosity_error_e, status_code_parameter_verbosity_normal_e, status_code_parameter_verbosity_verbose_e, status_code_parameter_verbosity_debug_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 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 };
 
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+        status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
 
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+        if (F_status_is_error(status)) {
+          fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
 
-        return status;
-      }
-
-      if (choice == status_code_parameter_verbosity_quiet_e) {
-        main->output.verbosity = f_console_verbosity_quiet_e;
-        main->error.verbosity = f_console_verbosity_quiet_e;
-        main->warning.verbosity = f_console_verbosity_quiet_e;
-      }
-      else if (choice == status_code_parameter_verbosity_error_e) {
-        main->output.verbosity = f_console_verbosity_error_e;
-        main->error.verbosity = f_console_verbosity_error_e;
-        main->warning.verbosity = f_console_verbosity_error_e;
-      }
-      else if (choice == status_code_parameter_verbosity_normal_e) {
-        main->output.verbosity = f_console_verbosity_normal_e;
-        main->error.verbosity = f_console_verbosity_normal_e;
-        main->warning.verbosity = f_console_verbosity_normal_e;
-      }
-      else if (choice == status_code_parameter_verbosity_verbose_e) {
-        main->output.verbosity = f_console_verbosity_verbose_e;
-        main->error.verbosity = f_console_verbosity_verbose_e;
-        main->warning.verbosity = f_console_verbosity_verbose_e;
-      }
-      else if (choice == status_code_parameter_verbosity_debug_e) {
-        main->output.verbosity = f_console_verbosity_debug_e;
-        main->error.verbosity = f_console_verbosity_debug_e;
-        main->warning.verbosity = f_console_verbosity_debug_e;
+          return;
+        }
       }
     }
 
@@ -169,7 +142,7 @@ extern "C" {
       return F_status_set_error(status);
     }
 
-    if (main->parameters.remaining.used == 0 && !main->process_pipe) {
+    if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) {
       fll_print_format("%[You failed to specify a status code.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
 
       return F_status_set_error(F_parameter);
@@ -178,7 +151,7 @@ extern "C" {
     f_status_t status2 = F_none;
 
     if (main->parameters.array[status_code_parameter_number_e].result == f_console_result_found_e) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         // @todo call status_code_process_number() here for all main from pipe that is space separated.
       }
 
@@ -210,7 +183,7 @@ extern "C" {
       }
     }
     else if (main->parameters.array[status_code_parameter_error_e].result == f_console_result_found_e || main->parameters.array[status_code_parameter_warning_e].result == f_console_result_found_e || main->parameters.array[status_code_parameter_fine_e].result == f_console_result_found_e) {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         // @todo call status_code_process_check() here for all main from pipe that is space separated.
       }
 
@@ -242,7 +215,7 @@ extern "C" {
       }
     }
     else {
-      if (main->process_pipe) {
+      if (main->pipe & fll_program_data_pipe_input_e) {
         // @todo call status_code_process_normal() here for all main from pipe that is space separated.
       }
 
index 59683f0e208bf37b9f5825f3fd1db2bdfcb5a94f..a03e99bd313fd5ded73cd3f5ee2057e9bf2b6246 100644 (file)
@@ -85,7 +85,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_status_code_main_
-  extern f_status_t status_code_main(fll_program_data_t * const main, const f_console_arguments_t *arguments);
+  extern f_status_t status_code_main(fll_program_data_t * const main, const f_console_arguments_t arguments);
 #endif // _di_status_code_main_
 
 #ifdef __cplusplus
index 0cdbe79b06772fffb70303ad347b8f491d06cb30..2c0d018c05d0f7d378491b782b2f82192cde39da 100644 (file)
@@ -3,7 +3,7 @@
 build_name status_code
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
index bf06d6049905278208af7c5ea547da5c5e01d87c..e106a7d38a2c9605303058da43d6e4f56a1813b9 100644 (file)
@@ -71,6 +71,352 @@ extern "C" {
   const f_string_static_t utf8_long_to_width_s = macro_f_string_static_t_initialize(UTF8_long_to_width_s, 0, UTF8_long_to_width_s_length);
 #endif // _di_utf8_parameters_
 
+#ifndef _di_utf8_setting_delete_
+  f_status_t utf8_setting_delete(utf8_setting_t * const setting) {
+
+    f_string_dynamics_resize(0, &setting->path_files_from);
+    f_string_dynamics_resize(0, &setting->path_files_to);
+
+    return F_none;
+  }
+#endif // _di_utf8_setting_delete_
+
+#ifndef _di_utf8_setting_load_
+  void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    // Load parameters.
+    setting->status = f_console_parameter_process(arguments, &main->parameters);
+    if (F_status_is_error(setting->status)) 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] = { utf8_parameter_no_color_e, utf8_parameter_light_e, utf8_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)) {
+          fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true);
+
+          return;
+        }
+      }
+
+      if (main->parameters.array[utf8_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[utf8_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] = { utf8_parameter_verbosity_quiet_e, utf8_parameter_verbosity_error_e, utf8_parameter_verbosity_verbose_e, utf8_parameter_verbosity_debug_e, utf8_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)) {
+          fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true);
+
+          return;
+        }
+      }
+
+      if (main->parameters.array[utf8_parameter_help_e].result == f_console_result_found_e) {
+        setting->flag |= utf8_main_flag_help_e;
+
+        return;
+      }
+
+      if (main->parameters.array[utf8_parameter_version_e].result == f_console_result_found_e) {
+        setting->flag |= utf8_main_flag_version_e;
+
+        return;
+      }
+
+      // Identify and prioritize "from" mode parameters.
+      {
+        uint16_t choices_array[2] = { utf8_parameter_from_bytesequence_e, utf8_parameter_from_codepoint_e };
+        choices.array = choices_array;
+        choices.used = 2;
+
+        setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+
+        if (F_status_is_error(setting->status)) {
+          fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
+
+          return;
+        }
+
+        if (choices.array[choice] == utf8_parameter_from_bytesequence_e) {
+          if (setting->mode & utf8_mode_from_codepoint_e) {
+            setting->mode -= utf8_mode_from_codepoint_e;
+          }
+
+          setting->mode |= utf8_mode_from_bytesequence_e;
+        }
+        else if (choices.array[choice] == utf8_parameter_from_codepoint_e) {
+          if (setting->mode & utf8_mode_from_bytesequence_e) {
+            setting->mode -= utf8_mode_from_bytesequence_e;
+          }
+
+          setting->mode |= utf8_mode_from_codepoint_e;
+        }
+      }
+
+      // Identify and prioritize "to" mode parameters.
+      {
+        uint16_t choices_array[4] = { utf8_parameter_to_bytesequence_e, utf8_parameter_to_codepoint_e, utf8_parameter_to_combining_e, utf8_parameter_to_width_e };
+        choices.array = choices_array;
+        choices.used = 4;
+        choice = 1;
+
+        setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
+
+        if (F_status_is_error(setting->status)) {
+          fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
+
+          return;
+        }
+
+        if (choices.array[choice] == utf8_parameter_to_bytesequence_e) {
+          if (setting->mode & utf8_mode_to_codepoint_e) {
+            setting->mode -= utf8_mode_to_codepoint_e;
+          }
+
+          if (setting->mode & utf8_mode_to_combining_e) {
+            setting->mode -= utf8_mode_to_combining_e;
+          }
+
+          if (setting->mode & utf8_mode_to_width_e) {
+            setting->mode -= utf8_mode_to_width_e;
+          }
+
+          setting->mode |= utf8_mode_to_bytesequence_e;
+        }
+        else if (choices.array[choice] == utf8_parameter_to_codepoint_e) {
+          if (setting->mode & utf8_mode_to_bytesequence_e) {
+            setting->mode -= utf8_mode_to_bytesequence_e;
+          }
+
+          if (setting->mode & utf8_mode_to_combining_e) {
+            setting->mode -= utf8_mode_to_combining_e;
+          }
+
+          if (setting->mode & utf8_mode_to_width_e) {
+            setting->mode -= utf8_mode_to_width_e;
+          }
+
+          setting->mode |= utf8_mode_to_codepoint_e;
+        }
+        else if (choices.array[choice] == utf8_parameter_to_combining_e) {
+          if (setting->mode & utf8_mode_to_bytesequence_e) {
+            setting->mode -= utf8_mode_to_bytesequence_e;
+          }
+
+          if (setting->mode & utf8_mode_to_codepoint_e) {
+            setting->mode -= utf8_mode_to_codepoint_e;
+          }
+
+          // --to_width may be specified with --to_combining.
+          if (main->parameters.array[utf8_parameter_to_width_e].result == f_console_result_found_e) {
+            setting->mode |= utf8_mode_to_width_e;
+          }
+
+          setting->mode |= utf8_mode_to_combining_e;
+        }
+        else if (choices.array[choice] == utf8_parameter_to_width_e) {
+          if (setting->mode & utf8_mode_to_bytesequence_e) {
+            setting->mode -= utf8_mode_to_bytesequence_e;
+          }
+
+          if (setting->mode & utf8_mode_to_codepoint_e) {
+            setting->mode -= utf8_mode_to_codepoint_e;
+          }
+
+          // --to_width may be specified with --to_combining.
+          if (main->parameters.array[utf8_parameter_to_combining_e].result == f_console_result_found_e) {
+            setting->mode |= utf8_mode_to_combining_e;
+          }
+
+          setting->mode |= utf8_mode_to_width_e;
+        }
+      }
+    }
+
+    f_string_static_t * const args = main->parameters.arguments.array;
+
+    if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_additional_e) {
+      if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
+        utf8_print_error_parameter_file_to_too_many(main, setting);
+
+        setting->status = F_status_set_error(F_parameter);
+
+        return;
+      }
+
+      if (args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
+        setting->path_files_to.used = 0;
+
+        setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
+        if (F_status_is_error(setting->status)) return;
+
+        setting->path_files_to.array[setting->path_files_to.used].used = 0;
+
+        setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
+        if (F_status_is_error(setting->status)) return;
+
+        ++setting->path_files_to.used;
+
+        setting->status = f_file_stream_open(args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
+
+        if (F_status_is_error(setting->status)) {
+          fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
+
+          return;
+        }
+
+        setting->flag |= utf8_main_flag_file_to_e;
+      }
+      else {
+        utf8_print_error_parameter_file_name_empty(main, setting, main->parameters.array[utf8_parameter_to_file_e].values.array[0]);
+
+        setting->status = F_status_set_error(F_parameter);
+
+        return;
+      }
+    }
+    else if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_found_e) {
+      utf8_print_error_no_value(main, setting, utf8_long_to_file_s);
+
+      setting->status = F_status_set_error(F_parameter);
+
+      return;
+    }
+    else {
+      main->output.to = main->message.to;
+
+      if (setting->flag & utf8_main_flag_file_to_e) {
+        setting->flag -= utf8_main_flag_file_to_e;
+      }
+    }
+
+    if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_additional_e) {
+      setting->path_files_from.used = 0;
+
+      setting->status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from);
+      if (F_status_is_error(setting->status)) return;
+
+      setting->path_files_from.used = main->parameters.array[utf8_parameter_from_file_e].values.used;
+
+      f_array_length_t i = 0;
+      f_array_length_t index = 0;
+
+      for (; i < setting->path_files_from.used; ++i) {
+
+        index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
+        setting->path_files_from.array[i].used = 0;
+
+        setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
+        if (F_status_is_error(setting->status)) return;
+
+        if (args[index].used) {
+          if (f_file_exists(args[index], F_true) != F_true) {
+            utf8_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
+
+            if (F_status_is_error_not(setting->status)) {
+              setting->status = F_status_set_error(F_file_found_not);
+            }
+          }
+        }
+        else {
+          utf8_print_error_parameter_file_name_empty(main, setting, index);
+
+          if (F_status_is_error_not(setting->status)) {
+            setting->status = F_status_set_error(F_parameter);
+          }
+        }
+      } // for
+
+      if (F_status_is_error(setting->status)) return;
+
+      setting->flag |= utf8_main_flag_file_from_e;
+    }
+    else if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_found_e) {
+      utf8_print_error_no_value(main, setting, utf8_long_from_file_s);
+
+      setting->status = F_status_set_error(F_parameter);
+
+      return;
+    }
+    else {
+      if (setting->flag & utf8_main_flag_file_from_e) {
+        setting->flag -= utf8_main_flag_file_from_e;
+      }
+    }
+
+    if (F_status_is_error(setting->status)) return;
+
+    if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
+      utf8_print_error_no_from(main, setting);
+
+      setting->status = F_status_set_error(F_parameter);
+    }
+
+    if (!(setting->mode & utf8_mode_to_bytesequence_e)) {
+      if (main->parameters.array[utf8_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[utf8_parameter_headers_e].result == f_console_result_found_e) {
+        setting->prepend = utf8_string_prepend_padding_s;
+        setting->append = f_string_eol_s;
+      }
+      else {
+        setting->prepend = f_string_space_s;
+      }
+    }
+
+    if (main->parameters.array[utf8_parameter_headers_e].result == f_console_result_found_e) {
+      setting->flag |= utf8_main_flag_header_e;
+    }
+
+    if (main->parameters.array[utf8_parameter_separate_e].result == f_console_result_found_e) {
+      setting->flag |= utf8_main_flag_separate_e;
+    }
+
+    if (main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) {
+      setting->flag |= utf8_main_flag_strip_invalid_e;
+    }
+
+    setting->valid_not = main->message.set->error;
+  }
+#endif // _di_utf8_setting_load_
+
+#ifndef _di_utf8_setting_unload_
+  f_status_t utf8_setting_unload(fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    f_string_dynamic_resize(0, &setting->buffer);
+    f_string_dynamic_resize(0, &setting->text);
+
+    return F_none;
+  }
+#endif // _di_utf8_setting_unload_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index c7672dc8213e8154d6f8688828c165204414ae88..66b55448a00d3ab5a625d733a77d94a4f7d33934 100644 (file)
@@ -248,6 +248,8 @@ extern "C" {
     utf8_parameter_verbosity_verbose_e,
     utf8_parameter_verbosity_debug_e,
     utf8_parameter_version_e,
+    utf8_parameter_line_first_no_e,
+    utf8_parameter_line_last_no_e,
 
     utf8_parameter_from_bytesequence_e,
     utf8_parameter_from_codepoint_e,
@@ -268,31 +270,34 @@ extern "C" {
 
   #define utf8_console_parameter_t_initialize \
     { \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_error_s.string, f_console_standard_long_error_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(f_console_standard_short_version_s.string, f_console_standard_long_version_s.string, 0, 0, f_console_type_inverse_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_from_bytesequence_s.string, utf8_long_from_bytesequence_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_from_codepoint_s.string, utf8_long_from_codepoint_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_from_file_s.string, utf8_long_from_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_headers_s.string, utf8_long_headers_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_separate_s.string, utf8_long_headers_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_strip_invalid_s.string, utf8_long_strip_invalid_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_to_bytesequence_s.string, utf8_long_to_bytesequence_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_to_codepoint_s.string, utf8_long_to_codepoint_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_to_combining_s.string, utf8_long_to_combining_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_to_file_s.string, utf8_long_to_file_s.string, 0, 1, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_to_width_s.string, utf8_long_to_width_s.string, 0, 0, f_console_type_normal_e), \
-      macro_f_console_parameter_t_initialize(utf8_short_verify_s.string, utf8_long_verify_s.string, 0, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_help_s,          f_console_standard_long_help_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_light_s,         f_console_standard_long_light_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_dark_s,          f_console_standard_long_dark_s,          0, f_console_type_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_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_quiet_s,         f_console_standard_long_quiet_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_error_s,         f_console_standard_long_error_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_normal_s,        f_console_standard_long_normal_s,        0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_verbose_s,       f_console_standard_long_verbose_s,       0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_debug_s,         f_console_standard_long_debug_s,         0, f_console_type_inverse_e), \
+      macro_f_console_parameter_t_initialize4(f_console_standard_short_version_s,       f_console_standard_long_version_s,       0, f_console_type_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_type_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_type_inverse_e), \
+      \
+      macro_f_console_parameter_t_initialize4(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_from_codepoint_s,    utf8_long_from_codepoint_s,    0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_from_file_s,         utf8_long_from_file_s,         1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_headers_s,           utf8_long_headers_s,           0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_separate_s,          utf8_long_separate_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_strip_invalid_s,     utf8_long_strip_invalid_s,     0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_to_bytesequence_s,   utf8_long_to_bytesequence_s,   0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_to_codepoint_s,      utf8_long_to_codepoint_s,      0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_to_combining_s,      utf8_long_to_combining_s,      0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_to_file_s,           utf8_long_to_file_s,           1, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_to_width_s,          utf8_long_to_width_s,          0, f_console_type_normal_e), \
+      macro_f_console_parameter_t_initialize4(utf8_short_verify_s,            utf8_long_verify_s,            0, f_console_type_normal_e), \
     }
 
-  #define utf8_total_parameters_d 22
+  #define utf8_total_parameters_d 24
 #endif // _di_utf8_parameters_
 
 /**
@@ -315,59 +320,174 @@ extern "C" {
   enum {
     utf8_mode_none_e              = 0x0,
     utf8_mode_from_bytesequence_e = 0x1,
-    utf8_mode_from_codepoint_d    = 0x2,
-    utf8_mode_to_bytesequence_d   = 0x4,
-    utf8_mode_to_codepoint_d      = 0x8,
-    utf8_mode_to_combining_d      = 0x10,
-    utf8_mode_to_width_d          = 0x20,
+    utf8_mode_from_codepoint_e    = 0x2,
+    utf8_mode_to_bytesequence_e   = 0x4,
+    utf8_mode_to_codepoint_e      = 0x8,
+    utf8_mode_to_combining_e      = 0x10,
+    utf8_mode_to_width_e          = 0x20,
   };
 #endif // _di_utf8_modes_e_
 
 /**
+ * Flags used to represent flags passed to the main function.
+ *
+ * utf8_main_flag_*_e:
+ *   - none:          No modes in use.
+ *   - file_from:     Using a specified source file.
+ *   - file_to:       Using a specified destination file.
+ *   - help:          Print help.
+ *   - header:        Enable printing of headers.
+ *   - separate:      Enable printing of separators.
+ *   - strip_invalid: Using strip invalid character mode.
+ *   - verify:        Using verify mode.
+ *   - version:       Print version.
+ */
+#ifndef _di_utf8_main_flag_e_
+  enum {
+    utf8_main_flag_none_e          = 0x0,
+    utf8_main_flag_file_from_e     = 0x1,
+    utf8_main_flag_file_to_e       = 0x2,
+    utf8_main_flag_header_e        = 0x4,
+    utf8_main_flag_help_e          = 0x8,
+    utf8_main_flag_separate_e      = 0x10,
+    utf8_main_flag_strip_invalid_e = 0x20,
+    utf8_main_flag_verify_e        = 0x40,
+    utf8_main_flag_version_e       = 0x80,
+  };
+#endif // _di_utf8_main_flag_e_
+
+/**
  * The UTF-8 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).
  *
  * mode: The input/output mode (see utf8_modes_e).
+ * flag: Flags passed to the main function.
+ *
+ * status: The main status code, generally used by the load settings and main functions.
+ *
+ * valid:     Designate the output context set for valid characters.
+ * valid_not: Designate the output context set for invalid characters.
+ *
+ * append:  A string to append. A value of NULL results in not appending.
+ * prepend: A string to prepend. A value of NULL results in not prepending.
+ *
+ * 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.
+ *
+ * buffer: A buffer to use for printing output (generally for storing a block of input from an input file).
+ * text:   A buffer for storing a series of characters for processing (generally for code point processing).
+ *
+ * path_files_from: An array of all "from" file paths for when the flag utf8_main_flag_file_from_e is set.
+ * path_files_to:   An array of all "to" file paths for when the flag utf8_main_flag_file_to_e is set.
  */
-#ifndef _di_utf8_main_setting_t_
+#ifndef _di_utf8_setting_t_
   typedef struct {
     uint8_t mode;
-  } utf8_main_setting_t;
+    uint16_t flag;
 
-  #define utf8_main_setting_t_initialize \
-    { \
-      utf8_mode_from_bytesequence_d | utf8_mode_to_codepoint_d, \
-    }
-#endif // _di_utf8_main_setting_t_
+    f_status_t status;
 
-/*
     f_color_set_t valid;
     f_color_set_t valid_not;
 
     f_string_static_t append;
     f_string_static_t prepend;
 
+    f_string_static_t line_first;
+    f_string_static_t line_last;
+
     f_string_dynamic_t buffer;
     f_string_dynamic_t text;
-  } utf8_data_t;
 
-  #define utf8_data_t_initialize \
+    f_string_dynamics_t path_files_from;
+    f_string_dynamics_t path_files_to;
+  } utf8_setting_t;
+
+  #define utf8_setting_t_initialize \
     { \
-      0, \
-      0, \
-      0, \
-      f_file_t_initialize, \
-      utf8_mode_from_bytesequence_d | utf8_mode_to_codepoint_d, \
+      utf8_mode_from_bytesequence_e | utf8_mode_to_codepoint_e, \
+      utf8_main_flag_none_e, \
+      F_none, \
       f_color_set_t_initialize, \
       f_color_set_t_initialize, \
       f_string_static_t_initialize, \
       f_string_static_t_initialize, \
+      f_string_eol_s, \
+      f_string_eol_s, \
       f_string_dynamic_t_initialize, \
       f_string_dynamic_t_initialize, \
+      f_string_dynamics_t_initialize, \
+      f_string_dynamics_t_initialize, \
     }
-    */
+#endif // _di_utf8_setting_t_
+
+/**
+ * Delete the program main setting data.
+ *
+ * @param setting
+ *   The program main setting data.
+ *   This does not alter setting.status.
+ *
+ *   Assumed to always be non-NULL.
+ *
+ * @return
+ *   F_none on success.
+ */
+#ifndef _di_utf8_setting_delete_
+  extern f_status_t utf8_setting_delete(utf8_setting_t * const setting);
+#endif // _di_utf8_setting_delete_
+
+/**
+ * Perform the standard program setting load process.
+ *
+ * This prints error messages as appropriate.
+ *
+ * @param arguments
+ *   The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ *   The main program data.
+ *
+ *   Assumed to always be non-NULL.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ *
+ *   This alters setting.status:
+ *     F_none on success.
+ *
+ *     Errors (with error bit) from: f_console_parameter_process().
+ *     Errors (with error bit) from: fll_program_parameter_process_context().
+ *
+ * @see f_console_parameter_process()
+ * @see fll_program_parameter_process_context()
+ */
+#ifndef _di_utf8_setting_load_
+  extern void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_setting_load_
+
+/**
+ * Perform the standard program setting unload process.
+ *
+ * @param main
+ *   The main program data.
+ *
+ *   Assumed to always be non-NULL.
+ * @param setting
+ *   The main program settings.
+ *   This does not alter setting.status.
+ *   All buffers are deallocated.
+ *
+ *   Assumed to always be non-NULL.
+ *
+ * @return
+ *   F_none on success.
+ */
+#ifndef _di_utf8_setting_unload_
+  extern f_status_t utf8_setting_unload(fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_setting_unload_
 
 #ifdef __cplusplus
 } // extern "C"
index 2f51d638d9865f6d01feef051602e0ebd478e382..ae3f2f32cb4a86abd0d88b48d8b14df25e785dcf 100644 (file)
@@ -2,39 +2,35 @@
 
 int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
-  const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
-
   fll_program_data_t data = fll_program_data_t_initialize;
-  utf8_main_setting_t setting = utf8_main_setting_t_initialize;
+  utf8_setting_t setting = utf8_setting_t_initialize;
 
   f_console_parameter_t parameters[] = utf8_console_parameter_t_initialize;
   data.parameters.array = parameters;
   data.parameters.used = utf8_total_parameters_d;
+  data.environment = envp;
 
   if (f_pipe_input_exists()) {
-    data.pipe |= fll_program_data_pipe_input_e;
+    data.pipe = fll_program_data_pipe_input_e;
   }
 
-  fll_program_standard_set_up(&data.signal);
+  fll_program_standard_set_up(&data);
 
-  f_status_t status = utf8_main_setting_load(arguments, data, &setting);
+  {
+    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
 
-  if (F_status_is_error_not(status)) {
-    status = utf8_main(&data, &setting);
+    utf8_setting_load(arguments, &data, &setting);
   }
 
-  if (data.message.stream != data.output.stream) {
-    f_file_stream_flush(&data->output);
-    f_file_stream_close(&data->output);
-  }
+  utf8_main(&data, &setting);
 
-  utf8_main_setting_unload(data, &setting);
+  utf8_setting_unload(&data, &setting);
 
-  utf8_main_setting_delete(&setting);
+  utf8_setting_delete(&setting);
 
   fll_program_data_delete(&data);
 
-  fll_program_standard_set_down(&data.signal);
+  fll_program_standard_set_down(&data);
 
-  return F_status_is_error(status) ? 1 : 0;
+  return F_status_is_error(setting.status) || setting.status == F_false ? 1 : 0;
 }
diff --git a/level_3/utf8/c/print.c b/level_3/utf8/c/print.c
new file mode 100644 (file)
index 0000000..f00e616
--- /dev/null
@@ -0,0 +1,547 @@
+#include "utf8.h"
+#include "private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_utf8_print_bytesequence_
+  void utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+
+    fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, sequence, setting->append);
+  }
+#endif // _di_utf8_print_bytesequence_
+
+#ifndef _di_utf8_print_character_invalid_
+  void utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid) {
+
+    if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+    if (!invalid.used) return;
+
+    if ((setting->mode & utf8_mode_to_combining_e) || (setting->mode & utf8_mode_to_width_e)) {
+      utf8_print_combining_or_width(main, setting, invalid);
+    }
+    else if (setting->mode & utf8_mode_to_bytesequence_e) {
+      fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append);
+    }
+    else if (setting->mode & utf8_mode_from_codepoint_e) {
+      fl_print_format("%r%[%Q%]%r", main->output.to.stream, setting->prepend, setting->valid_not, invalid, setting->valid_not, setting->append);
+    }
+    else {
+      fl_print_format("%r%[0x", main->output.to.stream, setting->prepend, setting->valid_not);
+
+      for (uint8_t i = 0; i < invalid.used; ++i) {
+        fl_print_format("%02_uii", main->output.to.stream, (uint8_t) invalid.string[i]);
+      } // for
+
+      fl_print_format("%]%r", main->output.to.stream, setting->valid_not, setting->append);
+    }
+  }
+#endif // _di_utf8_print_character_invalid_
+
+#ifndef _di_utf8_print_codepoint_
+  void utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint) {
+
+    if (codepoint < 0x10000) {
+      fl_print_format("%rU+%04_U%r", main->output.to.stream, setting->prepend, codepoint, setting->append);
+    }
+    else if (codepoint < 0x100000) {
+      fl_print_format("%rU+%05_U%r", main->output.to.stream, setting->prepend, codepoint, setting->append);
+    }
+    else {
+      fl_print_format("%rU+%06_U%r", main->output.to.stream, setting->prepend, codepoint, setting->append);
+    }
+  }
+#endif // _di_utf8_print_codepoint_
+
+#ifndef _di_utf8_print_combining_or_width_
+  void utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+
+    if (setting->mode & utf8_mode_to_combining_e) {
+      f_status_t status = f_utf_is_combining(sequence.string, sequence.used);
+
+      if (status == F_true) {
+        fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_combining_is_s, setting->append);
+      }
+      else if (status == F_false) {
+        status = f_utf_is_private(sequence.string, sequence.used);
+
+        if (status == F_true) {
+          fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_unknown_s, setting->append);
+        }
+        else if (setting->mode & utf8_mode_to_width_e) {
+          utf8_print_width(main, setting, sequence);
+        }
+        else {
+          fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_combining_not_s, setting->append);
+        }
+      }
+      else {
+        utf8_print_error_combining_or_width(main, setting);
+      }
+    }
+    else if (setting->mode & utf8_mode_to_width_e) {
+      utf8_print_width(main, setting, sequence);
+    }
+  }
+#endif // _di_utf8_print_combining_or_width_
+
+#ifndef _di_utf8_print_error_combining_or_width_
+  void utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+
+    fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append);
+  }
+#endif // _di_utf8_print_error_combining_or_width_
+
+#ifndef _di_utf8_print_error_decode_
+  void utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+    if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+
+    utf8_print_line_first(setting, main->error, F_false);
+
+    fl_print_format("%[%QFailed to decode character code '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
+
+    if (invalid.used) {
+      fl_print_format("%[0x", main->error.to.stream, main->context.set.notable);
+
+      for (uint8_t i = 0; i < invalid.used; ++i) {
+        fl_print_format("%02_uii", main->error.to.stream, (uint8_t) invalid.string[i]);
+      } // for
+
+      fl_print_format("%]", main->error.to.stream, main->context.set.notable);
+    }
+
+    if (F_status_set_fine(status) == F_utf_not) {
+      fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+    }
+    else if (F_status_set_fine(status) == F_complete_not_utf) {
+      fl_print_format("%[', invalid UTF-8 (truncated).%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+    }
+    else if (F_status_set_fine(status) == F_utf_fragment) {
+      fl_print_format("%[', invalid UTF-8 fragment.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+    }
+    else {
+      fl_print_format("%[', error status code%] ", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+      fl_print_format("%[%ui%]", main->error.to.stream, main->context.set.notable, F_status_set_fine(status), main->context.set.notable);
+      fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+    }
+  }
+#endif // _di_utf8_print_error_decode_
+
+#ifndef _di_utf8_print_error_encode_
+  void utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+
+    utf8_print_line_first(setting, main->error, F_false);
+
+    fl_print_format("%[%QFailed to encode Unicode codepoint '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
+    fl_print_format("%[U+%_U%]", main->error.to.stream, main->context.set.notable, codepoint, main->context.set.notable);
+
+    if (F_status_set_fine(status) == F_utf_not) {
+      fl_print_format("%[', not a valid Unicode codepoint.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+    }
+    else {
+      fl_print_format("%[', error status code%] ", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+      fl_print_format("%[%ui%]", main->error.to.stream, main->context.set.notable, F_status_set_fine(status), main->context.set.notable);
+      fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+    }
+  }
+#endif // _di_utf8_print_error_encode_
+
+#ifndef _di_utf8_print_error_no_from_
+  void utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+
+    utf8_print_line_first(setting, main->error, F_true);
+
+    fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
+  }
+#endif // _di_utf8_print_error_no_from_
+
+#ifndef _di_utf8_print_error_no_value_
+  void utf8_print_error_no_value(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t parameter) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+
+    flockfile(main->error.to.stream);
+
+    utf8_print_line_first(setting, main->error, F_false);
+
+    fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
+    fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, parameter, main->context.set.notable);
+    fl_print_format("%[' is specified, but no value was given.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+
+    funlockfile(main->error.to.stream);
+  }
+#endif // _di_utf8_print_error_no_value_
+
+#ifndef _di_utf8_print_error_parameter_file_name_empty_
+  void utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+
+    flockfile(main->error.to.stream);
+
+    utf8_print_line_first(setting, main->error, F_false);
+
+    fl_print_format("%[%QNo file specified at parameter index %]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
+    fl_print_format("%[%ul%]", main->error.to.stream, main->context.set.notable, index, main->context.set.notable);
+    fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+
+    funlockfile(main->error.to.stream);
+  }
+#endif // _di_utf8_print_error_parameter_file_name_empty_
+
+#ifndef _di_utf8_print_error_parameter_file_not_found_
+  void utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+
+    flockfile(main->error.to.stream);
+
+    utf8_print_line_first(setting, main->error, F_false);
+
+    fl_print_format("%[%QFailed to find the %r file '%]", main->error.to.stream, main->context.set.error, main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, main->context.set.error);
+    fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, name, main->context.set.notable);
+    fl_print_format("%['.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
+
+    funlockfile(main->error.to.stream);
+  }
+#endif // _di_utf8_print_error_parameter_file_not_found_
+
+#ifndef _di_utf8_print_error_parameter_file_to_too_many_
+  void utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+
+    utf8_print_line_first(setting, main->error, F_true);
+
+    fll_print_format("%[%QToo many %r files specified, there may only be one to file.%]%r", main->error.to.stream, main->context.set.error, main->error.prefix, utf8_string_to_s, main->context.set.error, f_string_eol_s);
+  }
+#endif // _di_utf8_print_error_parameter_file_to_too_many_
+
+#ifndef _di_utf8_print_flush_
+  void utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    if (setting->flag & utf8_main_flag_verify_e) return;
+
+    if (setting->status == F_interrupt) {
+      if (main->output.verbosity != f_console_verbosity_quiet_e) {
+        f_file_stream_flush(main->output.to);
+      }
+
+      if (main->output.to.stream != main->message.to.stream) {
+        if (main->message.verbosity != f_console_verbosity_quiet_e) {
+          f_file_stream_flush(main->message.to);
+        }
+      }
+    }
+  }
+#endif // _di_utf8_print_flush_
+
+#ifndef _di_utf8_print_help_
+  f_status_t utf8_print_help(utf8_setting_t * const setting, const f_file_t output, const f_color_context_t context) {
+
+    flockfile(output.stream);
+
+    f_print_dynamic_raw(setting->line_first, output.stream);
+
+    fll_program_print_help_header(output, context, utf8_program_name_long_s, utf8_program_version_s);
+
+    fll_program_print_help_option_standard(output, context);
+
+    f_print_dynamic_raw(f_string_eol_s, output.stream);
+
+    fll_program_print_help_option(output, context, utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The expected input format is byte sequence (character data).");
+    fll_program_print_help_option(output, context, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "   The expected input format is codepoint (such as U+0000).");
+    fll_program_print_help_option(output, context, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "        Use the given output as the input source.");
+
+    f_print_dynamic_raw(f_string_eol_s, output.stream);
+
+    fll_program_print_help_option(output, context, utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The output format is byte sequence (character data).");
+    fll_program_print_help_option(output, context, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "   The output format is codepoint (such as U+0000).");
+    fll_program_print_help_option(output, context, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "   The output format is to print whether or not character is combining or not.");
+    fll_program_print_help_option(output, context, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "        Use the given output as the output destination.");
+    fll_program_print_help_option(output, context, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "       The output format is to print the width of a character (either 0, 1, or 2).");
+
+    f_print_dynamic_raw(f_string_eol_s, output.stream);
+
+    fll_program_print_help_option(output, context, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "      Print headers for each section (pipe, output, or parameter).");
+    fll_program_print_help_option(output, context, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "     Separate characters by newlines (implied when printing headers).");
+    fll_program_print_help_option(output, context, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Strip invalid Unicode characters (do not print invalid sequences).");
+    fll_program_print_help_option(output, context, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "       Only perform verification of valid sequences.");
+
+    fll_program_print_help_usage(output, context, utf8_program_name_s, utf8_program_help_parameters_s);
+
+    fl_print_format("%r  The default behavior is to assume the expected input is byte sequence from the command line to be output to the screen as codepoints.%r%r", output.stream, f_string_eol_s, f_string_eol_s, f_string_eol_s);
+
+    fl_print_format("  Multiple input sources are allowed but only a single output destination is allowed.%r%r", output.stream, f_string_eol_s, f_string_eol_s);
+
+    fl_print_format("  When using the parameter '%[%r%r%]', no data is printed and 0 is returned if valid or 1 is returned if invalid.%r%r", output.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_verify_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+
+    fl_print_format("  When using the parameter '%[%r%r%]' with the parameter ", output.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_combining_s, context.set.notable);
+    fl_print_format("'%[%r%r%]', the ", output.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_width_s, context.set.notable);
+    fl_print_format("'%[%r%]' character is printed to represent the combining and the digits are used to represent widths.%r", output.stream, context.set.notable, utf8_string_combining_is_s, context.set.notable, f_string_eol_s);
+    fl_print_format("  The combining characters should be considered 1-width by themselves or 0-width when combined.%r", output.stream, f_string_eol_s);
+
+    f_print_dynamic_raw(setting->line_last, output.stream);
+
+    f_file_stream_flush(output);
+    funlockfile(output.stream);
+
+    return F_none;
+  }
+#endif // _di_utf8_print_help_
+
+#ifndef _di_utf8_print_line_first_
+  void utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return;
+
+    if (lock) {
+      fll_print_dynamic_raw(setting->line_first, print.to.stream);
+    }
+    else {
+      f_print_dynamic_raw(setting->line_first, print.to.stream);
+    }
+  }
+#endif // _di_utf8_print_line_first_
+
+#ifndef _di_utf8_print_line_last_
+  void utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock) {
+
+    if (print.verbosity == f_console_verbosity_quiet_e) return;
+    if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return;
+    if (setting->flag & utf8_main_flag_verify_e) return;
+    if ((setting->flag & utf8_main_flag_file_to_e) && !F_status_is_error(setting->status)) return;
+
+    if (lock) {
+      fll_print_dynamic_raw(setting->line_last, print.to.stream);
+    }
+    else {
+      f_print_dynamic_raw(setting->line_last, print.to.stream);
+    }
+  }
+#endif // _di_utf8_print_line_last_
+
+#ifndef _di_utf8_print_raw_bytesequence_
+  void utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width) {
+
+    if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+
+    f_string_static_t character = macro_f_string_static_t_initialize(0, 0, width);
+
+    f_char_t byte[character.used + 1];
+    character.string = byte;
+    byte[character.used] = 0;
+
+    if (raw) {
+      if (width == 1) {
+        byte[0] = macro_f_utf_char_t_to_char_4_be(raw);
+      }
+      else if (width == 2) {
+        byte[0] = macro_f_utf_char_t_to_char_3_be(raw);
+        byte[1] = macro_f_utf_char_t_to_char_4_be(raw);
+      }
+      else if (width == 3) {
+        byte[0] = macro_f_utf_char_t_to_char_2_be(raw);
+        byte[1] = macro_f_utf_char_t_to_char_3_be(raw);
+        byte[2] = macro_f_utf_char_t_to_char_4_be(raw);
+      }
+      else {
+        byte[0] = macro_f_utf_char_t_to_char_1_be(raw);
+        byte[1] = macro_f_utf_char_t_to_char_2_be(raw);
+        byte[2] = macro_f_utf_char_t_to_char_3_be(raw);
+        byte[3] = macro_f_utf_char_t_to_char_4_be(raw);
+      }
+    }
+    else {
+      memset(byte, 0, sizeof(f_char_t) * width);
+    }
+
+    fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, character, setting->valid_not, setting->append);
+  }
+#endif // _di_utf8_print_raw_bytesequence_
+
+#ifndef _di_utf8_print_raw_codepoint_
+  void utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw) {
+
+    if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+
+    fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, raw, setting->valid_not, setting->append);
+  }
+#endif // _di_utf8_print_raw_codepoint_
+
+#ifndef _di_utf8_print_raw_combining_or_width_
+  void utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width) {
+
+    if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+
+    if (setting->mode & utf8_mode_to_combining_e) {
+      utf8_print_error_combining_or_width(main, setting);
+    }
+    else if (setting->mode & utf8_mode_to_width_e) {
+      const f_string_static_t *character = 0;
+
+      switch (width) {
+        case 1:
+          character = &utf8_string_width_1_s;
+          break;
+
+        case 2:
+          character = &utf8_string_width_2_s;
+          break;
+
+        case 3:
+          character = &utf8_string_width_3_s;
+          break;
+
+        case 4:
+          character = &utf8_string_width_4_s;
+          break;
+
+        default:
+          character = &utf8_string_width_0_s;
+      }
+
+      fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, *character, setting->valid_not, setting->append);
+    }
+  }
+#endif // _di_utf8_print_raw_combining_or_width_
+
+#ifndef _di_utf8_print_section_header_file_
+  void utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index) {
+
+    if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return;
+    if (setting->flag & utf8_main_flag_verify_e) return;
+
+    flockfile(main->output.to.stream);
+
+    if ((main->pipe & fll_program_data_pipe_input_e) || index) {
+      f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+    }
+    else {
+      f_print_dynamic_raw(setting->line_first, main->output.to.stream);
+    }
+
+    if (setting->flag & utf8_main_flag_header_e) {
+      fl_print_format("%[File%] ", main->output.to.stream, main->output.set->title, main->output.set->title);
+
+      if (setting->flag & utf8_main_flag_file_to_e) {
+        fl_print_format("%[%Q%]: %Q.%r", main->output.to.stream, main->output.set->notable, name, main->output.set->notable, setting->path_files_to.array[0], f_string_eol_s);
+      }
+      else {
+        fl_print_format("%[%Q%]:%r", main->output.to.stream, main->output.set->notable, name, main->output.set->notable, f_string_eol_s);
+      }
+    }
+
+    funlockfile(main->output.to.stream);
+  }
+#endif // _di_utf8_print_section_header_file_
+
+#ifndef _di_utf8_print_section_header_parameter_
+  void utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) {
+
+    if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return;
+    if (setting->flag & utf8_main_flag_verify_e) return;
+
+    flockfile(main->output.to.stream);
+
+    if ((main->pipe & fll_program_data_pipe_input_e) || (setting->flag & utf8_main_flag_file_from_e) || index) {
+      f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+    }
+    else {
+      f_print_dynamic_raw(setting->line_first, main->output.to.stream);
+    }
+
+    if (setting->flag & utf8_main_flag_header_e) {
+      fl_print_format("%[Parameter%] ", main->output.to.stream, main->output.set->title, main->output.set->title);
+      fl_print_format("%[%ul%]:%r", main->output.to.stream, main->output.set->notable, index, main->output.set->notable, f_string_eol_s);
+    }
+
+    funlockfile(main->output.to.stream);
+  }
+#endif // _di_utf8_print_section_header_parameter_
+
+#ifndef _di_utf8_print_section_header_pipe_
+  void utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting) {
+
+    if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return;
+    if (setting->flag & utf8_main_flag_verify_e) return;
+
+    flockfile(main->output.to.stream);
+
+    f_print_dynamic_raw(setting->line_first, main->output.to.stream);
+
+    if (setting->flag & utf8_main_flag_header_e) {
+      fl_print_format("%[Pipe%]:%r", main->output.to.stream, main->output.set->title, main->output.set->title, f_string_eol_s);
+    }
+
+    funlockfile(main->output.to.stream);
+  }
+#endif // _di_utf8_print_section_header_pipe_
+
+#ifndef _di_utf8_print_signal_received_
+  void utf8_print_signal_received(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t signal) {
+
+    if (main->warning.verbosity != f_console_verbosity_verbose_e && main->warning.verbosity != f_console_verbosity_debug_e) {
+      return;
+    }
+
+    flockfile(main->warning.to.stream);
+
+    // Must flush and reset color because the interrupt may have interrupted the middle of a print function.
+    f_file_stream_flush(main->warning.to);
+
+    fl_print_format("%]", main->warning.to.stream, main->context.set.reset);
+
+    utf8_print_line_first(setting, main->warning, F_false);
+
+    fl_print_format("%r%[Received signal code %]", main->warning.to.stream, f_string_eol_s, main->context.set.warning, main->context.set.warning);
+    fl_print_format("%[%i%]", main->warning.to.stream, main->context.set.notable, signal, main->context.set.notable);
+    fl_print_format("%[.%]%r", main->warning.to.stream, main->context.set.warning, main->context.set.warning, f_string_eol_s);
+
+    funlockfile(main->warning.to.stream);
+  }
+#endif // _di_utf8_print_signal_received_
+
+#ifndef _di_utf8_print_width_
+  void utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+
+    f_status_t status = f_utf_is_wide(sequence.string, sequence.used);
+
+    if (status == F_true) {
+      fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_width_2_s, setting->append);
+
+      return;
+    }
+
+    if (status == F_false) {
+      status = f_utf_is_graph(sequence.string, sequence.used);
+
+      if (status == F_true) {
+        fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_width_1_s, setting->append);
+
+        return;
+      }
+
+      if (status == F_false) {
+        fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_width_0_s, setting->append);
+
+        return;
+      }
+    }
+
+    utf8_print_error_combining_or_width(main, setting);
+  }
+#endif // _di_utf8_print_width_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/utf8/c/print.h b/level_3/utf8/c/print.h
new file mode 100644 (file)
index 0000000..21da76c
--- /dev/null
@@ -0,0 +1,418 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: UTF-8
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _utf8_print_h
+#define _utf8_print_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print the byte sequence character (such as '豸').
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param sequence
+ *   A byte sequences representing a single character to print.
+ */
+#ifndef _di_utf8_print_bytesequence_
+  extern void utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+#endif // _di_utf8_print_bytesequence_
+
+/**
+ * Print an invalid character either as a Unicode codeblock or as a byte sequence.
+ *
+ * This handles whether or not the invalid character should be printed or not based on program parameters.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param invalid
+ *   The byte sequence string or unicode codepoint string representing a single character to print.
+ *
+ * @see utf8_print_combining_or_width()
+ */
+#ifndef _di_utf8_print_character_invalid_
+  extern void utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid);
+#endif // _di_utf8_print_character_invalid_
+
+/**
+ * Print the codepoint number as a codepoint string (such as U+8C78).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param codepoint
+ *   The codepoint to print.
+ *   This is the code that represents a single character.
+ */
+#ifndef _di_utf8_print_codepoint_
+  extern void utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint);
+#endif // _di_utf8_print_codepoint_
+
+/**
+ * Print the width or combining state of the given character.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param sequence
+ *   A byte sequences representing a single character to print.
+ *
+ * @see utf8_print_width()
+ */
+#ifndef _di_utf8_print_combining_or_width_
+  extern void utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+#endif // _di_utf8_print_combining_or_width_
+
+/**
+ * Print an error regarding the width or combining state of a some character.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ */
+#ifndef _di_utf8_print_error_combining_or_width_
+  extern void utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_print_error_combining_or_width_
+
+/**
+ * Print error message when attempt to decode the character failed.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param invalid
+ *   The byte sequence string or unicode codepoint string representing a single character to print.
+ */
+#ifndef _di_utf8_print_error_decode_
+  extern void utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid);
+#endif // _di_utf8_print_error_decode_
+
+/**
+ * Print error message when attempt to encode the character failed.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param codepoint
+ *   The codepoint that is invalid.
+ */
+#ifndef _di_utf8_print_error_encode_
+  extern void utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint);
+#endif // _di_utf8_print_error_encode_
+
+/**
+ * Print error message for when no sources are provided.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ */
+#ifndef _di_utf8_print_error_no_from_
+  extern void utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_print_error_no_from_
+
+/**
+ * Print error message for when no sources are provided.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param parameter
+ *   The long parameter name.
+ */
+#ifndef _di_utf8_print_error_no_value_
+  extern void utf8_print_error_no_value(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t parameter);
+#endif // _di_utf8_print_error_no_value_
+
+/**
+ * Print error message for when the file parameter is an empty string.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param index
+ *   The index within the argv[] array where the empty string is found.
+ */
+#ifndef _di_utf8_print_error_parameter_file_name_empty_
+  extern void utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index);
+#endif // _di_utf8_print_error_parameter_file_name_empty_
+
+/**
+ * Print error message for when no sources are provided in the main program parameters.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param from
+ *   If TRUE, then this is a from file (source file).
+ *   If FALSE, then this is a to file (destination file).
+ * @param name
+ *   The file path name.
+ */
+#ifndef _di_utf8_print_error_parameter_file_not_found_
+  extern void utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name);
+#endif // _di_utf8_print_error_parameter_file_not_found_
+
+/**
+ * Print error message for when too many 'to' destinations are specified.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ */
+#ifndef _di_utf8_print_error_parameter_file_to_too_many_
+  extern void utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_print_error_parameter_file_to_too_many_
+
+/**
+ * Flush the output, if appropriate.
+ *
+ * This is intended to be run after the utf8_main() is complete.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *   This does not alter setting.status.
+ */
+#ifndef _di_utf8_print_flush_
+  extern void utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_print_flush_
+
+/**
+ * Print help.
+ *
+ * @param setting
+ *   The main program settings.
+ *   This does not alter setting.status.
+ * @param output
+ *   The file to print to.
+ * @param context
+ *   The color context settings.
+ *
+ * @return
+ *   F_none on success.
+ *   F_true on success and validation passed.
+ *   F_false on success and validation failed.
+ */
+#ifndef _di_utf8_print_help_
+  extern f_status_t utf8_print_help(utf8_setting_t * const setting, const f_file_t output, const f_color_context_t context);
+#endif // _di_utf8_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.
+ *
+ * @param setting
+ *   The main program settings.
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates how the how and where to print.
+ * @param lock
+ *   If TRUE, then lock the stream.
+ *   If FALSE, then do not lock or unlock the stream.
+ */
+#ifndef _di_utf8_print_line_first_
+  extern void utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock);
+#endif // _di_utf8_print_line_first_
+
+/**
+ * Print last new line when the main is complete, unless verbosity says otherwise.
+ *
+ * This is generally the very last line printed in the program.
+ *
+ * @param setting
+ *   The main program settings.
+ *   This does not alter setting.status.
+ * @param print
+ *   Designates how the how and where to print.
+ * @param lock
+ *   If TRUE, then lock the stream.
+ *   If FALSE, then do not lock or unlock the stream.
+ */
+#ifndef _di_utf8_print_line_last_
+  extern void utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock);
+#endif // _di_utf8_print_line_last_
+
+/**
+ * Print the raw character data (binary / byte sequence).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param raw
+ *   The raw string in integer format.
+ * @param width
+ *   The width the raw character represents (a value inclusively from 1 to 4).
+ */
+#ifndef _di_utf8_print_raw_bytesequence_
+  extern void utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width);
+#endif // _di_utf8_print_raw_bytesequence_
+
+/**
+ * Print the raw character data (codepoint).
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param raw
+ *   The raw string already in codepoint format.
+ */
+#ifndef _di_utf8_print_raw_codepoint_
+  extern void utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw);
+#endif // _di_utf8_print_raw_codepoint_
+
+/**
+ * Print the width or combining state of the for a raw character.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param width
+ *   The pre-calculated width.
+ *
+ * @see utf8_print_width()
+ */
+#ifndef _di_utf8_print_raw_combining_or_width_
+  extern void utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width);
+#endif // _di_utf8_print_raw_combining_or_width_
+
+/**
+ * Print the input file section header.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param name
+ *   The name of the file.
+ * @param index
+ *   The index position of the file.
+ */
+#ifndef _di_utf8_print_section_header_file_
+  extern void utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index);
+#endif // _di_utf8_print_section_header_file_
+
+/**
+ * Print the input parameter section header.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param index
+ *   The index position of the parameter.
+ */
+#ifndef _di_utf8_print_section_header_parameter_
+  extern void utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index);
+#endif // _di_utf8_print_section_header_parameter_
+
+/**
+ * Print the input pipe section header.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ */
+#ifndef _di_utf8_print_section_header_pipe_
+  extern void utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting);
+#endif // _di_utf8_print_section_header_pipe_
+
+/**
+ * Print a message about a process signal being recieved, such as an interrupt signal.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param signal
+ *   The signal code received.
+ */
+#ifndef _di_utf8_print_signal_received_
+  extern void utf8_print_signal_received(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t signal);
+#endif // _di_utf8_print_signal_received_
+
+/**
+ * Print the width of the given character.
+ *
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
+ *
+ *   Assumed to always be non-NULL.
+ * @param sequence
+ *   A byte sequences representing a single character whose width is to be printed.
+ */
+#ifndef _di_utf8_print_width_
+  extern void utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+#endif // _di_utf8_print_width_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _utf8_print_h
index f6bc32618865cb871a3e29ec35526e2d4a8dae66..c289854c165afc20e8030289d0f743d3ede5d438 100644 (file)
@@ -1,19 +1,10 @@
 #include "utf8.h"
 #include "private-common.h"
-#include "private-print.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#ifndef _di_utf8_data_delete_
-  void utf8_data_delete(utf8_data_t *data) {
-
-    f_string_dynamic_resize(0, &data->buffer);
-    f_string_dynamic_resize(0, &data->text);
-  }
-#endif // _di_utf8_data_delete_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 40fc9cb9800a33ac17cd1f47653ccdeaf19666f9..4e587c0581e2e9df7feccab66a1e8ad9abd17372 100644 (file)
@@ -45,68 +45,6 @@ extern "C" {
   };
 #endif // _di__utf8_codepoint_modes_
 
-/**
- * The program data.
- *
- * main:    The main program data.
- * setting: The main program settings.
- * argv:    The argument structure in the progam data parameters for simplifying syntax.
- *
- * main:      The main program data.
- * file:      The output file for writing the processed data to (may potentially default to "output").
- * valid:     Designate the output context set for valid characters.
- * valid_not: Designate the output context set for invalid characters.
- * append:    A string to append. A value of NULL results in not appending.
- * prepend:   A string to prepend. A value of NULL results in not prepending.
- * buffer:    A buffer to use for printing output (generally for storing a block of input from an input file).
- * text:      A buffer for storing a series of characters for processing (generally for codepoint processing).
- */
-#ifndef _di_utf8_data_t_
-  typedef struct {
-    fll_program_data_t *main;
-    utf8_main_setting_t *setting;
-    f_string_static_t *argv;
-
-    //f_file_t file;
-
-    f_color_set_t valid;
-    f_color_set_t valid_not;
-
-    f_string_static_t append;
-    f_string_static_t prepend;
-
-    f_string_dynamic_t buffer;
-    f_string_dynamic_t text;
-  } utf8_data_t;
-
-  #define utf8_data_t_initialize \
-    { \
-      0, \
-      0, \
-      0, \
-      //f_file_t_initialize, \
-      f_color_set_t_initialize, \
-      f_color_set_t_initialize, \
-      f_string_static_t_initialize, \
-      f_string_static_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-    }
-#endif // _di_utf8_data_t_
-
-/**
- * Deallocate program data.
- *
- * @param data
- *   The program data.
- *
- * @return
- *   F_none on success.
- */
-#ifndef _di_utf8_data_delete_
-  extern void utf8_data_delete(utf8_data_t *data) F_attribute_visibility_internal_d;
-#endif // _di_utf8_data_delete_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
diff --git a/level_3/utf8/c/private-print.c b/level_3/utf8/c/private-print.c
deleted file mode 100644 (file)
index 32346cd..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-#include "utf8.h"
-#include "private-common.h"
-#include "private-print.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _di_utf8_print_bytesequence_
-  void utf8_print_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) {
-
-    fl_print_format("%r%r%r", data->file.stream, data->prepend, sequence, data->append);
-  }
-#endif // _di_utf8_print_bytesequence_
-
-#ifndef _di_utf8_print_character_invalid_
-  void utf8_print_character_invalid(utf8_data_t * const data, const f_string_static_t invalid) {
-
-    if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    if (!invalid.used) return;
-
-    if ((data->mode & utf8_mode_to_combining_d) || (data->mode & utf8_mode_to_width_d)) {
-      utf8_print_combining_or_width(data, invalid);
-    }
-    else if (data->mode & utf8_mode_to_bytesequence_d) {
-      fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, invalid, data->valid_not, data->append);
-    }
-    else if (data->mode & utf8_mode_from_codepoint_d) {
-      fl_print_format("%r%[%Q%]%r", data->file.stream, data->prepend, data->valid_not, invalid, data->valid_not, data->append);
-    }
-    else {
-      fl_print_format("%r%[0x", data->file.stream, data->prepend, data->valid_not);
-
-      for (uint8_t i = 0; i < invalid.used; ++i) {
-        fl_print_format("%02_uii", data->file.stream, (uint8_t) invalid.string[i]);
-      } // for
-
-      fl_print_format("%]%r", data->file.stream, data->valid_not, data->append);
-    }
-  }
-#endif // _di_utf8_print_character_invalid_
-
-#ifndef _di_utf8_print_codepoint_
-  void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) {
-
-    if (codepoint < 0x10000) {
-      fl_print_format("%rU+%04_U%r", data->file.stream, data->prepend, codepoint, data->append);
-    }
-    else if (codepoint < 0x100000) {
-      fl_print_format("%rU+%05_U%r", data->file.stream, data->prepend, codepoint, data->append);
-    }
-    else {
-      fl_print_format("%rU+%06_U%r", data->file.stream, data->prepend, codepoint, data->append);
-    }
-  }
-#endif // _di_utf8_print_codepoint_
-
-#ifndef _di_utf8_print_combining_or_width_
-  void utf8_print_combining_or_width(utf8_data_t * const data, const f_string_static_t sequence) {
-
-    f_status_t status = F_none;
-
-    if (data->mode & utf8_mode_to_combining_d) {
-      status = f_utf_is_combining(sequence.string, sequence.used);
-
-      if (status == F_true) {
-        fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_combining_is_s, data->append);
-      }
-      else if (status == F_false) {
-        status = f_utf_is_private(sequence.string, sequence.used);
-
-        if (status == F_true) {
-          fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_unknown_s, data->append);
-        }
-        else if (data->mode & utf8_mode_to_width_d) {
-          utf8_print_width(data, sequence);
-        }
-        else {
-          fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_combining_not_s, data->append);
-        }
-      }
-      else if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_none_e && data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) {
-        utf8_print_error_combining_or_width(data);
-      }
-    }
-    else if (data->mode & utf8_mode_to_width_d) {
-      utf8_print_width(data, sequence);
-    }
-  }
-#endif // _di_utf8_print_combining_or_width_
-
-#ifndef _di_utf8_print_error_combining_or_width_
-  void utf8_print_error_combining_or_width(utf8_data_t * const data) {
-
-    if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, utf8_string_unknown_s, data->valid_not, data->append);
-  }
-#endif // _di_utf8_print_error_combining_or_width_
-
-#ifndef _di_utf8_print_error_decode_
-  void utf8_print_error_decode(utf8_data_t * const data, const f_status_t status, const f_string_static_t invalid) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-    if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    fl_print_format("%r%[%QFailed to decode character code '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error);
-
-    if (invalid.used) {
-      fl_print_format("%[0x", data->main->error.to.stream, data->main->context.set.notable);
-
-      for (uint8_t i = 0; i < invalid.used; ++i) {
-        fl_print_format("%02_uii", data->main->error.to.stream, (uint8_t) invalid.string[i]);
-      } // for
-
-      fl_print_format("%]", data->main->error.to.stream, data->main->context.set.notable);
-    }
-
-    if (F_status_set_fine(status) == F_utf_not) {
-      fl_print_format("%[', not a valid UTF-8 character sequence.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-    }
-    else if (F_status_set_fine(status) == F_complete_not_utf) {
-      fl_print_format("%[', invalid UTF-8 (truncated).%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-    }
-    else if (F_status_set_fine(status) == F_utf_fragment) {
-      fl_print_format("%[', invalid UTF-8 fragment.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-    }
-    else {
-      fl_print_format("%[', error status code%] ", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-      fl_print_format("%[%ui%]", data->main->error.to.stream, data->main->context.set.notable, F_status_set_fine(status), data->main->context.set.notable);
-      fl_print_format("%[.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-    }
-  }
-#endif // _di_utf8_print_error_decode_
-
-#ifndef _di_utf8_print_error_encode_
-  void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const uint32_t codepoint) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-
-    fl_print_format("%r%[%QFailed to encode Unicode codepoint '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error);
-    fl_print_format("%[U+%_U%]", data->main->error.to.stream, data->main->context.set.notable, codepoint, data->main->context.set.notable);
-
-    if (F_status_set_fine(status) == F_utf_not) {
-      fl_print_format("%[', not a valid Unicode codepoint.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-    }
-    else {
-      fl_print_format("%[', error status code%] ", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-      fl_print_format("%[%ui%]", data->main->error.to.stream, data->main->context.set.notable, F_status_set_fine(status), data->main->context.set.notable);
-      fl_print_format("%[.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-    }
-  }
-#endif // _di_utf8_print_error_encode_
-
-#ifndef _di_utf8_print_error_no_from_
-  void utf8_print_error_no_from(utf8_data_t * const data) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-
-    fll_print_format("%r%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context, f_string_eol_s);
-  }
-#endif // _di_utf8_print_error_no_from_
-
-#ifndef _di_utf8_print_error_no_value_
-  void utf8_print_error_no_value(utf8_data_t * const data, const f_string_static_t parameter) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-
-    flockfile(data->main->error.to.stream);
-
-    fl_print_format("%r%[%QThe parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error);
-    fl_print_format("%[%r%r%]", data->main->error.to.stream, data->main->context.set.notable, f_console_symbol_long_enable_s, parameter, data->main->context.set.notable);
-    fl_print_format("%[' is specified, but no value was given.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-
-    funlockfile(data->main->error.to.stream);
-  }
-#endif // _di_utf8_print_error_no_value_
-
-#ifndef _di_utf8_print_error_parameter_file_name_empty_
-  void utf8_print_error_parameter_file_name_empty(utf8_data_t * const data, const f_array_length_t index) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-
-    flockfile(data->main->error.to.stream);
-
-    fl_print_format("%r%[%QNo file specified at parameter index %]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error);
-    fl_print_format("%[%ul%]", data->main->error.to.stream, data->main->context.set.notable, index, data->main->context.set.notable);
-    fl_print_format("%[.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-
-    funlockfile(data->main->error.to.stream);
-  }
-#endif // _di_utf8_print_error_parameter_file_name_empty_
-
-#ifndef _di_utf8_print_error_parameter_file_not_found_
-  void utf8_print_error_parameter_file_not_found(utf8_data_t * const data, const bool from, const f_string_static_t name) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-
-    flockfile(data->main->error.to.stream);
-
-    fl_print_format("%r%[%QFailed to find the %r file '%]", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, from ? utf8_string_from_s : utf8_string_to_s, data->main->context.set.error);
-    fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->context.set.notable, name, data->main->context.set.notable);
-    fl_print_format("%['.%]%r", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error, f_string_eol_s);
-
-    funlockfile(data->main->error.to.stream);
-  }
-#endif // _di_utf8_print_error_parameter_file_not_found_
-
-#ifndef _di_utf8_print_error_parameter_file_to_too_many_
-  void utf8_print_error_parameter_file_to_too_many(utf8_data_t * const data) {
-
-    if (data->main->error.verbosity == f_console_verbosity_quiet_e) return;
-
-    fll_print_format("%r%[%QToo many %r files specified, there may only be one to file.%]%r", data->main->error.to.stream, f_string_eol_s, data->main->context.set.error, data->main->error.prefix, utf8_string_to_s, data->main->context.set.error, f_string_eol_s);
-  }
-#endif // _di_utf8_print_error_parameter_file_to_too_many_
-
-#ifndef _di_utf8_print_raw_bytesequence_
-  void utf8_print_raw_bytesequence(utf8_data_t * const data, const f_utf_char_t raw, const uint8_t width) {
-
-    if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    f_string_static_t character = macro_f_string_static_t_initialize(0, 0, width);
-
-    f_char_t byte[character.used + 1];
-    character.string = byte;
-    byte[character.used] = 0;
-
-    if (raw) {
-      if (width == 1) {
-        byte[0] = macro_f_utf_char_t_to_char_4_be(raw);
-      }
-      else if (width == 2) {
-        byte[0] = macro_f_utf_char_t_to_char_3_be(raw);
-        byte[1] = macro_f_utf_char_t_to_char_4_be(raw);
-      }
-      else if (width == 3) {
-        byte[0] = macro_f_utf_char_t_to_char_2_be(raw);
-        byte[1] = macro_f_utf_char_t_to_char_3_be(raw);
-        byte[2] = macro_f_utf_char_t_to_char_4_be(raw);
-      }
-      else {
-        byte[0] = macro_f_utf_char_t_to_char_1_be(raw);
-        byte[1] = macro_f_utf_char_t_to_char_2_be(raw);
-        byte[2] = macro_f_utf_char_t_to_char_3_be(raw);
-        byte[3] = macro_f_utf_char_t_to_char_4_be(raw);
-      }
-    }
-    else {
-      memset(byte, 0, sizeof(f_char_t) * width);
-    }
-
-    fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, character, data->valid_not, data->append);
-  }
-#endif // _di_utf8_print_raw_bytesequence_
-
-#ifndef _di_utf8_print_raw_codepoint_
-  void utf8_print_raw_codepoint(utf8_data_t * const data, const f_string_static_t raw) {
-
-    if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, raw, data->valid_not, data->append);
-  }
-#endif // _di_utf8_print_raw_codepoint_
-
-#ifndef _di_utf8_print_raw_combining_or_width_
-  void utf8_print_raw_combining_or_width(utf8_data_t * const data, const uint8_t width) {
-
-    if (data->main->parameters.array[utf8_parameter_strip_invalid_e].result == f_console_result_found_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    if (data->mode & utf8_mode_to_combining_d) {
-      utf8_print_error_combining_or_width(data);
-    }
-    else if (data->mode & utf8_mode_to_width_d) {
-      const f_string_static_t *character = 0;
-
-      switch (width) {
-        case 1:
-          character = &utf8_string_width_1_s;
-          break;
-
-        case 2:
-          character = &utf8_string_width_2_s;
-          break;
-
-        case 3:
-          character = &utf8_string_width_3_s;
-          break;
-
-        case 4:
-          character = &utf8_string_width_4_s;
-          break;
-
-        default:
-          character = &utf8_string_width_0_s;
-      }
-
-      fl_print_format("%r%[%r%]%r", data->file.stream, data->prepend, data->valid_not, *character, data->valid_not, data->append);
-    }
-  }
-#endif // _di_utf8_print_raw_combining_or_width_
-
-#ifndef _di_utf8_print_section_header_file_
-  void utf8_print_section_header_file(utf8_data_t * const data, const f_string_static_t name) {
-
-    if (data->main->parameters.array[utf8_parameter_headers_e].result == f_console_result_none_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    flockfile(data->main->output.to.stream);
-
-    fl_print_format("%r%[File%] ", data->main->output.to.stream, f_string_eol_s, data->main->output.set->title, data->main->output.set->title);
-
-    if (data->file.stream == data->main->output.to.stream) {
-      fl_print_format("%[%Q%]:%r", data->main->output.to.stream, data->main->output.set->notable, name, data->main->output.set->notable, f_string_eol_s);
-    }
-    else {
-      fl_print_format("%[%Q%]: %Q.%r", data->main->output.to.stream, data->main->output.set->notable, name, data->main->output.set->notable, data->argv[data->main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_string_eol_s);
-    }
-
-    funlockfile(data->main->output.to.stream);
-  }
-#endif // _di_utf8_print_section_header_file_
-
-#ifndef _di_utf8_print_section_header_parameter_
-  void utf8_print_section_header_parameter(utf8_data_t * const data, const f_array_length_t index) {
-
-    if (data->main->parameters.array[utf8_parameter_headers_e].result == f_console_result_none_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    flockfile(data->main->output.to.stream);
-
-    fl_print_format("%r%[Parameter%] ", data->main->output.to.stream, f_string_eol_s, data->main->output.set->title, data->main->output.set->title);
-    fl_print_format("%[%ul%]:%r", data->main->output.to.stream, data->main->output.set->notable, index, data->main->output.set->notable, f_string_eol_s);
-
-    funlockfile(data->main->output.to.stream);
-  }
-#endif // _di_utf8_print_section_header_parameter_
-
-#ifndef _di_utf8_print_section_header_pipe_
-  void utf8_print_section_header_pipe(utf8_data_t * const data) {
-
-    if (data->main->parameters.array[utf8_parameter_headers_e].result == f_console_result_none_e) return;
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) return;
-
-    fll_print_format("%r%[Pipe%]:%r", data->main->output.to.stream, f_string_eol_s, data->main->output.set->title, data->main->output.set->title, f_string_eol_s);
-  }
-#endif // _di_utf8_print_section_header_pipe_
-
-#ifndef _di_utf8_print_signal_received_
-  void utf8_print_signal_received(utf8_data_t * const data, const f_status_t signal) {
-
-    if (data->main->warning.verbosity != f_console_verbosity_verbose_e && data->main->warning.verbosity != f_console_verbosity_debug_e) return;
-
-    // Must flush and reset color because the interrupt may have interrupted the middle of a print function.
-    fflush(data->main->warning.to.stream);
-
-    flockfile(data->main->warning.to.stream);
-
-    fl_print_format("%]%r%r%[Received signal code %]", data->main->warning.to.stream, data->main->context.set.reset, f_string_eol_s, f_string_eol_s, data->main->context.set.warning, data->main->context.set.warning);
-    fl_print_format("%[%i%]", data->main->warning.to.stream, data->main->context.set.notable, signal, data->main->context.set.notable);
-    fl_print_format("%[.%]%r", data->main->warning.to.stream, data->main->context.set.warning, data->main->context.set.warning, f_string_eol_s);
-
-    funlockfile(data->main->warning.to.stream);
-  }
-#endif // _di_utf8_print_signal_received_
-
-#ifndef _di_utf8_print_width_
-  void utf8_print_width(utf8_data_t * const data, const f_string_static_t sequence) {
-
-    f_status_t status = f_utf_is_wide(sequence.string, sequence.used);
-
-    if (status == F_true) {
-      fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_2_s, data->append);
-
-      return;
-    }
-
-    if (status == F_false) {
-      status = f_utf_is_graph(sequence.string, sequence.used);
-
-      if (status == F_true) {
-        fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_1_s, data->append);
-
-        return;
-      }
-
-      if (status == F_false) {
-        fl_print_format("%r%r%r", data->file.stream, data->prepend, utf8_string_width_0_s, data->append);
-
-        return;
-      }
-    }
-
-    utf8_print_error_combining_or_width(data);
-  }
-#endif // _di_utf8_print_width_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_3/utf8/c/private-print.h b/level_3/utf8/c/private-print.h
deleted file mode 100644 (file)
index e16320d..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- * FLL - Level 3
- *
- * Project: UTF-8
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- */
-#ifndef _PRIVATE_utf8_print_h
-#define _PRIVATE_utf8_print_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Print the byte sequence character (such as '豸').
- *
- * @param data
- *   The program data.
- * @param sequence
- *   A byte sequences representing a single character to print.
- */
-#ifndef _di_utf8_print_bytesequence_
-  extern void utf8_print_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_bytesequence_
-
-/**
- * Print an invalid character either as a Unicode codeblock or as a byte sequence.
- *
- * This handles whether or not the invalid character should be printed or not based on program parameters.
- *
- * @param data
- *   The program data.
- * @param invalid
- *   The byte sequence string or unicode codepoint string representing a single character to print.
- *
- * @see utf8_print_combining_or_width()
- */
-#ifndef _di_utf8_print_character_invalid_
-  extern void utf8_print_character_invalid(utf8_data_t * const data, const f_string_static_t invalid) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_character_invalid_
-
-/**
- * Print the codepoint number as a codepoint string (such as U+8C78).
- *
- * @param data
- *   The program data.
- * @param codepoint
- *   The codepoint to print.
- *   This is the code that represents a single character.
- */
-#ifndef _di_utf8_print_codepoint_
-  extern void utf8_print_codepoint(utf8_data_t * const data, const uint32_t codepoint) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_codepoint_
-
-/**
- * Print the width or combining state of the given character.
- *
- * @param data
- *   The program data.
- * @param sequence
- *   A byte sequences representing a single character to print.
- *
- * @see utf8_print_width()
- */
-#ifndef _di_utf8_print_combining_or_width_
-  extern void utf8_print_combining_or_width(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_combining_or_width_
-
-/**
- * Print an error regarding the width or combining state of a some character.
- *
- * @param data
- *   The program data.
- */
-#ifndef _di_utf8_print_error_combining_or_width_
-  extern void utf8_print_error_combining_or_width(utf8_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_combining_or_width_
-
-/**
- * Print error message when attempt to decode the character failed.
- *
- * @param data
- *   The program data.
- * @param invalid
- *   The byte sequence string or unicode codepoint string representing a single character to print.
- */
-#ifndef _di_utf8_print_error_decode_
-  extern void utf8_print_error_decode(utf8_data_t * const data, const f_status_t status, const f_string_static_t invalid) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_decode_
-
-/**
- * Print error message when attempt to encode the character failed.
- *
- * @param data
- *   The program data.
- * @param codepoint
- *   The codepoint that is invalid.
- */
-#ifndef _di_utf8_print_error_encode_
-  extern void utf8_print_error_encode(utf8_data_t * const data, const f_status_t status, const uint32_t codepoint) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_encode_
-
-/**
- * Print error message for when no sources are provided.
- *
- * @param data
- *   The program data.
- */
-#ifndef _di_utf8_print_error_no_from_
-  extern void utf8_print_error_no_from(utf8_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_no_from_
-
-/**
- * Print error message for when no sources are provided.
- *
- * @param data
- *   The program data.
- * @param parameter
- *   The long parameter name.
- */
-#ifndef _di_utf8_print_error_no_value_
-  extern void utf8_print_error_no_value(utf8_data_t * const data, const f_string_static_t parameter) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_no_value_
-
-/**
- * Print error message for when the file parameter is an empty string.
- *
- * @param data
- *   The program data.
- * @param index
- *   The index within the argv[] array where the empty string is found.
- */
-#ifndef _di_utf8_print_error_parameter_file_name_empty_
-  extern void utf8_print_error_parameter_file_name_empty(utf8_data_t * const data, const f_array_length_t index) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_parameter_file_name_empty_
-
-/**
- * Print error message for when no sources are provided in the main program parameters.
- *
- * @param data
- *   The program data.
- * @param from
- *   If TRUE, then this is a from file (source file).
- *   If FALSE, then this is a to file (destination file).
- * @param name
- *   The file path name.
- */
-#ifndef _di_utf8_print_error_parameter_file_not_found_
-  extern void utf8_print_error_parameter_file_not_found(utf8_data_t * const data, const bool from, const f_string_static_t name) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_parameter_file_not_found_
-
-/**
- * Print error message for when too many 'to' destinations are specified.
- *
- * @param data
- *   The program data.
- */
-#ifndef _di_utf8_print_error_parameter_file_to_too_many_
-  extern void utf8_print_error_parameter_file_to_too_many(utf8_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_error_parameter_file_to_too_many_
-
-/**
- * Print the raw character data (binary / byte sequence).
- *
- * @param data
- *   The program data.
- * @param raw
- *   The raw string in integer format.
- * @param width
- *   The width the raw character represents (a value inclusively from 1 to 4).
- */
-#ifndef _di_utf8_print_raw_bytesequence_
-  extern void utf8_print_raw_bytesequence(utf8_data_t * const data, const f_utf_char_t raw, const uint8_t width) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_raw_bytesequence_
-
-/**
- * Print the raw character data (codepoint).
- *
- * @param data
- *   The program data.
- * @param raw
- *   The raw string already in codepoint format.
- */
-#ifndef _di_utf8_print_raw_codepoint_
-  extern void utf8_print_raw_codepoint(utf8_data_t * const data, const f_string_static_t raw) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_raw_codepoint_
-
-/**
- * Print the width or combining state of the for a raw character.
- *
- * @param data
- *   The program data.
- * @param width
- *   The pre-calculated width.
- *
- * @see utf8_print_width()
- */
-#ifndef _di_utf8_print_raw_combining_or_width_
-  extern void utf8_print_raw_combining_or_width(utf8_data_t * const data, const uint8_t width) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_raw_combining_or_width_
-
-/**
- * Print the input file section header.
- *
- * @param data
- *   The program data.
- * @param name
- *   The name of the file.
- */
-#ifndef _di_utf8_print_section_header_file_
-  extern void utf8_print_section_header_file(utf8_data_t * const data, const f_string_static_t name) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_section_header_file_
-
-/**
- * Print the input parameter section header.
- *
- * @param data
- *   The program data.
- * @param index
- *   The index position of the parameter.
- */
-#ifndef _di_utf8_print_section_header_parameter_
-  extern void utf8_print_section_header_parameter(utf8_data_t * const data, const f_array_length_t index) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_section_header_parameter_
-
-/**
- * Print the input pipe section header.
- *
- * @param data
- *   The program data.
- */
-#ifndef _di_utf8_print_section_header_pipe_
-  extern void utf8_print_section_header_pipe(utf8_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_section_header_pipe_
-
-/**
- * Print a message about a process signal being recieved, such as an interrupt signal.
- *
- * @param data
- *   The program data.
- * @param signal
- *   The signal code received.
- */
-#ifndef _di_utf8_print_signal_received_
-  extern void utf8_print_signal_received(utf8_data_t * const data, const f_status_t signal) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_signal_received_
-
-/**
- * Print the width of the given character.
- *
- * @param data
- *   The program data.
- * @param sequence
- *   A byte sequences representing a single character whose width is to be printed.
- */
-#ifndef _di_utf8_print_width_
-  extern void utf8_print_width(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d;
-#endif // _di_utf8_print_width_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _PRIVATE_utf8_print_h
index 65b2e5bc22bc00b0fe2d442a0191283118616a9c..d7fbb0d3b0de7380e1a55b9f762406bc7f479f1a 100644 (file)
@@ -1,6 +1,5 @@
 #include "utf8.h"
 #include "private-common.h"
-#include "private-print.h"
 #include "private-utf8.h"
 #include "private-utf8_bytesequence.h"
 #include "private-utf8_codepoint.h"
@@ -10,7 +9,7 @@ extern "C" {
 #endif
 
 #ifndef _di_utf8_process_text_
-  f_status_t utf8_process_text(utf8_data_t * const data, f_string_static_t text) {
+  f_status_t utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) {
 
     if (!text.used) return F_true;
 
@@ -20,38 +19,39 @@ extern "C" {
 
     utf8_process_text_width(&text);
 
-    flockfile(data->file.stream);
+    flockfile(main->output.to.stream);
 
     for (; text.string[0] && F_status_is_error_not(status); ) {
 
-      if (!((++data->main->signal_check) % utf8_signal_check_d)) {
-        if (fll_program_standard_signal_received(data->main)) {
-          utf8_print_signal_received(data, status);
+      if (!((++main->signal_check) % utf8_signal_check_d)) {
+        if (fll_program_standard_signal_received(main)) {
+          utf8_print_signal_received(main, setting, status);
 
           status = F_status_set_error(F_interrupt);
 
           break;
         }
 
-        data->main->signal_check = 0;
+        main->signal_check = 0;
       }
 
       status = F_none;
 
-      if (data->mode & utf8_mode_from_bytesequence_d) {
-        status = utf8_convert_bytesequence(data, text);
+      if (setting->mode & utf8_mode_from_bytesequence_e) {
+        status = utf8_convert_bytesequence(main, setting, text);
       }
       else {
-        status = utf8_detect_codepoint(data, text, &mode_codepoint);
+        status = utf8_detect_codepoint(main, setting, text, &mode_codepoint);
 
         if (F_status_is_error(status)) {
-          fll_error_print(data->main->error, F_status_set_fine(status), "utf8_detect_codepoint", F_true);
+          utf8_print_line_first(setting, main->error, F_true);
+          fll_error_print(main->error, F_status_set_fine(status), "utf8_detect_codepoint", F_true);
 
           break;
         }
 
         if (F_status_is_fine(status) && status != F_next) {
-          status = utf8_convert_codepoint(data, text, &mode_codepoint);
+          status = utf8_convert_codepoint(main, setting, text, &mode_codepoint);
         }
       }
 
@@ -63,7 +63,7 @@ extern "C" {
       utf8_process_text_width(&text);
     } // for
 
-    if (F_status_is_error_not(status) && !(data->mode & utf8_mode_from_bytesequence_d)) {
+    if (F_status_is_error_not(status) && !(setting->mode & utf8_mode_from_bytesequence_e)) {
       if (mode_codepoint != utf8_codepoint_mode_ready_e && mode_codepoint != utf8_codepoint_mode_end_e && mode_codepoint != utf8_codepoint_mode_bad_end_e && mode_codepoint != utf8_codepoint_mode_raw_end_e) {
         if (mode_codepoint == utf8_codepoint_mode_number_e) {
           mode_codepoint = utf8_codepoint_mode_end_e;
@@ -79,29 +79,21 @@ extern "C" {
         text.used = 0;
 
         if (mode_codepoint == utf8_codepoint_mode_raw_number_e) {
-          status = utf8_convert_raw(data, text, &mode_codepoint);
+          status = utf8_convert_raw(main, setting, text, &mode_codepoint);
         }
         else {
-          status = utf8_convert_codepoint(data, text, &mode_codepoint);
+          status = utf8_convert_codepoint(main, setting, text, &mode_codepoint);
         }
       }
     }
 
     if (F_status_is_error(status)) {
-      funlockfile(data->file.stream);
+      funlockfile(main->output.to.stream);
 
       return status;
     }
 
-    if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) {
-
-      // When headers are printed, they are printed with a newline so only print this newline when separate is used without headers being printed.
-      if (data->main->parameters.array[utf8_parameter_headers_e].result == f_console_result_none_e && data->main->parameters.array[utf8_parameter_separate_e].result == f_console_result_found_e) {
-        f_print_dynamic_raw(f_string_eol_s, data->file.stream);
-      }
-    }
-
-    funlockfile(data->file.stream);
+    funlockfile(main->output.to.stream);
 
     return valid;
   }
index 1673b2733c8f40bfc5c445f6bb2c02ea6018350a..6c6aca578f2c37f288011bf2dd6eba8bf895ea7d 100644 (file)
@@ -15,8 +15,10 @@ extern "C" {
 /**
  * Convert the text from one format to other another format or verify text.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param text
  *   This represent a single text data.
  *   This text is NULL terminated and can therefore not contain any NULLs.
@@ -36,7 +38,7 @@ extern "C" {
  * @see utf8_signal_received()
  */
 #ifndef _di_utf8_process_text_
-  extern f_status_t utf8_process_text(utf8_data_t * const data, f_string_static_t text) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_process_text(fll_program_data_t * const main, utf8_setting_t * const setting, f_string_static_t text) F_attribute_visibility_internal_d;
 #endif // _di_utf8_process_text_
 
 /**
index dd18133b267fbde3f7a0c9a219af73d6341731c0..6f454ce89992842c91e939eb33a4413137cedb43 100644 (file)
@@ -1,6 +1,5 @@
 #include "utf8.h"
 #include "private-common.h"
-#include "private-print.h"
 #include "private-utf8.h"
 #include "private-utf8_bytesequence.h"
 #include "private-utf8_codepoint.h"
@@ -10,7 +9,7 @@ extern "C" {
 #endif
 
 #ifndef _di_utf8_convert_bytesequence_
-  f_status_t utf8_convert_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) {
+  f_status_t utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
 
     f_status_t status = F_none;
     bool valid_not = F_false;
@@ -30,25 +29,25 @@ extern "C" {
       if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) {
         valid_not = F_true;
 
-        utf8_print_character_invalid(data, sequence);
+        utf8_print_character_invalid(main, setting, sequence);
       }
       else {
         status = F_status_set_error(status);
 
-        utf8_print_error_decode(data, status, sequence);
+        utf8_print_error_decode(main, setting, status, sequence);
 
         return status;
       }
     }
-    else if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) {
-      if (data->mode & utf8_mode_to_bytesequence_d) {
-        utf8_print_bytesequence(data, sequence);
+    else if (!(setting->flag & utf8_main_flag_verify_e)) {
+      if (setting->mode & utf8_mode_to_bytesequence_e) {
+        utf8_print_bytesequence(main, setting, sequence);
       }
-      else if (data->mode & utf8_mode_to_codepoint_d) {
-        utf8_print_codepoint(data, codepoint);
+      else if (setting->mode & utf8_mode_to_codepoint_e) {
+        utf8_print_codepoint(main, setting, codepoint);
       }
       else {
-        utf8_print_combining_or_width(data, sequence);
+        utf8_print_combining_or_width(main, setting, sequence);
       }
     }
 
@@ -59,7 +58,7 @@ extern "C" {
 #endif // _di_utf8_convert_bytesequence_
 
 #ifndef _di_utf8_process_file_bytesequence_
-  f_status_t utf8_process_file_bytesequence(utf8_data_t * const data, const f_file_t file) {
+  f_status_t utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
 
     f_status_t status = F_none;
 
@@ -74,45 +73,45 @@ extern "C" {
     f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 4);
 
     do {
-      status = f_file_stream_read_block(file, &data->buffer);
+      status = f_file_stream_read_block(file, &setting->buffer);
 
-      if (status == F_none_eof && !data->buffer.used) break;
+      if (status == F_none_eof && !setting->buffer.used) break;
 
-      for (i = 0; F_status_is_fine(status) && i < data->buffer.used; ) {
+      for (i = 0; F_status_is_fine(status) && i < setting->buffer.used; ) {
 
-        if (!((++data->main->signal_check) % utf8_signal_check_d)) {
-          if (fll_program_standard_signal_received(data->main)) {
-            utf8_print_signal_received(data, status);
+        if (!((++main->signal_check) % utf8_signal_check_d)) {
+          if (fll_program_standard_signal_received(main)) {
+            utf8_print_signal_received(main, setting, status);
 
             status = F_interrupt;
 
             break;
           }
 
-          data->main->signal_check = 0;
+          main->signal_check = 0;
         }
 
         status = F_none;
 
         // Get the current width only when processing a new block.
         if (next) {
-          sequence.used = macro_f_utf_byte_width(data->buffer.string[i]);
+          sequence.used = macro_f_utf_byte_width(setting->buffer.string[i]);
           next = F_false;
         }
 
-        for (; j < sequence.used && i < data->buffer.used; ++j, ++i) {
-          sequence.string[j] = data->buffer.string[i];
+        for (; j < sequence.used && i < setting->buffer.used; ++j, ++i) {
+          sequence.string[j] = setting->buffer.string[i];
         } // for
 
         if (j == sequence.used) {
-          if (data->mode & utf8_mode_from_bytesequence_d) {
-            status = utf8_convert_bytesequence(data, sequence);
+          if (setting->mode & utf8_mode_from_bytesequence_e) {
+            status = utf8_convert_bytesequence(main, setting, sequence);
           }
           else {
-            status = utf8_detect_codepoint(data, sequence, &mode_codepoint);
+            status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
 
             if (F_status_is_fine(status) && status != F_next) {
-              status = utf8_convert_codepoint(data, sequence, &mode_codepoint);
+              status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
             }
           }
 
@@ -126,7 +125,7 @@ extern "C" {
       } // for
 
       i = 0;
-      data->buffer.used = 0;
+      setting->buffer.used = 0;
 
     } while (F_status_is_fine(status) && status != F_interrupt);
 
@@ -134,14 +133,14 @@ extern "C" {
     if (F_status_is_error_not(status) && status != F_interrupt && next == F_false) {
       sequence.used = j;
 
-      if (data->mode & utf8_mode_from_bytesequence_d) {
-        status = utf8_convert_bytesequence(data, sequence);
+      if (setting->mode & utf8_mode_from_bytesequence_e) {
+        status = utf8_convert_bytesequence(main, setting, sequence);
       }
       else {
-        status = utf8_detect_codepoint(data, sequence, &mode_codepoint);
+        status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
 
         if (F_status_is_fine(status) && status != F_next) {
-          status = utf8_convert_codepoint(data, sequence, &mode_codepoint);
+          status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
         }
       }
 
@@ -150,7 +149,7 @@ extern "C" {
       }
     }
 
-    data->buffer.used = 0;
+    setting->buffer.used = 0;
 
     if (F_status_is_error(status) || status == F_interrupt) return status;
 
index 15eee7e427b86cb4732cfb7cc1a29e643d2feacd..c2c66257790abcc5cfb26f1e36af2520d43d0d10 100644 (file)
@@ -17,8 +17,10 @@ extern "C" {
  *
  * This automatically determines the output format and is also handles the verify process.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param sequence
  *   A byte sequences representing a single character to convert.
  *   This does not stop on NULL and will process all text until sequence.used.
@@ -32,14 +34,16 @@ extern "C" {
  *   Errors (with error bit) from: f_utf_unicode_to()
  */
 #ifndef _di_utf8_convert_bytesequence_
-  extern f_status_t utf8_convert_bytesequence(utf8_data_t * const data, const f_string_static_t sequence) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_convert_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) F_attribute_visibility_internal_d;
 #endif // _di_utf8_convert_bytesequence_
 
 /**
  * Process file as a bytesequence input, handling conversion or verification as appropriate.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param file
  *   The file stream to process.
  *   This file may contain NULLs.
@@ -57,7 +61,7 @@ extern "C" {
  * @see utf8_detect_codepoint()
  */
 #ifndef _di_utf8_process_file_bytesequence_
-  extern f_status_t utf8_process_file_bytesequence(utf8_data_t * const data, const f_file_t file) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_process_file_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) F_attribute_visibility_internal_d;
 #endif // _di_utf8_process_file_bytesequence_
 
 #ifdef __cplusplus
index f96c43d99ad655b94abaffd0913e1d26199344f0..ddf0956d2b062cca2294553f37482fa8d9ca505b 100644 (file)
@@ -1,6 +1,5 @@
 #include "utf8.h"
 #include "private-common.h"
-#include "private-print.h"
 #include "private-utf8.h"
 #include "private-utf8_bytesequence.h"
 #include "private-utf8_codepoint.h"
@@ -10,26 +9,26 @@ extern "C" {
 #endif
 
 #ifndef _di_utf8_convert_codepoint_
-  f_status_t utf8_convert_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) {
+  f_status_t utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
 
     f_status_t status = F_none;
     bool valid_not = F_false;
 
     if (*mode != utf8_codepoint_mode_end_e) {
-      if (data->text.used + unicode.used >= data->text.size) {
-        status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &data->text);
+      if (setting->text.used + unicode.used >= setting->text.size) {
+        status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
         if (F_status_is_error(status)) return status;
       }
 
       for (f_array_length_t i = 0; i < unicode.used; ++i) {
-        data->text.string[data->text.used++] = unicode.string[i];
+        setting->text.string[setting->text.used++] = unicode.string[i];
       } // for
     }
 
     if (*mode == utf8_codepoint_mode_end_e) {
       uint32_t codepoint = 0;
 
-      status = f_utf_unicode_string_to(data->text.string, data->text.used, &codepoint);
+      status = f_utf_unicode_string_to(setting->text.string, setting->text.used, &codepoint);
 
       if (F_status_is_error(status)) {
         status = F_status_set_fine(status);
@@ -37,19 +36,19 @@ extern "C" {
         if (status == F_failure || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_valid_not) {
           valid_not = F_true;
 
-          utf8_print_character_invalid(data, unicode);
+          utf8_print_character_invalid(main, setting, unicode);
         }
         else {
           status = F_status_set_error(status);
 
-          utf8_print_error_decode(data, status, unicode);
+          utf8_print_error_decode(main, setting, status, unicode);
 
           return status;
         }
       }
-      else if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) {
-        if (data->mode & utf8_mode_to_codepoint_d) {
-          utf8_print_codepoint(data, codepoint);
+      else if (!(setting->flag & utf8_main_flag_verify_e)) {
+        if (setting->mode & utf8_mode_to_codepoint_e) {
+          utf8_print_codepoint(main, setting, codepoint);
         }
         else {
           f_char_t byte[4] = { 0, 0, 0, 0 };
@@ -58,23 +57,23 @@ extern "C" {
           status = f_utf_unicode_from(codepoint, 4, &unicode.string);
 
           if (F_status_is_error(status)) {
-            if (data->mode & utf8_mode_to_bytesequence_d) {
-              utf8_print_error_encode(data, status, codepoint);
+            if (setting->mode & utf8_mode_to_bytesequence_e) {
+              utf8_print_error_encode(main, setting, status, codepoint);
             }
             else {
-              utf8_print_error_combining_or_width(data);
+              utf8_print_error_combining_or_width(main, setting);
             }
           }
-          else if (data->mode & utf8_mode_to_bytesequence_d) {
+          else if (setting->mode & utf8_mode_to_bytesequence_e) {
             status = F_none;
             unicode.used = macro_f_utf_byte_width(unicode.string[0]);
 
-            utf8_print_bytesequence(data, unicode);
+            utf8_print_bytesequence(main, setting, unicode);
           }
           else {
             status = F_none;
 
-            utf8_print_combining_or_width(data, unicode);
+            utf8_print_combining_or_width(main, setting, unicode);
           }
         }
       }
@@ -82,14 +81,14 @@ extern "C" {
     else if (*mode == utf8_codepoint_mode_bad_end_e) {
       status = F_none;
 
-      utf8_print_character_invalid(data, unicode);
+      utf8_print_character_invalid(main, setting, unicode);
     }
     else {
       return F_none;
     }
 
     *mode = utf8_codepoint_mode_ready_e;
-    data->text.used = 0;
+    setting->text.used = 0;
 
     if (valid_not || F_status_is_error(status)) {
       return F_utf_not;
@@ -100,19 +99,19 @@ extern "C" {
 #endif // _di_utf8_convert_codepoint_
 
 #ifndef _di_utf8_convert_raw_
-  f_status_t utf8_convert_raw(utf8_data_t * const data, const f_string_static_t hex, uint8_t *mode) {
+  f_status_t utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) {
 
     f_status_t status = F_none;
     bool valid_not = F_false;
 
     if (*mode != utf8_codepoint_mode_raw_end_e) {
-      if (data->text.used + hex.used >= data->text.size) {
-        status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &data->text);
+      if (setting->text.used + hex.used >= setting->text.size) {
+        status = f_string_dynamic_increase_by(utf8_default_allocation_step_d, &setting->text);
         if (F_status_is_error(status)) return status;
       }
 
       for (f_array_length_t i = 0; i < hex.used; ++i) {
-        data->text.string[data->text.used++] = hex.string[i];
+        setting->text.string[setting->text.used++] = hex.string[i];
       } // for
     }
 
@@ -122,7 +121,7 @@ extern "C" {
       {
         f_number_unsigned_t number = 0;
 
-        status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data->text, &number);
+        status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, setting->text, &number);
 
         raw = (f_utf_char_t) number;
       }
@@ -133,47 +132,47 @@ extern "C" {
         if (status == F_number || status == F_utf_not || status == F_complete_not_utf || status == F_utf_fragment || status == F_number_decimal || status == F_number_negative || status == F_number_positive || status == F_number_overflow) {
           valid_not = F_true;
 
-          utf8_print_character_invalid(data, hex);
+          utf8_print_character_invalid(main, setting, hex);
         }
         else {
           status = F_status_set_error(status);
 
-          utf8_print_error_decode(data, status, hex);
+          utf8_print_error_decode(main, setting, status, hex);
 
           return status;
         }
       }
-      else if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) {
+      else if (!(setting->flag & utf8_main_flag_verify_e)) {
 
         // The width actually includes the leading '0x', which is not part of the width of the digit in binary form.
-        uint8_t width = data->text.used > 1 ? (data->text.used - 2) / 2 : 0;
+        uint8_t width = setting->text.used > 1 ? (setting->text.used - 2) / 2 : 0;
 
-        if ((data->text.used - 2) % 2) {
+        if ((setting->text.used - 2) % 2) {
           ++width;
         }
 
-        if (data->mode & utf8_mode_to_bytesequence_d) {
-          utf8_print_raw_bytesequence(data, raw, width);
+        if (setting->mode & utf8_mode_to_bytesequence_e) {
+          utf8_print_raw_bytesequence(main, setting, raw, width);
         }
-        else if (data->mode & utf8_mode_to_codepoint_d) {
-          utf8_print_raw_codepoint(data, data->text);
+        else if (setting->mode & utf8_mode_to_codepoint_e) {
+          utf8_print_raw_codepoint(main, setting, setting->text);
         }
         else {
-          utf8_print_raw_combining_or_width(data, width);
+          utf8_print_raw_combining_or_width(main, setting, width);
         }
       }
     }
     else if (*mode == utf8_codepoint_mode_bad_end_e) {
       status = F_none;
 
-      utf8_print_character_invalid(data, hex);
+      utf8_print_character_invalid(main, setting, hex);
     }
     else {
       return F_none;
     }
 
     *mode = utf8_codepoint_mode_ready_e;
-    data->text.used = 0;
+    setting->text.used = 0;
 
     if (valid_not || F_status_is_error(status)) {
       return F_valid_not;
@@ -184,7 +183,7 @@ extern "C" {
 #endif // _di_utf8_convert_raw_
 
 #ifndef _di_utf8_detect_codepoint_
-  f_status_t utf8_detect_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) {
+  f_status_t utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) {
 
     // Skip past NULL.
     if (!unicode.string[0]) {
@@ -265,11 +264,11 @@ extern "C" {
         }
         else if (unicode.string[0] == f_string_ascii_u_s.string[0] || unicode.string[0] == f_string_ascii_U_s.string[0]) {
           *mode = utf8_codepoint_mode_begin_e;
-          data->text.used = 0;
+          setting->text.used = 0;
         }
         else if (unicode.string[0] == f_string_ascii_0_s.string[0]) {
           *mode = utf8_codepoint_mode_raw_begin_e;
-          data->text.used = 0;
+          setting->text.used = 0;
         }
         else {
           *mode = utf8_codepoint_mode_bad_e;
@@ -308,7 +307,7 @@ extern "C" {
 #endif // _di_utf8_detect_codepoint_
 
 #ifndef _di_utf8_process_file_codepoint_
-  f_status_t utf8_process_file_codepoint(utf8_data_t * const data, const f_file_t file) {
+  f_status_t utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) {
 
     f_status_t status = F_none;
     bool valid = F_true;
@@ -322,21 +321,21 @@ extern "C" {
     f_string_static_t sequence = macro_f_string_static_t_initialize(block, 0, 0);
 
     do {
-      status = f_file_stream_read_block(file, &data->buffer);
+      status = f_file_stream_read_block(file, &setting->buffer);
 
-      if (status == F_none_eof && !data->buffer.used) {
+      if (status == F_none_eof && !setting->buffer.used) {
 
         // Handle complete character, which must be explicitly set to end in this situation.
         if (mode_codepoint == utf8_codepoint_mode_number_e || mode_codepoint == utf8_codepoint_mode_raw_number_e) {
           if (mode_codepoint == utf8_codepoint_mode_number_e) {
             mode_codepoint = utf8_codepoint_mode_end_e;
 
-            status = utf8_convert_codepoint(data, sequence, &mode_codepoint);
+            status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
           }
           else if (mode_codepoint == utf8_codepoint_mode_raw_number_e) {
             mode_codepoint = utf8_codepoint_mode_raw_end_e;
 
-            status = utf8_convert_raw(data, sequence, &mode_codepoint);
+            status = utf8_convert_raw(main, setting, sequence, &mode_codepoint);
 
             // Raw mode represents an invalid Unicode sequence.
             valid = F_false;
@@ -351,48 +350,48 @@ extern "C" {
         break;
       }
 
-      for (i = 0; F_status_is_fine(status) && i < data->buffer.used; ) {
+      for (i = 0; F_status_is_fine(status) && i < setting->buffer.used; ) {
 
-        if (!((++data->main->signal_check) % utf8_signal_check_d)) {
-          if (fll_program_standard_signal_received(data->main)) {
-            utf8_print_signal_received(data, status);
+        if (!((++main->signal_check) % utf8_signal_check_d)) {
+          if (fll_program_standard_signal_received(main)) {
+            utf8_print_signal_received(main, setting, status);
 
             status = F_interrupt;
 
             break;
           }
 
-          data->main->signal_check = 0;
+          main->signal_check = 0;
         }
 
         status = F_none;
 
         // Get the current width only when processing a new block.
         if (next) {
-          sequence.used = macro_f_utf_byte_width(data->buffer.string[i]);
+          sequence.used = macro_f_utf_byte_width(setting->buffer.string[i]);
           next = F_false;
         }
 
-        for (; j < sequence.used && i < data->buffer.used; ++j, ++i) {
-          sequence.string[j] = data->buffer.string[i];
+        for (; j < sequence.used && i < setting->buffer.used; ++j, ++i) {
+          sequence.string[j] = setting->buffer.string[i];
         } // for
 
         if (j >= sequence.used) {
-          if (data->mode & utf8_mode_from_bytesequence_d) {
-            status = utf8_convert_bytesequence(data, sequence);
+          if (setting->mode & utf8_mode_from_bytesequence_e) {
+            status = utf8_convert_bytesequence(main, setting, sequence);
           }
           else {
-            status = utf8_detect_codepoint(data, sequence, &mode_codepoint);
+            status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
 
             if (F_status_is_fine(status) && status != F_next) {
               if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) {
-                status = utf8_convert_raw(data, sequence, &mode_codepoint);
+                status = utf8_convert_raw(main, setting, sequence, &mode_codepoint);
 
                 // Raw mode represents an invalid Unicode sequence.
                 valid = F_false;
               }
               else {
-                status = utf8_convert_codepoint(data, sequence, &mode_codepoint);
+                status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
               }
             }
           }
@@ -406,7 +405,7 @@ extern "C" {
         }
       } // for
 
-      data->buffer.used = 0;
+      setting->buffer.used = 0;
 
     } while (F_status_is_fine(status) && status != F_interrupt);
 
@@ -414,21 +413,21 @@ extern "C" {
     if (F_status_is_error_not(status) && status != F_interrupt && next == F_false) {
       sequence.used = j;
 
-      if (data->mode & utf8_mode_from_bytesequence_d) {
-        status = utf8_convert_bytesequence(data, sequence);
+      if (setting->mode & utf8_mode_from_bytesequence_e) {
+        status = utf8_convert_bytesequence(main, setting, sequence);
       }
       else {
-        status = utf8_detect_codepoint(data, sequence, &mode_codepoint);
+        status = utf8_detect_codepoint(main, setting, sequence, &mode_codepoint);
 
         if (F_status_is_fine(status) && status != F_next) {
           if (mode_codepoint == utf8_codepoint_mode_raw_begin_e || mode_codepoint == utf8_codepoint_mode_raw_number_e || mode_codepoint == utf8_codepoint_mode_raw_end_e) {
-            status = utf8_convert_raw(data, sequence, &mode_codepoint);
+            status = utf8_convert_raw(main, setting, sequence, &mode_codepoint);
 
             // Raw mode represents an invalid Unicode sequence.
             valid = F_false;
           }
           else {
-            status = utf8_convert_codepoint(data, sequence, &mode_codepoint);
+            status = utf8_convert_codepoint(main, setting, sequence, &mode_codepoint);
           }
         }
       }
@@ -438,7 +437,7 @@ extern "C" {
       }
     }
 
-    data->buffer.used = 0;
+    setting->buffer.used = 0;
 
     if (F_status_is_error(status) || status == F_interrupt) return status;
 
index 17c122d651e632c35e35804f8d086e3d7f7a1f51..360e75b43949fcb039dd54d82e0541d7d305ccad 100644 (file)
@@ -17,8 +17,10 @@ extern "C" {
  *
  * This automatically determines the output format and also handles the verify process.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param unicode
  *   A set of bytes representing a single codepoint character to process.
  * @param mode
@@ -35,7 +37,7 @@ extern "C" {
  * @see f_utf_unicode_to()
  */
 #ifndef _di_utf8_convert_codepoint_
-  extern f_status_t utf8_convert_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_convert_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
 #endif // _di_utf8_convert_codepoint_
 
 /**
@@ -43,8 +45,10 @@ extern "C" {
  *
  * This automatically determines the output format and also handles the verify process.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param hex
  *   A set of bytes representing hexidecimal digits of a character to process.
  * @param mode
@@ -61,14 +65,16 @@ extern "C" {
  * @see fl_conversion_dynamic_to_unsigned_detect()
  */
 #ifndef _di_utf8_convert_raw_
-  extern f_status_t utf8_convert_raw(utf8_data_t * const data, const f_string_static_t hex, uint8_t *mode) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_convert_raw(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t hex, uint8_t *mode) F_attribute_visibility_internal_d;
 #endif // _di_utf8_convert_raw_
 
 /**
  * Detect a codepoint character.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param unicode
  *   A set of bytes representing a single codepoint character to process.
  * @param mode
@@ -82,14 +88,16 @@ extern "C" {
  *   Errors (with error bit) from: f_utf_is_whitespace()
  */
 #ifndef _di_utf8_detect_codepoint_
-  extern f_status_t utf8_detect_codepoint(utf8_data_t * const data, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_detect_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t unicode, uint8_t *mode) F_attribute_visibility_internal_d;
 #endif // _di_utf8_detect_codepoint_
 
 /**
  * Process file as a codepoint input, handling conversion or verification as appropriate.
  *
- * @param data
- *   The program data.
+ * @param main
+ *   The main program data.
+ * @param setting
+ *   The main program settings.
  * @param file
  *   The file stream to process.
  *   This file may contain NULLs.
@@ -107,7 +115,7 @@ extern "C" {
  * @see utf8_detect_codepoint()
  */
 #ifndef _di_utf8_process_file_codepoint_
-  extern f_status_t utf8_process_file_codepoint(utf8_data_t * const data, const f_file_t file) F_attribute_visibility_internal_d;
+  extern f_status_t utf8_process_file_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_file_t file) F_attribute_visibility_internal_d;
 #endif // _di_utf8_process_file_codepoint_
 
 #ifdef __cplusplus
index eef2f33dbd0c6025265ed33177c2697e19d684f5..ad93caeb5c74bb0f7951e4bbf498a93d051d8112 100644 (file)
@@ -1,6 +1,5 @@
 #include "utf8.h"
 #include "private-common.h"
-#include "private-print.h"
 #include "private-utf8.h"
 #include "private-utf8_bytesequence.h"
 #include "private-utf8_codepoint.h"
 extern "C" {
 #endif
 
-#ifndef _di_utf8_print_help_
-  f_status_t utf8_print_help(const f_file_t file, const f_color_context_t context) {
-
-    flockfile(file.stream);
-
-    fll_program_print_help_header(file, context, utf8_program_name_long_s, utf8_program_version_s);
-
-    fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "    Print this help message.");
-    fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "    Output using colors that show up better on dark backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Output using colors that show up better on light backgrounds.");
-    fll_program_print_help_option(file, context, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "Do not print using color.");
-    fll_program_print_help_option(file, context, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, silencing most output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Decrease verbosity, using only error output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "  Set verbosity to normal.");
-    fll_program_print_help_option(file, context, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Increase verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, "   Enable debugging, significantly increasing verbosity beyond normal output.");
-    fll_program_print_help_option(file, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
-
-    f_print_dynamic_raw(f_string_eol_s, file.stream);
-
-    fll_program_print_help_option(file, context, utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The expected input format is byte sequence (character data).");
-    fll_program_print_help_option(file, context, utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "   The expected input format is codepoint (such as U+0000).");
-    fll_program_print_help_option(file, context, utf8_short_from_file_s, utf8_long_from_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "        Use the given file as the input source.");
-
-    f_print_dynamic_raw(f_string_eol_s, file.stream);
-
-    fll_program_print_help_option(file, context, utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The output format is byte sequence (character data).");
-    fll_program_print_help_option(file, context, utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "   The output format is codepoint (such as U+0000).");
-    fll_program_print_help_option(file, context, utf8_short_to_combining_s, utf8_long_to_combining_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "   The output format is to print whether or not character is combining or not.");
-    fll_program_print_help_option(file, context, utf8_short_to_file_s, utf8_long_to_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "        Use the given file as the output destination.");
-    fll_program_print_help_option(file, context, utf8_short_to_width_s, utf8_long_to_width_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "       The output format is to print the width of a character (either 0, 1, or 2).");
-
-    f_print_dynamic_raw(f_string_eol_s, file.stream);
-
-    fll_program_print_help_option(file, context, utf8_short_headers_s, utf8_long_headers_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "      Print headers for each section (pipe, file, or parameter).");
-    fll_program_print_help_option(file, context, utf8_short_separate_s, utf8_long_separate_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "     Separate characters by newlines (implied when printing headers).");
-    fll_program_print_help_option(file, context, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Strip invalid Unicode characters (do not print invalid sequences).");
-    fll_program_print_help_option(file, context, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "       Only perform verification of valid sequences.");
-
-    fll_program_print_help_usage(file, context, utf8_program_name_s, utf8_program_help_parameters_s);
-
-    fl_print_format("  The default behavior is to assume the expected input is byte sequence from the command line to be output to the screen as codepoints.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
-
-    fl_print_format("  Multiple input sources are allowed but only a single output destination is allowed.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
-
-    fl_print_format("  When using the parameter '%[%r%r%]', no data is printed and 0 is returned if valid or 1 is returned if invalid.%r%r", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_verify_s, context.set.notable, f_string_eol_s, f_string_eol_s);
-
-    fl_print_format("  When using the parameter '%[%r%r%]' with the parameter ", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_combining_s, context.set.notable);
-    fl_print_format("'%[%r%r%]', the ", file.stream, context.set.notable, f_console_symbol_long_enable_s, utf8_long_to_width_s, context.set.notable);
-    fl_print_format("'%[%r%]' character is printed to represent the combining and the digits are used to represent widths.%r", file.stream, context.set.notable, utf8_string_combining_is_s, context.set.notable, f_string_eol_s);
-    fl_print_format("  The combining characters should be considered 1-width by themselves or 0-width when combined.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
-
-    funlockfile(file.stream);
-
-    return F_none;
-  }
-#endif // _di_utf8_print_help_
-
 #ifndef _di_utf8_main_
-  f_status_t utf8_main(fll_program_data_t * const main, utf8_main_setting_t * const setting) {
+  void utf8_main(fll_program_data_t * const main, utf8_setting_t * const setting) {
 
     if (!main || !setting) {
-      if (main->error.verbosity != f_console_verbosity_quiet_e) {
-        fll_error_print(main->error, F_status_set_fine(status), "utf8_main", F_true);
-        fll_print_dynamic_raw(f_string_eol_s, main->message.to.stream);
-      }
+      utf8_print_line_first(setting, main->error, F_true);
+      fll_error_print(main->error, F_parameter, "utf8_main", F_true);
+      utf8_print_line_last(setting, main->error, F_true);
 
-      return F_status_set_error(F_paremeter);
+      return;
     }
 
-    utf8_data_t data = utf8_data_t_initialize;
-    data.main = main;
-    data.setting = setting;
-    data.argv = main->parameters.arguments.array;
-    f_status_t status = F_none;
-
-    if (main->parameters.array[utf8_parameter_help_e].result == f_console_result_found_e) {
-      utf8_print_help(main->message.to, main->context);
-
-      utf8_data_delete(&data);
+    if (F_status_is_error(setting->status)) {
+      utf8_print_line_last(setting, main->error, F_true);
 
-      return F_none;
+      return;
     }
 
-    if (main->parameters.array[utf8_parameter_version_e].result == f_console_result_found_e) {
-      fll_program_print_version(main->message.to, utf8_program_version_s);
+    setting->status = F_none;
 
-      utf8_data_delete(&data);
+    if (setting->flag & utf8_main_flag_help_e) {
+      utf8_print_help(setting, main->message.to, main->context);
 
-      return F_none;
+      return;
     }
 
-    if (F_status_is_error_not(status)) {
-      if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_additional_e) {
-        f_array_length_t i = 0;
-        f_array_length_t index = 0;
+    if (setting->flag & utf8_main_flag_version_e) {
+      fll_program_print_version(main->message.to, utf8_program_version_s);
 
-        for (; i < main->parameters.array[utf8_parameter_from_file_e].values.used; ++i) {
+      return;
+    }
 
-          index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
+    f_status_t valid = F_true;
 
-          if (data.argv[index].used) {
-            if (f_file_exists(data.argv[index], F_true) != F_true) {
-              utf8_print_error_parameter_file_not_found(&data, F_true, data.argv[index]);
+    if (main->pipe & fll_program_data_pipe_input_e) {
+      const f_file_t file = macro_f_file_t_initialize(F_type_input_d, F_type_descriptor_input_d, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
 
-              if (F_status_is_error_not(status)) {
-                status = F_status_set_error(F_file_found_not);
-              }
-            }
-          }
-          else {
-            utf8_print_error_parameter_file_name_empty(&data, index);
+      utf8_print_section_header_pipe(main, setting);
 
-            if (F_status_is_error_not(status)) {
-              status = F_status_set_error(F_parameter);
-            }
-          }
-        } // for
+      if (setting->mode & utf8_mode_from_bytesequence_e) {
+        setting->status = utf8_process_file_bytesequence(main, setting, file);
       }
-      else if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_found_e) {
-        utf8_print_error_no_value(&data, utf8_long_from_file_s);
-
-        status = F_status_set_error(F_parameter);
+      else {
+        setting->status = utf8_process_file_codepoint(main, setting, file);
       }
-    }
-
-    bool valid = F_true;
-
-    if (F_status_is_error_not(status)) {
-      if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_additional_e) {
-        if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
-          utf8_print_error_parameter_file_to_too_many(&data);
-
-          status = F_status_set_error(F_parameter);
-        }
-        else {
-          if (data.argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]].used) {
-            status = f_file_stream_open(data.argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &data.file);
 
-            if (F_status_is_error(status)) {
-              fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-            }
+      if (F_status_is_error_not(setting->status)) {
+        if (setting->mode & utf8_mode_to_bytesequence_e) {
+          if (setting->flag & utf8_main_flag_header_e) {
+            fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
           }
-          else {
-            utf8_print_error_parameter_file_name_empty(&data, main->parameters.array[utf8_parameter_to_file_e].values.array[0]);
-
-            status = F_status_set_error(F_parameter);
+          else if ((setting->flag & utf8_main_flag_separate_e) && ((setting->flag & utf8_main_flag_file_from_e) || main->parameters.remaining.used)) {
+            fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
           }
         }
       }
-      else if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_found_e) {
-        utf8_print_error_no_value(&data, utf8_long_to_file_s);
 
-        status = F_status_set_error(F_parameter);
-      }
-      else {
-        data.file = main->message.to;
+      if (F_status_is_error(setting->status) && F_status_set_fine(setting->status) != F_utf_fragment && F_status_set_fine(setting->status) != F_complete_not_utf) {
+        fll_error_file_print(main->error, F_status_set_fine(setting->status), setting->mode & utf8_mode_from_bytesequence_e ? "utf8_process_file_bytesequence" : "utf8_process_file_codepoint", F_true, f_string_empty_s, f_file_operation_process_s, fll_error_file_type_pipe_e);
       }
     }
 
-    if (F_status_is_error_not(status)) {
-      if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_none_e && !(main->process_pipe || main->parameters.remaining.used)) {
-        utf8_print_error_no_from(&data);
-
-        status = F_status_set_error(F_parameter);
-      }
-
-      if (!(data.mode & utf8_mode_to_bytesequence_d)) {
-        if (main->parameters.array[utf8_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[utf8_parameter_headers_e].result == f_console_result_found_e) {
-          data.prepend = utf8_string_prepend_padding_s;
-          data.append = f_string_eol_s;
-        }
-        else {
-          data.prepend = f_string_space_s;
-        }
-      }
-
-      data.valid_not = main->message.set->error;
-    }
+    if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && (setting->flag & utf8_main_flag_file_from_e)) {
+      f_array_length_t i = 0;
+      f_array_length_t index = 0;
 
-    if (F_status_is_error_not(status)) {
-      status = F_none;
+      f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
 
-      if (main->process_pipe) {
-        f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
+      f_string_static_t * const args = main->parameters.arguments.array;
 
-        file.id = F_type_descriptor_input_d;
-        file.stream = F_type_input_d;
+      for (; i < main->parameters.array[utf8_parameter_from_file_e].values.used && setting->status != F_interrupt; ++i) {
 
-        utf8_print_section_header_pipe(&data);
+        if (!((++main->signal_check) % utf8_signal_check_d)) {
+          if (fll_program_standard_signal_received(main)) {
+            setting->status = F_status_set_error(F_interrupt);
 
-        if (data.mode & utf8_mode_from_bytesequence_d) {
-          status = utf8_process_file_bytesequence(&data, file);
-        }
-        else {
-          status = utf8_process_file_codepoint(&data, file);
-        }
+            break;
+          }
 
-        if (F_status_is_error(status) && F_status_set_fine(status) != F_utf_fragment && F_status_set_fine(status) != F_complete_not_utf) {
-          fll_error_file_print(main->error, F_status_set_fine(status), data.mode & utf8_mode_from_bytesequence_d ? "utf8_process_file_bytesequence" : "utf8_process_file_codepoint", F_true, f_string_empty_s, f_file_operation_process_s, fll_error_file_type_pipe_e);
+          main->signal_check = 0;
         }
-      }
-
-      if (F_status_is_error_not(status) && status != F_interrupt && main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_additional_e) {
-        f_array_length_t i = 0;
-        f_array_length_t index = 0;
 
-        f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
+        index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
 
-        for (; i < main->parameters.array[utf8_parameter_from_file_e].values.used && status != F_interrupt; ++i) {
+        utf8_print_section_header_file(main, setting, args[index], i);
 
-          if (!((++main->signal_check) % utf8_signal_check_d)) {
-            if (fll_program_standard_signal_received(main)) {
-              status = F_status_set_error(F_interrupt);
+        setting->status = f_file_stream_open(args[index], f_string_empty_s, &file);
 
-              break;
-            }
-
-            main->signal_check = 0;
-          }
+        if (F_status_is_error(setting->status)) {
+          fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[index], f_file_operation_open_s, fll_error_file_type_file_e);
 
-          index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
-
-          utf8_print_section_header_file(&data, data.argv[index]);
-
-          status = f_file_stream_open(data.argv[index], f_string_empty_s, &file);
+          break;
+        }
 
-          if (F_status_is_error(status)) {
-            fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
+        if (setting->mode & utf8_mode_from_bytesequence_e) {
+          setting->status = utf8_process_file_bytesequence(main, setting, file);
+        }
+        else {
+          setting->status = utf8_process_file_codepoint(main, setting, file);
+        }
 
-            break;
-          }
+        f_file_stream_flush(file);
+        f_file_stream_close(&file);
 
-          if (data.mode & utf8_mode_from_bytesequence_d) {
-            status = utf8_process_file_bytesequence(&data, file);
-          }
-          else {
-            status = utf8_process_file_codepoint(&data, file);
+        if (setting->flag & utf8_main_flag_verify_e) {
+          if (setting->status == F_false) {
+            valid = F_false;
           }
+        }
 
-          f_file_stream_flush(&file);
-          f_file_stream_close(&file);
-
-          if (main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) {
-            if (status == F_false) {
-              valid = F_false;
+        if (F_status_is_error_not(setting->status)) {
+          if (setting->mode & utf8_mode_to_bytesequence_e) {
+            if (setting->flag & utf8_main_flag_header_e) {
+              fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
             }
-          }
-
-          if (F_status_is_error(status) && F_status_set_fine(status) != F_utf_fragment && F_status_set_fine(status) != F_complete_not_utf) {
-            fll_error_file_print(main->error, F_status_set_fine(status), data.mode & utf8_mode_from_bytesequence_d ? "utf8_process_file_bytesequence" : "utf8_process_file_codepoint", F_true, data.argv[index], f_file_operation_process_s, fll_error_file_type_file_e);
-
-            break;
-          }
-        } // for
-      }
-
-      if (F_status_is_error_not(status) && status != F_interrupt && main->parameters.remaining.used) {
-        for (f_array_length_t i = 0; F_status_is_error_not(status) && i < main->parameters.remaining.used; ++i) {
-
-          if (!((++main->signal_check) % utf8_signal_check_d)) {
-            if (fll_program_standard_signal_received(main)) {
-              status = F_status_set_error(F_interrupt);
-
-              break;
+            else if ((setting->flag & utf8_main_flag_separate_e) && (main->parameters.remaining.used || i + 1 < main->parameters.array[utf8_parameter_from_file_e].values.used)) {
+              fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
             }
-
-            main->signal_check = 0;
           }
-
-          utf8_print_section_header_parameter(&data, main->parameters.remaining.array[i]);
-
-          status = utf8_process_text(&data, data.argv[main->parameters.remaining.array[i]]);
-
-          if (main->parameters.array[utf8_parameter_verify_e].result == f_console_result_found_e) {
-            if (status == F_false) {
-              valid = F_false;
+          else {
+            if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e))) {
+              if (!(setting->flag & utf8_main_flag_separate_e)) {
+                fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+              }
             }
           }
-        } // for
-      }
-    }
-
-    if (main->message.verbosity != f_console_verbosity_quiet_e && main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) {
-      if (status == F_interrupt) {
-        fflush(data.file.stream);
-
-        if (data.file.stream != main->message.to.stream) {
-          fflush(main->message.to.stream);
         }
-      }
-
-      fll_print_dynamic_raw(f_string_eol_s, main->message.to.stream);
-    }
-
-    utf8_data_delete(&data);
-
-    if (F_status_is_error(status) || status == F_interrupt) return status;
 
-    return valid;
-  }
-#endif // _di_utf8_main_
-
-#ifndef _di_utf8_main_setting_delete_
-  f_status_t utf8_main_setting_delete(utf8_main_setting_t * const setting) {
-
-    return F_none;
-  }
-#endif // _di_utf8_main_setting_delete_
+        if (F_status_is_error(setting->status) && F_status_set_fine(setting->status) != F_utf_fragment && F_status_set_fine(setting->status) != F_complete_not_utf) {
+          fll_error_file_print(main->error, F_status_set_fine(setting->status), setting->mode & utf8_mode_from_bytesequence_e ? "utf8_process_file_bytesequence" : "utf8_process_file_codepoint", F_true, args[index], f_file_operation_process_s, fll_error_file_type_file_e);
 
-#ifndef _di_utf8_main_setting_load_
-  f_status_t utf8_main_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_main_setting_t * const setting) {
-
-    f_status_t status = F_none;
-
-    // Identify priority of color parameters.
-    {
-      f_console_parameter_id_t ids[3] = { utf8_parameter_no_color_e, utf8_parameter_light_e, utf8_parameter_dark_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 3);
-
-      status = fll_program_parameter_process(arguments, choices, F_true, main);
-
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
-
-        return status;
-      }
-    }
-
-    {
-      const verbosity[5] = { utf8_parameter_verbosity_quiet_e, utf8_parameter_verbosity_error_e, f_console_verbosity_normal_e, utf8_parameter_verbosity_verbose_e, utf8_parameter_verbosity_debug_e };
-      f_console_parameter_id_t ids[5] = { utf8_parameter_verbosity_quiet_e, utf8_parameter_verbosity_error_e, utf8_parameter_verbosity_normal_e, utf8_parameter_verbosity_verbose_e, utf8_parameter_verbosity_debug_e };
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
-
-      status = fll_program_parameter_process_verbosity(choices, F_true, verbosity, main);
-
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
-
-        return status;
-      }
-    }
-
-    // Identify and prioritize from mode parameters.
-    {
-      f_console_parameter_id_t ids[2] = { utf8_parameter_from_bytesequence_e, utf8_parameter_from_codepoint_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 2);
-
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
-
-        return status;
-      }
-
-      if (choice == utf8_parameter_from_bytesequence_e) {
-        if (data.mode & utf8_mode_from_codepoint_d) {
-          data.mode -= utf8_mode_from_codepoint_d;
+          break;
         }
-
-        data.mode |= utf8_mode_from_bytesequence_d;
-      }
-      else if (choice == utf8_parameter_from_codepoint_e) {
-        if (data.mode & utf8_mode_from_bytesequence_d) {
-          data.mode -= utf8_mode_from_bytesequence_d;
-        }
-
-        data.mode |= utf8_mode_from_codepoint_d;
-      }
+      } // for
     }
 
-    // Identify and prioritize to mode parameters.
-    {
-      f_console_parameter_id_t ids[5] = { utf8_parameter_to_bytesequence_e, utf8_parameter_to_codepoint_e, utf8_parameter_to_combining_e, utf8_parameter_to_width_e };
-      f_console_parameter_id_t choice = 0;
-      const f_console_parameter_ids_t choices = macro_f_console_parameter_ids_t_initialize(ids, 5);
-
-      status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
-      if (F_status_is_error(status)) {
-        fll_error_print(main->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
-
-        return status;
-      }
-
-      if (choice == utf8_parameter_to_bytesequence_e) {
-        if (data.mode & utf8_mode_to_codepoint_d) {
-          data.mode -= utf8_mode_to_codepoint_d;
-        }
-
-        if (data.mode & utf8_mode_to_combining_d) {
-          data.mode -= utf8_mode_to_combining_d;
-        }
-
-        if (data.mode & utf8_mode_to_width_d) {
-          data.mode -= utf8_mode_to_width_d;
-        }
-
-        data.mode |= utf8_mode_to_bytesequence_d;
-      }
-      else if (choice == utf8_parameter_to_codepoint_e) {
-        if (data.mode & utf8_mode_to_bytesequence_d) {
-          data.mode -= utf8_mode_to_bytesequence_d;
-        }
+    if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && main->parameters.remaining.used) {
+      for (f_array_length_t i = 0; F_status_is_error_not(setting->status) && i < main->parameters.remaining.used; ++i) {
 
-        if (data.mode & utf8_mode_to_combining_d) {
-          data.mode -= utf8_mode_to_combining_d;
-        }
+        if (!((++main->signal_check) % utf8_signal_check_d)) {
+          if (fll_program_standard_signal_received(main)) {
+            setting->status = F_status_set_error(F_interrupt);
 
-        if (data.mode & utf8_mode_to_width_d) {
-          data.mode -= utf8_mode_to_width_d;
-        }
+            break;
+          }
 
-        data.mode |= utf8_mode_to_codepoint_d;
-      }
-      else if (choice == utf8_parameter_to_combining_e) {
-        if (data.mode & utf8_mode_to_bytesequence_d) {
-          data.mode -= utf8_mode_to_bytesequence_d;
+          main->signal_check = 0;
         }
 
-        if (data.mode & utf8_mode_to_codepoint_d) {
-          data.mode -= utf8_mode_to_codepoint_d;
-        }
+        utf8_print_section_header_parameter(main, setting, main->parameters.remaining.array[i]);
 
-        // --to_width may be specified with --to_combining.
-        if (main->parameters.array[utf8_parameter_to_width_e].result == f_console_result_found_e) {
-          data.mode |= utf8_mode_to_width_d;
-        }
+        setting->status = utf8_process_text(main, setting, main->parameters.arguments.array[main->parameters.remaining.array[i]]);
 
-        data.mode |= utf8_mode_to_combining_d;
-      }
-      else if (choice == utf8_parameter_to_width_e) {
-        if (data.mode & utf8_mode_to_bytesequence_d) {
-          data.mode -= utf8_mode_to_bytesequence_d;
+        if (setting->mode & utf8_mode_to_bytesequence_e) {
+          if (setting->flag & utf8_main_flag_header_e) {
+            fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+          }
+          else if ((setting->flag & utf8_main_flag_separate_e) && i + 1 < main->parameters.remaining.used) {
+            fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+          }
         }
-
-        if (data.mode & utf8_mode_to_codepoint_d) {
-          data.mode -= utf8_mode_to_codepoint_d;
+        else {
+          if (!(setting->flag & (utf8_main_flag_file_to_e | utf8_main_flag_header_e | utf8_main_flag_verify_e))) {
+            if (!(setting->flag & utf8_main_flag_separate_e)) {
+              fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+            }
+          }
         }
 
-        // --to_width may be specified with --to_combining.
-        if (main->parameters.array[utf8_parameter_to_combining_e].result == f_console_result_found_e) {
-          data.mode |= utf8_mode_to_combining_d;
+        if (setting->flag & utf8_main_flag_verify_e) {
+          if (setting->status == F_false) {
+            valid = F_false;
+          }
         }
-
-        data.mode |= utf8_mode_to_width_d;
-      }
+      } // for
     }
 
-    return F_none;
-  }
-#endif // _di_utf8_main_setting_load_
+    if (F_status_is_error(setting->status)) {
+      utf8_print_line_last(setting, main->error, F_true);
+    }
+    else if (setting->status != F_interrupt) {
+      utf8_print_line_last(setting, main->message, F_true);
+    }
 
-#ifndef _di_utf8_main_setting_unload_
-  f_status_t utf8_main_setting_unload(fll_program_data_t * const main, utf8_main_setting_t * const setting) {
+    if (F_status_is_error(setting->status) || setting->status == F_interrupt) return;
 
-    if (data->file.stream) {
-      if (data->file.stream != main->message.stream && data->file.stream != main->output.stream && data->file.stream != main->error.stream && data->file.stream != main->warning.stream && data->file.stream != main->debug.stream) {
-        f_file_stream_flush(&data->file);
-        f_file_stream_close(&data->file);
-      }
+    if (setting->flag & utf8_main_flag_verify_e) {
+      setting->status = valid;
     }
-    else if (data->file.id != -1) {
-      if (data->file.id != main->message.id && data->file.id != main->output.id && data->file.id != main->error.id && data->file.id != main->warning.id && data->file.id != main->debug.id) {
-        f_file_flush(&data->file);
-        f_file_close(&data->file);
-      }
+    else {
+      setting->status = F_none;
     }
   }
-#endif // _di_utf8_main_setting_unload_
+#endif // _di_utf8_main_
 
 #ifdef __cplusplus
 } // extern "C"
index 9d1697fc616813b7165388332cbb2b99318740b6..ffd1a5496d0e1efdae7edb5ad2b06d3041b007c3 100644 (file)
 
 // UTF-8 includes.
 #include <program/utf8/common.h>
+#include <program/utf8/print.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /**
- * Print help.
- *
- * @param file
- *   The file to print to.
- * @param context
- *   The color context settings.
- *
- * @return
- *   F_none on success.
- */
-#ifndef _di_utf8_print_help_
-  extern f_status_t utf8_print_help(const f_file_t file, const f_color_context_t context);
-#endif // _di_utf8_print_help_
-
-/**
  * Execute main program.
  *
  * If main.signal is non-zero, then this blocks and handles the following signals:
@@ -90,69 +76,20 @@ extern "C" {
  * @param main
  *   The main program data.
  * @param setting
- *   The main program setting data.
+ *   The main program settings.
  *
- * @return
- *   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.
+ *   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.
+ *     F_parameter (with error bit) if main is NULL or setting is NULL.
  */
 #ifndef _di_utf8_main_
-  extern f_status_t utf8_main(fll_program_data_t * const main, utf8_main_setting_t * const setting);
+  extern void utf8_main(fll_program_data_t * const main, utf8_setting_t * const setting);
 #endif // _di_utf8_main_
 
-/**
- * Delete the program main setting data.
- *
- * @param setting
- *   The program main setting data.
- *
- * @return
- *   F_none on success.
- */
-#ifndef _di_utf8_main_setting_delete_
-  extern f_status_t utf8_main_setting_delete(utf8_main_setting_t * const setting);
-#endif // _di_utf8_main_setting_delete_
-
-/**
- * Perform the standard program setting load process.
- *
- * @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 setting data.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: fll_program_parameter_process().
- *
- * @see fll_program_parameter_process()
- */
-#ifndef _di_utf8_main_setting_load_
-  extern f_status_t utf8_main_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_main_setting_t * const setting);
-#endif // _di_utf8_main_setting_load_
-
-/**
- * Perform the standard program setting unload process.
- *
- * @param main
- *   The main program data.
- * @param setting
- *   The main program setting data.
- *
- * @return
- *   F_none on success.
- */
-#ifndef _di_utf8_main_setting_unload_
-  extern f_status_t utf8_main_setting_unload(fll_program_data_t * const main, utf8_main_setting_t * const setting);
-#endif // _di_utf8_main_setting_unload_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 2df3049bf94f272e555b2c3b6e2faaf4908fd742..501819c4847dd7ca8db75dbb875d7ef99a5c8d59 100644 (file)
@@ -3,7 +3,7 @@
 build_name utf8
 
 version_major 0
-version_minor 6
+version_minor 7
 version_micro 0
 version_file micro
 version_target minor
@@ -22,11 +22,12 @@ build_libraries-individual -lfll_error -lfll_print -lfll_program -lfl_conversion
 build_libraries-level -lfll_2 -lfll_1 -lfll_0
 build_libraries-monolithic -lfll
 
-build_sources_library utf8.c common.c private-common.c private-print.c private-utf8.c private-utf8_bytesequence.c private-utf8_codepoint.c
+build_sources_library common.c print.c utf8.c
+build_sources_library private-common.c private-utf8.c private-utf8_bytesequence.c private-utf8_codepoint.c
 
 build_sources_program main.c
 
-build_sources_headers utf8.h common.h
+build_sources_headers common.h print.h utf8.h
 
 build_script yes
 build_shared yes