From: Kevin Day Date: Thu, 17 Nov 2022 02:27:57 +0000 (-0600) Subject: Progress: Continue program related work. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=3257974d7613d13994faab4527dfaadcd3e1be04;p=fll Progress: Continue program related work. Add additional prunt functions. Fix out of date parameter names. Make content_prepend function parameter a constant pointer to a constant string. Should this instead be a constant pointer to a string? --- diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index ff31dd3..d000c87 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -290,7 +290,7 @@ extern "C" { #endif // _di_fl_fss_basic_list_content_read_ #ifndef _di_fl_fss_basic_list_content_write_ - f_status_t fl_fss_basic_list_content_write(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) { + f_status_t fl_fss_basic_list_content_write(const f_string_static_t content, const uint8_t complete, const f_string_static_t * const prepend, f_state_t state, f_string_range_t *range, f_string_dynamic_t *destination) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); if (!destination) return F_status_set_error(F_parameter); diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index c5994f2..2b98541 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -155,7 +155,7 @@ extern "C" { * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_list_content_write_ - extern f_status_t fl_fss_basic_list_content_write(const f_string_static_t content, const uint8_t complete, const f_string_static_t *prepend, f_state_t state, f_string_range_t * const range, f_string_dynamic_t * const destination); + extern f_status_t fl_fss_basic_list_content_write(const f_string_static_t content, const uint8_t complete, const f_string_static_t * const prepend, f_state_t state, f_string_range_t * const range, f_string_dynamic_t * const destination); #endif // _di_fl_fss_basic_list_content_write_ /** diff --git a/level_2/fll_fss/c/fss/payload.c b/level_2/fll_fss/c/fss/payload.c index 868bfc7..710fa06 100644 --- a/level_2/fll_fss/c/fss/payload.c +++ b/level_2/fll_fss/c/fss/payload.c @@ -181,7 +181,7 @@ extern "C" { #endif // _di_fll_fss_payload_read_ #ifndef _di_fll_fss_payload_write_ - f_status_t fll_fss_payload_write(const f_string_static_t object, const f_string_static_t content, const bool trim, const f_string_static_t *content_prepend, f_state_t state, f_string_dynamic_t * const destination) { + f_status_t fll_fss_payload_write(const f_string_static_t object, const f_string_static_t content, const bool trim, const f_string_static_t * const content_prepend, f_state_t state, f_string_dynamic_t * const destination) { #ifndef _di_level_2_parameter_checking_ if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ diff --git a/level_2/fll_fss/c/fss/payload.h b/level_2/fll_fss/c/fss/payload.h index 62d0bed..4c9f7eb 100644 --- a/level_2/fll_fss/c/fss/payload.h +++ b/level_2/fll_fss/c/fss/payload.h @@ -150,7 +150,7 @@ extern "C" { * @see fl_fss_basic_list_object_write() */ #ifndef _di_fll_fss_payload_write_ - extern f_status_t fll_fss_payload_write(const f_string_static_t object, const f_string_static_t content, const bool trim, const f_string_static_t *content_prepend, f_state_t state, f_string_dynamic_t * const destination); + extern f_status_t fll_fss_payload_write(const f_string_static_t object, const f_string_static_t content, const bool trim, const f_string_static_t * const content_prepend, f_state_t state, f_string_dynamic_t * const destination); #endif // _di_fll_fss_payload_write_ #ifdef __cplusplus diff --git a/level_2/fll_program/c/program/print.c b/level_2/fll_program/c/program/print.c index c7e6075..e15a805 100644 --- a/level_2/fll_program/c/program/print.c +++ b/level_2/fll_program/c/program/print.c @@ -40,16 +40,16 @@ extern "C" { #endif // _di_fll_program_print_error_missing_variable_not_zero_ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ - f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second) { + f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second) { if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; f_file_stream_lock(print.to); fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, first, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); - fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, second, print.set->notable); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); fl_print_format("%[' parameter must be specified the same number of times.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); f_file_stream_unlock(print.to); @@ -58,6 +58,27 @@ extern "C" { } #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_ +#ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ + f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); + fl_print_format("%[' parameter and the '%]", print.to, print.set->error, print.set->error); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); + fl_print_format("%[' parameter must be specified the same number of times when not specifying the '%]", print.to, print.set->error, print.set->error); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_third, third, print.set->notable); + fl_print_format("%[' parameter.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fll_program_print_error_parameter_both_specified_same_amount_without_ + #ifndef _di_fll_program_print_error_parameter_cannot_use_with_ f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second) { @@ -101,7 +122,7 @@ extern "C" { f_file_stream_lock(print.to); - fl_print_format("%r%[%QThe '%]", print.to, f_string_eol_s, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%QThe '%]", print.to, print.set->error, print.prefix, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_first, first, print.set->notable); fl_print_format("%[' parameter only allows either the '%]", print.to, print.set->error, print.set->error); fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol_second, second, print.set->notable); @@ -244,6 +265,27 @@ extern "C" { } #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ +#ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ + f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value_start, const f_string_static_t value_stop) { + + if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not; + + f_file_stream_lock(print.to); + + fl_print_format("%[%QThe start range value '%]", print.to, print.set->error, print.prefix, print.set->error); + fl_print_format("%[%Q%]", print.to, print.set->notable, value_start, print.set->notable); + fl_print_format("%[' may not be greater than the stop value '%]", print.to, print.set->error, print.set->error); + fl_print_format("%[%Q%]", print.to, print.set->notable, value_stop, print.set->notable); + fl_print_format("%[' for the parameter '%]", print.to, print.set->error, print.set->error); + fl_print_format("%[%Q%Q%]", print.to, print.set->notable, symbol, parameter, print.set->notable); + fl_print_format("%['.%]%r", print.to, print.set->error, print.set->error, f_string_eol_s); + + f_file_stream_unlock(print.to); + + return F_none; + } +#endif // _di_fll_program_print_error_parameter_range_start_before_stop_ + #ifndef _di_fll_program_print_error_pipe_invalid_form_feed_ f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print) { diff --git a/level_2/fll_program/c/program/print.h b/level_2/fll_program/c/program/print.h index 7734235..a653f96 100644 --- a/level_2/fll_program/c/program/print.h +++ b/level_2/fll_program/c/program/print.h @@ -75,8 +75,11 @@ extern "C" { * @param print * The output structure. * This locks, uses, and unlocks the file stream. - * @param symbol - * The symbol string prepended to both parameters. + * @param symbol_first + * The symbol string prepended to the first parameter. + * This is usually f_console_symbol_long_enable_s. + * @param symbol_second + * The symbol string prepended to the second parameter. * This is usually f_console_symbol_long_enable_s. * @param first * The first parameter name. @@ -88,10 +91,48 @@ extern "C" { * F_output_not on success, but no printing is performed. */ #ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_ - extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second); + extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t first, const f_string_static_t second); #endif // _di_fll_program_print_error_parameter_both_specified_same_amount_ /** + * Print an error message about two parameters being required to be specified the same number of times when not specifying the third parameter. + * + * This is only printed when verbosity is not set to quiet. + * + * This uses the following: + * - print.set->error: For the error context. + * - print.set->strong: For the highlighting context + * - print.prefix: For the prefixing a string to the message (such as "ERROR:"). + * + * @param print + * The output structure. + * This locks, uses, and unlocks the file stream. + * @param symbol_first + * The symbol string prepended to the first parameter. + * This is usually f_console_symbol_long_enable_s. + * @param symbol_second + * The symbol string prepended to the second parameter. + * This is usually f_console_symbol_long_enable_s. + * @param symbol_third + * The symbol string prepended to the third parameter. + * This is usually f_console_symbol_long_enable_s. + * @param first + * The first parameter name. + * @param second + * The second parameter name. + * @param third + * The third parameter name, representing the "without" parameter. + * The first and second parameter must be specified the same amount of times without this parameter. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_without_ + extern f_status_t fll_program_print_error_parameter_both_specified_same_amount_without(const fl_print_t print, const f_string_static_t symbol_first, const f_string_static_t symbol_second, const f_string_static_t symbol_third, const f_string_static_t first, const f_string_static_t second, const f_string_static_t third); +#endif // _di_fll_program_print_error_parameter_both_specified_same_amount_without_ + +/** * Print message about two parameters not being allowed to be used together. * * This is only printed when verbosity is not set to quiet. @@ -400,6 +441,38 @@ extern "C" { #endif // _di_fll_program_print_error_parameter_must_specify_once_value_ /** + * Print message about a specific value only being allowed to be used once for the parameter. + * + * This is only printed when verbosity is not set to quiet. + * + * This uses the following: + * - print.set->error: For the error context. + * - print.set->strong: For the highlighting context + * - print.prefix: For the prefixing a string to the message (such as "ERROR:"). + * + * @param print + * The output structure. + * This locks, uses, and unlocks the file stream. + * @param symbol + * The symbol string prepended to both parameters. + * This locks, uses, and unlocks the file stream. + * This is usually f_console_symbol_long_enable_s. + * @param parameter + * The parameter name. + * @param value_start + * The range start value. + * @param value_stop + * The range stop value. + * + * @return + * F_none on success. + * F_output_not on success, but no printing is performed. + */ +#ifndef _di_fll_program_print_error_parameter_range_start_before_stop_ + extern f_status_t fll_program_print_error_parameter_range_start_before_stop(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value_start, const f_string_static_t value_stop); +#endif // _di_fll_program_print_error_parameter_range_start_before_stop_ + +/** * Print a message about the pipe having an invalid form-feed character '\f' (U+000C). * * This is only printed when verbosity is not set to quiet.