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.
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
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
build_name f_account
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_account
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_account
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_capability
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_capability
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_capability
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
#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);
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);
}
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)) {
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)) {
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);
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);
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);
#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.
* 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.
*
* @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_
/**
/**
* 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.
#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_
/**
#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_
/**
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; \
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_
/**
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;
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, \
}
#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) \
#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);
#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);
f_status
f_memory
f_string
+f_type_array
build_name f_color
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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
build_name f_color
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_color
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
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;
++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);
#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;
#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;
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, ¶meters->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;
* 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_
/**
* 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_
/**
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);
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);
* 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.)
* - 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;
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;
* 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 {
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, \
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_
#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_
build_name f_console
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_console
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_control_group
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_control_group
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_conversion
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_conversion
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_conversion
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_directory
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_directory
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_directory
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_environment
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_environment
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_environment
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_execute
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_execute
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
#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);
* @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_
/**
build_name f_file
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_file
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_file
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_fss
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_fss
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_fss
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_iki
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_iki
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_limit
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_limit
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_limit
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
#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_
#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) {
#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) {
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);
}
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;
#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_
*
* 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).
* @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_
/**
*
* 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).
* @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
#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) {
}
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) {
}
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;
#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) {
}
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;
build_name f_memory
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_path
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_path
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_path
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_pipe
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_pipe
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_pipe
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
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);
}
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);
}
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);
}
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);
}
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);
}
build_name f_print
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_print
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_print
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_serialize
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_serialize
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_serialize
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_signal
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_signal
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_signal
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_socket
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_socket
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_socket
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
F_halt_not,
F_header,
F_header_not,
+ F_help,
+ F_help_not,
F_ignore,
F_ignore_not,
F_implemented,
build_name f_status
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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);
#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"
#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
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;
build_name f_status_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_status_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
F_group_not,
F_halt,
F_halt_not,
+ F_help,
+ F_help_not,
F_header,
F_header_not,
F_ignore,
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,
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;
* 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;
#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"
#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;
#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;
#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;
#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;
build_name f_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_thread
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_thread
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_thread
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
build_name f_type
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_type_array
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name f_utf
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-f_utf
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
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
build_name fl_control_group
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_conversion
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_directory
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_environment
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_execute
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_fss
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_iki
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_print
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_signal
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_utf
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fl_utf_file
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_control_group
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
#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.
*
* @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
build_name fll_error
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_execute
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_file
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_fss
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_fss_status_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_iki
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_path
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name fll_print
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
--- /dev/null
+#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
--- /dev/null
+/**
+ * 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
#include "program.h"
+#include "private-program.h"
#ifdef __cplusplus
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);
#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) {
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;
}
}
#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;
}
}
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;
}
#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) {
}
} // 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_
#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) {
}
} // 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_
}
} // 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_
#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;
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_
#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.
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;
}
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;
}
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;
}
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;
}
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;
}
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) {
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) {
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) {
#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);
#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.
#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.
*
* 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.
* @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_
/**
*
* @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().
* @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_
/**
*
* @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.
*
* 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 *).
* 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.
#ifndef _di_fll_program_data_t_
typedef struct {
f_console_parameters_t parameters;
+ const f_string_t * environment;
mode_t umask;
pid_t pid;
0, \
0, \
0, \
+ 0, \
fll_program_data_pipe_none_e, \
0, \
0, \
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, \
build_name fll_program
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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
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;
build_name fll_status_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
build_name test-fll_status_string
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file major
version_target major
F_halt_not,
F_header,
F_header_not,
+ F_help,
+ F_help_not,
F_ignore,
F_ignore_not,
F_implemented,
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,
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;
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);
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);
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;
#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;
+ }
}
}
// 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);
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);
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);
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;
}
}
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);
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;
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)) {
* 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
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,
#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
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;
build_name byte_dump
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
}
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);
* 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
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;
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)) {
build_name control
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
* 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.
typedef struct {
f_console_parameters_t parameters;
- bool process_pipe;
bool as_init;
fl_print_t output;
{ \
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(), \
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);
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);
#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;
+ }
}
}
* @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
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;
}
}
- f_file_stream_flush(&file);
+ f_file_stream_flush(file);
f_file_stream_close(&file);
if (F_status_is_error_not(status)) {
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;
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)) {
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)) {
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);
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);
}
#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) {
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);
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) {
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_
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_
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_
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_
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);
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);
build_name controller
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
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) {
{
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);
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) {
}
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) {
* 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_
/**
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);
*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;
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);
}
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);
}
}
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,
};
#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_
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)) {
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]);
}
*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]);
}
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);
}
}
- 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, §ion_stack);
else {
status = F_none;
- f_file_stream_flush(&file);
+ f_file_stream_flush(file);
f_file_stream_close(&file);
}
}
} // for
}
- f_file_stream_flush(&file);
+ f_file_stream_flush(file);
f_file_stream_close(&file);
}
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);
}
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);
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);
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);
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;
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);
}
}
build_name fake
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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;
#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;
+ }
}
}
* 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
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);
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) {
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)) {
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)) {
build_name firewall
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
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,
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;
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;
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;
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)) {
}
} // for
- f_file_stream_flush(&file);
+ f_file_stream_flush(file);
f_file_stream_close(&file);
}
* 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
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;
build_name fss_basic_list_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
}
}
}
- 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);
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);
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)) {
}
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);
}
* 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
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;
build_name fss_basic_list_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
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,
} // 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;
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;
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;
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)) {
* 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
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;
build_name fss_basic_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
}
}
}
- 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);
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);
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)) {
}
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);
}
* 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
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;
build_name fss_basic_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
}
}
- 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);
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;
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;
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;
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;
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)) {
* 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
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;
/**
* 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 {
build_name fss_embedded_list_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
}
}
}
- 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);
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);
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) {
}
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);
}
* 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
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;
build_name fss_embedded_list_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
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,
} // 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;
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;
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;
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)) {
* 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
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;
build_name fss_extended_list_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
}
}
}
- 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);
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);
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)) {
}
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);
}
* 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
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;
build_name fss_extended_list_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
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,
} // 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;
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;
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;
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)) {
* 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
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;
build_name fss_extended_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
}
}
}
- 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);
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);
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)) {
}
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);
}
* 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
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;
build_name fss_extended_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
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;
}
}
- f_file_stream_flush(&file);
+ f_file_stream_flush(file);
f_file_stream_close(&file);
if (F_status_is_error(status)) break;
* 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
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;
build_name fss_identify
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
/**
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);
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);
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;
#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;
+ }
}
}
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,
} // 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;
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;
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;
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)) {
* 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
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;
build_name fss_payload_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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);
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;
#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;
+ }
}
}
}
}
}
- 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);
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);
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)) {
}
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);
}
* 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
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;
build_name fss_payload_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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);
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;
#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;
+ }
}
}
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);
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.
}
}
}
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.
}
}
}
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.
}
* 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
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;
build_name fss_status_code
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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_
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);
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);
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;
#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;
+ }
}
}
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);
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;
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;
// Skip past empty files.
if (!size_file) {
- f_file_stream_flush(&file);
+ f_file_stream_flush(file);
f_file_stream_close(&file);
continue;
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;
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)) {
* 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
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;
build_name iki_read
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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.");
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;
#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;
+ }
}
}
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);
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;
}
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);
}
* 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
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;
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;
}
build_name iki_write
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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,
#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
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;
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);
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;
#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;
+ }
}
}
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);
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.
}
}
}
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.
}
}
}
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.
}
* 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
build_name status_code
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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
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,
#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_
/**
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"
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;
}
--- /dev/null
+#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
--- /dev/null
+/**
+ * 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
#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
};
#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
+++ /dev/null
-#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
+++ /dev/null
-/**
- * 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
#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"
#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;
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);
}
}
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;
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;
}
/**
* 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.
* @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_
/**
#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"
#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;
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);
}
}
#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;
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);
}
}
} // for
i = 0;
- data->buffer.used = 0;
+ setting->buffer.used = 0;
} while (F_status_is_fine(status) && status != F_interrupt);
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);
}
}
}
}
- data->buffer.used = 0;
+ setting->buffer.used = 0;
if (F_status_is_error(status) || status == F_interrupt) return status;
*
* 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.
* 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.
* @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
#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"
#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);
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 };
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);
}
}
}
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;
#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
}
{
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;
}
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;
#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]) {
}
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;
#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;
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;
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);
}
}
}
}
} // for
- data->buffer.used = 0;
+ setting->buffer.used = 0;
} while (F_status_is_fine(status) && status != F_interrupt);
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);
}
}
}
}
}
- data->buffer.used = 0;
+ setting->buffer.used = 0;
if (F_status_is_error(status) || status == F_interrupt) return status;
*
* 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
* @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_
/**
*
* 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
* @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
* 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.
* @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
#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"
// 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:
* @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
build_name utf8
version_major 0
-version_minor 6
+version_minor 7
version_micro 0
version_file micro
version_target minor
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