#endif // _di_f_console_parameter_prioritize_right_
#ifndef _di_f_console_parameter_process_
- f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data) {
+ f_status_t f_console_parameter_process(f_state_t state_passed, const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data) {
#ifndef _di_level_0_parameter_checking_
if (!parameters) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
f_console_parameter_state_t state = f_console_parameter_state_t_initialize;
+ state.state = (f_state_t) state_passed;
+
state.status = f_string_dynamics_increase_by(arguments.argc, ¶meters->arguments);
if (F_status_is_error(state.status)) return state.status;
- // Parameter 0 represents the program name so skip it.
- state.location = 1;
+ state.status = f_array_lengths_increase(state_passed.step_small, &state.needs);
+ if (F_status_is_error(state.status)) return state.status;
// Append the program name parameter as a static string.
parameters->arguments.array[parameters->arguments.used].string = arguments.argv[0];
parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[0], F_console_parameter_size_d);
parameters->arguments.array[parameters->arguments.used++].size = 0;
- uint8_t width = 0;
- f_utf_char_t character_utf_argument = 0;
- f_utf_char_t character_utf_symbol = 0;
- f_array_length_t i;
- f_array_length_t values;
- f_number_unsigned_t width_max = 0;
+ // Parameter 0 represents the program name so skip it.
+ state.location = 1;
+
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+
+ f_utf_char_t utf_argument = 0;
+ f_utf_char_t utf_console = 0;
while (state.location < arguments.argc && arguments.argv[state.location]) {
+ if (state_passed.interrupt) {
+ state.status = state_passed.interrupt((void * const) &state_passed, 0);
+
+ if (F_status_set_fine(state.status) == F_interrupt) {
+ state.status = F_status_set_error(F_interrupt);
+
+ break;
+ }
+ }
+
parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location];
parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d);
parameters->arguments.array[parameters->arguments.used++].size = 0;
// Additional parameters must always follow what requests them.
- if (state.value_need.used) {
+ if (state.needs.used) {
if (parameters->callback) {
- state.type = f_console_parameter_state_type_value_need_e;
+ state.type = f_console_parameter_state_type_need_e;
+ state.at = state.needs.array[0];
parameters->callback(arguments, (void * const) parameters, &state, data);
-
- if (F_status_is_error(state.status)) {
- f_array_lengths_resize(0, &state.value_need);
-
- return state.status;
- }
-
+ if (F_status_is_error(state.status)) break;
if (state.status == F_break) break;
if (state.status == F_continue) continue;
}
}
if (state.status == F_process) {
- i = state.value_need.array[0];
-
- state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].values);
- if (F_status_is_error(state.status)) break;
+ i = state.needs.array[0];
- parameters->array[i].result |= f_console_result_value_e;
- parameters->array[i].values.array[parameters->array[i].values.used++] = state.location;
+ parameters->array[i].result = f_console_result_value_e;
+ parameters->array[i].values.array[parameters->array[i].values.used++] = state.location++;
+ }
- --state.value_need.used;
+ --state.needs.used;
- // Pop the matched parameter off of the top of the state.value_need array.
- for (i = 0; i < state.value_need.used; ++i) {
- state.value_need.array[i] = state.value_need.array[i + 1];
- } // for
- }
+ for (i = 0; i < state.needs.used; ++i) {
+ state.needs.array[i] = state.needs.array[i + 1];
+ } // for
- ++state.location;
state.status = F_none;
continue;
if (parameters->callback) {
state.type = f_console_parameter_state_type_identify_e;
+ state.at = 0;
parameters->callback(arguments, (void * const) parameters, &state, data);
-
- if (F_status_is_error(state.status)) {
- f_array_lengths_resize(0, &state.value_need);
-
- return state.status;
- }
-
+ if (F_status_is_error(state.status)) break;
if (state.status == F_break) break;
if (state.status == F_continue) continue;
}
if (state.status == F_process) {
private_f_console_identify(arguments.argv[state.location], &state.result);
-
- // Process the current parameter.
- if (state.result & f_console_result_short_e) {
- state.increment_by = 1;
- state.location_sub = 1;
- }
- else if (state.result & f_console_result_long_e) {
- state.increment_by = parameters->arguments.array[state.location].used;
- state.location_sub = 2;
- }
- else {
- state.increment_by = parameters->arguments.array[state.location].used;
- state.location_sub = 0;
- }
-
- state.found = F_false;
}
+ state.found = F_false;
state.status = F_none;
- if (state.result & (f_console_result_short_e | f_console_result_long_e)) {
+ if (state.result & f_console_result_short_e) {
+
+ // Perform pre-process.
+ for (state.location_sub = 1; state.location_sub < parameters->arguments.array[state.location].used; ++state.location_sub) {
- // The state.location_sub is used on a per increment basis.
- while (state.location_sub < parameters->arguments.array[state.location].used) {
+ state.found = F_false;
for (i = 0; i < parameters->used; ++i) {
+ if (state_passed.interrupt) {
+ state.status = state_passed.interrupt((void * const) &state_passed, 0);
+
+ if (F_status_set_fine(state.status) == F_interrupt) {
+ state.status = F_status_set_error(F_interrupt);
+
+ break;
+ }
+ }
+
if (parameters->array[i].flag & f_console_flag_disable_e) continue;
if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue;
if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue;
+ if (!parameters->array[i].match_short.used && !parameters->array[i].match_short.string) continue;
+ if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].match_short.string) continue;
- // For sublocation processing of 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters)
- if (state.result & f_console_result_short_e) {
- if (!parameters->array[i].symbol_short) continue;
+ state.width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]);
- width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]);
- if (width) state.increment_by = width;
+ if (parameters->callback) {
+ state.type = f_console_parameter_state_type_short_preprocess_e;
+ state.at = i;
- if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].symbol_short) continue;
+ parameters->callback(arguments, (void * const) parameters, &state, data);
+ if (F_status_is_error(state.status)) break;
- if (width) {
- character_utf_argument = 0;
- character_utf_symbol = 0;
- width_max = parameters->arguments.array[state.location].used - state.location_sub;
+ if (state.status == F_break || state.status == F_continue) {
+ if (state.depth) {
+ --state.depth;
- state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, width_max, &character_utf_argument);
- if (F_status_is_error(state.status)) break;
+ break;
+ }
- width_max = strlen(parameters->array[i].symbol_short);
+ state.status = F_none;
- state.status = f_utf_char_to_character((f_string_t) parameters->array[i].symbol_short, width_max, &character_utf_symbol);
- if (F_status_is_error(state.status)) break;
+ if (state.status == F_break) break;
- if (character_utf_argument != character_utf_symbol) continue;
+ continue;
}
}
- else if (state.result & f_console_result_long_e) {
- if (!parameters->array[i].symbol_long) continue;
- if (strncmp(&arguments.argv[state.location][state.location_sub], parameters->array[i].symbol_long, state.increment_by + 1)) continue;
- }
else {
- continue;
+ state.status = F_process;
+ }
+
+ if (state.status == F_process) {
+ if (state.width) {
+ utf_argument = 0;
+ utf_console = 0;
+
+ state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, parameters->arguments.array[state.location].used - state.location_sub, &utf_argument);
+ if (F_status_is_error(state.status)) break;
+
+ state.status = f_utf_char_to_character(parameters->array[i].match_short.string, parameters->array[i].match_short.used, &utf_console);
+ if (F_status_is_error(state.status)) break;
+
+ if (utf_argument != utf_console) continue;
+ }
+ }
+
+ state.found = F_true;
+
+ break;
+ } // for
+
+ if (F_status_is_error(state.status)) break;
+
+ if (state.status == F_break || state.status == F_continue) {
+ if (state.depth) {
+ --state.depth;
+
+ break;
}
state.status = F_none;
- if (parameters->callback) {
- state.type = f_console_parameter_state_type_match_normal_e;
+ if (state.status == F_break) break;
- parameters->callback(arguments, (void * const) parameters, &state, data);
+ continue;
+ }
- if (F_status_is_error(state.status)) {
- f_array_lengths_resize(0, &state.value_need);
+ if (!state.found) break;
+ } // for
- return state.status;
- }
+ if (F_status_is_error(state.status)) break;
- if (state.status == F_break) break;
+ if (state.status == F_break || state.status == F_continue) {
+ state.depth = 0;
+ state.status = F_none;
- if (state.status == F_continue) {
- if (state.depth) break;
+ if (state.status == F_break) break;
- continue;
- }
+ continue;
+ }
+
+ // The entire string references valid parameters.
+ if (state.found) {
+ state.location_sub = 1;
+ state.needs.used = 0;
+
+ state.status = f_array_lengths_increase_by(parameters->arguments.array[state.location].used, &state.needs);
+ if (F_status_is_error(state.status)) break;
+
+ // The state.location_sub is used on a per-increment basis (such as 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters).
+ while (state.location_sub < parameters->arguments.array[state.location].used) {
+
+ state.width = macro_f_utf_byte_width_is(arguments.argv[state.location][state.location_sub]);
+
+ if (state.width) {
+ utf_argument = 0;
+ utf_console = 0;
+
+ state.status = f_utf_char_to_character(arguments.argv[state.location] + state.location_sub, parameters->arguments.array[state.location].used - state.location_sub, &utf_argument);
+ if (F_status_is_error(state.status)) break;
+
+ state.status = f_utf_char_to_character(parameters->array[i].match_short.string, parameters->array[i].match_short.used, &utf_console);
+ if (F_status_is_error(state.status)) break;
+
+ if (utf_argument != utf_console) continue;
}
else {
- state.status = F_process;
+ state.width = 1;
}
- if (state.status == F_process) {
- state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations);
- if (F_status_is_error(state.status)) break;
+ for (i = 0; i < parameters->used; ++i) {
- state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations_sub);
- if (F_status_is_error(state.status)) break;
+ if (state_passed.interrupt) {
+ state.status = state_passed.interrupt((void * const) &state_passed, 0);
- state.found = F_true;
+ if (F_status_set_fine(state.status) == F_interrupt) {
+ state.status = F_status_set_error(F_interrupt);
- parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
+ break;
+ }
+ }
- parameters->array[i].result = state.result | (parameters->array[i].result & f_console_result_value_e);
- parameters->array[i].location = state.location;
- parameters->array[i].location_sub = 0;
+ if (parameters->array[i].flag & f_console_flag_disable_e) continue;
+ if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue;
+ if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue;
+ if (!parameters->array[i].match_short.used && !parameters->array[i].match_short.string) continue;
+ if (arguments.argv[state.location][state.location_sub] != *parameters->array[i].match_short.string) continue;
- if (state.result & f_console_result_short_e) {
- parameters->array[i].location_sub = state.location_sub;
- parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = state.location_sub;
+ if (parameters->callback) {
+ state.type = f_console_parameter_state_type_short_e;
+ state.at = i;
+
+ parameters->callback(arguments, (void * const) parameters, &state, data);
+ if (F_status_is_error(state.status)) break;
+
+ if (state.status == F_break || state.status == F_continue) {
+ if (state.depth) {
+ --state.depth;
+
+ break;
+ }
+
+ state.status = F_none;
+
+ if (state.status == F_break) break;
+
+ continue;
+ }
}
else {
- parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0;
+ state.status = F_process;
}
- if (parameters->array[i].values_total) {
- state.status = f_array_lengths_increase_by(parameters->array[i].values_total, &state.value_need);
+ if (state.status == F_process) {
+ state.status = f_array_lengths_increase(state_passed.step_small, ¶meters->array[i].locations);
if (F_status_is_error(state.status)) break;
- for (values = 0; values < parameters->array[i].values_total; ++values) {
- state.value_need.array[state.value_need.used++] = i;
+ state.status = f_array_lengths_increase(state_passed.step_small, ¶meters->array[i].locations_sub);
+ if (F_status_is_error(state.status)) break;
+
+ if (parameters->array[i].location != state.location) {
+ parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
+ }
+
+ parameters->array[i].result = f_console_result_found_e;
+ parameters->array[i].location = state.location;
+ parameters->array[i].location_sub = state.location_sub;
+ parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = state.location_sub;
+
+ for (j = 0; j < parameters->array[i].values_total; ++j) {
+ state.needs.array[state.needs.used++] = i;
} // for
+
+ state.status = f_array_lengths_increase_by(state.needs.used, ¶meters->array[i].values);
+ if (F_status_is_error(state.status)) break;
}
- }
- state.status = F_none;
+ state.status = F_none;
- break;
- } // for
+ break;
+ } // for
- if (F_status_is_error(state.status)) break;
+ if (F_status_is_error(state.status)) break;
- if (state.status == F_break || state.status == F_continue) {
- if (state.depth) {
- --state.depth;
+ if (state.status == F_break || state.status == F_continue) {
+ if (state.depth) {
+ --state.depth;
+
+ break;
+ }
+
+ state.status = F_none;
if (state.status == F_break) break;
continue;
}
- }
- state.location_sub += state.increment_by;
- } // while
-
- if (F_status_is_error(state.status)) break;
+ state.location_sub += state.width;
+ } // while
- if (state.status == F_break || state.status == F_continue) {
- if (state.depth) {
- --state.depth;
+ if (state.status == F_break || state.status == F_continue) {
+ state.depth = 0;
+ state.status = F_none;
if (state.status == F_break) break;
continue;
}
}
-
- state.status = F_none;
}
else {
- if (parameters->callback) {
- state.type = f_console_parameter_state_type_match_remaining_e;
+ if (state.result & f_console_result_long_e) {
+ state.location_sub = 2;
+ state.needs.used = 0;
- parameters->callback(arguments, (void * const) parameters, &state, data);
+ for (i = 0; i < parameters->used; ++i) {
- if (F_status_is_error(state.status)) {
- f_array_lengths_resize(0, &state.value_need);
+ if (state_passed.interrupt) {
+ state.status = state_passed.interrupt((void * const) &state_passed, 0);
- return state.status;
- }
+ if (F_status_set_fine(state.status) == F_interrupt) {
+ state.status = F_status_set_error(F_interrupt);
- if (state.status == F_break) break;
- if (state.status == F_continue) continue;
+ break;
+ }
+ }
+
+ if (parameters->array[i].flag & f_console_flag_disable_e) continue;
+ if ((state.result & f_console_result_normal_e) && !(parameters->array[i].flag & f_console_flag_normal_e)) continue;
+ if ((state.result & f_console_result_inverse_e) && !(parameters->array[i].flag & f_console_flag_inverse_e)) continue;
+ if (!parameters->array[i].match_long.used && !parameters->array[i].match_long.string) continue;
+ if (strncmp(&arguments.argv[state.location][state.location_sub], parameters->array[i].match_long.string, parameters->array[i].match_long.used + 1)) continue;
+
+ if (parameters->callback) {
+ state.type = f_console_parameter_state_type_long_e;
+ state.at = i;
+
+ parameters->callback(arguments, (void * const) parameters, &state, data);
+ if (F_status_is_error(state.status)) break;
+
+ if (state.status == F_break || state.status == F_continue) {
+ if (state.depth) {
+ --state.depth;
+
+ break;
+ }
+
+ state.status = F_none;
+
+ if (state.status == F_break) break;
+
+ continue;
+ }
+ }
+ else {
+ state.status = F_process;
+ }
+
+ state.found = F_true;
+
+ break;
+ } // for
}
else {
- state.status = F_process;
- }
-
- if (state.status == F_process) {
for (i = 0; i < parameters->used; ++i) {
+ if (state_passed.interrupt) {
+ state.status = state_passed.interrupt((void * const) &state_passed, 0);
+
+ if (F_status_set_fine(state.status) == F_interrupt) {
+ state.status = F_status_set_error(F_interrupt);
+
+ break;
+ }
+ }
+
if (parameters->array[i].flag & f_console_flag_disable_e) continue;
if (!(parameters->array[i].flag & f_console_result_alone_e)) continue;
- if (!parameters->array[i].symbol_simple) continue;
+ if (!parameters->array[i].match_simple.used && !parameters->array[i].match_simple.string) continue;
+ if (strncmp(arguments.argv[state.location], parameters->array[i].match_simple.string, parameters->array[i].match_simple.used + 1)) continue;
- if (strncmp(arguments.argv[state.location], parameters->array[i].symbol_simple, parameters->arguments.array[state.location].used + 1) != 0) continue;
+ if (parameters->callback) {
+ state.type = f_console_parameter_state_type_simple_e;
+ state.at = i;
- state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations);
- if (F_status_is_error(state.status)) break;
+ parameters->callback(arguments, (void * const) parameters, &state, data);
+ if (F_status_is_error(state.status)) break;
- state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->array[i].locations_sub);
- if (F_status_is_error(state.status)) break;
+ if (state.status == F_break || state.status == F_continue) {
+ if (state.depth) {
+ --state.depth;
- parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
- parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0;
+ break;
+ }
- parameters->array[i].result = state.result | (parameters->array[i].result & f_console_result_value_e);
- parameters->array[i].location = state.location;
- parameters->array[i].location_sub = 0;
+ state.status = F_none;
- if (parameters->array[i].values_total) {
- if (state.value_need.used + parameters->array[i].values_total > state.value_need.size) {
- state.status = f_array_lengths_resize(state.value_need.used + parameters->array[i].values_total, &state.value_need);
- if (F_status_is_error(state.status)) break;
- }
+ if (state.status == F_break) break;
- for (values = 0; values < parameters->array[i].values_total; ++values) {
- state.value_need.array[state.value_need.used++] = i;
- } // for
+ continue;
+ }
+ }
+ else {
+ state.status = F_process;
}
state.found = F_true;
break;
} // for
+ }
+
+ if (F_status_is_error(state.status)) break;
+ if (state.status == F_break || state.status == F_continue) {
+ state.depth = 0;
+ state.status = F_none;
+
+ if (state.status == F_break) break;
+
+ continue;
+ }
+
+ if (state.status == F_process && state.found) {
+ state.status = f_array_lengths_increase(state_passed.step_small, ¶meters->array[i].locations);
+ if (F_status_is_error(state.status)) break;
+
+ state.status = f_array_lengths_increase(state_passed.step_small, ¶meters->array[i].locations_sub);
+ if (F_status_is_error(state.status)) break;
+
+ parameters->array[i].result = f_console_result_found_e;
+ parameters->array[i].location = state.location;
+ parameters->array[i].location_sub = 0;
+ parameters->array[i].locations.array[parameters->array[i].locations.used++] = state.location;
+ parameters->array[i].locations_sub.array[parameters->array[i].locations_sub.used++] = 0;
+
+ for (j = 0; j < parameters->array[i].values_total; ++j) {
+ state.needs.array[state.needs.used++] = i;
+ } // for
+
+ state.status = f_array_lengths_increase_by(state.needs.used, ¶meters->array[i].values);
if (F_status_is_error(state.status)) break;
}
state.status = F_none;
}
- if (state.found) {
- ++state.location;
- }
- else {
+ if (F_status_is_error(state.status)) break;
+
+ // Add the missed parameter to the remaining array.
+ if (!state.found) {
if (parameters->callback) {
- state.type = f_console_parameter_state_type_match_not_e;
+ state.type = f_console_parameter_state_type_miss_e;
+ state.at = 0;
parameters->callback(arguments, (void * const) parameters, &state, data);
-
if (F_status_is_error(state.status)) break;
if (state.status == F_break) break;
if (state.status == F_continue) continue;
}
if (state.status == F_process) {
-
- // Populate list of remaining parameters->array that are not associated with anything.
- state.status = f_array_lengths_increase(F_memory_default_allocation_small_d, ¶meters->remaining);
+ state.status = f_array_lengths_increase(state_passed.step_small, ¶meters->remaining);
if (F_status_is_error(state.status)) break;
- parameters->remaining.array[parameters->remaining.used++] = state.location++;
+ parameters->remaining.array[parameters->remaining.used++] = state.location;
}
state.status = F_none;
}
- } // while
- if (F_status_is_error_not(state.status)) {
- if (parameters->callback) {
- state.type = f_console_parameter_state_type_wrap_up_e;
+ ++state.location;
+ } // while
- parameters->callback(arguments, (void * const) parameters, &state, data);
+ // Make sure the entire parameters arguments array is populated.
+ if (parameters->callback) {
+ state.type = f_console_parameter_state_type_wrap_up_e;
+ state.at = 0;
- if (F_status_is_error(state.status)) {
- f_array_lengths_resize(0, &state.value_need);
+ parameters->callback(arguments, (void * const) parameters, &state, data);
+ }
+ else {
+ state.status = F_process;
+ }
- return state.status;
- }
- }
- else {
- state.status = F_process;
- }
+ if (state.status == F_process) {
+ state.status == F_none;
- if (state.status == F_process) {
+ for (; state.location < arguments.argc && arguments.argv[state.location]; ++state.location) {
- // Make sure the entire parameters arguments array is populated.
- for (; state.location < arguments.argc && arguments.argv[state.location]; ++state.location) {
+ if (state_passed.interrupt) {
+ state.status = state_passed.interrupt((void * const) &state_passed, 0);
- parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location];
- parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d);
- parameters->arguments.array[parameters->arguments.used++].size = 0;
- } // for
+ if (F_status_set_fine(state.status) == F_interrupt) {
+ state.status = F_status_set_error(F_interrupt);
- if (F_status_is_error_not(state.status)) {
- state.status = state.value_need.used ? F_complete_not : F_none;
+ break;
+ }
}
+
+ parameters->arguments.array[parameters->arguments.used].string = arguments.argv[state.location];
+ parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[state.location], F_console_parameter_size_d);
+ parameters->arguments.array[parameters->arguments.used++].size = 0;
+ } // for
+
+ if (F_status_is_error_not(state.status)) {
+ state.status = state.needs.used ? F_complete_not : F_none;
}
}
- f_array_lengths_resize(0, &state.value_need);
+ f_array_lengths_resize(0, &state.needs);
return state.status;
}
*
* Any changes to this function may likely require changes to f_console_parameter_state_t and callbacks.
*
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param arguments
* The parameters passed to the process.
* @param parameters
*
* F_array_too_large (with error bit) if a buffer would exceed max length.
* F_failure (with error bit) if width is not long enough to convert when processing arguments as UTF-8.
+ * F_interrupt (with error bit) if an interrupt is received via the state.interrupt callback.
* F_parameter (with error bit) if a parameter is invalid.
*
* Errors (with error bit) from: f_array_lengths_increase().
* Errors (with error bit) from: f_array_lengths_increase_by().
+ * Errors (with error bit) from: f_string_dynamics_increase_by().
* Errors (with error bit) from: f_utf_char_to_character().
*
* @see f_array_lengths_increase()
* @see f_array_lengths_increase_by()
+ * @see f_string_dynamics_increase_by()
* @see f_utf_char_to_character()
*/
#ifndef _di_f_console_parameter_process_
- extern f_status_t f_console_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data);
+ extern f_status_t f_console_parameter_process(f_state_t state, const f_console_arguments_t arguments, f_console_parameters_t * const parameters, void * const data);
#endif // _di_f_console_parameter_process_
#ifdef __cplusplus
#endif // _di_f_console_symbol_long_inverse_s_
#endif // _di_f_console_symbol_s_
+#ifndef _di_f_console_parameter_state_delete_
+ f_status_t f_console_parameter_state_delete(f_console_parameter_state_t * const state) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!state) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return f_array_lengths_resize(0, &state->needs);
+ }
+#endif // _di_f_console_parameter_state_delete_
+
+#ifndef _di_f_console_parameter_state_destroy_
+ f_status_t f_console_parameter_state_destroy(f_console_parameter_state_t * const state) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!state) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ return f_array_lengths_adjust(0, &state->needs);
+ }
+#endif // _di_f_console_parameter_state_destroy_
+
#ifndef _di_f_console_parameters_delete_
f_status_t f_console_parameters_delete(f_console_parameters_t * const parameters) {
#ifndef _di_level_0_parameter_checking_
* Provide a special type explicitly intended to be used for f_console_parameter_state_t.
*
* f_console_parameter_state_type_*_e:
- * - none: No type set.
- * - identify: Perform identify processing.
- * - match_normal: Perform short or long parameter match processing.
- * - match_not: Perform no parameter match processing.
- * - match_remaining: Perform remaining parameter match processing.
- * - value_need: Perform value is needed processing.
- * - wrap_up: Perform wrap up processing.
+ * - none: No type set.
+ * - identify: Perform identify processing.
+ * - match_normal: Perform short or long parameter match processing.
+ * - match_not: Perform no parameter match processi
+ * - match_other: Perform other parameter match processing.ng.
+ * - need: Perform value is needed processing.
+ * - wrap_up: Perform wrap up processing.
*/
#ifndef _di_f_console_parameter_state_type_e_
enum {
f_console_parameter_state_type_none_e = 0,
f_console_parameter_state_type_identify_e,
- f_console_parameter_state_type_match_normal_e,
- f_console_parameter_state_type_match_not_e,
- f_console_parameter_state_type_match_remaining_e,
- f_console_parameter_state_type_value_need_e,
+ f_console_parameter_state_type_long_e,
+ f_console_parameter_state_type_miss_e,
+ f_console_parameter_state_type_short_e,
+ f_console_parameter_state_type_short_preprocess_e,
+ f_console_parameter_state_type_simple_e,
+ f_console_parameter_state_type_need_e,
f_console_parameter_state_type_wrap_up_e,
}; // enum
#endif // _di_f_console_parameter_state_type_e_
* The description here is a relatively generalized description.
*
* Any changes to the f_console_parameter_process() code likely requires changes or re-interpretation of these properties.
+ *
+ * type: Describe the kind of processing is being performed.
+ * depth: Designate how many loops to break or continue out of (0 = one loop, 1 = two loops).
+ * width: Used like a cache to store width results such as from macro_f_utf_byte_width_is().
+ * found: Designate that the currently process parameter has been matched.
+ *
+ * status: The return status.
+ * result: The parameter result state determined by the appropriate f_console_identify() or similar call.
+ * state: The state information used during pocessing (this primarily utilizes the interrupt and the allocation steps).
+ *
+ * at: The location in the parameters array currently being processed (not all types use this).
+ * location: The current location within the argv array.
+ * location_sub: The current location within the argv[location] string.
+ * increment_by: The amount of characters being processed within the argv[location] for the current pass.
+ * need: The number of additional parameters that need to be grabbed.
+ *
+ * The expected processing of each type (f_console_parameter_state_type_*_e) is as follows:
+ * - identify: Determine what type of parameter is being processed.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth is not used for this type.
+ *
+ * - long: A long parameter is being processed.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth can be from 0 to 1.
+ * This utilizes "at".
+ *
+ * - miss: A no parameter has been matched at the location situation is being processed.
+ * This is generally used to populate the parameters.remaining array.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth is not used for this type.
+ *
+ * - short: A short parameter is being processed.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth can be from 0 to 2.
+ * This utilizes "at".
+ *
+ * - short_preprocess: A short parameter is being pre-processed.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth can be from 0 to 2.
+ * This utilizes "at".
+ *
+ * - simple: A simple parameter is being processed.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth can be set up to 1.
+ * This utilizes "at".
+ *
+ * - need: Additional parameters are needed based on the match variable.
+ * This is processed for every location before any parameter matching is performed.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * Set status to F_break or F_continue to break or continue after executing the callback.
+ * The depth is not used for this type.
+ * This utilizes "at".
+ *
+ * - wrap_up: This is called after all parameters have been processed or when the main loop has been broken out of.
+ * This is used to perform after processing clean up and data management.
+ * Set status to F_process to perform normal operations after executing the callback.
+ * The F_break, F_continue, and depth are not used for this type.
+ *
+ * When using the callback, then the responsibility of ensuring the proper and secure handling of the data is on in the callback.
+ * Failure to properly handle this can lead to integrity and security issues.
+ *
+ * The result is used to determine what type of parameter is being processed (a short, a long, a remaining, etc..).
+ *
+ * The location_sub should start after any of the symbols (for example for '--parameter', the symbol is the two '-', so the initial location_sub should be 2).
+ *
+ * The increment_by is generally set to 1 when performing the short matches and is generally set to the entire length of the string (minus the length of the symbol) for long matches.
+ * Each character in a short parameter potentially represents a parameter.
+ * There will be a loop pass for each character in the short string due to the value of the increment_by.
+ *
+ * The need represents the total number of arguments that are needed by the parameter that is just matched.
+ * The index of the parameter that is just matched is stored in the "match" variable.
*/
#ifndef _di_f_console_parameter_state_t_
typedef struct {
uint8_t type;
uint8_t depth;
+ uint8_t width;
bool found;
f_status_t status;
f_console_result_t result;
+ f_state_t state;
- unsigned long location;
+ f_array_length_t at;
+ f_array_length_t location;
f_array_length_t location_sub;
- f_array_length_t increment_by;
- f_array_lengths_t value_need;
+ f_array_lengths_t needs;
} f_console_parameter_state_t;
#define f_console_parameter_state_t_initialize { \
f_console_parameter_state_type_none_e, \
0, \
+ 0, \
F_false, \
F_none, \
f_console_result_t_initialize, \
- 0, \
- 0, \
- 0, \
+ f_state_t_initialize, \
+ f_array_length_t_initialize, \
+ f_array_length_t_initialize, \
+ f_array_length_t_initialize, \
f_array_lengths_t_initialize, \
}
#endif // _di_f_console_parameter_state_t_
* The long parameters are prepended with either '--' or '++'.
* The simple parameters have no prefix characters.
*
- * symbol_short: The NULL terminated single character string, such as 'h' in '-h'.
- * symbol_long: The NULL terminated multi-character string, such as 'help' in '--help'.
- * symbol_simple: The NULL terminated parameter that has no prefix, such as 'all' in 'make all'.
- * values_total: Designates that a parameter will have a given number of values arguments, such as 'blue' in '--color blue'.
- * flag: A set of bits for providing states associated with the parameter.
- * result: A set of bits representing if and how the parameter is found (such as '-h' vs '--help').
- * 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).
+ * match_short: The NULL terminated single character string, such as 'h' in '-h'.
+ * match_long: The NULL terminated multi-character string, such as 'help' in '--help'.
+ * match_simple: The NULL terminated parameter that has no prefix, such as 'all' in 'make all'.
+ *
+ * values_total: Designates that a parameter will have a given number of values arguments, such as 'blue' in '--color blue'.
+ *
+ * flag: A set of bits for providing states associated with the parameter.
+ * result: A set of bits representing if and how the parameter is found (such as '-h' vs '--help').
+ *
+ * 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).
+ *
* locations: All locations within argv where this parameter is found (order is preserved).
* locations_sub: All sub-locations within argv where this parameter is found (order is preserved).
- * values: An array of locations representing where in the argv[] the values arguments are found.
+ *
+ * values: An array of locations representing where in the argv[] the values arguments are found.
*
* The macro_f_console_parameter_t_initialize_1() all arguments.
- * The macro_f_console_parameter_t_initialize_2() reduced arguments.
- * The macro_f_console_parameter_t_initialize_3() reduced arguments, strings are of f_string_static_t, has short, long, and simple.
- * The macro_f_console_parameter_t_initialize_4() reduced arguments, strings are of f_string_static_t, has short and long.
- * The macro_f_console_parameter_t_initialize_5() reduced arguments, strings are of f_string_static_t, has short.
- * The macro_f_console_parameter_t_initialize_6() reduced arguments, strings are of f_string_static_t, has long.
- * The macro_f_console_parameter_t_initialize_7() reduced arguments, strings are of f_string_static_t, has simple.
+ * The macro_f_console_parameter_t_initialize_2() reduced arguments has short, long, and simple.
+ * The macro_f_console_parameter_t_initialize_3() reduced arguments has short and long.
+ * The macro_f_console_parameter_t_initialize_4() reduced arguments has short.
+ * The macro_f_console_parameter_t_initialize_5() reduced arguments has long.
+ * The macro_f_console_parameter_t_initialize_6() reduced arguments has simple.
*/
#ifndef _di_f_console_parameter_t_
typedef struct {
- f_string_t symbol_short;
- f_string_t symbol_long;
- f_string_t symbol_simple;
+ f_string_static_t match_short;
+ f_string_static_t match_long;
+ f_string_static_t match_simple;
f_array_length_t values_total;
f_console_flag_t flag;
f_console_result_t result;
+
f_array_length_t location;
f_array_length_t location_sub;
+
f_array_lengths_t locations;
f_array_lengths_t locations_sub;
+
f_array_lengths_t values;
} f_console_parameter_t;
#define f_console_parameter_t_initialize { \
- 0, \
- 0, \
- 0, \
+ f_string_static_t_initialize, \
+ f_string_static_t_initialize, \
+ f_string_static_t_initialize, \
f_console_flag_t_initialize, \
f_console_result_t_initialize, \
f_array_length_t_initialize, \
f_array_lengths_t_initialize, \
}
- #define macro_f_console_parameter_t_initialize_1(symbol_short, symbol_long, symbol_simple, values_total, flag, result, location, location_sub, locations, locations_sub, values) { \
- symbol_short, \
- symbol_long, \
- symbol_simple, \
+ #define macro_f_console_parameter_t_initialize_1(match_short, match_long, match_simple, values_total, flag, result, location, location_sub, locations, locations_sub, values) { \
+ match_short, \
+ match_long, \
+ match_simple, \
values_total, \
flag, \
result, \
values, \
}
- #define macro_f_console_parameter_t_initialize_2(symbol_short, symbol_long, symbol_simple, values_total, flag) { \
- symbol_short, \
- symbol_long, \
- symbol_simple, \
+ #define macro_f_console_parameter_t_initialize_2(match_short, match_long, match_simple, values_total, flag) { \
+ match_short, \
+ match_long, \
+ match_simple, \
values_total, \
flag, \
f_console_result_none_e, \
f_array_lengths_t_initialize, \
}
- #define macro_f_console_parameter_t_initialize_3(symbol_short, symbol_long, symbol_simple, values_total, flag) { \
- symbol_short.string, \
- symbol_long.string, \
- symbol_simple.string, \
+ #define macro_f_console_parameter_t_initialize_3(match_short, match_long, values_total, flag) { \
+ match_short, \
+ match_long, \
+ f_string_empty_s, \
values_total, \
flag, \
f_console_result_none_e, \
f_array_lengths_t_initialize, \
}
- #define macro_f_console_parameter_t_initialize_4(symbol_short, symbol_long, values_total, flag) { \
- symbol_short.string, \
- symbol_long.string, \
- 0, \
- values_total, \
- flag, \
- f_console_result_none_e, \
- 0, \
- 0, \
- f_array_lengths_t_initialize, \
- f_array_lengths_t_initialize, \
- f_array_lengths_t_initialize, \
- }
-
- #define macro_f_console_parameter_t_initialize_5(symbol_short, values_total, flag) { \
- symbol_short.string, \
- 0, \
- 0, \
+ #define macro_f_console_parameter_t_initialize_4(match_short, values_total, flag) { \
+ match_short, \
+ f_string_empty_s, \
+ f_string_empty_s, \
values_total, \
flag, \
f_console_result_none_e, \
f_array_lengths_t_initialize, \
}
- #define macro_f_console_parameter_t_initialize_6(symbol_long, values_total, flag) { \
- 0, \
- symbol_long.string, \
- 0, \
+ #define macro_f_console_parameter_t_initialize_5(match_long, values_total, flag) { \
+ f_string_empty_s, \
+ match_long, \
+ f_string_empty_s, \
values_total, \
flag, \
f_console_result_none_e, \
f_array_lengths_t_initialize, \
f_array_lengths_t_initialize, \
f_array_lengths_t_initialize, \
- callback \
}
- #define macro_f_console_parameter_t_initialize_7(symbol_simple, values_total, flag) { \
- 0, \
- 0, \
- symbol_simple.string, \
+ #define macro_f_console_parameter_t_initialize_6(match_simple, values_total, flag) { \
+ f_string_empty_s, \
+ f_string_empty_s, \
+ match_simple, \
values_total, \
flag, \
f_console_result_none_e, \
* arguments: An array of arguments pointing to the argv[] strings with the string lengths already calculated (This is a dynamic array of f_string_static_t).
* remaining: An array of indexes within the arguments representing unmatched parameters.
* length: The total number of parameters in the parameters array.
- * callback: A callback to perform when matched in order to handle condition values.
+ *
+ * callback: A callback to perform when matched in order to handle condition values.
*
* The callback function arguments:
* - arguments: The console arguments being processed.
- * - parameters: A pointer to this parameter structure and must be of type f_console_parameter_t.
+ * - parameters: A pointer to this parameter structure and must be of type f_console_parameters_t.
* - state: The state information shared between the processing function and any callbacks.
* - data: The structure determined by the caller for passing to the parameter processing function and is intended to be used for updating based on results.
*
* - F_continue: To tell the caller to continue the loop (based on depth, when applicable).
* - F_process: To tell the caller to perform the built in functionality.
* - Any status with error bit set is treated as an error and calling function returns.
+ *
+ * When using the callback, then the responsibility of ensuring the proper and secure handling of the data is on in the callback.
+ * Failure to properly handle this can lead to integrity and security issues.
*/
#ifndef _di_f_console_parameters_t_
typedef struct {
f_console_parameter_t *array;
-
f_string_dynamics_t arguments;
f_array_lengths_t remaining;
-
f_array_length_t used;
void (*callback)(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data);
} f_console_parameters_t;
- #define f_console_parameters_t_initialize {0, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, 0, 0 }
+ #define f_console_parameters_t_initialize { \
+ 0, \
+ f_string_dynamics_t_initialize, \
+ f_array_lengths_t_initialize, \
+ 0, \
+ 0 \
+ }
- #define macro_f_console_parameters_t_initialize(parameter, used, callback) { parameter, f_string_dynamics_t_initialize, f_array_lengths_t_initialize, used, callback }
+ #define macro_f_console_parameters_t_initialize(parameters, used, callback) { \
+ parameters, \
+ f_string_dynamics_t_initialize, \
+ f_array_lengths_t_initialize, \
+ used, \
+ callback \
+ }
#endif // _di_f_console_parameters_t_
/**
#endif // _di_f_console_standard_s_
/**
+ * Delete any dynamic allocated data on the state object.
+ *
+ * @param state
+ * The state object.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_string_dynamics_resize().
+ * Errors (with error bit) from: f_array_lengths_resize().
+ *
+ * @see f_string_dynamics_resize()
+ * @see f_array_lengths_resize()
+ */
+#ifndef _di_f_console_parameter_state_delete_
+ extern f_status_t f_console_parameter_state_delete(f_console_parameter_state_t * const state);
+#endif // _di_f_console_parameter_state_delete_
+
+/**
+ * Destroy any dynamic allocated data on the state object.
+ *
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_string_dynamics_adjust().
+ * Errors (with error bit) from: f_array_lengths_adjust().
+ *
+ * @see f_string_dynamics_adjust()
+ * @see f_array_lengths_adjust()
+ */
+#ifndef _di_f_console_parameter_state_destroy_
+ extern f_status_t f_console_parameter_state_destroy(f_console_parameter_state_t * const state);
+#endif // _di_f_console_parameter_state_destroy_
+
+/**
* Delete any dynamic allocated data on the parameters object.
*
* @param parameters
extern "C" {
#endif
+void test__f_console_parameter_process__incomplete_arguments(void **state) {
+
+ const f_string_t argv[] = {
+ "program",
+ "--second",
+ 0,
+ };
+
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(2, argv, 0);
+
+ f_console_parameter_t parameter[] = {
+ macro_f_console_parameter_t_initialize("f", 0, 0, 1, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("s", "second", 0, 1, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("t", "third", 0, 1, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("F", 0, 0, 0, f_console_type_inverse_e),
+ macro_f_console_parameter_t_initialize(0, "fifth", 0, 1, f_console_type_inverse_e),
+ macro_f_console_parameter_t_initialize(0, "sixth", 0, 1, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize(0, "seventh", 0, 2, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("N", "not_found", 0, 0, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize(0, 0, "other", 0, f_console_type_other_e),
+ };
+
+ f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9);
+
+ {
+ const f_status_t status = f_console_parameter_process(arguments, ¶meters);
+
+ assert_int_equal(status, F_complete_not);
+
+ assert_int_equal(parameter[0].result, f_console_result_none_e);
+ assert_int_equal(parameter[0].locations.used, 0);
+ assert_int_equal(parameter[0].locations_sub.used, 0);
+ assert_int_equal(parameter[0].values.used, 0);
+ assert_int_equal(parameter[0].location, 0);
+ assert_int_equal(parameter[0].location_sub, 0);
+
+ assert_int_equal(parameter[1].result, f_console_result_found_e);
+ assert_int_equal(parameter[1].locations.used, 1);
+ assert_int_equal(parameter[1].locations_sub.used, 1);
+ assert_int_equal(parameter[1].values.used, 0);
+ assert_int_equal(parameter[1].location, 1);
+ assert_int_equal(parameter[1].location_sub, 0);
+ assert_int_equal(parameter[1].locations.array[0], 1);
+ assert_int_equal(parameter[1].locations_sub.array[0], 0);
+
+ assert_int_equal(parameter[2].result, f_console_result_none_e);
+ assert_int_equal(parameter[2].locations.used, 0);
+ assert_int_equal(parameter[2].locations_sub.used, 0);
+ assert_int_equal(parameter[2].values.used, 0);
+ assert_int_equal(parameter[2].location, 0);
+ assert_int_equal(parameter[2].location_sub, 0);
+
+ assert_int_equal(parameter[3].result, f_console_result_none_e);
+ assert_int_equal(parameter[3].locations.used, 0);
+ assert_int_equal(parameter[3].locations_sub.used, 0);
+ assert_int_equal(parameter[3].values.used, 0);
+ assert_int_equal(parameter[3].location, 0);
+ assert_int_equal(parameter[3].location_sub, 0);
+
+ assert_int_equal(parameter[4].result, f_console_result_none_e);
+ assert_int_equal(parameter[4].locations.used, 0);
+ assert_int_equal(parameter[4].locations_sub.used, 0);
+ assert_int_equal(parameter[4].values.used, 0);
+ assert_int_equal(parameter[4].location, 0);
+ assert_int_equal(parameter[4].location_sub, 0);
+
+ assert_int_equal(parameter[5].result, f_console_result_none_e);
+ assert_int_equal(parameter[5].locations.used, 0);
+ assert_int_equal(parameter[5].locations_sub.used, 0);
+ assert_int_equal(parameter[5].values.used, 0);
+ assert_int_equal(parameter[5].location, 0);
+ assert_int_equal(parameter[5].location_sub, 0);
+
+ assert_int_equal(parameter[6].result, f_console_result_none_e);
+ assert_int_equal(parameter[6].locations.used, 0);
+ assert_int_equal(parameter[6].locations_sub.used, 0);
+ assert_int_equal(parameter[6].values.used, 0);
+ assert_int_equal(parameter[6].location, 0);
+ assert_int_equal(parameter[6].location_sub, 0);
+
+ assert_int_equal(parameter[7].result, f_console_result_none_e);
+ assert_int_equal(parameter[7].locations.used, 0);
+ assert_int_equal(parameter[7].locations_sub.used, 0);
+ assert_int_equal(parameter[7].values.used, 0);
+ assert_int_equal(parameter[7].location, 0);
+ assert_int_equal(parameter[7].location_sub, 0);
+
+ assert_int_equal(parameter[8].result, f_console_result_none_e);
+ assert_int_equal(parameter[8].locations.used, 0);
+ assert_int_equal(parameter[8].locations_sub.used, 0);
+ assert_int_equal(parameter[8].values.used, 0);
+ assert_int_equal(parameter[8].location, 0);
+ assert_int_equal(parameter[8].location_sub, 0);
+
+ assert_int_equal(parameters.remaining.used, 0);
+ }
+
+ f_console_parameters_delete(¶meters);
+}
+
void test__f_console_parameter_process__no_arguments_no_program(void **state) {
const f_string_t argv[] = {
};
// Test both valid and invalid argc.
- for (uint8_t argc = 0; argc < 3; ++argc) {
+ for (uint8_t argc = 0; argc < 2; ++argc) {
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, 0);
assert_int_equal(parameter[0].result, f_console_result_none_e);
assert_int_equal(parameter[0].locations.used, 0);
+ assert_int_equal(parameter[0].locations_sub.used, 0);
assert_int_equal(parameter[0].values.used, 0);
assert_int_equal(parameter[0].location, 0);
assert_int_equal(parameter[0].location_sub, 0);
assert_int_equal(parameter[1].result, f_console_result_none_e);
assert_int_equal(parameter[1].locations.used, 0);
+ assert_int_equal(parameter[1].locations_sub.used, 0);
assert_int_equal(parameter[1].values.used, 0);
assert_int_equal(parameter[1].location, 0);
assert_int_equal(parameter[1].location_sub, 0);
assert_int_equal(parameter[2].result, f_console_result_none_e);
assert_int_equal(parameter[2].locations.used, 0);
+ assert_int_equal(parameter[2].locations_sub.used, 0);
assert_int_equal(parameter[2].values.used, 0);
assert_int_equal(parameter[2].location, 0);
assert_int_equal(parameter[2].location_sub, 0);
assert_int_equal(parameter[3].result, f_console_result_none_e);
assert_int_equal(parameter[3].locations.used, 0);
+ assert_int_equal(parameter[3].locations_sub.used, 0);
assert_int_equal(parameter[3].values.used, 0);
assert_int_equal(parameter[3].location, 0);
assert_int_equal(parameter[3].location_sub, 0);
assert_int_equal(parameter[4].result, f_console_result_none_e);
assert_int_equal(parameter[4].locations.used, 0);
+ assert_int_equal(parameter[4].locations_sub.used, 0);
assert_int_equal(parameter[4].values.used, 0);
assert_int_equal(parameter[4].location, 0);
assert_int_equal(parameter[4].location_sub, 0);
assert_int_equal(parameter[5].result, f_console_result_none_e);
assert_int_equal(parameter[5].locations.used, 0);
+ assert_int_equal(parameter[5].locations_sub.used, 0);
assert_int_equal(parameter[5].values.used, 0);
assert_int_equal(parameter[5].location, 0);
assert_int_equal(parameter[5].location_sub, 0);
assert_int_equal(parameter[6].result, f_console_result_none_e);
assert_int_equal(parameter[6].locations.used, 0);
+ assert_int_equal(parameter[6].locations_sub.used, 0);
assert_int_equal(parameter[6].values.used, 0);
assert_int_equal(parameter[6].location, 0);
assert_int_equal(parameter[6].location_sub, 0);
assert_int_equal(parameter[7].result, f_console_result_none_e);
assert_int_equal(parameter[7].locations.used, 0);
+ assert_int_equal(parameter[7].locations_sub.used, 0);
assert_int_equal(parameter[7].values.used, 0);
assert_int_equal(parameter[7].location, 0);
assert_int_equal(parameter[7].location_sub, 0);
assert_int_equal(parameter[8].result, f_console_result_none_e);
assert_int_equal(parameter[8].locations.used, 0);
+ assert_int_equal(parameter[8].locations_sub.used, 0);
assert_int_equal(parameter[8].values.used, 0);
assert_int_equal(parameter[8].location, 0);
assert_int_equal(parameter[8].location_sub, 0);
assert_int_equal(parameter[0].result, f_console_result_none_e);
assert_int_equal(parameter[0].locations.used, 0);
+ assert_int_equal(parameter[0].locations_sub.used, 0);
assert_int_equal(parameter[0].values.used, 0);
assert_int_equal(parameter[0].location, 0);
assert_int_equal(parameter[0].location_sub, 0);
assert_int_equal(parameter[1].result, f_console_result_none_e);
assert_int_equal(parameter[1].locations.used, 0);
+ assert_int_equal(parameter[1].locations_sub.used, 0);
assert_int_equal(parameter[1].values.used, 0);
assert_int_equal(parameter[1].location, 0);
assert_int_equal(parameter[1].location_sub, 0);
assert_int_equal(parameter[2].result, f_console_result_none_e);
assert_int_equal(parameter[2].locations.used, 0);
+ assert_int_equal(parameter[2].locations_sub.used, 0);
assert_int_equal(parameter[2].values.used, 0);
assert_int_equal(parameter[2].location, 0);
assert_int_equal(parameter[2].location_sub, 0);
assert_int_equal(parameter[3].result, f_console_result_none_e);
assert_int_equal(parameter[3].locations.used, 0);
+ assert_int_equal(parameter[3].locations_sub.used, 0);
assert_int_equal(parameter[3].values.used, 0);
assert_int_equal(parameter[3].location, 0);
assert_int_equal(parameter[3].location_sub, 0);
assert_int_equal(parameter[4].result, f_console_result_none_e);
assert_int_equal(parameter[4].locations.used, 0);
+ assert_int_equal(parameter[4].locations_sub.used, 0);
assert_int_equal(parameter[4].values.used, 0);
assert_int_equal(parameter[4].location, 0);
assert_int_equal(parameter[4].location_sub, 0);
assert_int_equal(parameter[5].result, f_console_result_none_e);
assert_int_equal(parameter[5].locations.used, 0);
+ assert_int_equal(parameter[5].locations_sub.used, 0);
assert_int_equal(parameter[5].values.used, 0);
assert_int_equal(parameter[5].location, 0);
assert_int_equal(parameter[5].location_sub, 0);
assert_int_equal(parameter[6].result, f_console_result_none_e);
assert_int_equal(parameter[6].locations.used, 0);
+ assert_int_equal(parameter[6].locations_sub.used, 0);
assert_int_equal(parameter[6].values.used, 0);
assert_int_equal(parameter[6].location, 0);
assert_int_equal(parameter[6].location_sub, 0);
assert_int_equal(parameter[7].result, f_console_result_none_e);
assert_int_equal(parameter[7].locations.used, 0);
+ assert_int_equal(parameter[7].locations_sub.used, 0);
assert_int_equal(parameter[7].values.used, 0);
assert_int_equal(parameter[7].location, 0);
assert_int_equal(parameter[7].location_sub, 0);
assert_int_equal(parameter[8].result, f_console_result_none_e);
assert_int_equal(parameter[8].locations.used, 0);
+ assert_int_equal(parameter[8].locations_sub.used, 0);
assert_int_equal(parameter[8].values.used, 0);
assert_int_equal(parameter[8].location, 0);
assert_int_equal(parameter[8].location_sub, 0);
"+h",
"--help",
"../`~!@#$%^&*()_-+={[}]:;\"'<,>./?",
+ "-soo",
+ "-oso",
+ "-oos",
+ "+soo",
+ "+oso",
+ "+oos",
+ "--seconds",
+ "--seconds",
+ "--seconds",
+ "++seconds",
+ "++seconds",
+ "++seconds",
0,
};
- const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(7, argv, 0);
+ const int total = 19;
+
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(total, argv, 0);
f_console_parameter_t parameter[] = {
macro_f_console_parameter_t_initialize("f", 0, 0, 1, f_console_type_normal_e),
assert_int_equal(parameter[8].location, 0);
assert_int_equal(parameter[8].location_sub, 0);
- assert_int_equal(parameters.remaining.used, 6);
+ assert_int_equal(parameters.remaining.used, total - 1);
+ assert_string_equal(argv[parameters.remaining.array[0]], argv[1]);
+ assert_string_equal(argv[parameters.remaining.array[1]], argv[2]);
+ assert_string_equal(argv[parameters.remaining.array[2]], argv[3]);
+ assert_string_equal(argv[parameters.remaining.array[3]], argv[4]);
+ assert_string_equal(argv[parameters.remaining.array[4]], argv[5]);
+ assert_string_equal(argv[parameters.remaining.array[5]], argv[6]);
+ assert_string_equal(argv[parameters.remaining.array[6]], argv[7]);
+ assert_string_equal(argv[parameters.remaining.array[7]], argv[8]);
+ assert_string_equal(argv[parameters.remaining.array[8]], argv[9]);
+ assert_string_equal(argv[parameters.remaining.array[9]], argv[10]);
+ assert_string_equal(argv[parameters.remaining.array[10]], argv[11]);
+ assert_string_equal(argv[parameters.remaining.array[11]], argv[12]);
+ assert_string_equal(argv[parameters.remaining.array[12]], argv[13]);
+ assert_string_equal(argv[parameters.remaining.array[13]], argv[14]);
+ assert_string_equal(argv[parameters.remaining.array[14]], argv[15]);
+ assert_string_equal(argv[parameters.remaining.array[15]], argv[16]);
+ assert_string_equal(argv[parameters.remaining.array[16]], argv[17]);
+ assert_string_equal(argv[parameters.remaining.array[17]], argv[18]);
}
f_console_parameters_delete(¶meters);
"-f",
"first",
"-st",
- "second",
+ "--second",
"third",
"other",
"+F",
"other",
"free",
"-4",
+ "+fast",
+ "-staff",
+ "-mMxx",
+ "mixed 1",
+ "mixed 2, value 1",
+ "mixed 2, value 2",
0,
};
- const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(18, argv, 0);
+ const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(24, argv, 0);
f_console_parameter_t parameter[] = {
macro_f_console_parameter_t_initialize("f", 0, 0, 1, f_console_type_normal_e),
macro_f_console_parameter_t_initialize(0, "sixth", 0, 1, f_console_type_normal_e),
macro_f_console_parameter_t_initialize(0, "seventh", 0, 2, f_console_type_normal_e),
macro_f_console_parameter_t_initialize("N", "not_found", 0, 0, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("m", "mixed_1", 0, 1, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("M", "mixed_2", 0, 2, f_console_type_normal_e),
+ macro_f_console_parameter_t_initialize("x", "mixed_3", 0, 0, f_console_type_normal_e),
macro_f_console_parameter_t_initialize(0, 0, "other", 0, f_console_type_other_e),
};
- f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 9);
+ f_console_parameters_t parameters = macro_f_console_parameters_t_initialize(parameter, 12);
{
const f_status_t status = f_console_parameter_process(arguments, ¶meters);
assert_int_equal(parameter[0].result, f_console_result_additional_e);
assert_int_equal(parameter[0].locations.used, 1);
+ assert_int_equal(parameter[0].locations_sub.used, 1);
assert_int_equal(parameter[0].values.used, 1);
assert_int_equal(parameter[0].location, 1);
assert_int_equal(parameter[0].location_sub, 1);
assert_int_equal(parameter[0].locations.array[0], 1);
- assert_string_equal(argv[parameter[0].values.array[0]], "first");
+ assert_int_equal(parameter[0].locations_sub.array[0], 1);
+ assert_string_equal(argv[parameter[0].values.array[0]], argv[2]);
assert_int_equal(parameter[1].result, f_console_result_additional_e);
assert_int_equal(parameter[1].locations.used, 1);
+ assert_int_equal(parameter[1].locations_sub.used, 1);
assert_int_equal(parameter[1].values.used, 1);
assert_int_equal(parameter[1].location, 3);
assert_int_equal(parameter[1].location_sub, 1);
assert_int_equal(parameter[1].locations.array[0], 3);
- assert_string_equal(argv[parameter[1].values.array[0]], "second");
+ assert_int_equal(parameter[1].locations_sub.array[0], 1);
+ assert_string_equal(argv[parameter[1].values.array[0]], argv[4]);
assert_int_equal(parameter[2].result, f_console_result_additional_e);
assert_int_equal(parameter[2].locations.used, 1);
+ assert_int_equal(parameter[2].locations_sub.used, 1);
assert_int_equal(parameter[2].values.used, 1);
assert_int_equal(parameter[2].location, 3);
assert_int_equal(parameter[2].location_sub, 2);
assert_int_equal(parameter[2].locations.array[0], 3);
- assert_string_equal(argv[parameter[2].values.array[0]], "third");
+ assert_int_equal(parameter[2].locations_sub.array[0], 2);
+ assert_string_equal(argv[parameter[2].values.array[0]], argv[5]);
assert_int_equal(parameter[3].result, f_console_result_found_e);
assert_int_equal(parameter[3].locations.used, 1);
+ assert_int_equal(parameter[3].locations_sub.used, 1);
assert_int_equal(parameter[3].values.used, 0);
assert_int_equal(parameter[3].location, 7);
assert_int_equal(parameter[3].location_sub, 1);
assert_int_equal(parameter[3].locations.array[0], 7);
+ assert_int_equal(parameter[3].locations_sub.array[0], 1);
assert_int_equal(parameter[4].result, f_console_result_additional_e);
assert_int_equal(parameter[4].locations.used, 1);
+ assert_int_equal(parameter[4].locations_sub.used, 1);
assert_int_equal(parameter[4].values.used, 1);
assert_int_equal(parameter[4].location, 8);
assert_int_equal(parameter[4].location_sub, 0);
assert_int_equal(parameter[4].locations.array[0], 8);
- assert_string_equal(argv[parameter[4].values.array[0]], "fifth");
+ assert_int_equal(parameter[4].locations_sub.array[0], 0);
+ assert_string_equal(argv[parameter[4].values.array[0]], argv[9]);
assert_int_equal(parameter[5].result, f_console_result_additional_e);
assert_int_equal(parameter[5].locations.used, 1);
+ assert_int_equal(parameter[5].locations_sub.used, 1);
assert_int_equal(parameter[5].values.used, 1);
assert_int_equal(parameter[5].location, 10);
assert_int_equal(parameter[5].location_sub, 0);
assert_int_equal(parameter[5].locations.array[0], 10);
- assert_string_equal(argv[parameter[5].values.array[0]], "sixth");
+ assert_int_equal(parameter[5].locations_sub.array[0], 0);
+ assert_string_equal(argv[parameter[5].values.array[0]], argv[11]);
assert_int_equal(parameter[6].result, f_console_result_additional_e);
assert_int_equal(parameter[6].locations.used, 1);
+ assert_int_equal(parameter[6].locations_sub.used, 1);
assert_int_equal(parameter[6].values.used, 2);
assert_int_equal(parameter[6].location, 12);
assert_int_equal(parameter[6].location_sub, 0);
assert_int_equal(parameter[6].locations.array[0], 12);
- assert_string_equal(argv[parameter[6].values.array[0]], "seventh");
- assert_string_equal(argv[parameter[6].values.array[1]], "7");
+ assert_int_equal(parameter[6].locations_sub.array[0], 0);
+ assert_string_equal(argv[parameter[6].values.array[0]], argv[13]);
+ assert_string_equal(argv[parameter[6].values.array[1]], argv[14]);
assert_int_equal(parameter[7].result, f_console_result_none_e);
assert_int_equal(parameter[7].locations.used, 0);
+ assert_int_equal(parameter[7].locations_sub.used, 0);
assert_int_equal(parameter[7].values.used, 0);
assert_int_equal(parameter[7].location, 0);
assert_int_equal(parameter[7].location_sub, 0);
- assert_int_equal(parameter[8].result, f_console_result_found_e);
- assert_int_equal(parameter[8].locations.used, 2);
- assert_int_equal(parameter[8].values.used, 0);
- assert_int_equal(parameter[8].location, 15);
- assert_int_equal(parameter[8].location_sub, 0);
- assert_int_equal(parameter[8].locations.array[0], 6);
- assert_int_equal(parameter[8].locations.array[1], 15);
-
- assert_int_equal(parameters.remaining.used, 2);
- assert_string_equal(argv[parameters.remaining.array[0]], "free");
- assert_string_equal(argv[parameters.remaining.array[1]], "-4");
+ assert_int_equal(parameter[8].result, f_console_result_additional_e);
+ assert_int_equal(parameter[8].locations.used, 1);
+ assert_int_equal(parameter[8].locations_sub.used, 1);
+ assert_int_equal(parameter[8].values.used, 1);
+ assert_int_equal(parameter[8].location, 20);
+ assert_int_equal(parameter[8].location_sub, 1);
+ assert_int_equal(parameter[8].locations.array[0], 20);
+ assert_int_equal(parameter[8].locations_sub.array[0], 1);
+ assert_string_equal(argv[parameter[8].values.array[0]], argv[21]);
+
+ assert_int_equal(parameter[9].result, f_console_result_additional_e);
+ assert_int_equal(parameter[9].locations.used, 1);
+ assert_int_equal(parameter[9].locations_sub.used, 1);
+ assert_int_equal(parameter[9].values.used, 2);
+ assert_int_equal(parameter[9].location, 20);
+ assert_int_equal(parameter[9].location_sub, 2);
+ assert_int_equal(parameter[9].locations.array[0], 20);
+ assert_int_equal(parameter[9].locations_sub.array[0], 2);
+ assert_string_equal(argv[parameter[9].values.array[0]], argv[22]);
+ assert_string_equal(argv[parameter[9].values.array[1]], argv[23]);
+
+ assert_int_equal(parameter[10].result, f_console_result_found_e);
+ assert_int_equal(parameter[10].locations.used, 1);
+ assert_int_equal(parameter[10].locations_sub.used, 2);
+ assert_int_equal(parameter[10].values.used, 0);
+ assert_int_equal(parameter[10].location, 20);
+ assert_int_equal(parameter[10].location_sub, 4);
+ assert_int_equal(parameter[10].locations.array[0], 20);
+ assert_int_equal(parameter[10].locations_sub.array[0], 3);
+ assert_int_equal(parameter[10].locations_sub.array[1], 4);
+
+ assert_int_equal(parameter[11].result, f_console_result_found_e);
+ assert_int_equal(parameter[11].locations.used, 2);
+ assert_int_equal(parameter[11].locations_sub.used, 2);
+ assert_int_equal(parameter[11].values.used, 0);
+ assert_int_equal(parameter[11].location, 15);
+ assert_int_equal(parameter[11].location_sub, 0);
+ assert_int_equal(parameter[11].locations.array[0], 6);
+ assert_int_equal(parameter[11].locations.array[1], 15);
+ assert_int_equal(parameter[11].locations_sub.array[0], 0);
+
+ assert_int_equal(parameters.remaining.used, 4);
+ assert_string_equal(argv[parameters.remaining.array[0]], argv[16]);
+ assert_string_equal(argv[parameters.remaining.array[1]], argv[17]);
+ assert_string_equal(argv[parameters.remaining.array[2]], argv[18]);
+ assert_string_equal(argv[parameters.remaining.array[3]], argv[19]);
}
f_console_parameters_delete(¶meters);
// f_console_parameter_process() only returns memory failures.
/**
+ * Test that function works with incomplete arguments.
+ *
+ * @see f_console_parameter_process()
+ */
+extern void test__f_console_parameter_process__incomplete_arguments(void **state);
+
+/**
* Test that function works with no (argv) arguments (but does have program name).
*
* @see f_console_parameter_process()
cmocka_unit_test(test__f_console_parameter_prioritize_right__fails),
cmocka_unit_test(test__f_console_parameter_prioritize_right__works),
+ cmocka_unit_test(test__f_console_parameter_process__incomplete_arguments),
cmocka_unit_test(test__f_console_parameter_process__no_arguments_no_program),
cmocka_unit_test(test__f_console_parameter_process__no_arguments),
cmocka_unit_test(test__f_console_parameter_process__null_arguments),
while (range->start <= range->stop && range->start < buffer->used) {
if (state.interrupt) {
- status = state.interrupt((void *) &state, 0);
+ status = state.interrupt((void * const) &state, 0);
if (F_status_set_fine(status) == F_interrupt) {
status = F_status_set_error(F_interrupt);
while (F_status_is_error_not(status) && range->start <= range->stop && range->start < buffer->used) {
if (state.interrupt) {
- status = state.interrupt((void *) &state, 0);
+ status = state.interrupt((void * const) &state, 0);
if (F_status_set_fine(status) == F_interrupt) {
status = F_status_set_error(F_interrupt);
while (range->start <= range->stop && range->start < buffer->used) {
if (state.interrupt) {
- status = state.interrupt((void *) &state, 0);
+ status = state.interrupt((void * const) &state, 0);
if (F_status_set_fine(status) == F_interrupt) {
status = F_status_set_error(F_interrupt);
while (range->start <= range->stop && range->start < buffer->used) {
if (state.interrupt) {
- status = state.interrupt((void *) &state, 0);
+ status = state.interrupt((void * const) &state, 0);
if (F_status_set_fine(status) == F_interrupt) {
status = F_status_set_error(F_interrupt);
void *data;
} f_state_t;
- #define f_state_t_initialize { F_memory_default_allocation_large_d, F_memory_default_allocation_small_d, 0, 0, 0, 0, 0, 0 }
+ #define f_state_t_initialize { \
+ F_memory_default_allocation_large_d, \
+ F_memory_default_allocation_small_d, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ }
#define macro_f_state_t_initialize(step_large, step_small, flag, handle, interrupt, callbacks, custom, data) { \
step_large, \
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_byte_dump_setting_load_
- extern void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting);
+ extern void byte_dump_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, byte_dump_setting_t * const setting);
#endif // _di_byte_dump_setting_load_
/**
#endif // _di_byte_dump_setting_delete_
#ifndef _di_byte_dump_setting_load_
- void byte_dump_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, byte_dump_setting_t * const setting) {
+ void byte_dump_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, byte_dump_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
byte_dump_print_line_first_locked(setting, main->error);
#define byte_dump_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(byte_dump_short_binary_s, byte_dump_long_binary_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_decimal_s, byte_dump_long_decimal_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_octal_s, byte_dump_long_octal_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_unicode_s, byte_dump_long_unicode_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_first_s, byte_dump_long_first_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_last_s, byte_dump_long_last_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_narrow_s, byte_dump_long_narrow_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_text_s, byte_dump_long_text_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_wide_s, byte_dump_long_wide_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(byte_dump_short_width_s, byte_dump_long_width_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_binary_s, byte_dump_long_binary_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_decimal_s, byte_dump_long_decimal_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_duodecimal_s, byte_dump_long_duodecimal_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_hexidecimal_s, byte_dump_long_hexidecimal_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_octal_s, byte_dump_long_octal_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_unicode_s, byte_dump_long_unicode_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_first_s, byte_dump_long_first_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_last_s, byte_dump_long_last_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_narrow_s, byte_dump_long_narrow_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_placeholder_s, byte_dump_long_placeholder_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_text_s, byte_dump_long_text_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_wide_s, byte_dump_long_wide_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(byte_dump_short_width_s, byte_dump_long_width_s, 1, f_console_flag_normal_e), \
\
- macro_f_console_parameter_t_initialize_6(byte_dump_long_normal_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(byte_dump_long_simple_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(byte_dump_long_classic_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(byte_dump_long_normal_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(byte_dump_long_simple_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(byte_dump_long_classic_s, 0, f_console_flag_normal_e), \
}
#define byte_dump_total_parameters_d 28
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- byte_dump_setting_load(arguments, &data, &setting);
+ byte_dump_setting_load(arguments, state, &data, &setting);
}
byte_dump_main(&data, &setting);
#endif // _di_control_setting_delete_
#ifndef _di_control_setting_load_
- void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting) {
+ void control_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, control_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
control_print_line_first_locked(setting, main->error);
#define control_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(control_short_name_s, control_long_name_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(control_short_return_s, control_long_return_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(control_short_settings_s, control_long_settings_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(control_short_socket_s, control_long_socket_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(control_short_name_s, control_long_name_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(control_short_return_s, control_long_return_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(control_short_settings_s, control_long_settings_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(control_short_socket_s, control_long_socket_s, 1, f_console_flag_normal_e), \
}
#define control_total_parameters_d 16
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_control_setting_load_
- extern void control_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, control_setting_t * const setting);
+ extern void control_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, control_setting_t * const setting);
#endif // _di_control_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- control_setting_load(arguments, &data, &setting);
+ control_setting_load(arguments, state, &data, &setting);
}
control_main(&data, &setting);
#endif // _di_controller_setting_delete_
#ifndef _di_controller_setting_load_
- void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting) {
+ void controller_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, controller_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
controller_print_line_first_locked(setting, main->error);
#define controller_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(controller_short_cgroup_s, controller_long_cgroup_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_daemon_s, controller_long_daemon_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_init_s, controller_long_init_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_interruptible_s, controller_long_interruptible_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_pid_s, controller_long_pid_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_settings_s, controller_long_settings_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_simulate_s, controller_long_simulate_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_socket_s, controller_long_socket_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_uninterruptible_s, controller_long_uninterruptible_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(controller_short_validate_s, controller_long_validate_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_cgroup_s, controller_long_cgroup_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_daemon_s, controller_long_daemon_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_init_s, controller_long_init_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_interruptible_s, controller_long_interruptible_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_pid_s, controller_long_pid_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_settings_s, controller_long_settings_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_simulate_s, controller_long_simulate_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_socket_s, controller_long_socket_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_uninterruptible_s, controller_long_uninterruptible_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(controller_short_validate_s, controller_long_validate_s, 0, f_console_flag_normal_e), \
}
#define controller_total_parameters_d 22
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_controller_setting_load_
- extern void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting);
+ extern void controller_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, controller_setting_t * const setting);
#endif // _di_controller_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- controller_setting_load(arguments, &data, &setting);
+ controller_setting_load(arguments, state, &data, &setting);
}
controller_main(&data, &setting);
"f_console_parameter_process",
"f_file_is",
"f_file_name_base",
+ "f_path_directory_cleanup",
"f_string_append",
"f_string_dynamic_append",
"f_string_dynamic_append_nulless",
"f_string_dynamic_mash",
"f_string_dynamic_resize",
"f_string_dynamics_increase_by",
+ "f_uint8s_increase",
"f_uint8s_increase_by",
"f_utf_is_word_dash_plus",
"fl_directory_copy",
"fll_execute_arguments_add",
"fll_execute_arguments_add_parameter_set",
"fll_execute_program",
+ "fll_program_parameter_additional_rip",
"fll_program_parameter_process_context",
"fll_program_parameter_process_verbosity",
};
fake_f_f_console_parameter_process_e,
fake_f_f_file_is_e,
fake_f_f_file_name_base_e,
+ fake_f_f_path_directory_cleanup_e,
fake_f_f_string_append_e,
fake_f_f_string_dynamic_append_e,
fake_f_f_string_dynamic_append_nulless_e,
fake_f_f_string_dynamic_mash_e,
fake_f_f_string_dynamic_resize_e,
fake_f_f_string_dynamics_increase_by_e,
+ fake_f_f_uint8s_increase_e,
fake_f_f_uint8s_increase_by_e,
fake_f_f_utf_is_word_dash_plus_e,
fake_f_fl_directory_copy_e,
fake_f_fll_execute_arguments_add_e,
fake_f_fll_execute_arguments_add_parameter_set_e,
fake_f_fll_execute_program_e,
+ fake_f_fll_program_parameter_additional_rip_e,
fake_f_fll_program_parameter_process_context_e,
fake_f_fll_program_parameter_process_verbosity_e,
}; // enum
* Provide default settings.
*/
#ifndef _di_fake_default_s_
- const f_string_static_t fake_default_path_build_s = macro_f_string_static_t_initialize(FAKE_default_path_build_s, 0, FAKE_default_path_build_s_length);
- const f_string_static_t fake_default_path_data_s = macro_f_string_static_t_initialize(FAKE_default_path_data_s, 0, FAKE_default_path_data_s_length);
- const f_string_static_t fake_default_path_sources_s = macro_f_string_static_t_initialize(FAKE_default_path_sources_s, 0, FAKE_default_path_sources_s_length);
- const f_string_static_t fake_default_path_work_s = macro_f_string_static_t_initialize(FAKE_default_path_work_s, 0, FAKE_default_path_work_s_length);
+ const f_string_static_t fake_default_build_s = macro_f_string_static_t_initialize(FAKE_default_build_s, 0, FAKE_default_build_s_length);
+ const f_string_static_t fake_default_data_s = macro_f_string_static_t_initialize(FAKE_default_data_s, 0, FAKE_default_data_s_length);
+ const f_string_static_t fake_default_sources_s = macro_f_string_static_t_initialize(FAKE_default_sources_s, 0, FAKE_default_sources_s_length);
+ const f_string_static_t fake_default_work_s = macro_f_string_static_t_initialize(FAKE_default_work_s, 0, FAKE_default_work_s_length);
const f_string_static_t fake_default_fakefile_s = macro_f_string_static_t_initialize(FAKE_default_fakefile_s, 0, FAKE_default_fakefile_s_length);
const f_string_static_t fake_default_process_s = macro_f_string_static_t_initialize(FAKE_default_process_s, 0, FAKE_default_process_s_length);
f_string_dynamic_resize(0, &setting->settings);
f_string_dynamic_resize(0, &setting->sources);
f_string_dynamic_resize(0, &setting->work);
- f_string_dynamic_resize(0, &setting->path_build);
- f_string_dynamic_resize(0, &setting->path_build_documentation);
- f_string_dynamic_resize(0, &setting->path_build_documents);
- f_string_dynamic_resize(0, &setting->path_build_includes);
- f_string_dynamic_resize(0, &setting->path_build_libraries);
- f_string_dynamic_resize(0, &setting->path_build_libraries_script);
- f_string_dynamic_resize(0, &setting->path_build_libraries_shared);
- f_string_dynamic_resize(0, &setting->path_build_libraries_static);
- f_string_dynamic_resize(0, &setting->path_build_objects);
- f_string_dynamic_resize(0, &setting->path_build_objects_script);
- f_string_dynamic_resize(0, &setting->path_build_objects_shared);
- f_string_dynamic_resize(0, &setting->path_build_objects_static);
- f_string_dynamic_resize(0, &setting->path_build_programs);
- f_string_dynamic_resize(0, &setting->path_build_programs_script);
- f_string_dynamic_resize(0, &setting->path_build_programs_shared);
- f_string_dynamic_resize(0, &setting->path_build_programs_static);
- f_string_dynamic_resize(0, &setting->path_build_settings);
- f_string_dynamic_resize(0, &setting->path_build_stage);
- f_string_dynamic_resize(0, &setting->path_data);
- f_string_dynamic_resize(0, &setting->path_data_build);
- f_string_dynamic_resize(0, &setting->path_data_documentation);
- f_string_dynamic_resize(0, &setting->path_data_settings);
- f_string_dynamic_resize(0, &setting->path_documents);
- f_string_dynamic_resize(0, &setting->path_licenses);
- f_string_dynamic_resize(0, &setting->path_sources);
- f_string_dynamic_resize(0, &setting->path_work);
- f_string_dynamic_resize(0, &setting->path_work_includes);
- f_string_dynamic_resize(0, &setting->path_work_libraries);
- f_string_dynamic_resize(0, &setting->path_work_libraries_script);
- f_string_dynamic_resize(0, &setting->path_work_libraries_shared);
- f_string_dynamic_resize(0, &setting->path_work_libraries_static);
- f_string_dynamic_resize(0, &setting->path_work_programs);
- f_string_dynamic_resize(0, &setting->path_work_programs_script);
- f_string_dynamic_resize(0, &setting->path_work_programs_shared);
- f_string_dynamic_resize(0, &setting->path_work_programs_static);
- f_string_dynamic_resize(0, &setting->file_data_build_defines);
- f_string_dynamic_resize(0, &setting->file_data_build_dependencies);
- f_string_dynamic_resize(0, &setting->file_data_build_fakefile);
- f_string_dynamic_resize(0, &setting->file_data_build_process_post);
- f_string_dynamic_resize(0, &setting->file_data_build_process_pre);
- f_string_dynamic_resize(0, &setting->file_data_build_settings);
- f_string_dynamic_resize(0, &setting->file_documents_readme);
f_string_dynamics_resize(0, &setting->defines);
f_string_dynamics_resize(0, &setting->modes);
#endif // _di_fake_setting_delete_
#ifndef _di_fake_setting_load_
- void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting) {
+ void fake_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fake_setting_t * const setting) {
if (!main || !setting) return;
- setting->flag = 0;
-
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, (void *) setting);
+ setting->status = f_console_parameter_process(arguments, state, &main->parameters, (void *) setting);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_console_parameter_process));
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(f_console_parameter_process));
return;
}
setting->status = fll_program_parameter_process_context(choices, modes, F_true, main);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_context));
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(fll_program_parameter_process_context));
return;
}
setting->status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_process_verbosity));
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(fll_program_parameter_process_verbosity));
return;
}
fake_parameter_path_work_e,
fake_parameter_process_e,
fake_parameter_settings_e,
- fake_parameter_sources_e,
};
const f_string_static_t names[] = {
fake_long_path_work_s,
fake_long_process_s,
fake_long_settings_s,
- fake_long_sources_s,
};
f_string_dynamic_t * const variable[] = {
&setting->fakefile,
- &setting->path_build,
- &setting->path_data,
- &setting->path_sources,
- &setting->path_work,
+ &setting->build,
+ &setting->data,
+ &setting->sources,
+ &setting->work,
&setting->process,
&setting->settings,
- &setting->sources,
};
- f_string_static_t * const defaults[] = {
- &fake_default_fakefile_s, // fake_parameter_fakefile_e
- 0, // fake_parameter_path_build_e
- 0, // fake_parameter_path_data_e
- 0, // fake_parameter_path_sources_e
- 0, // fake_parameter_path_work_e
- &fake_default_process_s, // fake_parameter_process_e
- &fake_default_settings_s, // fake_parameter_settings_e
- 0, // fake_parameter_sources_e
+ f_string_dynamic_resize(0, &setting->build);
+ f_string_dynamic_resize(0, &setting->data);
+ f_string_dynamic_resize(0, &setting->fakefile);
+ f_string_dynamic_resize(0, &setting->process);
+ f_string_dynamic_resize(0, &setting->settings);
+ f_string_dynamic_resize(0, &setting->sources);
+ f_string_dynamic_resize(0, &setting->work);
+
+ const f_string_static_t defaults[] = {
+ fake_default_fakefile_s,
+ fake_default_build_s,
+ fake_default_data_s,
+ fake_default_sources_s,
+ fake_default_work_s,
+ fake_default_process_s,
+ fake_default_settings_s,
};
- for (i = 0; i < 8; ++i) {
+ const bool cleanups[] = {
+ F_false, // fake_parameter_fakefile_e
+ F_true, // fake_parameter_path_build_e
+ F_true, // fake_parameter_path_data_e
+ F_false, // fake_parameter_path_sources_e
+ F_true, // fake_parameter_path_work_e
+ F_false, // fake_parameter_process_e
+ F_false, // fake_parameter_settings_e
+ };
+
+ for (i = 0; i < 7; ++i) {
if (main->parameters.array[parameters[i]].result & f_console_result_found_e) {
setting->status = F_status_set_error(F_parameter);
return;
}
- if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) {
+ if (main->parameters.array[parameters[i]].result & f_console_result_value_e) {
index = data->main->parameters.array[parameters[i]].values.array[data->main->parameters.array[parameters[i]].values.used - 1];
if (data->main->parameters.arguments.array[index].used) {
} // for
}
- // De-allocate memory before replacing it with a statically allocated string.
- if (variable[i]->size) {
- setting->status = f_string_dynamic_resize(0, variable[i]);
+ if (cleanups[i]) {
+ status = f_path_directory_cleanup(data->main->parameters.arguments.array[index], parameters_value[i]);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize));
+ if (print.verbosity > f_console_verbosity_quiet_e) {
+ fake_print_line_first_locked(setting, print);
+
+ if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(f_path_directory_cleanup), F_false) == F_false) {
+ fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]);
+ }
+ }
return;
}
}
+ else {
- variable[i]->string = data->main->parameters.arguments.array[index].string;
- variable[i]->used = data->main->parameters.arguments.array[index].used;
- variable[i]->size = 0;
+ // De-allocate memory before replacing it with a statically allocated string.
+ if (variable[i]->size) {
+ setting->status = f_string_dynamic_resize(0, variable[i]);
+
+ if (F_status_is_error(setting->status)) {
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_resize));
+
+ return;
+ }
+ }
+
+ variable[i]->string = data->main->parameters.arguments.array[index].string;
+ variable[i]->used = data->main->parameters.arguments.array[index].used;
+ variable[i]->size = 0;
+ }
+
+ if (!variable[i]->used) {
+ setting->status = F_status_set_error(F_parameter);
+
+ fake_print_error_parameter_not_empty(setting, data->main->error, f_console_symbol_long_normal_s, names[i], data->main->parameters.arguments.array[index]);
+
+ return;
+ }
setting->status = F_none;
}
}
- else if (defaults[i]) {
+ else {
// De-allocate memory before replacing it with a statically allocated string.
if (variable[i]->size) {
setting->status = f_string_dynamic_resize(0, variable[i]);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize));
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_resize));
return;
}
}
- variable[i]->string = defaults[i]->string;
- variable[i]->used = defaults[i]->used;
+ variable[i]->string = defaults[i].string;
+ variable[i]->used = defaults[i].used;
variable[i]->size = 0;
}
} // for
return;
}
- if (main->parameters.array[parameters[i]].result & f_console_result_additional_e) {
- variable[i]->used = 0;
-
- setting->status = f_string_dynamics_increase_by(data->main->parameters.array[parameters[i]].values.used, variable[i]);
+ if (main->parameters.array[parameters[i]].result & f_console_result_value_e) {
+ setting->status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[parameters[i]].values, variable[i]);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, macro_fake_f(f_string_dynamics_increase_by));
+ if (print.verbosity > f_console_verbosity_quiet_e) {
+ fake_print_line_first_locked(setting, print);
+
+ if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(fll_program_parameter_additional_rip), F_false) == F_false) {
+ fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]);
+ }
+ }
return;
}
- for (; variable[i]->used < data->main->parameters.array[parameters[i]].values.used; ) {
+ if (parameters[i] == fake_parameter_mode_e) {
+ f_array_length_t i = 0;
+ f_array_length_t j = 0;
+ f_array_length_t width_max = 0;
- // De-allocate memory before replacing it with a statically allocated string.
- if (variable[i]->size) {
- setting->status = f_string_dynamic_resize(0, variable[i]);
+ for (; i < data->mode.used; ++i) {
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, F_status_set_fine(setting->status), macro_fake_f(f_string_dynamic_resize));
+ for (j = 0; j < data->mode.array[i].used; ++j) {
- return;
- }
- }
+ width_max = data->mode.array[i].used - j;
+
+ setting->status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[i].string + j, data->main->parameters.arguments.array[i].used - j, F_false);
- index = data->main->parameters.array[parameters[i]].values.array[variable[i]->used];
+ if (F_status_is_error(setting->status)) {
+ if (print.verbosity > f_console_verbosity_quiet_e) {
+ fake_print_line_first_locked(setting, print);
+
+ if (fll_error_print(data->main->error, F_status_set_fine(setting->status), macro_fake_f(f_utf_is_word_dash_plus), F_false) == F_false) {
+ fll_program_print_error_parameter_process(data->main->error, F_status_set_fine(setting->status), f_console_symbol_long_normal_s, names[i]);
+ }
+ }
- variable[i]->array[variable[i]->used].string = main->parameters.arguments.array[index].string;
- variable[i]->array[variable[i]->used].used = main->parameters.arguments.array[index].used;
- variable[i]->array[variable[i]->used++].size = 0;
- } // for
+ return;
+ }
+
+ if (setting->status == F_false) {
+ setting->status = F_status_set_error(F_parameter);
+
+ fake_print_error_parameter_not_word(setting, data->main->error, f_console_symbol_long_normal_s, names[i], data->main->parameters.arguments.array[index]);
+
+ return;
+ }
+ } // for
+ } // for
+ }
}
} // for
}
}
- {
- f_array_length_t locations = main->parameters.array[fake_parameter_operation_build_e].locations.used;
- locations += main->parameters.array[fake_parameter_operation_clean_e].locations.used;
- locations += main->parameters.array[fake_parameter_operation_make_e].locations.used;
- locations += main->parameters.array[fake_parameter_operation_skeleton_e].locations.used;
-
- setting->operations.used = 0;
+ if (setting->operations.used) {
+ setting->flag |= fake_data_flag_operation_e;
+ }
+ else {
+ setting->flag |= fake_data_flag_operation_make_e;
+ setting->flag -= setting->flag & fake_data_flag_operation_e;
- setting->status = f_uint8s_increase_by(locations ? locations : 1, &setting->operations);
+ setting->status = f_uint8s_increase_by(1, &setting->operations);
if (F_status_is_error(setting->status)) {
- fake_print_error(setting, main->error, macro_fake_f(f_uint8s_increase_by));
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(f_uint8s_increase_by));
return;
}
- if (locations) {
- data.flag |= fake_data_flag_operation_e;
-
- f_array_length_t i = 0;
-
- //f_string_static_t * const args = main->parameters.arguments.array;
-
- /*
- fake_process_console_parameters
- fake_parameter_operation_build_e,
- fake_parameter_operation_clean_e,
- fake_parameter_operation_make_e,
- fake_parameter_operation_skeleton_e,
- */
- /*
- f_array_length_t locations[operations_length];
- f_array_length_t locations_length = 0;
- f_array_length_t i = 0;
- f_array_length_t j = 0;
- f_array_length_t k = 0;
+ setting->operations.array[setting->operations.used++] = fake_operation_make_e;
+ }
+ }
+#endif // _di_fake_setting_load_
- for (; i < main->parameters.array[fake_parameter_operation_build_e].locations.used; ++i, ++locations_length) {
+#ifndef _di_fake_setting_load_parameter_callback_
+ void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const void_parameters, f_console_parameter_state_t * const state, void * const void_data) {
- operations[locations_length] = fake_operation_build_e;
- locations[locations_length] = main->parameters.array[fake_parameter_operation_build_e].locations.array[i];
- } // for
+ if (!state) return;
- for (i = 0; i < main->parameters.array[fake_parameter_operation_clean_e].locations.used; ++i) {
+ if (!parameters || !data || state->type != f_console_parameter_state_type_match_other_e)) {
+ state->status = F_process;
- for (j = 0; j < locations_length; ++j) {
+ return;
+ }
- if (main->parameters.array[fake_parameter_operation_clean_e].locations.array[i] < locations[j]) {
- for (k = locations_length; k > j; --k) {
- locations[k] = locations[k - 1];
- operations[k] = operations[k - 1];
- } // for
+ f_console_parameters_t * const parameters = (f_console_parameters_t * const) void_parameters;
+ fake_setting_t * const setting = (fake_setting_t * const) void_data;
- break;
- }
- } // for
+ state->status = f_uint8s_increase(fake_default_allocation_small_d, &setting->operations);
- locations[j] = main->parameters.array[fake_parameter_operation_clean_e].locations.array[i];
- operations[j] = fake_operation_clean_e;
- ++locations_length;
- } // for
+ if (F_status_is_error(state->status)) {
+ fake_print_error(setting, state->status, main->error, macro_fake_f(f_uint8s_increase));
- for (i = 0; i < main->parameters.array[fake_parameter_operation_make_e].locations.used; ++i) {
+ return;
+ }
- for (j = 0; j < locations_length; ++j) {
+ switch (state.match) {
+ case fake_parameter_operation_build_e:
+ setting->operations.array[setting->operations.used++] = fake_operation_build_e;
+ setting->flag |= fake_data_flag_operation_build_e;
- if (main->parameters.array[fake_parameter_operation_make_e].locations.array[i] < locations[j]) {
- for (k = locations_length; k > j; --k) {
- locations[k] = locations[k - 1];
- operations[k] = operations[k - 1];
- } // for
+ break;
- break;
- }
- } // for
+ case fake_parameter_operation_clean_e:
+ setting->operations.array[setting->operations.used++] = fake_operation_clean_e;
+ setting->flag |= fake_data_flag_operation_clean_e;
- locations[j] = main->parameters.array[fake_parameter_operation_make_e].locations.array[i];
- operations[j] = fake_operation_make_e;
- ++locations_length;
- } // for
+ break;
- for (i = 0; i < main->parameters.array[fake_parameter_operation_skeleton_e].locations.used; ++i) {
+ case fake_parameter_operation_make_e:
+ setting->operations.array[setting->operations.used++] = fake_operation_make_e;
+ setting->flag |= fake_data_flag_operation_make_e;
- for (j = 0; j < locations_length; ++j) {
+ break;
- if (main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i] < locations[j]) {
- for (k = locations_length; k > j; --k) {
+ case fake_parameter_operation_skeleton_e:
+ setting->operations.array[setting->operations.used++] = fake_operation_skeleton_e;
+ setting->flag |= fake_data_flag_operation_skeleton_e;
- locations[k] = locations[k - 1];
- operations[k] = operations[k - 1];
- } // for
+ break;
- break;
- }
- } // for
+ default:
+ state->status = F_process;
- locations[j] = main->parameters.array[fake_parameter_operation_skeleton_e].locations.array[i];
- operations[j] = fake_operation_skeleton_e;
- ++locations_length;
- } // for
- */
- }
- else {
- setting->operations.array[setting->operations.used++] = fake_parameter_operation_make_e;
- }
+ return;
}
+
+ state->status = F_none;
}
-#endif // _di_fake_setting_load_
+#endif // _di_fake_setting_load_parameter_callback_
#ifndef _di_fake_setting_unload_
f_status_t fake_setting_unload(fll_program_data_t * const main, fake_setting_t * const setting) {
* Provide default settings.
*/
#ifndef _di_fake_default_s_
- #define FAKE_default_path_build_s "build" F_path_separator_s
- #define FAKE_default_path_data_s "data" F_path_separator_s
- #define FAKE_default_path_sources_s "sources" F_path_separator_s
- #define FAKE_default_path_work_s ""
+ #define FAKE_default_build_s "build" F_path_separator_s
+ #define FAKE_default_data_s "data" F_path_separator_s
+ #define FAKE_default_sources_s "sources" F_path_separator_s
+ #define FAKE_default_work_s ""
#define FAKE_default_fakefile_s "fakefile"
#define FAKE_default_process_s ""
#define FAKE_default_settings_s "settings"
- #define FAKE_default_path_build_s_length 5 + F_path_separator_s_length
- #define FAKE_default_path_data_s_length 4 + F_path_separator_s_length
- #define FAKE_default_path_sources_s_length 7 + F_path_separator_s_length
- #define FAKE_default_path_work_s_length 0
+ #define FAKE_default_build_s_length 5 + F_path_separator_s_length
+ #define FAKE_default_data_s_length 4 + F_path_separator_s_length
+ #define FAKE_default_sources_s_length 7 + F_path_separator_s_length
+ #define FAKE_default_work_s_length 0
#define FAKE_default_fakefile_s_length 8
#define FAKE_default_process_s_length 0
#define FAKE_default_settings_s_length 8
- extern const f_string_static_t fake_default_path_build_s;
- extern const f_string_static_t fake_default_path_data_s;
- extern const f_string_static_t fake_default_path_sources_s;
- extern const f_string_static_t fake_default_path_work_s;
+ extern const f_string_static_t fake_default_build_s;
+ extern const f_string_static_t fake_default_data_s;
+ extern const f_string_static_t fake_default_sources_s;
+ extern const f_string_static_t fake_default_work_s;
extern const f_string_static_t fake_default_fakefile_s;
extern const f_string_static_t fake_default_process_s;
#define fake_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fake_short_define_s, fake_long_define_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_fakefile_s, fake_long_fakefile_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_mode_s, fake_long_mode_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_process_s, fake_long_process_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_settings_s, fake_long_settings_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_path_build_s, fake_long_path_build_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_path_data_s, fake_long_path_data_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_path_sources_s, fake_long_path_sources_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fake_short_path_work_s, fake_long_path_work_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_define_s, fake_long_define_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_fakefile_s, fake_long_fakefile_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_mode_s, fake_long_mode_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_process_s, fake_long_process_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_settings_s, fake_long_settings_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_path_build_s, fake_long_path_build_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_path_data_s, fake_long_path_data_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_path_sources_s, fake_long_path_sources_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fake_short_path_work_s, fake_long_path_work_s, 1, f_console_flag_normal_e), \
\
- macro_f_console_parameter_t_initialize_6(fake_long_documents_disabled_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(fake_long_documents_enabled_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(fake_long_shared_disabled_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(fake_long_shared_enabled_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(fake_long_static_disabled_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_6(fake_long_static_enabled_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(fake_long_documents_disabled_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(fake_long_documents_enabled_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(fake_long_shared_disabled_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(fake_long_shared_enabled_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(fake_long_static_disabled_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_5(fake_long_static_enabled_s, 0, f_console_flag_normal_e), \
\
- macro_f_console_parameter_t_initialize_7(fake_other_operation_build_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(fake_other_operation_clean_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(fake_other_operation_make_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(fake_other_operation_skeleton_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(fake_other_operation_build_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(fake_other_operation_clean_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(fake_other_operation_make_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(fake_other_operation_skeleton_s, 0, f_console_flag_simple_e), \
}
#define fake_total_parameters_d 31
* Flags passed to the main function or program.
*
* fake_main_flag_*_e:
- * - none: No flags set.
- * - enable_documents: Enable documents, as-in --enable-doc (not specifying means --disable-doc).
- * - enable_shared: Enable shared, as-in --enable-shared (not specifying means --disable-shared).
- * - enable_static: Enable static, as-in --enable-static (not specifying means --disable-static).
- * - file_from: Using a specified source file.
- * - file_to: Using a specified destination file.
- * - header: Enable printing of headers.
- * - help: Print help.
- * - operation: Designate that an operation is explicitly passed.
- * - separate: Enable printing of separators.
- * - strip_invalid: Using strip invalid character mode.
- * - verify: Using verify mode.
- * - version: Print version.
+ * - none: No flags set.
+ * - enable_documents: Enable documents, as-in --enable-doc (not specifying means --disable-doc).
+ * - enable_shared: Enable shared, as-in --enable-shared (not specifying means --disable-shared).
+ * - enable_static: Enable static, as-in --enable-static (not specifying means --disable-static).
+ * - file_from: Using a specified source file.
+ * - file_to: Using a specified destination file.
+ * - header: Enable printing of headers.
+ * - help: Print help.
+ * - operation: Designate that an operation is explicitly passed.
+ * - operation_build: The build operation is designated.
+ * - operation_clean: The clean operation is designated.
+ * - operation_make: The make operation is designated (or enabled as default).
+ * - operation_skeleton: The skeleton operation is designated.
+ * - separate: Enable printing of separators.
+ * - strip_invalid: Using strip invalid character mode.
+ * - verify: Using verify mode.
+ * - version: Print version.
*/
#ifndef _di_fake_main_flag_e_
enum {
- fake_main_flag_none_e = 0x0,
- fake_main_flag_enable_documents_e = 0x1,
- fake_main_flag_enable_shared_e = 0x2,
- fake_main_flag_enable_static_e = 0x4,
- fake_main_flag_file_from_e = 0x8,
- fake_main_flag_file_to_e = 0x10,
- fake_main_flag_header_e = 0x20,
- fake_main_flag_help_e = 0x40,
- fake_data_flag_operation_e = 0x80,
- fake_main_flag_separate_e = 0x100,
- fake_main_flag_strip_invalid_e = 0x200,
- fake_main_flag_verify_e = 0x400,
- fake_main_flag_version_e = 0x800,
+ fake_main_flag_none_e = 0x0,
+ fake_main_flag_enable_documents_e = 0x1,
+ fake_main_flag_enable_shared_e = 0x2,
+ fake_main_flag_enable_static_e = 0x4,
+ fake_main_flag_file_from_e = 0x8,
+ fake_main_flag_file_to_e = 0x10,
+ fake_main_flag_header_e = 0x20,
+ fake_main_flag_help_e = 0x40,
+ fake_data_flag_operation_e = 0x80,
+ fake_data_flag_operation_build_e = 0x100,
+ fake_data_flag_operation_clean_e = 0x200,
+ fake_data_flag_operation_make_e = 0x400,
+ fake_data_flag_operation_skeleton_e = 0x800,
+ fake_main_flag_separate_e = 0x1000,
+ fake_main_flag_strip_invalid_e = 0x2000,
+ fake_main_flag_verify_e = 0x4000,
+ fake_main_flag_version_e = 0x8000,
}; // enum
#endif // _di_fake_main_flag_e_
* settings: The settings file path.
* sources: The sources directory.
* work: The work directory.
- *
- * path_build: The build path.
- * path_build_documentation: The build documentation path.
- * path_build_documents: The build documents path.
- * path_build_includes: The build includes path.
- * path_build_libraries: The build libraries path.
- * path_build_libraries_script: The build libraries_script path.
- * path_build_libraries_shared: The build libraries_shared path.
- * path_build_libraries_static: The build libraries_static path.
- * path_build_objects: The build objects path.
- * path_build_objects_script: The build objects_script path.
- * path_build_objects_shared: The build objects_shared path.
- * path_build_objects_static: The build objects_static path.
- * path_build_programs: The build programs path.
- * path_build_programs_script: The build programs_script path.
- * path_build_programs_shared: The build programs_shared path.
- * path_build_programs_static: The build programs_static path.
- * path_build_settings: The build settings path.
- * path_build_stage: The build stage path.
- *
- * path_data: The data path.
- * path_data_build: The build data path.
- * path_data_documentation: The documentation data path.
- * path_data_settings: The settings data path.
- *
- * path_documents: The documents path.
- * path_licenses: The licenses path.
- * path_sources: The sources path.
- *
- * path_work: The work path.
- * path_work_includes: The includes work path.
- * path_work_libraries: The libraries work path.
- * path_work_libraries_script: The libraries_script work path.
- * path_work_libraries_shared: The libraries_shared work path.
- * path_work_libraries_static: The libraries_static work path.
- * path_work_programs: The programs work path.
- * path_work_programs_script: The programs_script work path.
- * path_work_programs_shared: The programs_shared work path.
- * path_work_programs_static: The programs_static work path.
- *
- * file_data_build_defines: The defines build file data.
- * file_data_build_dependencies: The dependencies build file data.
- * file_data_build_fakefile: The fakefile build file data.
- * file_data_build_process_post: The process_post_s build file data.
- * file_data_build_process_pre: The process_pre_s build file data.
- * file_data_build_settings: The settings build file data.
- *
- * file_documents_readme: The documents readme file data.
* defines: The define data.
* modes: The mode data.
f_string_dynamic_t sources;
f_string_dynamic_t work;
- f_string_dynamic_t path_build;
- f_string_dynamic_t path_build_documentation;
- f_string_dynamic_t path_build_documents;
- f_string_dynamic_t path_build_includes;
- f_string_dynamic_t path_build_libraries;
- f_string_dynamic_t path_build_libraries_script;
- f_string_dynamic_t path_build_libraries_shared;
- f_string_dynamic_t path_build_libraries_static;
- f_string_dynamic_t path_build_objects;
- f_string_dynamic_t path_build_objects_script;
- f_string_dynamic_t path_build_objects_shared;
- f_string_dynamic_t path_build_objects_static;
- f_string_dynamic_t path_build_programs;
- f_string_dynamic_t path_build_programs_script;
- f_string_dynamic_t path_build_programs_shared;
- f_string_dynamic_t path_build_programs_static;
- f_string_dynamic_t path_build_settings;
- f_string_dynamic_t path_build_stage;
-
- f_string_dynamic_t path_data;
- f_string_dynamic_t path_data_build;
- f_string_dynamic_t path_data_documentation;
- f_string_dynamic_t path_data_settings;
-
- f_string_dynamic_t path_documents;
-
- f_string_dynamic_t path_licenses;
-
- f_string_dynamic_t path_sources;
-
- f_string_dynamic_t path_work;
- f_string_dynamic_t path_work_includes;
- f_string_dynamic_t path_work_libraries;
- f_string_dynamic_t path_work_libraries_script;
- f_string_dynamic_t path_work_libraries_shared;
- f_string_dynamic_t path_work_libraries_static;
- f_string_dynamic_t path_work_programs;
- f_string_dynamic_t path_work_programs_script;
- f_string_dynamic_t path_work_programs_shared;
- f_string_dynamic_t path_work_programs_static;
-
- // @fixme there is overlap here with setting->fakefile and similar.
- f_string_dynamic_t file_data_build_defines;
- f_string_dynamic_t file_data_build_dependencies;
- f_string_dynamic_t file_data_build_fakefile;
- f_string_dynamic_t file_data_build_process_post;
- f_string_dynamic_t file_data_build_process_pre;
- f_string_dynamic_t file_data_build_settings;
-
- f_string_dynamic_t file_documents_readme;
-
f_string_dynamics_t defines;
f_string_dynamics_t modes;
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_uint8s_t_initialize, \
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fake_setting_load_
- extern void fake_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fake_setting_t * const setting);
+ extern void fake_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fake_setting_t * const setting);
#endif // _di_fake_setting_load_
/**
+ * Callback used by f_console_parameter_process() for custom handling of parameters.
+ *
+ * This prints error messages as appropriate.
+ *
+ * If either main or setting is NULL, then this immediately returns without doing anything.
+ *
+ * @param arguments
+ * The parameters passed to the process (often referred to as command line arguments).
+ * @param parameters
+ * The parameters array (generally from main.parameters) representing all of the parameters to look for.
+ * This must be of type f_console_parameters_t.
+ * @param state
+ * The internal state data primarily managed by f_console_parameter_process().
+ * The state.status is used to represent the return status of this callback.
+ * @param data
+ * This must be of the type fake_setting_t.
+ *
+ * @see f_console_parameter_process()
+ */
+#ifndef _di_fake_setting_load_parameter_callback_
+ extern void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const state, void * const data);
+#endif // _di_fake_setting_load_parameter_callback_
+
+/**
* Perform the standard program setting unload process.
*
* @param main
return;
}
- // @todo everything below is old, mostly.
+ if ((setting->flag & fake_data_flag_operation_build_e) && (setting->flag & fake_data_flag_operation_make_e)) {
+ setting->status = F_status_set_error(F_parameter);
+
+ fake_print_error_parameter_operation_not_with(setting, main->error, fake_other_operation_build_s, fake_other_operation_make_s);
+
+ return;
+ }
+
fake_data_t data = fake_data_t_initialize;
data.main = main;
data.setting = setting;
- data.argv = main->parameters.arguments.array;
- if (F_status_is_error_not(setting->status)) {
- if (main->parameters.array[fake_parameter_operation_build_e].locations.used && main->parameters.array[fake_parameter_operation_make_e].locations.used) {
- setting->status = F_status_set_error(F_parameter);
+ setting->status = fake_path_generate(&data); // @todo needs to be updated regarding the new data structure.
- fake_print_error_parameter_operation_not_with(setting, main->error, fake_other_operation_build_s, fake_other_operation_make_s);
- }
- }
+ if (F_status_is_error(setting->status)) {
+ fake_data_delete(&data);
- if (F_status_is_error_not(setting->status)) {
- bool validate_parameter_paths = F_true;
+ return;
+ }
- setting->status = fake_process_console_parameters(&data);
+ if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_data_flag_operation_e)) {
+ data.file_data_build_fakefile.used = 0;
- if (F_status_is_error_not(setting->status)) {
- setting->status = fake_path_generate(&data);
- }
+ setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
if (F_status_is_error(setting->status)) {
- fake_data_delete(&data);
-
- return;
+ fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_append));
}
+ else {
+ setting->fakefile.used = 0;
- {
- uint8_t i = 0;
+ setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &setting->fakefile);
+ }
+ }
- if ((main->pipe & fll_program_data_pipe_input_e) && !(data.setting->flag & fake_data_flag_operation_e)) {
- data.file_data_build_fakefile.used = 0;
+ {
+ f_array_length_t i = 0;
- setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.file_data_build_fakefile);
+ // Pre-process and perform validation when "clean" is before a "build" or "make" command as a safety check.
+ {
+ uint8_t has_clean = F_false;
- if (F_status_is_error(setting->status)) {
- fake_print_error(setting, setting->status, main->error, macro_fake_f(f_string_dynamic_append));
- }
- else {
- data.fakefile.used = 0;
+ for (; i < setting->operations.used; ++i) {
- setting->status = f_string_dynamic_append(f_string_ascii_minus_s, &data.fakefile);
+ if (setting->operations.array[i] == fake_operation_clean_e) {
+ has_clean = F_true;
}
- }
-
- // Pre-process and perform validation when "clean" is before a "build" or "make" command as a safety check.
- if (operations_length) {
- for (uint8_t has_clean = F_false; i < operations_length; ++i) {
+ else if (setting->operations.array[i] == fake_operation_build_e || setting->operations.array[i] == fake_operation_make_e) {
- if (operations[i] == fake_operation_clean_e) {
- has_clean = F_true;
- }
- else if (operations[i] == fake_operation_build_e || operations[i] == fake_operation_make_e) {
+ // If the first operation is clean and a make or build operation exists, then the clean operation requires the appropriate settings file or fakefile file.
+ if (has_clean) {
+ data.operation = setting->operations.array[i];
- // If the first operation is clean and a make or build operation exists, then the clean operation requires the appropriate settings file or fakefile file.
- if (has_clean) {
- operations_name = fake_other_operation_clean_s;
- data.operation = operations[i];
+ setting->status = fake_validate_parameter_paths(&data);
- setting->status = fake_validate_parameter_paths(&data);
+ if (F_status_is_error_not(setting->status) && !(main->pipe & fll_program_data_pipe_input_e)) {
+ setting->status = f_file_is(
+ setting->operations.array[i] == fake_operation_build_e
+ ? data.file_data_build_settings
+ : data.file_data_build_fakefile,
+ F_file_type_regular_d, F_false
+ );
- if (F_status_is_error_not(setting->status) && !(main->pipe & fll_program_data_pipe_input_e)) {
- f_string_static_t *path = 0;
+ if (setting->status == F_false) {
+ setting->status = F_status_set_error(F_file_not);
+ }
- if (operations[i] == fake_operation_build_e) {
- path = &data.file_data_build_settings;
- }
- else {
- path = &data.file_data_build_fakefile;
- }
+ if (F_status_is_error(setting->status)) {
+ fake_print_error_file(
+ setting,
+ F_status_set_fine(setting->status),
+ main->error,
+ macro_fake_f(f_file_is),
+ setting->operations.array[i] == fake_operation_build_e
+ ? data.file_data_build_settings
+ : data.file_data_build_fakefile,
+ fake_common_file_path_access_s,
+ fll_error_file_type_file_e
+ );
+ }
+ }
+ }
- setting->status = f_file_is(*path, F_file_type_regular_d, F_false);
+ break;
+ }
- if (setting->status == F_false) {
- setting->status = F_status_set_error(F_file_not);
- }
+ if (!((++main->signal_check) % fake_signal_check_short_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(data.main->error, F_status_set_fine(setting->status), "f_file_is", F_true, *path, fake_common_file_path_access_s, fll_error_file_type_file_e);
- }
- }
- }
+ setting->status = F_status_set_error(F_interrupt);
break;
}
- } // for
- }
- if (F_status_is_error_not(setting->status)) {
- for (i = 0; i < operations_length; ++i) {
+ main->signal_check = 0;
+ }
+ } // for
+ }
- data.operation = operations[i];
+ {
+ bool check_paths = F_true;
- if (data.operation == fake_operation_build_e) {
- operations_name = fake_other_operation_build_s;
- }
- else if (data.operation == fake_operation_clean_e) {
- operations_name = fake_other_operation_clean_s;
- }
- else if (data.operation == fake_operation_make_e) {
- operations_name = fake_other_operation_make_s;
- }
- else if (data.operation == fake_operation_skeleton_e) {
- operations_name = fake_other_operation_skeleton_s;
- }
+ for (i = 0; i < setting->operations.used; ++i) {
- if (data.operation == fake_operation_build_e) {
- if (validate_parameter_paths) {
- setting->status = fake_validate_parameter_paths(&data);
- validate_parameter_paths = F_false;
- }
+ data.operation = setting->operations.array[i];
- if (F_status_is_error_not(setting->status)) {
- setting->status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
- }
+ if (data.operation == fake_operation_build_e) {
+ if (check_paths) {
+ setting->status = fake_validate_parameter_paths(&data);
+ check_paths = F_false;
}
- else if (data.operation == fake_operation_clean_e) {
- setting->status = fake_clean_operate(&data);
- // Reset in case next operation needs files.
- validate_parameter_paths = F_true;
+ if (F_status_is_error_not(setting->status)) {
+ setting->status = fake_build_operate(&data, 0, main->pipe & fll_program_data_pipe_input_e);
}
- else if (data.operation == fake_operation_make_e) {
- if (validate_parameter_paths) {
- setting->status = fake_validate_parameter_paths(&data);
- validate_parameter_paths = F_false;
- }
+ }
+ else if (data.operation == fake_operation_clean_e) {
+ setting->status = fake_clean_operate(&data);
- if (F_status_is_error_not(setting->status)) {
- setting->status = fake_make_operate(&data);
- if (setting->status == F_child) break;
- }
+ // Reset in case next operation needs files.
+ check_paths = F_true;
+ }
+ else if (data.operation == fake_operation_make_e) {
+ if (check_paths) {
+ setting->status = fake_validate_parameter_paths(&data);
+ check_paths = F_false;
}
- else if (data.operation == fake_operation_skeleton_e) {
- setting->status = fake_skeleton_operate(&data);
- // Skeleton is supposed to guarantee these.
- validate_parameter_paths = F_false;
+ if (F_status_is_error_not(setting->status)) {
+ setting->status = fake_make_operate(&data);
+ if (setting->status == F_child) break;
}
+ }
+ else if (data.operation == fake_operation_skeleton_e) {
+ setting->status = fake_skeleton_operate(&data);
- if (setting->status == F_child) break;
+ // Skeleton is supposed to guarantee these.
+ check_paths = F_false;
+ }
- if (F_status_set_fine(setting->status) == F_interrupt || !(i % fake_signal_check_short_d)) {
- if (fll_program_standard_signal_received(main)) {
- fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
+ if (setting->status == F_child) break;
- setting->status = F_status_set_error(F_interrupt);
+ if (!((++main->signal_check) % fake_signal_check_short_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- break;
- }
+ setting->status = F_status_set_error(F_interrupt);
- main->signal_check = 0;
+ break;
}
- if (F_status_is_error(setting->status)) break;
- } // for
- }
-
- if (F_status_is_error(setting->status)) {
- fake_print_error_failure_operation(setting, main->error, operations_name);
- }
- }
+ main->signal_check = 0;
+ }
- if (setting->status != F_child) {
- fake_print_operation_all_complete(setting, main->message);
+ if (F_status_is_error(setting->status)) break;
+ } // for
}
}
if (F_status_is_error(setting->status)) {
+ fake_print_error_failure_operation(setting, main->error, data.operation);
fake_print_line_last_locked(setting, main->error);
}
- else if (setting->status != F_interrupt && setting->status != F_child) {
- fake_print_line_last_locked(setting, main->message);
+ else if (setting->status != F_child) {
+ fake_print_operation_all_complete(setting, main->message);
+
+ if (setting->status != F_interrupt) {
+ fake_print_line_last_locked(setting, main->message);
+ }
}
fake_data_delete(&data);
f_console_parameter_t parameters[] = fake_console_parameter_t_initialize;
data.parameters.array = parameters;
data.parameters.used = fake_total_parameters_d;
+ data.parameters.callback = &fake_setting_load_parameter_callback;
data.environment = envp;
if (f_pipe_input_exists()) {
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fake_setting_load(arguments, &data, &setting);
+ fake_setting_load(arguments, state, &data, &setting);
}
fake_main(&data, &setting);
}
#endif // _di_fake_print_error_
+#ifndef _di_fake_print_error_file_
+ f_status_t fake_print_error_file(fake_setting_t * const setting, const f_status_t status, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ fake_print_line_first_locked(setting, print);
+ fll_error_file_print(print, F_status_set_fine(status), function, F_true, name, operation, type);
+
+ return F_none;
+ }
+#endif // _di_fake_print_error_file_
+
#ifndef _di_fake_print_error_failure_operation_
- f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation) {
+ f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation) {
if (!setting || print.verbosity < f_console_verbosity_error_e) return F_output_not;
fake_print_line_first_unlocked(setting, print);
- fl_print_format("%[%QThe operation '%]", print.to, print.context, print.prefix, print.context);
- fl_print_format("%[%Q%]", print.to, print.notable, operation, print.notable);
- fl_print_format("%[' failed.%]%r", print.to, print.context, print.context, f_string_eol_s);
+ fl_print_format("%[%QThe operation '%]%[", print.to, print.context, print.prefix, print.context, print.notable);
+
+ if (data.operation == fake_operation_build_e) {
+ f_print_dynamic(print.to, fake_other_operation_build_s);
+ }
+ else if (data.operation == fake_operation_clean_e) {
+ f_print_dynamic(print.to, fake_other_operation_clean_s);
+ }
+ else if (data.operation == fake_operation_make_e) {
+ f_print_dynamic(print.to, fake_other_operation_make_s);
+ }
+ else if (data.operation == fake_operation_skeleton_e) {
+ f_print_dynamic(print.to, fake_other_operation_skeleton_s);
+ }
+
+ fl_print_format("%]%[' failed.%]%r", print.to, print.notable, print.context, print.context, f_string_eol_s);
f_file_stream_unlock(print.to);
}
#endif // _di_fake_print_error_failure_script_
+#ifndef _di_fake_print_error_parameter_not_empty_
+ f_status_t fake_print_error_parameter_not_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) {
+
+ if (!setting || print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ if (!F_status_is_error(setting->status)) {
+ if (print.verbosity < f_console_verbosity_error_e) return F_output_not;
+ }
+
+ f_file_stream_lock(print.to);
+
+ fake_print_line_first_unlocked(setting, print);
+
+ fl_print_format("%[%QThe '%]", print.to, print.context, print.prefix, print.context);
+ fl_print_format("%[%Q%Q%]", print.to, print.notable, symbol, name, print.notable);
+ fl_print_format("%[' parameter must not be empty and must not contain only white space.%]%r", print.to, print.context, print.context, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fake_print_error_parameter_not_empty_
+
#ifndef _di_fake_print_error_parameter_not_word_
f_status_t fake_print_error_parameter_not_word(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value) {
#endif // _di_fake_print_error_
/**
+ * Print file related error message regarding a function failing in some way.
+ *
+ * @param setting
+ * The main program settings.
+ *
+ * This does not alter setting.status.
+ * @param status
+ * The status to use.
+ * This is provided, ignoring setting.status, for thread-safety reasons.
+ * @param print
+ * Designates the how and where to print.
+ * @param name
+ * The name of the file or directory.
+ * @param operation
+ * The operation that fails, such as 'create' or 'access'.
+ * @param type
+ * A valid file type code from the fll_error_file_type enum.
+ *
+ * @return
+ * F_true is returned if the status code has no print message.
+ * F_false is returned on successful print of known errors.
+ */
+#ifndef _di_fake_print_error_file_
+ extern f_status_t fake_print_error_file(fake_setting_t * const setting, const f_status_t status, const fl_print_t print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type);
+#endif // _di_fake_print_error_file_
+
+/**
* Print error message for when an operation fails.
*
* @param setting
* @param print
* Designates the how and where to print.
* @param operation
- * The name of the operation that failed.
+ * The identifier of the operation that failed.
*
* @return
* F_none on success.
* F_output_not on success, but no printing is performed.
*/
#ifndef _di_fake_print_error_failure_operation_
- extern f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t operation);
+ extern f_status_t fake_print_error_failure_operation(fake_setting_t * const setting, const fl_print_t print, const uint8_t operation);
#endif // _di_fake_print_error_failure_operation_
/**
#endif // _di_fake_print_error_failure_script_
/**
+ * Print error message for when the parameter value is an empty string.
+ *
+ * @param setting
+ * The main program settings.
+ *
+ * This does not alter setting.status.
+ * @param print
+ * Designates the how and where to print.
+ * @param symbol
+ * The symbol of the parameter.
+ * @param name
+ * The name of the parameter.
+ * @param value
+ * The value that is invalid.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fake_print_error_parameter_not_empty_
+ extern f_status_t fake_print_error_parameter_not_empty(fake_setting_t * const setting, const fl_print_t print, const f_string_static_t symbol, const f_string_static_t name, const f_string_static_t value);
+#endif // _di_fake_print_error_parameter_not_empty_
+
+/**
* Print error message for when the parameter value contains a non-word, non-minus, and non-plus character.
*
* @param setting
for (f_array_length_t i = 0; i < files.used; ++i) {
- if (!(i % fake_signal_check_short_d)) {
+ if (!((++data->main->signal_check) % fake_signal_check_short_d)) {
if (fll_program_standard_signal_received(data->main)) {
fll_program_print_signal_received(data->main->warning, data->setting->line_first, data->main->signal_received);
break;
}
- data->main->signal_check = 0;
+ main->signal_check = 0;
}
if (!files.array[i].used) continue;
#ifndef _di_fake_data_delete_
f_status_t fake_data_delete(fake_data_t * const data) {
- f_string_dynamics_resize(0, &data->define);
- f_string_dynamic_resize(0, &data->fakefile);
- f_string_dynamics_resize(0, &data->mode);
- f_string_dynamic_resize(0, &data->process);
- f_string_dynamic_resize(0, &data->settings);
-
f_string_dynamic_resize(0, &data->path_build);
f_string_dynamic_resize(0, &data->path_build_documentation);
f_string_dynamic_resize(0, &data->path_build_documents);
/**
* The program data.
*
+ * operation: A code representing the currrent operation.
+ *
* main: The main program data.
* setting: The settings data.
- * argv: The argument structure in the progam data parameters for simplifying syntax.
*
- * operation: A code representing the currrent operation.
+ * path_build: The build path.
+ * path_build_documentation: The build documentation path.
+ * path_build_documents: The build documents path.
+ * path_build_includes: The build includes path.
+ * path_build_libraries: The build libraries path.
+ * path_build_libraries_script: The build libraries_script path.
+ * path_build_libraries_shared: The build libraries_shared path.
+ * path_build_libraries_static: The build libraries_static path.
+ * path_build_objects: The build objects path.
+ * path_build_objects_script: The build objects_script path.
+ * path_build_objects_shared: The build objects_shared path.
+ * path_build_objects_static: The build objects_static path.
+ * path_build_programs: The build programs path.
+ * path_build_programs_script: The build programs_script path.
+ * path_build_programs_shared: The build programs_shared path.
+ * path_build_programs_static: The build programs_static path.
+ * path_build_settings: The build settings path.
+ * path_build_stage: The build stage path.
+ *
+ * path_data: The data path.
+ * path_data_build: The build data path.
+ * path_data_documentation: The documentation data path.
+ * path_data_settings: The settings data path.
+ *
+ * path_documents: The documents path.
+ * path_licenses: The licenses path.
+ * path_sources: The sources path.
+ *
+ * path_work: The work path.
+ * path_work_includes: The includes work path.
+ * path_work_libraries: The libraries work path.
+ * path_work_libraries_script: The libraries_script work path.
+ * path_work_libraries_shared: The libraries_shared work path.
+ * path_work_libraries_static: The libraries_static work path.
+ * path_work_programs: The programs work path.
+ * path_work_programs_script: The programs_script work path.
+ * path_work_programs_shared: The programs_shared work path.
+ * path_work_programs_static: The programs_static work path.
+ *
+ * file_data_build_defines: The defines build file data.
+ * file_data_build_dependencies: The dependencies build file data.
+ * file_data_build_fakefile: The fakefile build file data.
+ * file_data_build_process_post: The process_post_s build file data.
+ * file_data_build_process_pre: The process_pre_s build file data.
+ * file_data_build_settings: The settings build file data.
+ *
+ * file_documents_readme: The documents readme file data.
*/
#ifndef _di_fake_data_t_
typedef struct {
+ uint8_t operation;
+
fll_program_data_t *main;
fake_setting_t *setting;
- f_string_static_t *argv; // @todo this might be removable now that settings exists.
- uint8_t operation;
+ f_string_dynamic_t path_build;
+ f_string_dynamic_t path_build_documentation;
+ f_string_dynamic_t path_build_documents;
+ f_string_dynamic_t path_build_includes;
+ f_string_dynamic_t path_build_libraries;
+ f_string_dynamic_t path_build_libraries_script;
+ f_string_dynamic_t path_build_libraries_shared;
+ f_string_dynamic_t path_build_libraries_static;
+ f_string_dynamic_t path_build_objects;
+ f_string_dynamic_t path_build_objects_script;
+ f_string_dynamic_t path_build_objects_shared;
+ f_string_dynamic_t path_build_objects_static;
+ f_string_dynamic_t path_build_programs;
+ f_string_dynamic_t path_build_programs_script;
+ f_string_dynamic_t path_build_programs_shared;
+ f_string_dynamic_t path_build_programs_static;
+ f_string_dynamic_t path_build_settings;
+ f_string_dynamic_t path_build_stage;
+
+ f_string_dynamic_t path_data;
+ f_string_dynamic_t path_data_build;
+ f_string_dynamic_t path_data_documentation;
+ f_string_dynamic_t path_data_settings;
+
+ f_string_dynamic_t path_documents;
+
+ f_string_dynamic_t path_licenses;
+
+ f_string_dynamic_t path_sources;
+
+ f_string_dynamic_t path_work;
+ f_string_dynamic_t path_work_includes;
+ f_string_dynamic_t path_work_libraries;
+ f_string_dynamic_t path_work_libraries_script;
+ f_string_dynamic_t path_work_libraries_shared;
+ f_string_dynamic_t path_work_libraries_static;
+ f_string_dynamic_t path_work_programs;
+ f_string_dynamic_t path_work_programs_script;
+ f_string_dynamic_t path_work_programs_shared;
+ f_string_dynamic_t path_work_programs_static;
+
+ f_string_dynamic_t file_data_build_defines;
+ f_string_dynamic_t file_data_build_dependencies;
+ f_string_dynamic_t file_data_build_fakefile;
+ f_string_dynamic_t file_data_build_process_post;
+ f_string_dynamic_t file_data_build_process_pre;
+ f_string_dynamic_t file_data_build_settings;
+
+ f_string_dynamic_t file_documents_readme;
} fake_data_t;
#define fake_data_t_initialize \
0, \
0, \
0, \
- 0, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
}
#endif // _di_fake_main_t_
}
#endif // _di_fake_pipe_buffer_
-// @todo move this into the common.
-#ifndef _di_fake_process_console_parameters_
- f_status_t fake_process_console_parameters(fake_data_t * const data) {
-
- f_status_t status = F_none;
-
- {
- const uint8_t parameters_id[] = {
- fake_parameter_fakefile_e,
- fake_parameter_process_e,
- fake_parameter_settings_e,
- };
-
- const f_string_static_t parameters_name[] = {
- fake_long_fakefile_s,
- fake_long_process_s,
- fake_long_settings_s,
- };
-
- const f_string_static_t parameter_defaults[] = {
- fake_default_fakefile_s,
- fake_default_process_s,
- fake_default_settings_s,
- };
-
- f_string_dynamic_t * const parameters_value[] = {
- &data->fakefile,
- &data->process,
- &data->settings,
- };
-
- bool parameters_validate_word[] = {
- F_false,
- F_true,
- F_false,
- };
-
- for (uint8_t i = 0; i < 3; ++i) {
-
- if (data->main->parameters.array[parameters_id[i]].result & f_console_result_found_e) {
- fake_print_error_parameter_missing_value(data, parameters_name[i]);
-
- return F_status_set_error(F_parameter);
- }
-
- if (data->main->parameters.array[parameters_id[i]].result & f_console_result_value_e) {
- if (data->main->parameters.array[parameters_id[i]].locations.used > 1) {
- fake_print_error_parameter_too_many(data, parameters_name[i]);
-
- return F_status_set_error(F_parameter);
- }
-
- f_array_length_t index = data->main->parameters.array[parameters_id[i]].values.array[0];
-
- if (data->main->parameters.arguments.array[index].used) {
- if (parameters_validate_word[i]) {
- f_array_length_t j = 0;
- f_array_length_t width_max = 0;
-
- for (j = 0; j < data->main->parameters.arguments.array[index].used; ++j) {
-
- width_max = data->main->parameters.arguments.array[index].used - j;
-
- status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[index].string + j, width_max, F_false);
-
- if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable);
- fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return status;
- }
-
- if (status == F_false) {
- if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QThe '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_process_s, data->main->error.notable);
- fl_print_format("%[' parameters value '%]", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
- fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, data->main->parameters.arguments.array[index], data->main->error.notable);
- fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return F_status_set_error(F_parameter);
- }
- } // for
- }
-
- status = f_string_dynamic_increase_by(data->main->parameters.arguments.array[index].used + 1, parameters_value[i]);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
- return status;
- }
-
- status = f_string_dynamic_append(data->main->parameters.arguments.array[index], parameters_value[i]);
-
- if (F_status_is_error(status)) {
- if (status == F_status_set_error(F_string_too_large)) {
- if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QThe parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%Q%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
- fl_print_format("%[' is too long.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
- }
- else {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_append", F_true);
- }
-
- return status;
- }
-
- status = F_none;
- }
-
- if (!data->main->parameters.arguments.array[index].used || status == F_data_not) {
- if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QThe parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
- fl_print_format("%[' must not be empty and must not contain only white space.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
- }
- }
- else if (parameter_defaults[i].used) {
- parameters_value[i]->used = 0;
-
- status = f_string_dynamic_increase_by(parameter_defaults[i].used + 1, parameters_value[i]);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
- return status;
- }
-
- status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
-
- return status;
- }
- }
- } // for
- }
-
- if (data->main->parameters.array[fake_parameter_define_e].result & f_console_result_found_e) {
- fake_print_error_parameter_missing_value(data, fake_long_define_s);
-
- return F_status_set_error(F_parameter);
- }
-
- {
- const uint8_t parameters_id[] = {
- fake_parameter_path_build_e,
- fake_parameter_path_data_e,
- fake_parameter_path_work_e,
- };
-
- const f_string_static_t parameters_name[] = {
- fake_long_path_build_s,
- fake_long_path_data_s,
- fake_long_path_work_s,
- };
-
- const f_string_static_t parameter_defaults[] = {
- fake_default_path_build_s,
- fake_default_path_data_s,
- fake_default_path_work_s,
- };
-
- f_string_dynamic_t * const parameters_value[] = {
- &data->path_build,
- &data->path_data,
- &data->path_work,
- };
-
- for (uint8_t i = 0; i < 3; ++i) {
-
- if (data->main->parameters.array[parameters_id[i]].result & f_console_result_found_e) {
- fake_print_error_parameter_missing_value(data, parameters_name[i]);
-
- return F_status_set_error(F_parameter);
- }
-
- if (data->main->parameters.array[parameters_id[i]].result & f_console_result_value_e) {
- if (data->main->parameters.array[parameters_id[i]].values.used > 1) {
- fake_print_error_parameter_too_many(data, parameters_name[i]);
-
- return F_status_set_error(F_parameter);
- }
-
- const f_array_length_t index = data->main->parameters.array[parameters_id[i]].values.array[data->main->parameters.array[parameters_id[i]].values.used - 1];
-
- parameters_value[i]->used = 0;
-
- status = f_string_dynamic_increase_by(data->main->parameters.arguments.array[index].used + 1, parameters_value[i]);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
- return status;
- }
-
- status = f_path_directory_cleanup(data->main->parameters.arguments.array[index], parameters_value[i]);
-
- if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "f_path_directory_cleanup", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QFailed to process parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
- fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return status;
- }
- }
- else if (parameter_defaults[i].used) {
- parameters_value[i]->used = 0;
-
- status = f_string_dynamic_increase_by(parameter_defaults[i].used + 1, parameters_value[i]);
-
- if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
-
- return status;
- }
-
- status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]);
-
- if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), " f_string_dynamic_append", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QFailed to load default for the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
- fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return status;
- }
- }
- } // for
- }
-
- if (data->main->parameters.array[fake_parameter_define_e].result & f_console_result_value_e) {
- status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_define_e].values, &data->define);
-
- if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_define_s, data->main->error.notable);
- fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return status;
- }
- }
-
- if (data->main->parameters.array[fake_parameter_mode_e].result & f_console_result_found_e) {
- fake_print_error_parameter_missing_value(data, fake_long_mode_s);
-
- return F_status_set_error(F_parameter);
- }
-
- if (data->main->parameters.array[fake_parameter_mode_e].result & f_console_result_value_e) {
- status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_mode_e].values, &data->mode);
-
- if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
- fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return status;
- }
-
- f_array_length_t i = 0;
- f_array_length_t j = 0;
- f_array_length_t width_max = 0;
-
- for (; i < data->mode.used; ++i) {
-
- for (j = 0; j < data->mode.array[i].used; ++j) {
-
- width_max = data->mode.array[i].used - j;
-
- status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false);
-
- if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
- fl_print_format("%['.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return status;
- }
-
- if (status == F_false) {
- if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
- f_file_stream_lock(data->main->error.to);
-
- fl_print_format("%r%[%QThe '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
- fl_print_format("%[' parameters value '%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, fake_long_mode_s, data->main->error.notable);
- fl_print_format("%[%Q%]", data->main->error.to, data->main->error.notable, data->mode.array[i], data->main->error.notable);
- fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- f_file_stream_unlock(data->main->error.to);
- }
-
- return F_status_set_error(F_parameter);
- }
- } // for
- } // for
- }
-
- return F_none;
- }
-#endif // _di_fake_process_console_parameters_
-
#ifndef _di_fake_validate_parameter_paths_
f_status_t fake_validate_parameter_paths(fake_data_t * const data) {
return F_status_set_error(F_interrupt);
}
- const f_string_static_t parameters_name[] = {
+ const f_string_static_t names[] = {
fake_long_path_build_s,
fake_long_path_data_s,
fake_long_path_work_s,
};
- const f_string_dynamic_t parameters_value[] = {
+ const f_string_dynamic_t values[] = {
data->path_build,
data->path_data,
data->path_work,
};
- uint8_t parameters_required[] = {
+ uint8_t requireds[] = {
F_false,
(data->main->pipe & fll_program_data_pipe_input_e) ? F_false : F_true,
F_false,
if (data->main->parameters.array[fake_parameter_fakefile_e].result == f_console_result_none_e) {
if (data->path_build.used && f_file_exists(data->path_build, F_false) != F_true) {
if (f_file_exists(fake_default_fakefile_s, F_false) == F_true) {
- parameters_required[1] = F_false;
- }
- }
- }
-
- // If a custom --data or a custom --fakefile parameter is passed and uses an absolute or relative to current path, then do not check.
- if (data->main->parameters.array[fake_parameter_fakefile_e].result & f_console_result_value_e) {
- const f_array_length_t index = data->main->parameters.array[fake_parameter_fakefile_e].values.array[data->main->parameters.array[fake_parameter_fakefile_e].values.used - 1];
-
- if (f_path_is_absolute(data->main->parameters.arguments.array[index]) == F_true || f_path_is_relative_current(data->main->parameters.arguments.array[index]) == F_true) {
- parameters_required[1] = F_none;
- }
- else {
- status = f_file_exists(data->main->parameters.arguments.array[index], F_true);
-
- if (F_status_is_error_not(status) && status == F_true) {
- parameters_required[1] = F_none;
+ requireds[1] = F_false;
}
}
}
}
- else if (data->operation == fake_operation_build_e) {
- // If a custom --data or a custom --settings parameter is passed and uses an absolute or relative to current path, then do not check.
- if (data->main->parameters.array[fake_parameter_settings_e].result & f_console_result_value_e) {
- const f_array_length_t index = data->main->parameters.array[fake_parameter_settings_e].values.array[data->main->parameters.array[fake_parameter_settings_e].values.used - 1];
+ // If a custom --data or a custom --fakefile parameter is passed and uses an absolute or relative to current path, then do not check.
+ if (data->operation == fake_operation_make_e || data->operation == fake_operation_build_e) {
+ f_console_parameter_t * const parameter = &data->main->parameters.array[
+ data->operation == fake_operation_make_e
+ ? fake_parameter_fakefile_e
+ : fake_parameter_settings_e
+ ];
+
+ if (parameter->result & f_console_result_value_e) {
+ const f_array_length_t index = parameter->values.array[parameter->values.used - 1];
if (f_path_is_absolute(data->main->parameters.arguments.array[index]) == F_true || f_path_is_relative_current(data->main->parameters.arguments.array[index]) == F_true) {
- parameters_required[1] = F_none;
+ requireds[1] = F_none;
}
else {
status = f_file_exists(data->main->parameters.arguments.array[index], F_true);
if (F_status_is_error_not(status) && status == F_true) {
- parameters_required[1] = F_none;
+ requireds[1] = F_none;
}
}
}
for (uint8_t i = 0; i < 3; ++i) {
- if (parameters_required[i] != F_none && parameters_value[i].used) {
+ if (requireds[i] != F_none && values[i].used) {
memset(&directory_stat, 0, sizeof(struct stat));
- status = f_file_stat(parameters_value[i], F_true, &directory_stat);
+ status = f_file_stat(values[i], F_true, &directory_stat);
if (status == F_status_set_error(F_file_found_not)) status = F_status_set_error(F_directory_found_not);
if (F_status_is_error(status)) {
- if (F_status_set_fine(status) != F_directory_found_not || parameters_required[i]) {
- fll_error_file_print(data->main->error, F_status_set_fine(status), "f_file_stat", F_true, parameters_value[i], f_file_operation_access_s, fll_error_file_type_directory_e);
+ if (F_status_set_fine(status) != F_directory_found_not || requireds[i]) {
+ fll_error_file_print(data->main->error, F_status_set_fine(status), "f_file_stat", F_true, values[i], f_file_operation_access_s, fll_error_file_type_directory_e);
return status;
}
}
}
- else if (parameters_required[i] == F_true) {
+ else if (requireds[i] == F_true) {
f_file_stream_lock(data->main->error.to);
fl_print_format("%r%[%QNo valid path for the (required) directory parameter '%]", data->main->error.to, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, parameters_name[i], data->main->error.notable);
+ fl_print_format("%[%r%r%]", data->main->error.to, data->main->error.notable, f_console_symbol_long_normal_s, names[i], data->main->error.notable);
fl_print_format("%[' was found.%]%r", data->main->error.to, data->main->error.context, data->main->error.context, f_string_eol_s);
f_file_stream_unlock(data->main->error.to);
#endif // _di_fake_pipe_buffer_
/**
- * Validate console arguments and print any relating error messages.
- *
- * @param data
- * The program data.
- *
- * @return
- * F_none on success.
- *
- * Status codes (with error bit) are returned on any problem.
- */
-#ifndef _di_fake_process_console_parameters_
- extern f_status_t fake_process_console_parameters(fake_data_t * const data) F_attribute_visibility_internal_d;
-#endif // _di_validate_console_parameters_
-
-/**
* Validate directories and print any relating error messages.
*
* This should not be called for skeleton as in that case the directories probably do not exist.
#endif // _di_firewall_setting_delete_
#ifndef _di_firewall_setting_load_
- void firewall_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, firewall_setting_t * const setting) {
+ void firewall_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, firewall_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
firewall_print_line_first_locked(setting, main->error);
#define firewall_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_7(firewall_command_start_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(firewall_command_stop_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(firewall_command_restart_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(firewall_command_lock_s, 0, f_console_flag_simple_e), \
- macro_f_console_parameter_t_initialize_7(firewall_command_show_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_command_start_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_command_stop_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_command_restart_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_command_lock_s, 0, f_console_flag_simple_e), \
+ macro_f_console_parameter_t_initialize_6(firewall_command_show_s, 0, f_console_flag_simple_e), \
}
#define firewall_total_parameters_d 17
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_firewall_setting_load_
- extern void firewall_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, firewall_setting_t * const setting);
+ extern void firewall_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, firewall_setting_t * const setting);
#endif // _di_firewall_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- firewall_setting_load(arguments, &data, &setting);
+ firewall_setting_load(arguments, state, &data, &setting);
}
firewall_main(&data, &setting);
#endif // _di_fss_basic_list_read_setting_delete_
#ifndef _di_fss_basic_list_read_setting_load_
- void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
+ void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_basic_list_read_print_line_first_locked(setting, main->error);
#define fss_basic_list_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_original_s, fss_basic_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_original_s, fss_basic_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
}
#define fss_basic_list_read_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_basic_list_read_setting_load_
- extern void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting);
+ extern void fss_basic_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_list_read_setting_t * const setting);
#endif // _di_fss_basic_list_read_setting_load_
/**
};
const uint8_t parameter_match[] = {
- f_console_result_additional_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
+ f_console_result_value_e,
f_console_result_found_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
f_console_result_found_e,
};
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_basic_list_read_setting_load(arguments, &data, &setting);
+ fss_basic_list_read_setting_load(arguments, state, &data, &setting);
}
fss_basic_list_read_main(&data, &setting);
#endif // _di_fss_basic_read_setting_delete_
#ifndef _di_fss_basic_read_setting_load_
- void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
+ void fss_basic_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_basic_read_print_line_first_locked(setting, main->error);
#define fss_basic_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_original_s, fss_basic_read_long_original_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_at_s, fss_basic_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_content_s, fss_basic_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_columns_s, fss_basic_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_delimit_s, fss_basic_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_depth_s, fss_basic_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_empty_s, fss_basic_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_line_s, fss_basic_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_name_s, fss_basic_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_object_s, fss_basic_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_pipe_s, fss_basic_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_original_s, fss_basic_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_select_s, fss_basic_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_total_s, fss_basic_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_basic_read_short_trim_s, fss_basic_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
}
#define fss_basic_read_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_basic_read_setting_load_
- extern void fss_basic_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_basic_read_setting_t * const setting);
+ extern void fss_basic_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_basic_read_setting_t * const setting);
#endif // _di_fss_basic_read_setting_load_
/**
};
const uint8_t parameter_match[] = {
- f_console_result_additional_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
+ f_console_result_value_e,
f_console_result_found_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
f_console_result_found_e,
};
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_basic_read_setting_load(arguments, &data, &setting);
+ fss_basic_read_setting_load(arguments, state, &data, &setting);
}
fss_basic_read_main(&data, &setting);
#endif // _di_fss_embedded_list_read_setting_delete_
#ifndef _di_fss_embedded_list_read_setting_load_
- void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
+ void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_embedded_list_read_print_line_first_locked(setting, main->error);
#define fss_embedded_list_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_at_s.string, fss_embedded_list_read_long_at_s.string, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_content_s.string, fss_embedded_list_read_long_content_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_columns_s.string, fss_embedded_list_read_long_columns_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_delimit_s.string, fss_embedded_list_read_long_delimit_s.string, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_depth_s.string, fss_embedded_list_read_long_depth_s.string, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_empty_s.string, fss_embedded_list_read_long_empty_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_line_s.string, fss_embedded_list_read_long_line_s.string, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_name_s.string, fss_embedded_list_read_long_name_s.string, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_object_s.string, fss_embedded_list_read_long_object_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_pipe_s.string, fss_embedded_list_read_long_pipe_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_original_s.string, fss_embedded_list_read_long_original_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_select_s.string, fss_embedded_list_read_long_select_s.string, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_total_s.string, fss_embedded_list_read_long_total_s.string, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_embedded_list_read_short_trim_s.string, fss_embedded_list_read_long_trim_s.string, 0, 0, f_console_flag_normal_e), \
}
#define fss_embedded_list_read_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_embedded_list_read_setting_load_
- extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting);
+ extern void fss_embedded_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_embedded_list_read_setting_t * const setting);
#endif // _di_fss_embedded_list_read_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_embedded_list_read_setting_load(arguments, &data, &setting);
+ fss_embedded_list_read_setting_load(arguments, state, &data, &setting);
}
fss_embedded_list_read_main(&data, &setting);
#endif // _di_fss_extended_list_read_setting_delete_
#ifndef _di_fss_extended_list_read_setting_load_
- void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
+ void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_extended_list_read_print_line_first_locked(setting, main->error);
#define fss_extended_list_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_original_s, fss_extended_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_at_s, fss_extended_list_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_content_s, fss_extended_list_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_columns_s, fss_extended_list_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_delimit_s, fss_extended_list_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_depth_s, fss_extended_list_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_empty_s, fss_extended_list_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_line_s, fss_extended_list_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_name_s, fss_extended_list_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_object_s, fss_extended_list_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_pipe_s, fss_extended_list_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_original_s, fss_extended_list_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_select_s, fss_extended_list_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_total_s, fss_extended_list_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_list_read_short_trim_s, fss_extended_list_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
}
#define fss_extended_list_read_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_extended_list_read_setting_load_
- extern void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
+ extern void fss_extended_list_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_list_read_setting_t * const setting);
#endif // _di_fss_extended_list_read_setting_load_
/**
};
const uint8_t parameter_match[] = {
- f_console_result_additional_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
+ f_console_result_value_e,
f_console_result_found_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
f_console_result_found_e,
};
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_extended_list_read_setting_load(arguments, &data, &setting);
+ fss_extended_list_read_setting_load(arguments, state, &data, &setting);
}
fss_extended_list_read_main(&data, &setting);
#endif // _di_fss_extended_read_setting_delete_
#ifndef _di_fss_extended_read_setting_load_
- void fss_extended_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
+ void fss_extended_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_extended_read_print_line_first_locked(setting, main->error);
#define fss_extended_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_original_s, fss_extended_read_long_original_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_content_s, fss_extended_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_columns_s, fss_extended_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_delimit_s, fss_extended_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_depth_s, fss_extended_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_empty_s, fss_extended_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_line_s, fss_extended_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_name_s, fss_extended_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_object_s, fss_extended_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_pipe_s, fss_extended_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_original_s, fss_extended_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_select_s, fss_extended_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_total_s, fss_extended_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_extended_read_short_trim_s, fss_extended_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
}
#define fss_extended_read_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_extended_read_setting_load_
- extern void fss_extended_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
+ extern void fss_extended_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_extended_read_setting_t * const setting);
#endif // _di_fss_extended_read_setting_load_
/**
};
const uint8_t parameter_match[] = {
- f_console_result_additional_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
+ f_console_result_value_e,
f_console_result_found_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
f_console_result_found_e,
};
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_extended_read_setting_load(arguments, &data, &setting);
+ fss_extended_read_setting_load(arguments, state, &data, &setting);
}
fss_extended_read_main(&data, &setting);
#endif // _di_fss_identify_setting_delete_
#ifndef _di_fss_identify_setting_load_
- void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting) {
+ void fss_identify_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_identify_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_identify_print_line_first_locked(setting, main->error);
#define fss_identify_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_identify_short_content_s, fss_identify_long_content_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_identify_short_line_s, fss_identify_long_line_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_identify_short_name_s, fss_identify_long_name_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_identify_short_object_s, fss_identify_long_object_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_identify_short_total_s, fss_identify_long_total_s, 0, 0, f_console_flag_normal_e), \
}
#define fss_identify_total_parameters_d 17
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_identify_setting_load_
- extern void fss_identify_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_identify_setting_t * const setting);
+ extern void fss_identify_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_identify_setting_t * const setting);
#endif // _di_fss_identify_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_identify_setting_load(arguments, &data, &setting);
+ fss_identify_setting_load(arguments, state, &data, &setting);
}
fss_identify_main(&data, &setting);
#endif // _di_fss_payload_read_setting_delete_
#ifndef _di_fss_payload_read_setting_load_
- void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
+ void fss_payload_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_payload_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_payload_read_print_line_first_locked(setting, main->error);
#define fss_payload_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e, 0), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_original_s, fss_payload_read_long_original_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_at_s, fss_payload_read_long_at_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_content_s, fss_payload_read_long_content_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_columns_s, fss_payload_read_long_columns_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_delimit_s, fss_payload_read_long_delimit_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_depth_s, fss_payload_read_long_depth_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_empty_s, fss_payload_read_long_empty_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_line_s, fss_payload_read_long_line_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_name_s, fss_payload_read_long_name_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_object_s, fss_payload_read_long_object_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_pipe_s, fss_payload_read_long_pipe_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_original_s, fss_payload_read_long_original_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_select_s, fss_payload_read_long_select_s, 0, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_total_s, fss_payload_read_long_total_s, 0, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_payload_read_short_trim_s, fss_payload_read_long_trim_s, 0, 0, f_console_flag_normal_e), \
}
#define fss_payload_read_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_fss_payload_read_setting_load_
- extern void fss_payload_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_payload_read_setting_t * const setting);
+ extern void fss_payload_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_payload_read_setting_t * const setting);
#endif // _di_fss_payload_read_setting_load_
/**
};
const uint8_t parameter_match[] = {
- f_console_result_additional_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
+ f_console_result_value_e,
f_console_result_found_e,
- f_console_result_additional_e,
+ f_console_result_value_e,
f_console_result_found_e,
};
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_payload_read_setting_load(arguments, &data, &setting);
+ fss_payload_read_setting_load(arguments, state, &data, &setting);
}
fss_payload_read_main(&data, &setting);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, 0);
+ fss_write_setting_load(arguments, state, &data, &setting, 0);
}
fss_write_main(&data, &setting);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, 0);
+ fss_write_setting_load(arguments, state, &data, &setting, 0);
}
fss_write_main(&data, &setting);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, 0);
+ fss_write_setting_load(arguments, state, &data, &setting, 0);
}
fss_write_main(&data, &setting);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, 0);
+ fss_write_setting_load(arguments, state, &data, &setting, 0);
}
fss_write_main(&data, &setting);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, 0);
+ fss_write_setting_load(arguments, state, &data, &setting, 0);
}
fss_write_main(&data, &setting);
#endif // _di_fss_write_setting_delete_
#ifndef _di_fss_write_setting_load_
- void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting)) {
+ void fss_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting)) {
if (!main || !setting) return;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
fss_write_print_error(setting, main->error, macro_fss_write_f(f_console_parameter_process));
}
if (callback) {
- callback(arguments, main, setting);
+ callback(arguments, state, main, setting);
if (F_status_is_error(setting->status)) return;
if (setting->status == F_done) {
#define fss_write_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(fss_write_short_as_s, fss_write_long_as_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_backtick_s, fss_write_long_backtick_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_content_s, fss_write_long_content_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_content_end_s, fss_write_long_content_end_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_content_next_s, fss_write_long_content_next_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_double_s, fss_write_long_double_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_file_s, fss_write_long_file_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_ignore_s, fss_write_long_ignore_s, 2, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_object_s, fss_write_long_object_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_object_open_s, fss_write_long_object_open_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_partial_s, fss_write_long_partial_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_prepend_s, fss_write_long_prepend_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_single_s, fss_write_long_single_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(fss_write_short_trim_s, fss_write_long_trim_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_as_s, fss_write_long_as_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_backtick_s, fss_write_long_backtick_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_content_s, fss_write_long_content_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_content_end_s, fss_write_long_content_end_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_content_next_s, fss_write_long_content_next_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_double_s, fss_write_long_double_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_file_s, fss_write_long_file_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_ignore_s, fss_write_long_ignore_s, 2, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_object_s, fss_write_long_object_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_object_open_s, fss_write_long_object_open_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_partial_s, fss_write_long_partial_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_prepend_s, fss_write_long_prepend_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_single_s, fss_write_long_single_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(fss_write_short_trim_s, fss_write_long_trim_s, 0, f_console_flag_normal_e), \
}
#define fss_write_total_parameters_d 26
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_fss_write_setting_load_
- extern void fss_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting));
+ extern void fss_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting, void (*callback)(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting));
#endif // _di_fss_write_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, &fss_write_main_setting_load_as);
+ fss_write_setting_load(arguments, state, &data, &setting, &fss_write_main_setting_load_as);
}
fss_write_main(&data, &setting);
#endif // _di_fss_write_main_process_help_
#ifndef _di_fss_write_main_setting_load_as_
- void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+ void fss_write_main_setting_load_as(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting) {
if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_flag_version_e)) return;
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fss_write_setting_load()
*/
#ifndef _di_fss_write_main_setting_load_as_
- extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+ extern void fss_write_main_setting_load_as(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting);
#endif // _di_fss_write_main_setting_load_as_
#ifdef __cplusplus
#endif // _di_fss_write_payload_process_set_
#ifndef _di_fss_write_payload_setting_load_
- void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting) {
+ void fss_write_payload_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting) {
if (!main || !setting) return;
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fss_write_setting_load()
*/
#ifndef _di_fss_write_payload_setting_load_
- extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, fss_write_setting_t * const setting);
+ extern void fss_write_payload_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, fss_write_setting_t * const setting);
#endif // _di_fss_write_payload_setting_load_
#ifdef __cplusplus
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- fss_write_setting_load(arguments, &data, &setting, &fss_write_payload_setting_load);
+ fss_write_setting_load(arguments, state, &data, &setting, &fss_write_payload_setting_load);
}
fss_write_main(&data, &setting);
#endif // _di_iki_read_setting_delete_
#ifndef _di_iki_read_setting_load_
- void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting) {
+ void iki_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_read_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
iki_read_print_error(setting, main->error, macro_iki_read_f(f_console_parameter_process));
#define iki_read_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(iki_read_short_at_s, iki_read_long_at_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_content_s, iki_read_long_content_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_line_s, iki_read_long_line_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_literal_s, iki_read_long_literal_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_name_s, iki_read_long_name_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_object_s, iki_read_long_object_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_reassign_s, iki_read_long_reassign_s, 3, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_replace_s, iki_read_long_replace_s, 2, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_total_s, iki_read_long_total_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_whole_s, iki_read_long_whole_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_read_short_wrap_s, iki_read_long_wrap_s, 3, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_at_s, iki_read_long_at_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_content_s, iki_read_long_content_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_line_s, iki_read_long_line_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_literal_s, iki_read_long_literal_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_name_s, iki_read_long_name_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_object_s, iki_read_long_object_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_reassign_s, iki_read_long_reassign_s, 3, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_replace_s, iki_read_long_replace_s, 2, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_substitute_s, iki_read_long_substitute_s, 3, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_total_s, iki_read_long_total_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_whole_s, iki_read_long_whole_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_read_short_wrap_s, iki_read_long_wrap_s, 3, f_console_flag_normal_e), \
}
#define iki_read_total_parameters_d 24
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_iki_read_setting_load_
- extern void iki_read_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_read_setting_t * const setting);
+ extern void iki_read_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_read_setting_t * const setting);
#endif // _di_iki_read_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- iki_read_setting_load(arguments, &data, &setting);
+ iki_read_setting_load(arguments, state, &data, &setting);
}
iki_read_main(&data, &setting);
#endif // _di_iki_write_setting_delete_
#ifndef _di_iki_write_setting_load_
- void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting) {
+ void iki_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_write_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
iki_write_print_error(setting, main->error, macro_iki_write_f(f_console_parameter_process));
#define iki_write_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(iki_write_short_backtick_s, iki_write_long_backtick_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_write_short_content_s, iki_write_long_content_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_write_short_double_s, iki_write_long_double_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_write_short_file_s, iki_write_long_file_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_write_short_object_s, iki_write_long_object_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(iki_write_short_single_s, iki_write_long_single_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_write_short_backtick_s, iki_write_long_backtick_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_write_short_content_s, iki_write_long_content_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_write_short_double_s, iki_write_long_double_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_write_short_file_s, iki_write_long_file_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_write_short_object_s, iki_write_long_object_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(iki_write_short_single_s, iki_write_long_single_s, 0, f_console_flag_normal_e), \
}
#define iki_write_total_parameters_d 18
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_verbosity()
*/
#ifndef _di_iki_write_setting_load_
- extern void iki_write_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, iki_write_setting_t * const setting);
+ extern void iki_write_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, iki_write_setting_t * const setting);
#endif // _di_iki_write_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- iki_write_setting_load(arguments, &data, &setting);
+ iki_write_setting_load(arguments, state, &data, &setting);
}
iki_write_main(&data, &setting);
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- status_code_setting_load(arguments, &data, &setting);
+ status_code_setting_load(arguments, state, &data, &setting);
}
status_code_main(&data, &setting);
#endif // _di_status_code_setting_delete_
#ifndef _di_status_code_setting_load_
- void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting) {
+ void status_code_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, status_code_setting_t * const setting) {
if (!main || !setting) return;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
status_code_print_error(setting, main->error, macro_status_code_f(f_console_parameter_process));
#define status_code_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(status_code_short_fine_s, status_code_long_fine_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(status_code_short_warning_s, status_code_long_warning_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(status_code_short_error_s, status_code_long_error_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(status_code_short_number_s, status_code_long_number_s, 0, f_console_flag_normal_e), \
}
#define status_code_total_parameters_d 16
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_status_code_setting_load_
- extern void status_code_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, status_code_setting_t * const setting);
+ extern void status_code_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, status_code_setting_t * const setting);
#endif // _di_status_code_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- status_code_setting_load(arguments, &data, &setting);
+ status_code_setting_load(arguments, state, &data, &setting);
}
status_code_main(&data, &setting);
#endif // _di_utf8_setting_delete_
#ifndef _di_utf8_setting_load_
- void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting) {
+ void utf8_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, utf8_setting_t * const setting) {
if (!main || !setting) return;
setting->flag = 0;
// Load parameters.
- setting->status = f_console_parameter_process(arguments, &main->parameters, 0);
+ setting->status = f_console_parameter_process(state, arguments, &main->parameters, 0);
if (F_status_is_error(setting->status)) {
utf8_print_error(setting, main->error, macro_utf8_f(f_console_parameter_process));
#define utf8_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_4(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
+ macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
\
- macro_f_console_parameter_t_initialize_4(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_from_file_s, utf8_long_from_file_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_headers_s, utf8_long_headers_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_separate_s, utf8_long_separate_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_to_file_s, utf8_long_to_file_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_to_width_s, utf8_long_to_width_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_4(utf8_short_verify_s, utf8_long_verify_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_from_bytesequence_s, utf8_long_from_bytesequence_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_from_codepoint_s, utf8_long_from_codepoint_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_from_file_s, utf8_long_from_file_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_headers_s, utf8_long_headers_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_separate_s, utf8_long_separate_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_bytesequence_s, utf8_long_to_bytesequence_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_codepoint_s, utf8_long_to_codepoint_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_combining_s, utf8_long_to_combining_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_file_s, utf8_long_to_file_s, 1, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_to_width_s, utf8_long_to_width_s, 0, f_console_flag_normal_e), \
+ macro_f_console_parameter_t_initialize_3(utf8_short_verify_s, utf8_long_verify_s, 0, f_console_flag_normal_e), \
}
#define utf8_total_parameters_d 24
*
* @param arguments
* The parameters passed to the process (often referred to as command line arguments).
+ * @param state
+ * A state for providing flags and handling interrupts during long running operations.
* @param main
* The main program data.
* @param setting
* @see fll_program_parameter_process_context()
*/
#ifndef _di_utf8_setting_load_
- extern void utf8_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern void utf8_setting_load(const f_console_arguments_t arguments, f_state_t state, fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_setting_load_
/**
{
const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize(argc, argv, envp);
+ f_state_t state = f_state_t_initialize;
- utf8_setting_load(arguments, &data, &setting);
+ utf8_setting_load(arguments, state, &data, &setting);
}
utf8_main(&data, &setting);