Althought not ideal, the ids must be in an explicit order of no_color, light, and dark.
This has been added to the functional documentation.
#endif // _di_fll_program_print_version_
#ifndef _di_fll_program_process_parameters_
- f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context) {
+ f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, f_string_lengths *remaining, fl_color_context *context) {
f_status status = f_none;
f_status allocation_status = f_none;
status = fl_console_parameter_process(arguments, parameters, remaining);
- f_console_parameter_ids choices = f_console_parameter_ids_initialize;
- f_console_parameter_id decision = parameter_dark;
- f_console_parameter_id ids[3] = { parameter_no_color, parameter_light, parameter_dark};
-
- choices.id = ids;
- choices.used = 3;
+ f_console_parameter_id decision = choices.id[2];
fl_console_parameter_prioritize(parameters, choices, &decision);
// load colors unless told not to.
- if (decision != parameter_no_color) {
+ if (decision != choices.id[0]) {
fl_macro_color_context_new(allocation_status, (*context));
if (f_status_is_error(allocation_status)) {
return allocation_status;
}
- fl_color_load_context(context, decision == parameter_light);
+ fl_color_load_context(context, decision == choices.id[1]);
}
if (f_status_is_error(status)) {
* The parameters passed to the process.
* @param parameters
* The console parameters to look for.
- * @param parameter_no_color
- * The parameter in the parameters array representing the no-color option.
- * @param parameter_light
- * The parameter in the parameters array representing the light-color option.
- * @param parameter_dark
- * The parameter in the parameters array representing the dark-color option.
+ * @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.
* @param remaining
* A list of remaining parameters not associated with anything.
* @param context
* f_reallocation_error (with error bit) on memory reallocation error.
*/
#ifndef _di_fll_program_process_parameters_
- extern f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context);
+ extern f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, f_string_lengths *remaining, fl_color_context *context);
#endif // _di_fll_program_process_parameters_
#ifdef __cplusplus
{
f_console_parameters parameters = { data->parameters, bit_dump_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, bit_dump_parameter_no_color, bit_dump_parameter_light, bit_dump_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { bit_dump_parameter_no_color, bit_dump_parameter_light, bit_dump_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, firewall_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_basic_list_read_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_basic_list_write_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_basic_read_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_basic_write_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_extended_read_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_extended_write_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, fss_status_code_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, init_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, init_parameter_no_color, init_parameter_light, init_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { init_parameter_no_color, init_parameter_light, init_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {
{
f_console_parameters parameters = { data->parameters, status_code_total_parameters };
- status = fll_program_process_parameters(arguments, parameters, status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark, &data->remaining, &data->context);
+ f_console_parameter_id ids[3] = { status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark };
+ f_console_parameter_ids choices = { ids, 3 };
+
+ status = fll_program_process_parameters(arguments, parameters, choices, &data->remaining, &data->context);
}
if (f_status_is_error(status)) {