From: Kevin Day Date: Sun, 10 May 2020 03:12:10 +0000 (-0500) Subject: Revert "Refactor: f_print_string_dynamic to f_print_string_static" X-Git-Tag: 0.5.0~269 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=a77632872228a550aba364fac1e6cff9e9b0f9cc;p=fll Revert "Refactor: f_print_string_dynamic to f_print_string_static" This reverts commit f225f4059d0e082a7bfae29e042a2120ac4bda33. It occurred to me that this would make the function names more inconsistent. This could get very confusing so just stick with "dynamic" in all the names. "dynamic" is the original term and "static" in isolation is a reserved word. The type names will remain as both f_string_static and f_string_dynamic. That inconsistency is desirable due to the explicit meaning communicated by their names. --- diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index 9d400ee..438f384 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -25,8 +25,8 @@ extern "C" { } #endif // _di_f_print_string_ -#ifndef _di_f_print_string_static_ - f_return_status f_print_string_static(FILE *output, const f_string_static buffer) { +#ifndef _di_f_print_string_dynamic_ + f_return_status f_print_string_dynamic(FILE *output, const f_string_static buffer) { #ifndef _di_level_0_parameter_checking_ if (buffer.used <= 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ @@ -43,10 +43,10 @@ extern "C" { return f_none; } -#endif // _di_f_print_string_static_ +#endif // _di_f_print_string_dynamic_ -#ifndef _di_f_print_string_static_partial_ - f_return_status f_print_string_static_partial(FILE *output, const f_string_static buffer, const f_string_range range) { +#ifndef _di_f_print_string_dynamic_partial_ + f_return_status f_print_string_dynamic_partial(FILE *output, const f_string_static buffer, const f_string_range range) { #ifndef _di_level_0_parameter_checking_ if (range.start < 0) return f_status_set_error(f_invalid_parameter); if (range.stop < range.start) return f_status_set_error(f_invalid_parameter); @@ -67,7 +67,7 @@ extern "C" { return f_none; } -#endif // _di_f_print_string_static_partial_ +#endif // _di_f_print_string_dynamic_partial_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_print/c/print.h b/level_0/f_print/c/print.h index 6f30cfb..b533f60 100644 --- a/level_0/f_print/c/print.h +++ b/level_0/f_print/c/print.h @@ -70,9 +70,9 @@ extern "C" { * f_error_output (with error bit) on failure. * f_invalid_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_f_print_string_static_ - extern f_return_status f_print_string_static(FILE *output, const f_string_static buffer); -#endif // _di_f_print_string_static_ +#ifndef _di_f_print_string_dynamic_ + extern f_return_status f_print_string_dynamic(FILE *output, const f_string_static buffer); +#endif // _di_f_print_string_dynamic_ /** * Similar to a c-library printf, except that this will only print a specific range. @@ -95,9 +95,9 @@ extern "C" { * f_error_output (with error bit) on failure. * f_invalid_parameter (with error bit) if a parameter is invalid. */ -#ifndef _di_f_print_string_static_partial_ - extern f_return_status f_print_string_static_partial(FILE *output, const f_string_static buffer, const f_string_range range); -#endif // _di_f_print_string_static_partial_ +#ifndef _di_f_print_string_dynamic_partial_ + extern f_return_status f_print_string_dynamic_partial(FILE *output, const f_string_static buffer, const f_string_range range); +#endif // _di_f_print_string_dynamic_partial_ #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_color/c/color.c b/level_1/fl_color/c/color.c index 7408832..ab97771 100644 --- a/level_1/fl_color/c/color.c +++ b/level_1/fl_color/c/color.c @@ -121,7 +121,7 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (start_color.used != 0) { - f_status status = f_print_string_static(file, start_color); + f_status status = f_print_string_dynamic(file, start_color); if (f_status_is_error(status)) return status; } @@ -135,7 +135,7 @@ extern "C" { va_end(ap); if (end_color.used != 0) { - f_status status = f_print_string_static(file, end_color); + f_status status = f_print_string_dynamic(file, end_color); if (f_status_is_error(status)) return status; } @@ -152,11 +152,11 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (start_color.used != 0) { - f_status status = f_print_string_static(file, start_color); + f_status status = f_print_string_dynamic(file, start_color); if (f_status_is_error(status)) return status; - status = f_print_string_static(file, extra_color); + status = f_print_string_dynamic(file, extra_color); if (f_status_is_error(status)) return status; } @@ -170,7 +170,7 @@ extern "C" { va_end(ap); if (end_color.used != 0) { - f_status status = f_print_string_static(file, end_color); + f_status status = f_print_string_dynamic(file, end_color); if (f_status_is_error(status)) return status; } @@ -187,7 +187,7 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (start_color.used != 0) { - f_status status = f_print_string_static(file, start_color); + f_status status = f_print_string_dynamic(file, start_color); if (f_status_is_error(status)) return status; } @@ -201,7 +201,7 @@ extern "C" { va_end(ap); if (end_color.used != 0) { - f_status status = f_print_string_static(file, end_color); + f_status status = f_print_string_dynamic(file, end_color); if (f_status_is_error(status)) return status; } @@ -221,11 +221,11 @@ extern "C" { #endif // _di_level_1_parameter_checking_ if (start_color.used != 0) { - f_status status = f_print_string_static(file, start_color); + f_status status = f_print_string_dynamic(file, start_color); if (f_status_is_error(status)) return status; - status = f_print_string_static(file, extra_color); + status = f_print_string_dynamic(file, extra_color); if (f_status_is_error(status)) return status; } @@ -239,7 +239,7 @@ extern "C" { va_end(ap); if (end_color.used != 0) { - f_status status = f_print_string_static(file, end_color); + f_status status = f_print_string_dynamic(file, end_color); if (f_status_is_error(status)) return status; } @@ -254,7 +254,7 @@ extern "C" { #ifndef _di_fl_color_print_code_ f_return_status fl_color_print_code(FILE *file, const f_string_static color) { if (color.used != 0) { - f_status status = f_print_string_static(file, color); + f_status status = f_print_string_dynamic(file, color); if (f_status_is_error(status)) return status; } diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index 3e394a0..400fbf6 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -309,7 +309,7 @@ extern "C" { } else if (data.mode == byte_dump_mode_duodecimal) { if (invalid[character_current]) { - f_print_string_static(f_standard_output, data.context.error); + f_print_string_dynamic(f_standard_output, data.context.error); } printf(" %01d", byte / 144); @@ -339,7 +339,7 @@ extern "C" { } if (invalid[character_current]) { - f_print_string_static(f_standard_output, data.context.reset); + f_print_string_dynamic(f_standard_output, data.context.reset); } } else if (data.mode == byte_dump_mode_octal) { diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index b45b1d3..dc27d64 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -389,7 +389,7 @@ extern "C" { return f_none; } - f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_static_partial; + f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_dynamic_partial; if (data->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_string_dynamic_partial; @@ -513,7 +513,7 @@ extern "C" { } if (data->contents.array[i].used > 0) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); } else if (include_empty) { fprintf(f_standard_output, "%c", f_string_eol); @@ -628,7 +628,7 @@ extern "C" { continue; } - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); } // for return f_none; diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index e97d4c7..d4470e9 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -189,7 +189,7 @@ extern "C" { } } else { - f_print_string_static(f_standard_output, buffer); + f_print_string_dynamic(f_standard_output, buffer); } } diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index a72ca2e..66610a3 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -389,7 +389,7 @@ extern "C" { return f_none; } - f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_static_partial; + f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_dynamic_partial; if (data->parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_string_dynamic_partial; @@ -455,7 +455,7 @@ extern "C" { } else if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { if (data->contents.array[i].used > 0) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); fprintf(f_standard_output, "%c", f_string_eol); } else if (include_empty) { @@ -464,7 +464,7 @@ extern "C" { } else { if (data->contents.array[i].used > 0) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); fprintf(f_standard_output, "%c", f_string_eol); } else if (include_empty) { @@ -523,7 +523,7 @@ extern "C" { } if (line_current == line) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); fprintf(f_standard_output, "%c", f_string_eol); break; @@ -548,7 +548,7 @@ extern "C" { continue; } - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[0]); fprintf(f_standard_output, "%c", f_string_eol); } // for diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 28e8e11..e3e85d1 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -189,7 +189,7 @@ extern "C" { } } else { - f_print_string_static(f_standard_output, buffer); + f_print_string_dynamic(f_standard_output, buffer); } } diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 86b840d..17ca9d6 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -412,7 +412,7 @@ extern "C" { return f_none; } - f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_static_partial; + f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_dynamic_partial; if (data->parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_string_dynamic_partial; @@ -526,7 +526,7 @@ extern "C" { } if (items->array[i].content.used > 0) { - f_print_string_static_partial(f_standard_output, data->buffer, items->array[i].content.array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, items->array[i].content.array[0]); } else if (include_empty) { fprintf(f_standard_output, "%c", f_string_eol); @@ -641,7 +641,7 @@ extern "C" { continue; } - f_print_string_static_partial(f_standard_output, data->buffer, items->array[i].content.array[0]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, items->array[i].content.array[0]); } // for return f_none; diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index 4fe485b..0149f38 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -384,7 +384,7 @@ extern "C" { return f_none; } - f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_static_partial; + f_return_status (*print_object)(FILE *, const f_string_static, const f_string_range) = &f_print_string_dynamic_partial; if (data->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { print_object = &fl_print_trim_string_dynamic_partial; @@ -452,13 +452,13 @@ extern "C" { if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { if (select < data->contents.array[i].used) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); } } else { for (j = 0; j < data->contents.array[i].used; j++) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); if (j + 1 < data->contents.array[i].used) { printf(" "); @@ -488,13 +488,13 @@ extern "C" { if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { if (select < data->contents.array[i].used) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); } } else { for (j = 0; j < data->contents.array[i].used; j++) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); if (j + 1 < data->contents.array[i].used) { printf(" "); @@ -570,13 +570,13 @@ extern "C" { if (line_current == line) { if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { if (select < data->contents.array[i].used) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); } } else { for (j = 0; j < data->contents.array[i].used; j++) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); if (j + 1 < data->contents.array[i].used) { printf(" "); @@ -613,13 +613,13 @@ extern "C" { if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { if (select < data->contents.array[i].used) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); } } else { for (j = 0; j < data->contents.array[i].used; j++) { - f_print_string_static_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); + f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[j]); if (j + 1 < data->contents.array[i].used) { printf(" "); diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 62cdca6..2dadede 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -254,7 +254,7 @@ extern "C" { } } else { - f_print_string_static(f_standard_output, buffer); + f_print_string_dynamic(f_standard_output, buffer); } }