The delimit is not being calculated correctly.
The fss_basic_read_load() and fss_basic_list_read_load functions are out of place.
The parameter order for some functions like fss_basic_read_print_at() are not adhering to the ordering practices (constants on the left).
The total is not consistently being counted.
The FSS Basic Read is not taking into consideration when Content is empty and --object is or is not selected for some line specific processing.
When there is only --content, then whether or not Content is empty matters.
When there is --object (or both --object and --content), then whether or not Content is empty does not matter because Object is already taking up a given line.
}
}
- // shorten the length to better convert the remainder to a number.
+ // Shorten the length to better convert the remainder to a number.
--length;
}
else if (arguments->argv[location][length - 1] == fss_basic_list_read_delimit_mode_name_lesser[0]) {
}
}
- // shorten the length to better convert the remainder to a number.
+ // Shorten the length to better convert the remainder to a number.
--length;
}
f_string_range_t range = macro_f_string_range_t_initialize(length);
- // ignore leading plus sign.
+ // Ignore leading plus sign.
if (arguments->argv[location][0] == '+') {
++range.start;
}
break;
}
+
+ // There can be nothing smaller than 0, so replace '0-' logic with just '0' logic.
+ if (data.delimit_mode == fss_basic_list_read_delimit_mode_content_lesser || data.delimit_mode == fss_basic_list_read_delimit_mode_content_lesser_object) {
+ if (!data.delimit_depth) {
+ if (data.delimit_mode == fss_basic_list_read_delimit_mode_content_lesser) {
+ data.delimit_mode = fss_basic_list_read_delimit_mode_content;
+ }
+ else {
+ data.delimit_mode = fss_basic_list_read_delimit_mode_content_object;
+ }
+ }
+ }
}
} // for
}
#endif // _di_fss_basic_list_read_file_identify_
+#ifndef _di_fss_basic_list_read_load_
+ f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) {
+
+ f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
+
+ data->delimits_object.used = 0;
+ data->delimits_content.used = 0;
+
+ const f_status_t status = fll_fss_basic_list_read(data->buffer, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments);
+
+ if (F_status_is_error(status)) {
+ const f_string_t file_name = fss_basic_list_read_file_identify(input.start, data->files);
+
+ fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file);
+
+ return status;
+ }
+ else if (status == F_data_not_stop || status == F_data_not_eos) {
+ if (data->option & fss_basic_list_read_data_option_total) {
+ fss_basic_list_read_print_zero(main);
+
+ return F_none;
+ }
+
+ return F_status_set_warning(status);
+ }
+
+ return F_none;
+ }
+#endif // _di_fss_basic_list_read_load_
+
#ifndef _di_fss_basic_list_read_load_number_
- f_status_t fss_basic_list_read_load_number(f_console_arguments_t * const arguments, fss_basic_list_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) {
+ f_status_t fss_basic_list_read_load_number(const f_array_length_t parameter, const f_string_t name, f_console_arguments_t * const arguments, fss_basic_list_read_main_t * const main, f_number_unsigned_t *number) {
if (main->parameters[parameter].result == f_console_result_additional) {
const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1];
#endif // _di_fss_basic_list_read_load_number_
#ifndef _di_fss_basic_list_read_print_at_
- void fss_basic_list_read_print_at(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
+ void fss_basic_list_read_print_at(const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t * const data) {
if (at >= data->contents.used) {
return;
}
#endif // _di_fss_basic_list_read_print_zero_
-#ifndef _di_fss_basic_list_read_load_
- f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) {
-
- f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
-
- data->delimits_object.used = 0;
- data->delimits_content.used = 0;
-
- const f_status_t status = fll_fss_basic_list_read(data->buffer, &input, &data->objects, &data->contents, &data->delimits_object, &data->delimits_content, &data->comments);
-
- if (F_status_is_error(status)) {
- const f_string_t file_name = fss_basic_list_read_file_identify(input.start, data->files);
-
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file);
-
- return status;
- }
- else if (status == F_data_not_stop || status == F_data_not_eos) {
- if (data->option & fss_basic_list_read_data_option_total) {
- fss_basic_list_read_print_zero(main);
-
- return F_none;
- }
-
- return F_status_set_warning(status);
- }
-
- return F_none;
- }
-#endif // _di_fss_basic_list_read_load_
-
#ifndef _di_fss_basic_list_read_process_
f_status_t fss_basic_list_read_process(f_console_arguments_t * const arguments, fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) {
if (!names[i]) continue;
- fss_basic_list_read_print_at(main, data, i, *delimits_object, *delimits_content);
+ fss_basic_list_read_print_at(i, *delimits_object, *delimits_content, main, data);
} // for
return F_none;
}
}
else {
- fss_basic_list_read_print_at(main, data, i, *delimits_object, *delimits_content);
+ fss_basic_list_read_print_at(i, *delimits_object, *delimits_content, main, data);
}
- break;
+ return F_none;
}
++at;
} // for
- // The line was never found.
- if (data->option & fss_basic_list_read_data_option_line) {
- if (data->option & fss_basic_list_read_data_option_total) {
- fss_basic_list_read_print_zero(main);
- }
+ if (data->option & fss_basic_list_read_data_option_total) {
+ fss_basic_list_read_print_zero(main);
}
return F_none;
if (main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) {
data->option |= fss_basic_list_read_data_option_line;
- status = fss_basic_list_read_load_number(arguments, main, fss_basic_list_read_parameter_line, fss_basic_list_read_long_line, &data->line);
+ status = fss_basic_list_read_load_number(fss_basic_list_read_parameter_line, fss_basic_list_read_long_line, arguments, main, &data->line);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) {
data->option |= fss_basic_list_read_data_option_select;
- status = fss_basic_list_read_load_number(arguments, main, fss_basic_list_read_parameter_select, fss_basic_list_read_long_select, &data->select);
+ status = fss_basic_list_read_load_number(fss_basic_list_read_parameter_select, fss_basic_list_read_long_select, arguments, main, &data->select);
if (F_status_is_error(status)) return status;
}
#endif // _di_fss_basic_list_read_file_identify_
/**
- * Load a given number parameter.
+ * Process the buffer, loading the FSS data.
*
* This will print an error message on error.
*
- * @param arguments
- * The console arguments passed to the program.
* @param main
* The main data.
+ * @param data
+ * The program data.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ * Errors (with error bit) from: fll_fss_basic_list_read()
+ *
+ * @see fll_fss_basic_list_read()
+ *
+ * @see fss_basic_list_read_process_option()
+ */
+#ifndef _di_fss_basic_list_read_load_
+ extern f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) f_attribute_visibility_internal;
+#endif // _di_fss_basic_list_read_load_
+
+/**
+ * Load a given number parameter.
+ *
+ * This will print an error message on error.
+ *
* @param parameter
* An ID representing the parameter.
* @param name
* The parameter name to print on error.
+ * @param arguments
+ * The console arguments passed to the program.
+ * @param main
+ * The main data.
* @param number
* The location to store the loaded number.
*
* @see fss_basic_list_read_depths_resize()
*/
#ifndef _di_fss_basic_list_read_load_number_
- extern f_status_t fss_basic_list_read_load_number(f_console_arguments_t * const arguments, fss_basic_list_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) f_attribute_visibility_internal;
+ extern f_status_t fss_basic_list_read_load_number(const f_array_length_t parameter, const f_string_t name, f_console_arguments_t * const arguments, fss_basic_list_read_main_t * const main, f_number_unsigned_t *number) f_attribute_visibility_internal;
#endif // _di_fss_basic_list_read_load_number_
/**
*
* Only what is requested to print (Object, Content, both, or neither) will be printed, if there is something to print.
*
- * @param main
- * The main data.
- * @param data
- * The program data.
* @param at
* The index in the Objects and Contents to print.
* @param delimits_object
* The delimits to be applied to an Object.
* @param delimits_content
* The delimits to be applied to Content.
+ * @param main
+ * The main data.
+ * @param data
+ * The program data.
*/
#ifndef _di_fss_basic_list_read_print_at_
- extern void fss_basic_list_read_print_at(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) f_attribute_visibility_internal;
+ extern void fss_basic_list_read_print_at(const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t * const data) f_attribute_visibility_internal;
#endif // _di_fss_basic_list_read_print_at_
/**
#endif // _di_fss_basic_list_read_print_zero_
/**
- * Process the buffer, loading the FSS data.
- *
- * This will print an error message on error.
- *
- * @param main
- * The main data.
- * @param data
- * The program data.
- *
- * @return
- * F_none on success.
- *
- * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
- * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
- *
- * Errors (with error bit) from: fll_fss_basic_list_read()
- *
- * @see fll_fss_basic_list_read()
- *
- * @see fss_basic_list_read_process_option()
- */
-#ifndef _di_fss_basic_list_read_load_
- extern f_status_t fss_basic_list_read_load(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data) f_attribute_visibility_internal;
-#endif // _di_fss_basic_list_read_load_
-
-/**
* Perform the basic read processing on the buffer.
*
* This will print an error message on error.
}
}
- // shorten the length to better convert the remainder to a number.
+ // Shorten the length to better convert the remainder to a number.
--length;
}
else if (arguments->argv[location][length - 1] == fss_basic_read_delimit_mode_name_lesser[0]) {
}
}
- // shorten the length to better convert the remainder to a number.
+ // Shorten the length to better convert the remainder to a number.
--length;
}
f_string_range_t range = macro_f_string_range_t_initialize(length);
- // ignore leading plus sign.
+ // Ignore leading plus sign.
if (arguments->argv[location][0] == '+') {
++range.start;
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_delimit, arguments->argv[location]);
+
break;
}
+
+ // There can be nothing smaller than 0, so replace '0-' logic with just '0' logic.
+ if (data.delimit_mode == fss_basic_read_delimit_mode_content_lesser || data.delimit_mode == fss_basic_read_delimit_mode_content_lesser_object) {
+ if (!data.delimit_depth) {
+ if (data.delimit_mode == fss_basic_read_delimit_mode_content_lesser) {
+ data.delimit_mode = fss_basic_read_delimit_mode_content;
+ }
+ else {
+ data.delimit_mode = fss_basic_read_delimit_mode_content_object;
+ }
+ }
+ }
}
} // for
}
#endif // _di_fss_basic_read_file_identify_
+#ifndef _di_fss_basic_read_load_
+ f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) {
+
+ f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
+
+ data->delimits.used = 0;
+
+ const f_status_t status = fll_fss_basic_read(data->buffer, &input, &data->objects, &data->contents, 0, &data->delimits, 0);
+
+ if (F_status_is_error(status)) {
+ const f_string_t file_name = fss_basic_read_file_identify(input.start, data->files);
+
+ fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file);
+
+ return status;
+ }
+ else if (status == F_data_not_stop || status == F_data_not_eos) {
+ if (data->option & fss_basic_read_data_option_total) {
+ fss_basic_read_print_zero(main);
+
+ return F_none;
+ }
+
+ return F_status_set_warning(status);
+ }
+
+ return F_none;
+ }
+#endif // _di_fss_basic_read_load_
+
#ifndef _di_fss_basic_read_load_number_
- f_status_t fss_basic_read_load_number(f_console_arguments_t * const arguments, fss_basic_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) {
+ f_status_t fss_basic_read_load_number(const f_array_length_t parameter, const f_string_t name, f_console_arguments_t * const arguments, fss_basic_read_main_t * const main, f_number_unsigned_t *number) {
if (main->parameters[parameter].result == f_console_result_additional) {
const f_array_length_t index = main->parameters[parameter].values.array[main->parameters[parameter].values.used - 1];
#endif // _di_fss_basic_read_load_number_
#ifndef _di_fss_basic_read_print_at_
- void fss_basic_read_print_at(fss_basic_read_main_t * const main, fss_basic_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) {
+ void fss_basic_read_print_at(const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_read_main_t * const main, fss_basic_read_data_t * const data) {
if (at >= data->contents.used) {
return;
}
#endif // _di_fss_basic_read_print_zero_
-#ifndef _di_fss_basic_read_load_
- f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) {
-
- f_string_range_t input = macro_f_string_range_t_initialize(data->buffer.used);
-
- data->delimits.used = 0;
-
- const f_status_t status = fll_fss_basic_read(data->buffer, &input, &data->objects, &data->contents, 0, &data->delimits, 0);
-
- if (F_status_is_error(status)) {
- const f_string_t file_name = fss_basic_read_file_identify(input.start, data->files);
-
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file);
-
- return status;
- }
- else if (status == F_data_not_stop || status == F_data_not_eos) {
- if (data->option & fss_basic_read_data_option_total) {
- fss_basic_read_print_zero(main);
-
- return F_none;
- }
-
- return F_status_set_warning(status);
- }
-
- return F_none;
- }
-#endif // _di_fss_basic_read_load_
-
#ifndef _di_fss_basic_read_process_
f_status_t fss_basic_read_process(f_console_arguments_t * const arguments, fss_basic_read_main_t * const main, fss_basic_read_data_t *data) {
if (!names[i]) continue;
- fss_basic_read_print_at(main, data, i, *delimits, except_none);
+ fss_basic_read_print_at(i, *delimits, except_none, main, data);
} // for
return F_none;
if (at == data->depths.array[0].value_at) {
if (data->option & fss_basic_read_data_option_line) {
- // This standard only supports one Content per Object so when using "--at", the only valid line is line 0.
+ // This standard only supports one line per Object so when using "--at", the only valid line is line 0.
+ if (data->line) break;
+
if (data->option & fss_basic_read_data_option_total) {
- if (data->line) {
- fss_basic_read_print_zero(main);
- }
- else {
- fss_basic_read_print_one(main);
- }
+ fss_basic_read_print_one(main);
}
- else if (!data->line) {
- fss_basic_read_print_at(main, data, i, *delimits, except_none);
+ else {
+ fss_basic_read_print_at(i, *delimits, except_none, main, data);
}
}
else if (data->option & fss_basic_read_data_option_total) {
}
}
else {
- fss_basic_read_print_at(main, data, i, *delimits, except_none);
+ fss_basic_read_print_at(i, *delimits, except_none, main, data);
}
- break;
+ return F_none;
}
++at;
} // for
+ if (data->option & fss_basic_read_data_option_total) {
+ fss_basic_read_print_zero(main);
+ }
+
return F_none;
}
#endif // _di_fss_basic_read_process_at_
if (!names[i]) continue;
- if (!data->contents.array[i].used) {
- if (data->option & fss_basic_read_data_option_empty) {
- if (line == data->line) {
- fss_basic_read_print_set_end(main);
+ if (!(data->option & fss_basic_read_data_option_object) && (data->option & fss_basic_read_data_option_content)) {
+ if (!data->contents.array[i].used) {
+ if (data->option & fss_basic_read_data_option_empty) {
+ if (line == data->line) {
+ fss_basic_read_print_set_end(main);
- break;
+ break;
+ }
+
+ ++line;
}
- ++line;
+ continue;
}
-
- continue;
}
if (line == data->line) {
- fss_basic_read_print_at(main, data, i, *delimits, except_none);
+ fss_basic_read_print_at(i, *delimits, except_none, main, data);
break;
}
if (main->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) {
data->option |= fss_basic_read_data_option_line;
- status = fss_basic_read_load_number(arguments, main, fss_basic_read_parameter_line, fss_basic_read_long_line, &data->line);
+ status = fss_basic_read_load_number(fss_basic_read_parameter_line, fss_basic_read_long_line, arguments, main, &data->line);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) {
data->option |= fss_basic_read_data_option_select;
- status = fss_basic_read_load_number(arguments, main, fss_basic_read_parameter_select, fss_basic_read_long_select, &data->select);
+ status = fss_basic_read_load_number(fss_basic_read_parameter_select, fss_basic_read_long_select, arguments, main, &data->select);
if (F_status_is_error(status)) return status;
}
if (!names[i]) continue;
- if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty))) {
- continue;
+ if (!(data->option & fss_basic_read_data_option_object) && data->option & fss_basic_read_data_option_content) {
+ if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty))) {
+ continue;
+ }
}
++total;
#endif // _di_fss_basic_read_file_identify_
/**
- * Load a given number parameter.
+ * Process the buffer, loading the FSS data.
*
* This will print an error message on error.
*
- * @param arguments
- * The console arguments passed to the program.
* @param main
* The main data.
+ * @param data
+ * The program data.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
+ * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
+ *
+ * Errors (with error bit) from: fll_fss_basic_read()
+ *
+ * @see fll_fss_basic_read()
+ *
+ * @see fss_basic_read_process_option()
+ */
+#ifndef _di_fss_basic_read_load_
+ extern f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) f_attribute_visibility_internal;
+#endif // _di_fss_basic_read_load_
+
+/**
+ * Load a given number parameter.
+ *
+ * This will print an error message on error.
+ *
* @param parameter
* An ID representing the parameter.
* @param name
* The parameter name to print on error.
+ * @param arguments
+ * The console arguments passed to the program.
+ * @param main
+ * The main data.
* @param number
* The location to store the loaded number.
*
* @see fss_basic_read_depths_resize()
*/
#ifndef _di_fss_basic_read_load_number_
- extern f_status_t fss_basic_read_load_number(f_console_arguments_t * const arguments, fss_basic_read_main_t * const main, const f_array_length_t parameter, const f_string_t name, f_number_unsigned_t *number) f_attribute_visibility_internal;
+ extern f_status_t fss_basic_read_load_number(const f_array_length_t parameter, const f_string_t name, f_console_arguments_t * const arguments, fss_basic_read_main_t * const main, f_number_unsigned_t *number) f_attribute_visibility_internal;
#endif // _di_fss_basic_read_load_number_
/**
*
* Only what is requested to print (Object, Content, both, or neither) will be printed, if there is something to print.
*
- * @param main
- * The main data.
- * @param data
- * The program data.
* @param at
* The index in the Objects and Contents to print.
* @param delimits_object
* The delimits to be applied to an Object.
* @param delimits_content
* The delimits to be applied to Content.
+ * @param main
+ * The main data.
+ * @param data
+ * The program data.
*/
#ifndef _di_fss_basic_read_print_at_
- extern void fss_basic_read_print_at(fss_basic_read_main_t * const main, fss_basic_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content) f_attribute_visibility_internal;
+ extern void fss_basic_read_print_at(const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_read_main_t * const main, fss_basic_read_data_t * const data) f_attribute_visibility_internal;
#endif // _di_fss_basic_read_print_at_
/**
#endif // _di_fss_basic_read_print_zero_
/**
- * Process the buffer, loading the FSS data.
- *
- * This will print an error message on error.
- *
- * @param main
- * The main data.
- * @param data
- * The program data.
- *
- * @return
- * F_none on success.
- *
- * F_data_not_stop (with warning bit) on no valid FSS data found and reached stopping point.
- * F_data_not_eos (with warning bit) on no valid FSS data found and reached end of string.
- *
- * Errors (with error bit) from: fll_fss_basic_read()
- *
- * @see fll_fss_basic_read()
- *
- * @see fss_basic_read_process_option()
- */
-#ifndef _di_fss_basic_read_load_
- extern f_status_t fss_basic_read_load(fss_basic_read_main_t * const main, fss_basic_read_data_t *data) f_attribute_visibility_internal;
-#endif // _di_fss_basic_read_load_
-
-/**
* Perform the basic read processing on the buffer.
*
* This will print an error message on error.