Rename the parameter from defines to define, because it acts on only a single parameter at a time.
The -d must be specified multiple times to get multiple defines.
When -d/--define is specified, the defines provided by the settings file get ignored.
Continue to pass the defines from the console parameters to the process scripts.
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(context, fake_short_defines, fake_long_defines, f_console_symbol_short_enable, f_console_symbol_long_enable, " Override custom defines with these defines.");
+ fll_program_print_help_option(context, fake_short_define, fake_long_define, f_console_symbol_short_enable, f_console_symbol_long_enable, " Override defines from settings file with this define.");
fll_program_print_help_option(context, fake_short_mode, fake_long_mode, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use this mode when processing the build settings.");
fll_program_print_help_option(context, fake_short_process, fake_long_process, f_console_symbol_short_enable, f_console_symbol_long_enable, " Process name for storing build states.");
fll_program_print_help_option(context, fake_short_settings, fake_long_settings, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use this settings file, from within the source settings directory.");
f_macro_string_lengths_delete_simple(data->remaining);
- f_macro_string_dynamic_delete_simple(data->defines);
+ f_macro_string_dynamics_delete_simple(data->define);
f_macro_string_dynamics_delete_simple(data->mode);
f_macro_string_dynamic_delete_simple(data->process);
f_macro_string_dynamic_delete_simple(data->settings);
#define fake_default_path_sources_length 8
#define fake_default_path_work_length 0
- #define fake_default_defines ""
+ #define fake_default_define ""
#define fake_default_mode ""
#define fake_default_process ""
#define fake_default_settings "settings"
- #define fake_default_defines_length 0
+ #define fake_default_define_length 0
#define fake_default_mode_length 0
#define fake_default_process_length 0
#define fake_default_settings_length 8
fake_verbosity_debug,
};
- #define fake_short_defines "d"
+ #define fake_short_define "d"
#define fake_short_mode "m"
#define fake_short_process "p"
#define fake_short_settings "s"
- #define fake_short_defines_length 1
+ #define fake_short_define_length 1
#define fake_short_mode_length 1
#define fake_short_process_length 1
#define fake_short_settings_length 1
#define fake_short_path_sources_length 1
#define fake_short_path_work_length 1
- #define fake_long_defines "defines"
+ #define fake_long_define "define"
#define fake_long_mode "mode"
#define fake_long_process "process"
#define fake_long_settings "settings"
- #define fake_long_defines_length 7
+ #define fake_long_define_length 6
#define fake_long_mode_length 4
#define fake_long_process_length 7
#define fake_long_settings_length 8
fake_parameter_verbose,
fake_parameter_version,
- fake_parameter_defines,
+ fake_parameter_define,
fake_parameter_mode,
fake_parameter_process,
fake_parameter_settings,
f_console_parameter_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
f_console_parameter_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
- f_console_parameter_initialize(fake_short_defines, fake_long_defines, 0, 1, f_console_type_normal), \
+ f_console_parameter_initialize(fake_short_define, fake_long_define, 0, 1, f_console_type_normal), \
f_console_parameter_initialize(fake_short_mode, fake_long_mode, 0, 1, f_console_type_normal), \
f_console_parameter_initialize(fake_short_process, fake_long_process, 0, 1, f_console_type_normal), \
f_console_parameter_initialize(fake_short_settings, fake_long_settings, 0, 1, f_console_type_normal), \
uint8_t operation;
uint8_t verbosity;
- f_string_dynamic defines;
+ f_string_dynamics define;
f_string_dynamics mode;
f_string_dynamic process;
f_string_dynamic settings;
0, \
0, \
fake_verbosity_normal, \
- f_string_dynamic_initialize, \
+ f_string_dynamics_initialize, \
f_string_dynamics_initialize, \
f_string_dynamic_initialize, \
f_string_dynamic_initialize, \
} // for
}
- {
+ if (data.define.used) {
+ f_string_length length = 0;
+ f_array_length i = 0;
+
+ for (; i < data.define.used && F_status_is_fine(*status); i++) {
+ length = fake_build_parameter_define_prefix_length + data.define.array[i].used;
+
+ char string[length + 1];
+
+ memcpy(string, fake_build_parameter_define_prefix, fake_build_parameter_define_prefix_length);
+ memcpy(string + fake_build_parameter_define_prefix_length, data.define.array[i].string, data.define.array[i].used);
+
+ string[length] = 0;
+
+ *status = fll_execute_arguments_add(string, length, arguments);
+ if (F_status_is_error(*status)) break;
+ } // for
+ }
+ else {
f_string_length length = 0;
f_array_length i = 0;
}
{
+ f_string_dynamic defines = f_string_dynamic_initialize;
+
+ if (data.define.used) {
+ for (f_array_length i = 0; i < data.define.used; i++) {
+ *status = fl_string_dynamic_mash(" ", 1, data.define.array[i], &defines);
+
+ if (F_status_is_error(*status)) {
+ break;
+ }
+ } // for
+
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_mash", F_true);
+
+ f_macro_string_dynamic_delete_simple(defines);
+ f_macro_string_dynamics_delete_simple(arguments);
+ return;
+ }
+
+ *status = fl_string_dynamic_terminate_after(&defines);
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true);
+
+ f_macro_string_dynamic_delete_simple(defines);
+ f_macro_string_dynamics_delete_simple(arguments);
+ return;
+ }
+ }
+
const f_string parameters_prefix[] = {
f_console_symbol_short_enable,
f_console_symbol_short_enable,
};
const f_string parameters_name[] = {
- fake_short_defines,
+ fake_short_define,
fake_short_process,
fake_short_settings,
fake_short_path_build,
};
const f_string_length parameters_name_length[] = {
- fake_short_defines_length,
+ fake_short_define_length,
fake_short_process_length,
fake_short_settings_length,
fake_short_path_build_length,
};
const f_string parameters_value[] = {
- data.defines.string,
+ defines.string,
data.process.string,
data.settings.string,
data.path_build.string,
};
const f_string_length parameters_value_length[] = {
- data.defines.used,
+ defines.used,
data.process.used,
data.settings.used,
data.path_build.used,
*status = fll_execute_arguments_add_parameter_set(parameters_prefix, parameters_prefix_length, parameters_name, parameters_name_length, parameters_value, parameters_value_length, 7, &arguments);
+ f_macro_string_dynamic_delete_simple(defines);
+
if (F_status_is_error(*status)) {
fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true);
} // for
}
- if (data->parameters[fake_parameter_defines].result == f_console_result_found) {
- fake_print_error_parameter_missing_value(data->context, data->verbosity, fake_long_defines);
+ if (data->parameters[fake_parameter_define].result == f_console_result_found) {
+ fake_print_error_parameter_missing_value(data->context, data->verbosity, fake_long_define);
return F_status_set_error(F_parameter);
}
} // for
}
- if (data->parameters[fake_parameter_defines].result == f_console_result_additional) {
- status = fll_program_parameter_additional_rip_mash(" ", 1, arguments.argv, data->parameters[fake_parameter_defines].additional, &data->defines);
+ if (data->parameters[fake_parameter_define].result == f_console_result_additional) {
+ status = fll_program_parameter_additional_rip(arguments.argv, data->parameters[fake_parameter_define].additional, &data->define);
if (F_status_is_error(status)) {
- if (status == F_status_set_error(F_string_too_large)) {
- if (data->verbosity != fake_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: the (combined) parameter '");
- fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_defines);
- fl_color_print_line(f_type_error, data->context.error, data->context.reset, "' is too long.");
- }
- }
- else {
- fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_additional_rip_mash", F_true);
+ if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) {
+ fprintf(f_type_error, "%c", f_string_eol[0]);
+ fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '");
+ fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_define);
+ fl_color_print_line(f_type_error, data->context.error, data->context.reset, "'.");
}
return status;
}
+
+ f_array_length i = 0;
+ f_string_length j = 0;
+ f_string_length width_max = 0;
+
+ for (; i < data->define.used; i++) {
+ for (j = 0; j < data->define.array[i].used; j++) {
+ width_max = data->define.array[i].used - j;
+
+ status = f_utf_is_word(data->define.array[i].string + j, width_max);
+
+ if (F_status_is_error(status)) {
+ if (fake_print_error(data->context, data->verbosity, F_status_set_fine(status), "f_utf_is_word", F_false) == F_unknown && data->verbosity != fake_verbosity_quiet) {
+ fprintf(f_type_error, "%c", f_string_eol[0]);
+ fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: failed to process the parameter '");
+ fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_define);
+ fl_color_print_line(f_type_error, data->context.error, data->context.reset, "'.");
+ }
+
+ return status;
+ }
+
+ if (status == F_false) {
+ if (data->verbosity != fake_verbosity_quiet) {
+ fprintf(f_type_error, "%c", f_string_eol[0]);
+ fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: the '");
+ fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, fake_long_define);
+ fl_color_print(f_type_error, data->context.error, data->context.reset, "' parameters value '");
+ fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s", data->define.array[i].string);
+ fl_color_print_line(f_type_error, data->context.error, data->context.reset, "' contains non-word characters.");
+ }
+
+ return F_status_set_error(F_parameter);
+ }
+ } // for
+ } // for
}
if (data->parameters[fake_parameter_mode].result == f_console_result_found) {