Provide support for trimming the object names on input and output.
After implementing this I suddenly remember that the standard might require that the whitespace before and after a valid object name are to be ignored.
This may be removed in the future and fixed in the library.
Additional investigation on how I want to handle this needs to happen first.
The standard is originally designed around ASCII, which only ASCII whitespace is considered whitespace.
This will probably have to be fixed to match the additional goals of the project in terms of whitespace handling.
fll_program_print_help_option(data.context, fss_basic_list_read_short_object, fss_basic_list_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content.");
fll_program_print_help_option(data.context, fss_basic_list_read_short_select, fss_basic_list_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index.");
fll_program_print_help_option(data.context, fss_basic_list_read_short_total, fss_basic_list_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines.");
+ fll_program_print_help_option(data.context, fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print.");
fll_program_print_help_usage(data.context, fss_basic_list_read_name, "filename(s)");
printf(" For parameters like ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_select);
- printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.");
+ printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.%c", f_string_eol);
- printf("%c%c", f_string_eol, f_string_eol);
+ printf("%c", f_string_eol);
+
+ printf(" The parameter ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_trim);
+ printf(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
return f_none;
}
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/print.h>
#include <level_1/string.h>
// fll-2 includes
#define fss_basic_list_read_short_object "o"
#define fss_basic_list_read_short_select "s"
#define fss_basic_list_read_short_total "t"
+ #define fss_basic_list_read_short_trim "T"
#define fss_basic_list_read_long_at "at"
#define fss_basic_list_read_long_depth "depth"
#define fss_basic_list_read_long_object "object"
#define fss_basic_list_read_long_select "select"
#define fss_basic_list_read_long_total "total"
+ #define fss_basic_list_read_long_trim "trim"
enum {
fss_basic_list_read_parameter_help,
fss_basic_list_read_parameter_object,
fss_basic_list_read_parameter_select,
fss_basic_list_read_parameter_total,
+ fss_basic_list_read_parameter_trim,
};
#define f_console_parameter_initialize_fss_basic_list_read \
f_console_parameter_initialize(fss_basic_list_read_short_object, fss_basic_list_read_long_object, 0, f_false, f_console_type_normal), \
f_console_parameter_initialize(fss_basic_list_read_short_select, fss_basic_list_read_long_select, 0, f_true, f_console_type_normal), \
f_console_parameter_initialize(fss_basic_list_read_short_total, fss_basic_list_read_long_total, 0, f_false, f_console_type_normal), \
+ f_console_parameter_initialize(fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, 0, f_false, f_console_type_normal), \
}
- #define fss_basic_list_read_total_parameters 13
+ #define fss_basic_list_read_total_parameters 14
#endif // _di_fss_basic_list_read_defines_
#ifndef _di_fss_basic_list_read_data_
depths->array[i].index_at = 0;
depths->array[i].index_name = 0;
depths->array[i].value_at = 0;
- depths->array[i].value_name = f_string_eos;
+
+ f_macro_string_dynamic_clear(depths->array[i].value_name);
if (data.parameters[fss_basic_list_read_parameter_depth].additional.used == 0) {
position_depth = 0;
}
depths->array[i].index_name = data.parameters[fss_basic_list_read_parameter_name].additional.array[position_name];
- depths->array[i].value_name = arguments.argv[depths->array[i].index_name];
- if (depths->array[i].value_name[0] == '\0') {
+ if (data.parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) {
+ fl_string_rip_trim(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+ else {
+ fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+
+ if (depths->array[i].value_name.used == 0) {
fl_color_print(f_standard_error, data.context.error, data.context.reset, "ERROR: The '");
fl_color_print(f_standard_error, data.context.notable, data.context.reset, "--%s", fss_basic_list_read_long_name);
fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "' must not be an empty string.");
if (depths.array[0].index_name > 0) {
memset(names, 0, sizeof(bool) * data->objects.used);
- f_string_length argv_length = strlen(depths.array[0].value_name);
f_string_length name_length = 0;
- for (f_string_length i = 0; i < data->objects.used; i++) {
- name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
+ if (data->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) {
+ for (f_string_length i = 0; i < data->objects.used; i++) {
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
- if (name_length == argv_length) {
- if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name, name_length, argv_length) == f_equal_to) {
- names[i] = 1;
+ if (name_length == depths.array[0].value_name.used) {
+ if (fl_string_compare_trim(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name.string, name_length, depths.array[0].value_name.used) == f_equal_to) {
+ names[i] = 1;
+ }
}
- }
- } // for
+ } // for
+ }
+ else {
+ for (f_string_length i = 0; i < data->objects.used; i++) {
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
+
+ if (name_length == depths.array[0].value_name.used) {
+ if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name.string, name_length, depths.array[0].value_name.used) == f_equal_to) {
+ names[i] = 1;
+ }
+ }
+ } // for
+ }
}
else {
memset(names, 1, sizeof(bool) * data->objects.used);
return f_none;
}
+ f_return_status (*print_object)(FILE *, const f_string_dynamic, const f_string_location) = &f_print_string_dynamic_partial;
+
+ if (data->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) {
+ print_object = &fl_print_trim_string_dynamic_partial;
+ }
+
if (depths.array[0].index_at > 0) {
f_array_length at = 0;
f_array_length i = 0;
for (; i < data->objects.used; i++) {
if (names[i]) {
if (at == depths.array[0].value_at) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ print_object(f_standard_output, data->buffer, data->objects.array[i]);
fprintf(f_standard_output, "%c", f_string_eol);
break;
}
for (f_string_length i = 0; i < data->objects.used; i++) {
if (names[i] == 0) continue;
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ print_object(f_standard_output, data->buffer, data->objects.array[i]);
fprintf(f_standard_output, "%c", f_string_eol);
} // for
f_array_length index_name;
f_number_unsigned value_at;
- f_string value_name;
+ f_string_dynamic value_name;
} fss_basic_list_read_depth;
#define fss_basic_list_read_depth_initialize \
0, \
0, \
0, \
- f_string_initialize, \
+ f_string_dynamic_initialize, \
}
+
+ #define macro_fss_basic_list_read_depth_clear(structure) \
+ structure.depth = 0; \
+ structure.index_at = 0; \
+ structure.index_name = 0; \
+ structure.value_at = 0; \
+ f_macro_string_dynamic_clear(structure.value_name)
+
+ #define macro_fss_basic_list_read_depth_delete(status, structure) f_macro_string_dynamic_delete(status, structure.value_name)
+ #define macro_fss_basic_list_read_depth_destroy(status, structure) f_macro_string_dynamic_destroy(status, structure.value_name)
+
+ #define macro_fss_basic_list_read_depth_delete_simple(structure) f_macro_string_dynamic_delete_simple(structure.value_name)
+ #define macro_fss_basic_list_read_depth_destroy_simple(structure) f_macro_string_dynamic_destroy_simple(structure.value_name)
#endif // _di_fss_basic_list_read_depth_
/**
#define macro_fss_basic_list_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_basic_list_read_depth, length)
- #define macro_fss_basic_list_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_basic_list_read_depth)
- #define macro_fss_basic_list_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_basic_list_read_depth)
-
- #define macro_fss_basic_list_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_basic_list_read_depth)
- #define macro_fss_basic_list_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_basic_list_read_depth)
+ #define macro_fss_basic_list_read_depths_delete(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_list_read_depth_delete(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_delete(depths, fss_basic_list_read_depth)
+
+ #define macro_fss_basic_list_read_depths_destroy(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_list_read_depth_destroy(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_destroy(depths, fss_basic_list_read_depth)
+
+ #define macro_fss_basic_list_read_depths_delete_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_list_read_depth_delete_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_delete_simple(depths, fss_basic_list_read_depth)
+
+ #define macro_fss_basic_list_read_depths_destroy_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_list_read_depth_destroy_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_destroy_simple(depths, fss_basic_list_read_depth)
+
+ #define macro_fss_basic_list_read_depths_resize(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_basic_list_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_basic_list_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_basic_list_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
- #define macro_fss_basic_list_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_basic_list_read_depth, new_length)
- #define macro_fss_basic_list_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_basic_list_read_depth, new_length)
+ #define macro_fss_basic_list_read_depths_adjust(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_basic_list_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_basic_list_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_basic_list_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
#endif // _di_fss_basic_list_read_depths_
/**
fl_directory
fl_file
fl_fss
+fl_print
fl_status
fl_string
fll_execute
build_compiler gcc
build_linker ar
build_libraries -lc
-build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_color -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
+build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_color -lfl_console -lf_conversion -lfl_directory -lfl_file -lfl_fss -lfl_print -lfl_status -lfl_string -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0
build_libraries_fll-monolithic -lfll
build_sources_library fss_basic_list_read.c private-fss_basic_list_read.c
fll_program_print_help_option(data.context, fss_basic_read_short_object, fss_basic_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content.");
fll_program_print_help_option(data.context, fss_basic_read_short_select, fss_basic_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index.");
fll_program_print_help_option(data.context, fss_basic_read_short_total, fss_basic_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines.");
+ fll_program_print_help_option(data.context, fss_basic_read_short_trim, fss_basic_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print.");
fll_program_print_help_usage(data.context, fss_basic_read_name, "filename(s)");
printf(" For parameters like ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_select);
- printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.");
+ printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.%c", f_string_eol);
- printf("%c%c", f_string_eol, f_string_eol);
+ printf("%c", f_string_eol);
+
+ printf(" The parameter ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_trim);
+ printf(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
return f_none;
}
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/print.h>
#include <level_1/string.h>
// fll-2 includes
#define fss_basic_read_short_object "o"
#define fss_basic_read_short_select "s"
#define fss_basic_read_short_total "t"
+ #define fss_basic_read_short_trim "T"
#define fss_basic_read_long_at "at"
#define fss_basic_read_long_depth "depth"
#define fss_basic_read_long_object "object"
#define fss_basic_read_long_select "select"
#define fss_basic_read_long_total "total"
+ #define fss_basic_read_long_trim "trim"
enum {
fss_basic_read_parameter_help,
fss_basic_read_parameter_object,
fss_basic_read_parameter_select,
fss_basic_read_parameter_total,
+ fss_basic_read_parameter_trim,
};
#define f_console_parameter_initialize_fss_basic_read \
f_console_parameter_initialize(fss_basic_read_short_object, fss_basic_read_long_object, 0, f_false, f_console_type_normal), \
f_console_parameter_initialize(fss_basic_read_short_select, fss_basic_read_long_select, 0, f_true, f_console_type_normal), \
f_console_parameter_initialize(fss_basic_read_short_total, fss_basic_read_long_total, 0, f_false, f_console_type_normal), \
+ f_console_parameter_initialize(fss_basic_read_short_trim, fss_basic_read_long_trim, 0, f_false, f_console_type_normal), \
}
- #define fss_basic_read_total_parameters 13
+ #define fss_basic_read_total_parameters 14
#endif // _di_fss_basic_read_defines_
#ifndef _di_fss_basic_read_data_
depths->array[i].index_at = 0;
depths->array[i].index_name = 0;
depths->array[i].value_at = 0;
- depths->array[i].value_name = f_string_eos;
+
+ f_macro_string_dynamic_clear(depths->array[i].value_name);
if (data.parameters[fss_basic_read_parameter_depth].additional.used == 0) {
position_depth = 0;
}
depths->array[i].index_name = data.parameters[fss_basic_read_parameter_name].additional.array[position_name];
- depths->array[i].value_name = arguments.argv[depths->array[i].index_name];
- if (depths->array[i].value_name[0] == '\0') {
+ if (data.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) {
+ fl_string_rip_trim(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+ else {
+ fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+
+ if (depths->array[i].value_name.used == 0) {
fl_color_print(f_standard_error, data.context.error, data.context.reset, "ERROR: The '");
fl_color_print(f_standard_error, data.context.notable, data.context.reset, "--%s", fss_basic_read_long_name);
fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "' must not be an empty string.");
if (depths.array[0].index_name > 0) {
memset(names, 0, sizeof(bool) * data->objects.used);
- f_string_length argv_length = strlen(depths.array[0].value_name);
f_string_length name_length = 0;
- for (f_string_length i = 0; i < data->objects.used; i++) {
- name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
+ if (data->parameters[fss_basic_read_parameter_trim].result == f_console_result_found) {
+ for (f_string_length i = 0; i < data->objects.used; i++) {
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
- if (name_length == argv_length) {
- if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name, name_length, argv_length) == f_equal_to) {
- names[i] = 1;
+ if (name_length == depths.array[0].value_name.used) {
+ if (fl_string_compare_trim(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name.string, name_length, depths.array[0].value_name.used) == f_equal_to) {
+ names[i] = 1;
+ }
}
- }
- } // for
+ } // for
+ }
+ else {
+ for (f_string_length i = 0; i < data->objects.used; i++) {
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
+
+ if (name_length == depths.array[0].value_name.used) {
+ if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name.string, name_length, depths.array[0].value_name.used) == f_equal_to) {
+ names[i] = 1;
+ }
+ }
+ } // for
+ }
}
else {
memset(names, 1, sizeof(bool) * data->objects.used);
return f_none;
}
+ f_return_status (*print_object)(FILE *, const f_string_dynamic, const f_string_location) = &f_print_string_dynamic_partial;
+
+ if (data->parameters[fss_basic_read_parameter_trim].result == f_console_result_found) {
+ print_object = &fl_print_trim_string_dynamic_partial;
+ }
+
if (depths.array[0].index_at > 0) {
f_array_length at = 0;
f_array_length i = 0;
for (; i < data->objects.used; i++) {
if (names[i]) {
if (at == depths.array[0].value_at) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ print_object(f_standard_output, data->buffer, data->objects.array[i]);
fprintf(f_standard_output, "%c", f_string_eol);
break;
}
for (f_array_length i = 0; i < data->objects.used; i++) {
if (names[i] == 0) continue;
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ print_object(f_standard_output, data->buffer, data->objects.array[i]);
fprintf(f_standard_output, "%c", f_string_eol);
} // for
f_array_length index_name;
f_number_unsigned value_at;
- f_string value_name;
+ f_string_dynamic value_name;
} fss_basic_read_depth;
#define fss_basic_read_depth_initialize \
0, \
0, \
0, \
- f_string_initialize, \
+ f_string_dynamic_initialize, \
}
+
+ #define macro_fss_basic_read_depth_clear(structure) \
+ structure.depth = 0; \
+ structure.index_at = 0; \
+ structure.index_name = 0; \
+ structure.value_at = 0; \
+ f_macro_string_dynamic_clear(structure.value_name)
+
+ #define macro_fss_basic_read_depth_delete(status, structure) f_macro_string_dynamic_delete(status, structure.value_name)
+ #define macro_fss_basic_read_depth_destroy(status, structure) f_macro_string_dynamic_destroy(status, structure.value_name)
+
+ #define macro_fss_basic_read_depth_delete_simple(structure) f_macro_string_dynamic_delete_simple(structure.value_name)
+ #define macro_fss_basic_read_depth_destroy_simple(structure) f_macro_string_dynamic_destroy_simple(structure.value_name)
#endif // _di_fss_basic_read_depth_
/**
#define macro_fss_basic_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_basic_read_depth, length)
- #define macro_fss_basic_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_basic_read_depth)
- #define macro_fss_basic_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_basic_read_depth)
-
- #define macro_fss_basic_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_basic_read_depth)
- #define macro_fss_basic_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_basic_read_depth)
+ #define macro_fss_basic_read_depths_delete(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_read_depth_delete(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_delete(depths, fss_basic_read_depth)
+
+ #define macro_fss_basic_read_depths_destroy(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_read_depth_destroy(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_destroy(depths, fss_basic_read_depth)
+
+ #define macro_fss_basic_read_depths_delete_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_read_depth_delete_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_delete_simple(depths, fss_basic_read_depth)
+
+ #define macro_fss_basic_read_depths_destroy_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_basic_read_depth_destroy_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_destroy_simple(depths, fss_basic_read_depth)
+
+ #define macro_fss_basic_read_depths_resize(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_basic_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_basic_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_basic_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
- #define macro_fss_basic_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_basic_read_depth, new_length)
- #define macro_fss_basic_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_basic_read_depth, new_length)
+ #define macro_fss_basic_read_depths_adjust(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_basic_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_basic_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_basic_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
#endif // _di_fss_basic_read_depths_
/**
fl_directory
fl_file
fl_fss
+fl_print
fl_status
fl_string
fll_execute
build_compiler gcc
build_linker ar
build_libraries -lc
-build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_color -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
+build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_color -lfl_console -lf_conversion -lfl_directory -lfl_file -lfl_fss -lfl_print -lfl_status -lfl_string -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0
build_libraries_fll-monolithic -lfll
build_sources_library fss_basic_read.c private-fss_basic_read.c
fll_program_print_help_option(data.context, fss_extended_list_read_short_object, fss_extended_list_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content.");
fll_program_print_help_option(data.context, fss_extended_list_read_short_select, fss_extended_list_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index.");
fll_program_print_help_option(data.context, fss_extended_list_read_short_total, fss_extended_list_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines.");
+ fll_program_print_help_option(data.context, fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print.");
fll_program_print_help_usage(data.context, fss_extended_list_read_name, "filename(s)");
printf(" For parameters like ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_list_read_long_select);
- printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.");
+ printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.%c", f_string_eol);
- printf("%c%c", f_string_eol, f_string_eol);
+ printf("%c", f_string_eol);
+
+ printf(" The parameter ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_list_read_long_trim);
+ printf(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
return f_none;
}
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/print.h>
#include <level_1/string.h>
// fll-2 includes
#define fss_extended_list_read_short_object "o"
#define fss_extended_list_read_short_select "s"
#define fss_extended_list_read_short_total "t"
+ #define fss_extended_list_read_short_trim "T"
#define fss_extended_list_read_long_at "at"
#define fss_extended_list_read_long_depth "depth"
#define fss_extended_list_read_long_object "object"
#define fss_extended_list_read_long_select "select"
#define fss_extended_list_read_long_total "total"
+ #define fss_extended_list_read_long_trim "trim"
enum {
fss_extended_list_read_parameter_help,
fss_extended_list_read_parameter_object,
fss_extended_list_read_parameter_select,
fss_extended_list_read_parameter_total,
+ fss_extended_list_read_parameter_trim,
};
#define f_console_parameter_initialize_fss_extended_list_read \
f_console_parameter_initialize(fss_extended_list_read_short_object, fss_extended_list_read_long_object, 0, f_false, f_console_type_normal), \
f_console_parameter_initialize(fss_extended_list_read_short_select, fss_extended_list_read_long_select, 0, f_true, f_console_type_normal), \
f_console_parameter_initialize(fss_extended_list_read_short_total, fss_extended_list_read_long_total, 0, f_false, f_console_type_normal), \
+ f_console_parameter_initialize(fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, 0, f_false, f_console_type_normal), \
}
- #define fss_extended_list_read_total_parameters 13
+ #define fss_extended_list_read_total_parameters 14
#endif // _di_fss_extended_list_read_defines_
#ifndef _di_fss_extended_list_read_data_
depths->array[i].index_at = 0;
depths->array[i].index_name = 0;
depths->array[i].value_at = 0;
- depths->array[i].value_name = f_string_eos;
+
+ f_macro_string_dynamic_clear(depths->array[i].value_name);
if (data.parameters[fss_extended_list_read_parameter_depth].additional.used == 0) {
position_depth = 0;
}
depths->array[i].index_name = data.parameters[fss_extended_list_read_parameter_name].additional.array[position_name];
- depths->array[i].value_name = arguments.argv[depths->array[i].index_name];
- if (depths->array[i].value_name[0] == '\0') {
+ if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ fl_string_rip_trim(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+ else {
+ fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+
+ if (depths->array[i].value_name.used == 0) {
fl_color_print(f_standard_error, data.context.error, data.context.reset, "ERROR: The '");
fl_color_print(f_standard_error, data.context.notable, data.context.reset, "--%s", fss_extended_list_read_long_name);
fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "' must not be an empty string.");
if (depth_setting.index_name > 0) {
memset(names, 0, sizeof(bool) * items->used);
- f_string_length argv_length = strlen(depth_setting.value_name);
- f_string_length name_length = 0;
+ f_string_location value_location = f_string_location_initialize;
+ value_location.stop = depth_setting.value_name.used - 1;
- for (f_string_length i = 0; i < items->used; i++) {
- name_length = (items->array[i].object.stop - items->array[i].object.start) + 1;
-
- if (name_length == argv_length) {
- if (fl_string_compare(data->buffer.string + items->array[i].object.start, depth_setting.value_name, name_length, argv_length) == f_equal_to) {
+ if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ for (f_string_length i = 0; i < items->used; i++) {
+ if (fl_string_dynamic_partial_compare_trim(data->buffer, depth_setting.value_name, items->array[i].object, value_location) == f_equal_to) {
names[i] = 1;
}
- }
- } // for
+ } // for
+ }
+ else {
+ for (f_string_length i = 0; i < items->used; i++) {
+ if (fl_string_dynamic_partial_compare(data->buffer, depth_setting.value_name, items->array[i].object, value_location) == f_equal_to) {
+ names[i] = 1;
+ }
+ } // for
+ }
}
else {
memset(names, 1, sizeof(bool) * items->used);
return f_none;
}
- else {
- if (depth_setting.index_at > 0) {
- if (depth_setting.value_at < items->used && names[depth_setting.value_at]) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, items->array[depth_setting.value_at].object);
- fprintf(f_standard_output, "%c", f_string_eol);
- }
- return f_none;
+ f_return_status (*print_object)(FILE *, const f_string_dynamic, const f_string_location) = &f_print_string_dynamic_partial;
+
+ if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) {
+ print_object = &fl_print_trim_string_dynamic_partial;
+ }
+
+ if (depth_setting.index_at > 0) {
+ if (depth_setting.value_at < items->used && names[depth_setting.value_at]) {
+ print_object(f_standard_output, data->buffer, items->array[depth_setting.value_at].object);
+ fprintf(f_standard_output, "%c", f_string_eol);
}
- for (f_array_length i = 0; i < items->used; i++) {
- if (names[i]) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, items->array[i].object);
- fprintf(f_standard_output, "%c", f_string_eol);
- }
- } // for
+ return f_none;
}
+ for (f_array_length i = 0; i < items->used; i++) {
+ if (names[i]) {
+ print_object(f_standard_output, data->buffer, items->array[i].object);
+ fprintf(f_standard_output, "%c", f_string_eol);
+ }
+ } // for
+
return f_none;
}
f_array_length index_name;
f_number_unsigned value_at;
- f_string value_name;
+ f_string_dynamic value_name;
} fss_extended_list_read_depth;
#define fss_extended_list_read_depth_initialize \
0, \
0, \
0, \
- f_string_initialize, \
+ f_string_dynamic_initialize, \
}
+
+ #define macro_fss_extended_list_read_depth_clear(structure) \
+ structure.depth = 0; \
+ structure.index_at = 0; \
+ structure.index_name = 0; \
+ structure.value_at = 0; \
+ f_macro_string_dynamic_clear(structure.value_name)
+
+ #define macro_fss_extended_list_read_depth_delete(status, structure) f_macro_string_dynamic_delete(status, structure.value_name)
+ #define macro_fss_extended_list_read_depth_destroy(status, structure) f_macro_string_dynamic_destroy(status, structure.value_name)
+
+ #define macro_fss_extended_list_read_depth_delete_simple(structure) f_macro_string_dynamic_delete_simple(structure.value_name)
+ #define macro_fss_extended_list_read_depth_destroy_simple(structure) f_macro_string_dynamic_destroy_simple(structure.value_name)
#endif // _di_fss_extended_list_read_depth_
/**
#define macro_fss_extended_list_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_extended_list_read_depth, length)
- #define macro_fss_extended_list_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_extended_list_read_depth)
- #define macro_fss_extended_list_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_extended_list_read_depth)
+ #define macro_fss_extended_list_read_depths_delete(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_list_read_depth_delete(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_delete(depths, fss_extended_list_read_depth)
+
+ #define macro_fss_extended_list_read_depths_destroy(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_list_read_depth_destroy(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_destroy(depths, fss_extended_list_read_depth)
- #define macro_fss_extended_list_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_extended_list_read_depth)
- #define macro_fss_extended_list_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_extended_list_read_depth)
+ #define macro_fss_extended_list_read_depths_delete_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_list_read_depth_delete_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_delete_simple(depths, fss_extended_list_read_depth)
- #define macro_fss_extended_list_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_extended_list_read_depth, new_length)
- #define macro_fss_extended_list_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_extended_list_read_depth, new_length)
+ #define macro_fss_extended_list_read_depths_destroy_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_list_read_depth_destroy_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_destroy_simple(depths, fss_extended_list_read_depth)
+
+ #define macro_fss_extended_list_read_depths_resize(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_extended_list_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_extended_list_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_extended_list_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
+
+ #define macro_fss_extended_list_read_depths_adjust(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_extended_list_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_extended_list_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_extended_list_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
#endif // _di_fss_extended_list_read_depths_
/**
fl_directory
fl_file
fl_fss
+fl_print
fl_status
fl_string
fll_execute
build_compiler gcc
build_linker ar
build_libraries -lc
-build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_color -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
+build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_color -lfl_console -lf_conversion -lfl_directory -lfl_file -lfl_fss -lfl_print -lfl_status -lfl_string -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0
build_libraries_fll-monolithic -lfll
build_sources_library fss_extended_list_read.c private-fss_extended_list_read.c
fll_program_print_help_option(data.context, fss_extended_read_short_object, fss_extended_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content.");
fll_program_print_help_option(data.context, fss_extended_read_short_select, fss_extended_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index.");
fll_program_print_help_option(data.context, fss_extended_read_short_total, fss_extended_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines.");
+ fll_program_print_help_option(data.context, fss_extended_read_short_trim, fss_extended_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print.");
fll_program_print_help_usage(data.context, fss_extended_read_name, "filename(s)");
printf(" For parameters like ");
fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_select);
- printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.");
+ printf(", if the standard doesn't support multiple content groups, then only a select of 0 would be valid.%c", f_string_eol);
- printf("%c%c", f_string_eol, f_string_eol);
+ printf("%c", f_string_eol);
+
+ printf(" The parameter ");
+ fl_color_print(f_standard_output, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_trim);
+ printf(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol);
+
+ printf("%c", f_string_eol);
return f_none;
}
#include <level_1/console.h>
#include <level_1/directory.h>
#include <level_1/file.h>
+#include <level_1/print.h>
#include <level_1/string.h>
// fll-2 includes
#define fss_extended_read_short_object "o"
#define fss_extended_read_short_select "s"
#define fss_extended_read_short_total "t"
+ #define fss_extended_read_short_trim "T"
#define fss_extended_read_long_at "at"
#define fss_extended_read_long_depth "depth"
#define fss_extended_read_long_object "object"
#define fss_extended_read_long_select "select"
#define fss_extended_read_long_total "total"
+ #define fss_extended_read_long_trim "trim"
enum {
fss_extended_read_parameter_help,
fss_extended_read_parameter_object,
fss_extended_read_parameter_select,
fss_extended_read_parameter_total,
+ fss_extended_read_parameter_trim,
};
#define f_console_parameter_initialize_fss_extended_read \
f_console_parameter_initialize(fss_extended_read_short_object, fss_extended_read_long_object, 0, f_false, f_console_type_normal), \
f_console_parameter_initialize(fss_extended_read_short_select, fss_extended_read_long_select, 0, f_true, f_console_type_normal), \
f_console_parameter_initialize(fss_extended_read_short_total, fss_extended_read_long_total, 0, f_false, f_console_type_normal), \
+ f_console_parameter_initialize(fss_extended_read_short_trim, fss_extended_read_long_trim, 0, f_false, f_console_type_normal), \
}
- #define fss_extended_read_total_parameters 13
+ #define fss_extended_read_total_parameters 14
#endif // _di_fss_extended_read_defines_
#ifndef _di_fss_extended_read_data_
depths->array[i].index_at = 0;
depths->array[i].index_name = 0;
depths->array[i].value_at = 0;
- depths->array[i].value_name = f_string_eos;
+
+ f_macro_string_dynamic_clear(depths->array[i].value_name);
if (data.parameters[fss_extended_read_parameter_depth].additional.used == 0) {
position_depth = 0;
}
depths->array[i].index_name = data.parameters[fss_extended_read_parameter_name].additional.array[position_name];
- depths->array[i].value_name = arguments.argv[depths->array[i].index_name];
- if (depths->array[i].value_name[0] == '\0') {
+ if (data.parameters[fss_extended_read_parameter_trim].result == f_console_result_found) {
+ fl_string_rip_trim(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+ else {
+ fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name);
+ }
+
+ if (depths->array[i].value_name.used == 0) {
fl_color_print(f_standard_error, data.context.error, data.context.reset, "ERROR: The '");
fl_color_print(f_standard_error, data.context.notable, data.context.reset, "--%s", fss_extended_read_long_name);
fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "' must not be an empty string.");
if (depths.array[0].index_name > 0) {
memset(names, 0, sizeof(bool) * data->objects.used);
- f_string_length argv_length = strlen(depths.array[0].value_name);
f_string_length name_length = 0;
- for (f_string_length i = 0; i < data->objects.used; i++) {
- name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
+ if (data->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) {
+ for (f_string_length i = 0; i < data->objects.used; i++) {
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
- if (name_length == argv_length) {
- if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name, name_length, argv_length) == f_equal_to) {
- names[i] = 1;
+ if (name_length == depths.array[0].value_name.used) {
+ if (fl_string_compare_trim(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name.string, name_length, depths.array[0].value_name.used) == f_equal_to) {
+ names[i] = 1;
+ }
}
- }
- } // for
+ } // for
+ }
+ else {
+ for (f_string_length i = 0; i < data->objects.used; i++) {
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
+
+ if (name_length == depths.array[0].value_name.used) {
+ if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name.string, name_length, depths.array[0].value_name.used) == f_equal_to) {
+ names[i] = 1;
+ }
+ }
+ } // for
+ }
}
else {
memset(names, 1, sizeof(bool) * data->objects.used);
return f_none;
}
+ f_return_status (*print_object)(FILE *, const f_string_dynamic, const f_string_location) = &f_print_string_dynamic_partial;
+
+ if (data->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) {
+ print_object = &fl_print_trim_string_dynamic_partial;
+ }
+
if (depths.array[0].index_at > 0) {
f_array_length at = 0;
f_array_length i = 0;
for (; i < data->objects.used; i++) {
if (names[i]) {
if (at == depths.array[0].value_at) {
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ print_object(f_standard_output, data->buffer, data->objects.array[i]);
fprintf(f_standard_output, "%c", f_string_eol);
break;
}
for (f_string_length i = 0; i < data->objects.used; i++) {
if (names[i] == 0) continue;
- f_print_string_dynamic_partial(f_standard_output, data->buffer, data->objects.array[i]);
+ print_object(f_standard_output, data->buffer, data->objects.array[i]);
fprintf(f_standard_output, "%c", f_string_eol);
} // for
f_array_length index_name;
f_number_unsigned value_at;
- f_string value_name;
+ f_string_dynamic value_name;
} fss_extended_read_depth;
#define fss_extended_read_depth_initialize \
0, \
0, \
0, \
- f_string_initialize, \
+ f_string_dynamic_initialize, \
}
+
+ #define macro_fss_extended_read_depth_clear(structure) \
+ structure.depth = 0; \
+ structure.index_at = 0; \
+ structure.index_name = 0; \
+ structure.value_at = 0; \
+ f_macro_string_dynamic_clear(structure.value_name)
+
+ #define macro_fss_extended_read_depth_delete(status, structure) f_macro_string_dynamic_delete(status, structure.value_name)
+ #define macro_fss_extended_read_depth_destroy(status, structure) f_macro_string_dynamic_destroy(status, structure.value_name)
+
+ #define macro_fss_extended_read_depth_delete_simple(structure) f_macro_string_dynamic_delete_simple(structure.value_name)
+ #define macro_fss_extended_read_depth_destroy_simple(structure) f_macro_string_dynamic_destroy_simple(structure.value_name)
#endif // _di_fss_extended_read_depth_
/**
#define macro_fss_extended_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_extended_read_depth, length)
- #define macro_fss_extended_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_extended_read_depth)
- #define macro_fss_extended_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_extended_read_depth)
-
- #define macro_fss_extended_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_extended_read_depth)
- #define macro_fss_extended_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_extended_read_depth)
+ #define macro_fss_extended_read_depths_delete(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_read_depth_delete(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_delete(depths, fss_extended_read_depth)
+
+ #define macro_fss_extended_read_depths_destroy(status, depths) \
+ status = f_none; \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_read_depth_destroy(status, depths.array[depths.used]); \
+ if (status != f_none) break; \
+ } \
+ if (status == f_none) f_macro_memory_structure_destroy(depths, fss_extended_read_depth)
+
+ #define macro_fss_extended_read_depths_delete_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_read_depth_delete_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_delete_simple(depths, fss_extended_read_depth)
+
+ #define macro_fss_extended_read_depths_destroy_simple(depths) \
+ depths.used = depths.size; \
+ while (depths.used > 0) { \
+ depths.used--; \
+ macro_fss_extended_read_depth_destroy_simple(depths.array[depths.used]); \
+ } \
+ if (depths.used == 0) f_macro_memory_structure_destroy_simple(depths, fss_extended_read_depth)
+
+ #define macro_fss_extended_read_depths_resize(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_extended_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_extended_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_extended_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
- #define macro_fss_extended_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_extended_read_depth, new_length)
- #define macro_fss_extended_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_extended_read_depth, new_length)
+ #define macro_fss_extended_read_depths_adjust(status, depths, new_length) \
+ status = f_none; \
+ if (new_length < depths.size) { \
+ f_array_length i = depths.size - new_length; \
+ for (; i < depths.size; i++) { \
+ macro_fss_extended_read_depth_delete(status, depths.array[i]); \
+ if (status != f_none) break; \
+ } \
+ } \
+ if (status == f_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_extended_read_depth), depths.size, new_length); \
+ if (status == f_none) { \
+ if (new_length > depths.size) { \
+ f_array_length i = depths.size; \
+ for (; i < new_length; i++) { \
+ memset(&depths.array[i], 0, sizeof(fss_extended_read_depth)); \
+ } \
+ } \
+ depths.size = new_length; \
+ if (depths.used > depths.size) depths.used = new_length; \
+ }
#endif // _di_fss_extended_read_depths_
/**
fl_directory
fl_file
fl_fss
+fl_print
fl_status
fl_string
fll_execute
build_compiler gcc
build_linker ar
build_libraries -lc
-build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_string -lfl_status -lfl_fss -lf_conversion -lfl_file -lfl_directory -lfl_console -lfl_color -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
+build_libraries_fll -lfll_program -lfll_file -lfll_fss -lfll_execute -lfl_color -lfl_console -lf_conversion -lfl_directory -lfl_file -lfl_fss -lfl_print -lfl_status -lfl_string -lf_utf -lf_file -lf_print -lf_pipe -lf_console -lf_memory
build_libraries_fll-level -lfll_2 -lfll_1 -lfll_0
build_libraries_fll-monolithic -lfll
build_sources_library fss_extended_read.c private-fss_extended_read.c