Get rid of total property.
This is redundant and too short.
Instead, use the location.used, which is an unsigned long as opposed to a uint8_t.
When I changed the result from an f_string_length_t to an f_array_length_t, I missed some places where the type needed to be replaced.
* - type: One of the f_console_type_* codes, defining how this parameter is to be processed.
*
* - result: A code representing that the parameter is found and how it is found ('-h' vs '--help').
- * - total: A number representing the total number of times this parameter is found ('-h -h' would result in a total of 2).
*
* - location: The last location in argv[] where this parameter is found.
* - location_sub: The last sub-location at location in argv (only used by short parameters, such as -h or +l).
const uint8_t has_additional;
const uint8_t type;
- uint8_t result;
- uint8_t total; // @todo locations.used could instead be used to represent the total.
-
- f_array_length_t location;
+ f_array_length_t result;
+ f_array_length_t location;
f_string_length_t location_sub;
f_array_lengths_t locations;
f_array_lengths_t locations_sub;
f_array_lengths_t additional;
} f_console_parameter_t;
- #define f_console_parameter_t_initialize(symbol_short, symbol_long, symbol_other, has_additional, type_value) { symbol_short, symbol_long, symbol_other, has_additional, type_value, f_console_result_none, 0, 0, 0, f_array_lengths_t_initialize, f_array_lengths_t_initialize, f_array_lengths_t_initialize }
+ #define f_console_parameter_t_initialize(symbol_short, symbol_long, symbol_other, has_additional, type_value) { symbol_short, symbol_long, symbol_other, has_additional, type_value, f_console_result_none, 0, 0, f_array_lengths_t_initialize, f_array_lengths_t_initialize, f_array_lengths_t_initialize }
- #define f_macro_console_parameter_t_initialize(symbol_short, symbol_long, symbol_other, has_additional, type_value, result, total, location, location_sub, locations, locations_sub, additional) { symbol_short, symbol_long, symbol_other, has_additional, type_value, result, total, location, location_sub, locations, locations_sub, additional }
+ #define f_macro_console_parameter_t_initialize(symbol_short, symbol_long, symbol_other, has_additional, type_value, result, location, location_sub, locations, locations_sub, additional) { symbol_short, symbol_long, symbol_other, has_additional, type_value, result, total, location, location_sub, locations, locations_sub, additional }
#endif // _di_f_console_parameter_t_
/**
parameters.parameter[i].result = f_console_result_found;
parameters.parameter[i].location = location;
parameters.parameter[i].location_sub = 0;
- parameters.parameter[i].total++;
if (result == console_short) {
parameters.parameter[i].location_sub = sub_location;
parameters.parameter[i].result = f_console_result_found;
parameters.parameter[i].location = location;
parameters.parameter[i].location_sub = 0;
- parameters.parameter[i].total++;
if (parameters.parameter[i].has_additional) {
if (needs_additional.used + parameters.parameter[i].has_additional > needs_additional.size) {
#endif // _di_fll_program_parameter_process_
#ifndef _di_fll_program_parameter_additional_append_
- f_return_status fll_program_parameter_additional_append(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination) {
+ f_return_status fll_program_parameter_additional_append(const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamics_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!argv) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_fll_program_parameter_additional_append_
#ifndef _di_fll_program_parameter_additional_mash_
- f_return_status fll_program_parameter_additional_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamic_t *destination) {
+ f_return_status fll_program_parameter_additional_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!argv) return F_status_set_error(F_parameter);
if (glue_length < 1) return F_status_set_error(F_parameter);
#endif // _di_fll_program_parameter_additional_mash_
#ifndef _di_fll_program_parameter_additional_rip_
- f_return_status fll_program_parameter_additional_rip(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination) {
+ f_return_status fll_program_parameter_additional_rip(const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamics_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!argv) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_fll_program_parameter_additional_rip_
#ifndef _di_fll_program_parameter_additional_rip_mash_
- f_return_status fll_program_parameter_additional_rip_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamic_t *destination) {
+ f_return_status fll_program_parameter_additional_rip_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
if (!argv) return F_status_set_error(F_parameter);
if (glue_length < 1) return F_status_set_error(F_parameter);
* @see fl_string_append()
*/
#ifndef _di_fll_program_parameter_additional_append_
- extern f_return_status fll_program_parameter_additional_append(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination);
+ extern f_return_status fll_program_parameter_additional_append(const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamics_t *destination);
#endif // _di_fll_program_parameter_additional_append_
/**
* @see fl_string_mash()
*/
#ifndef _di_fll_program_parameter_additional_mash_
- extern f_return_status fll_program_parameter_additional_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamic_t *destination);
+ extern f_return_status fll_program_parameter_additional_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamic_t *destination);
#endif // _di_fll_program_parameter_additional_mash_
/**
* @see fl_string_rip()
*/
#ifndef _di_fll_program_parameter_additional_rip_
- extern f_return_status fll_program_parameter_additional_rip(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination);
+ extern f_return_status fll_program_parameter_additional_rip(const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamics_t *destination);
#endif // _di_fll_program_parameter_additional_rip_
/**
* @see fl_string_rip()
*/
#ifndef _di_fll_program_parameter_additional_rip_mash_
- extern f_return_status fll_program_parameter_additional_rip_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamic_t *destination);
+ extern f_return_status fll_program_parameter_additional_rip_mash(const f_string_t glue, const f_string_length_t glue_length, const f_string_t *argv, const f_array_lengths_t additional, f_string_dynamic_t *destination);
#endif // _di_fll_program_parameter_additional_rip_mash_
#ifdef __cplusplus
return F_status_set_error(F_parameter);
}
else if (data->parameters[parameters_id[i]].result == f_console_result_additional) {
- if (data->parameters[parameters_id[i]].total > 1) {
+ if (data->parameters[parameters_id[i]].locations.used > 1) {
fake_print_error_parameter_too_many(*data, parameters_name[i]);
return F_status_set_error(F_parameter);
}