} // for
if (process.found && (parameters->array[i].flag & f_console_flag_stop_d)) {
+ stop = F_true;
+
++process.location;
break;
}
if ((parameters->array[i].flag & f_console_flag_stop_d) && !process.needs.used) {
+ stop = F_true;
+
++process.location;
break;
state->status = F_okay;
if (process.found && (parameters->array[i].flag & f_console_flag_stop_d) && !process.needs.used) {
+ stop = F_true;
+
++process.location;
break;
// Make sure the entire parameters arguments array is populated.
if (parameters->on_match) {
- process.type = f_console_parameter_state_type_wrap_up_e;
+ process.type = stop ? f_console_parameter_state_type_wrap_up_stop_e : f_console_parameter_state_type_wrap_up_e;
process.at = 0;
parameters->on_match(arguments, (void * const) parameters, &process, data);
if (state->status == F_process) {
state->status = F_okay;
- for (; process.location < arguments.argc && arguments.argv[process.location]; ++process.location) {
+ if (process.location < arguments.argc) {
+ state->status = f_memory_array_increase_by(arguments.argc - process.location, sizeof(f_number_unsigned_t), (void **) ¶meters->remaining.array, ¶meters->remaining.used, ¶meters->remaining.size);
- if (state->interrupt) {
- state->interrupt((void * const) state, 0);
- if (F_status_set_fine(state->status) == F_interrupt) break;
- }
+ if (F_status_is_error_not(state->status)) {
+ for (; process.location < arguments.argc && arguments.argv[process.location]; ++process.location) {
- parameters->arguments.array[parameters->arguments.used].string = arguments.argv[process.location];
- parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[process.location], F_console_parameter_size_d);
- parameters->arguments.array[parameters->arguments.used++].size = 0;
- } // for
+ if (state->interrupt) {
+ state->interrupt((void * const) state, 0);
+ if (F_status_set_fine(state->status) == F_interrupt) break;
+ }
- if (F_status_is_error_not(state->status)) {
- state->status = process.needs.used ? F_complete_not : F_okay;
+ parameters->arguments.array[parameters->arguments.used].string = arguments.argv[process.location];
+ parameters->arguments.array[parameters->arguments.used].used = strnlen(arguments.argv[process.location], F_console_parameter_size_d);
+ parameters->arguments.array[parameters->arguments.used++].size = 0;
+
+ parameters->remaining.array[parameters->remaining.used++] = process.location;
+ } // for
+
+ if (F_status_is_error_not(state->status)) {
+ state->status = process.needs.used ? F_complete_not : F_okay;
+ }
+ }
}
}
* 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_memory_array_increase().
* Errors (with error bit) from: f_memory_array_increase_by().
+ * Errors (with error bit) from: f_memory_array_resize().
* Errors (with error bit) from: f_utf_char_to_character().
* @param data
* (optional) A variable passed to the callback, if provided.
*
* Set to NULL to not use.
*
+ * @see f_memory_array_increase()
* @see f_memory_array_increase_by()
+ * @see f_memory_array_resize()
* @see f_utf_char_to_character()
*/
#ifndef _di_f_console_parameter_process_
* - simple: Perform simple parameter match processing.
* - need: Perform value is needed processing.
* - wrap_up: Perform wrap up processing.
+ * - wrap_up_stop: Perform wrap up processing after "stop" has been identified.
*/
#ifndef _di_f_console_parameter_state_type_e_
enum {
f_console_parameter_state_type_simple_e,
f_console_parameter_state_type_need_e,
f_console_parameter_state_type_wrap_up_e,
+ f_console_parameter_state_type_wrap_up_stop_e,
}; // enum
#endif // _di_f_console_parameter_state_type_e_