From: Kevin Day Date: Sat, 13 Nov 2021 22:36:17 +0000 (-0600) Subject: Update: Implement double support in print functions and add missing functionality. X-Git-Tag: 0.5.7~80 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=1751615882d6d8728fe49591550dd9ca1fb6522e;p=fll Update: Implement double support in print functions and add missing functionality. This implements the double support as a wrapper to the printf() functionality. Future versions will ideally impliment this internally. I observed that there is some incorrect logic with the "width" and the "precision". The logic appears to be asserting that they are XOR to each other. In actuality they are OR to each other and both can be provided. Rename "output" to "stream". This seems slightly more accurate to me. I considered using "file" but that is heavily used by the f_file_t rather than the FILE *. --- diff --git a/level_0/f_conversion/c/conversion-common.h b/level_0/f_conversion/c/conversion-common.h index a89bbd4..a6fc86b 100644 --- a/level_0/f_conversion/c/conversion-common.h +++ b/level_0/f_conversion/c/conversion-common.h @@ -84,7 +84,7 @@ extern "C" { #ifndef _di_f_conversion_data_t_ typedef struct { uint8_t base; - uint8_t flag; + uint16_t flag; int width; } f_conversion_data_t; @@ -121,12 +121,15 @@ extern "C" { * Define flags used by f_conversion_data_t. * * f_conversion_data_flag_*: - * - align_left: Use left-justification. - * - base_prepend: Prepend the base character, such as "0x", or "0X", defaulting to lowercase (this includes base 10) (does nothing for unsupported base units). - * - base_upper: Any alphabet characters in the number are made uppercase rather than lowercase and when *_base_prepend flag is used, use uppercase in the base prepend. - * - sign_always: Always show the signs ("+" or "-"). - * - sign_pad: If the sign is not to be shown, then add a space as a placeholder (ignored when *_sign_always is used). - * - zeros_leading: If the number has fewer digits that specified in the padding, then display leading zeros to fill the pad length. + * - align_left: Use left-justification. + * - base_prepend: Prepend the base character, such as "0x", or "0X", defaulting to lowercase (this includes base 10) (does nothing for unsupported base units). + * - base_upper: Any alphabet characters in the number are made uppercase rather than lowercase and when *_base_prepend flag is used, use uppercase in the base prepend. + * - exponent: Use exponent rather than decimal for printing double values. + * - exponent_either: Use either exponent or decimila for printing double values. + * - exponent_upper: When using exponent, display the exponent 'e' as uppercase 'E'. + * - sign_always: Always show the signs ("+" or "-"). + * - sign_pad: If the sign is not to be shown, then add a space as a placeholder (ignored when *_sign_always is used). + * - zeros_leading: If the number has fewer digits that specified in the padding, then display leading zeros to fill the pad length. * * Supported base prepend base units: * - base 2: 0b, 0B. @@ -136,12 +139,15 @@ extern "C" { * - base 16: 0x, 0X. */ #ifndef _di_f_conversion_data_flag_ - #define F_conversion_data_flag_align_left_d 0x1 - #define F_conversion_data_flag_base_prepend_d 0x2 - #define F_conversion_data_flag_base_upper_d 0x4 - #define F_conversion_data_flag_sign_always_d 0x8 - #define F_conversion_data_flag_sign_pad_d 0x10 - #define F_conversion_data_flag_zeros_leading_d 0x20 + #define F_conversion_data_flag_align_left_d 0x1 + #define F_conversion_data_flag_base_prepend_d 0x2 + #define F_conversion_data_flag_base_upper_d 0x4 + #define F_conversion_data_flag_exponent_d 0x8 + #define F_conversion_data_flag_exponent_either_d 0x10 + #define F_conversion_data_flag_exponent_upper_d 0x20 + #define F_conversion_data_flag_sign_always_d 0x40 + #define F_conversion_data_flag_sign_pad_d 0x80 + #define F_conversion_data_flag_zeros_leading_d 0x100 #endif // _di_f_conversion_data_flag_ #ifdef __cplusplus diff --git a/level_0/f_print/c/print-common.h b/level_0/f_print/c/print-common.h index 4a28424..6cbbcaf 100644 --- a/level_0/f_print/c/print-common.h +++ b/level_0/f_print/c/print-common.h @@ -121,66 +121,77 @@ extern "C" { * Provide basic format flags. * * f_print_format_flag_*: - * - align_left: "-", Use left-justification. - * - convert: "#", Use alternate form conversion (prefixing 0b/0B, 0o/0O, 0t/0T, 0d/0D, 0x/0X). - * - ignore_index: ";", Ignore characters in the given positions from a f_array_length_t (only applies to static/dynamic string arguments but not character arguments). - * - ignore_range: ":", Ignore characters in the given ranges from a f_string_range_t (only applies to static/dynamic string arguments but not character arguments). - * - precision: Designates that a precision is in use. - * - range: "/", Print only the given range of a string, specified by f_string_range_t (only applies to static/dynamic string arguments but not character arguments). - * - sign_always: "+", Always show the signs (+ or -). - * - sign_pad: " ", Add a space where a sign would be if the sign is not displayed. - * - trim: "=", Trim leading and trailing whitespaces (only applies to static/dynamic string arguments but not character arguments). - * - uppercase: Display any base units as uppercase. - * - width: Designates that a width is in use. - * - zeros_leading: "0", Use leading zeros. + * - align_left: "-", Use left-justification. + * - convert: "#", Use alternate form conversion (prefixing 0b/0B, 0o/0O, 0t/0T, 0d/0D, 0x/0X). @fixme this might not be needed given that there are explicit base conversion support. + * - exponent: Use exponent rather than decimal for printing double values. + * - exponent_either: Use either exponent or decimila for printing double values. + * - exponent_upper: When using exponent, display the exponent 'e' as uppercase 'E'. + * - ignore_index: ";", Ignore characters in the given positions from a f_array_length_t (only applies to static/dynamic string arguments but not character arguments). + * - ignore_range: ":", Ignore characters in the given ranges from a f_string_range_t (only applies to static/dynamic string arguments but not character arguments). + * - precision: ".*", Designates that a precision is in use. + * - precision_value: Designates that a precision is specified in the function value (parameter). + * - range: "/", Print only the given range of a string, specified by f_string_range_t (only applies to static/dynamic string arguments but not character arguments). + * - sign_always: "+", Always show the signs (+ or -). + * - sign_pad: " ", Add a space where a sign would be if the sign is not displayed. + * - trim: "=", Trim leading and trailing whitespaces (only applies to static/dynamic string arguments but not character arguments). + * - uppercase: Display any base units as uppercase. + * - width: Designates that a width is in use. + * - width_value: "*", Designates that a width is specified in the function value (parameter). + * - zeros_leading: "0", Use leading zeros. * * @see fprintf() */ #ifndef _di_f_print_format_flag_ - #define F_print_format_flag_align_left_d 0x1 - #define F_print_format_flag_convert_d 0x2 - #define F_print_format_flag_ignore_index_d 0x4 - #define F_print_format_flag_ignore_range_d 0x8 - #define F_print_format_flag_precision_d 0x10 - #define F_print_format_flag_range_d 0x20 - #define F_print_format_flag_sign_always_d 0x40 - #define F_print_format_flag_sign_pad_d 0x80 - #define F_print_format_flag_trim_d 0x100 - #define F_print_format_flag_uppercase_d 0x200 - #define F_print_format_flag_width_d 0x400 - #define F_print_format_flag_zeros_leading_d 0x800 + #define F_print_format_flag_align_left_d 0x1 + #define F_print_format_flag_convert_d 0x2 + #define F_print_format_flag_exponent_d 0x4 + #define F_print_format_flag_exponent_either_d 0x8 + #define F_print_format_flag_exponent_upper_d 0x10 + #define F_print_format_flag_ignore_index_d 0x20 + #define F_print_format_flag_ignore_range_d 0x40 + #define F_print_format_flag_precision_d 0x80 + #define F_print_format_flag_precision_value_d 0x100 + #define F_print_format_flag_range_d 0x200 + #define F_print_format_flag_sign_always_d 0x40 + #define F_print_format_flag_sign_pad_d 0x800 + #define F_print_format_flag_trim_d 0x1000 + #define F_print_format_flag_uppercase_d 0x2000 + #define F_print_format_flag_width_d 0x4000 + #define F_print_format_flag_width_value_d 0x8000 + #define F_print_format_flag_zeros_leading_d 0x10000 #endif // _di_f_print_format_flags_ /** * Provide type format flags. * - * @todo float and double support will likely be something like: "%d", "%dl", and "%dll" for float, double, and long double, respectively. - * @todo there may be support in the future for min/max type sizes, such that "%n" = min, "%m" = max, and "%niii" = min int8_t. + * @todo There may be support in the future for min/max type sizes, such that "%n" = min, "%m" = max, and "%niii" = min int8_t. * * f_print_format_type_*: - * - character: "c", Type is a 1-byte unsigned character. - * - character_safe: "C", Type is a 1-byte unsigned character, where control characters and invalid UTF-8 are replaced. - * - color_after: "]", Type is a f_color_set_t such that the f_color_set_t.after is used. - * - color_before: "[", Type is a f_color_set_t such that the f_color_set_t.begin is used. - * - signed_8: "iii", "III", Type is a int8_t digit. - * - signed_16: "ii", "II", Type is a int16_t digit. - * - signed_32: "i", "I", Type is a int32_t digit. - * - signed_64: "il", "IL", Type is a signed int64_t digit. - * - signed_128: "ill", "ILL", Type is a f_int_128_t digit. - * - number: "in", "IN", Type is a f_number_signed_t digit. - * - size: "z", "Z", Type is a size_t digit. - * - string: "s", Type is a NULL terminated string, where the string is printed as-is. - * - string_safe: "S", Type is a NULL terminated string, where control characters and other problems are handled. - * - string_static: "q", Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed). - * - string_static_raw: "r", Type is a f_string_static_t or f_string_dynamic_t and NULLs (and all other control characters) are printed. - * - string_static_safe: "Q", Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, where control characters and other problems are handled. - * - string_static_safe_raw: "R", Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, where control characters and other problems are handled. - * - unsigned_8: "uii", "UII", Type is a uint8_t digit. - * - unsigned_16: "ui", "UI", Type is a uint16_t digit. - * - unsigned_32: "u", "U", Type is a uint32_t digit. - * - unsigned_64: "ul", "UL", Type is a uint64_t digit. - * - unsigned_128: "ull", "ULL", Type is a f_uint_128_t digit. - * - unsigned_number: "un", "UN", Type is a f_number_unsigned_t digit (which by default is what f_array_length_t is a type of). + * - character: "c", Type is a 1-byte unsigned character. + * - character_safe: "C", Type is a 1-byte unsigned character, where control characters and invalid UTF-8 are replaced. + * - color_after: "]", Type is a f_color_set_t such that the f_color_set_t.after is used. + * - color_before: "[", Type is a f_color_set_t such that the f_color_set_t.begin is used. + * - double_32 "d", "D", Type is a double (32-bit). + * - double_64 "dl", "DL", Type is a long double (64-bit). + * - signed_8: "iii", "III", Type is a int8_t digit. + * - signed_16: "ii", "II", Type is a int16_t digit. + * - signed_32: "i", "I", Type is a int32_t digit. + * - signed_64: "il", "IL", Type is a signed int64_t digit. + * - signed_128: "ill", "ILL", Type is a f_int_128_t digit. + * - number: "in", "IN", Type is a f_number_signed_t digit. + * - size: "z", "Z", Type is a size_t digit. + * - string: "s", Type is a NULL terminated string, where the string is printed as-is. + * - string_safe: "S", Type is a NULL terminated string, where control characters and other problems are handled. + * - string_static: "q", Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed). + * - string_static_raw: "r", Type is a f_string_static_t or f_string_dynamic_t and NULLs (and all other control characters) are printed. + * - string_static_safe: "Q", Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, where control characters and other problems are handled. + * - string_static_safe_raw: "R", Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, where control characters and other problems are handled. + * - unsigned_8: "uii", "UII", Type is a uint8_t digit. + * - unsigned_16: "ui", "UI", Type is a uint16_t digit. + * - unsigned_32: "u", "U", Type is a uint32_t digit. + * - unsigned_64: "ul", "UL", Type is a uint64_t digit. + * - unsigned_128: "ull", "ULL", Type is a f_uint_128_t digit. + * - unsigned_number: "un", "UN", Type is a f_number_unsigned_t digit (which by default is what f_array_length_t is a type of). * * @see fprintf() */ @@ -190,6 +201,8 @@ extern "C" { f_print_format_type_character_safe, f_print_format_type_color_after, f_print_format_type_color_before, + f_print_format_type_double_32, + f_print_format_type_double_64, f_print_format_type_signed_8, f_print_format_type_signed_16, f_print_format_type_signed_32, diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index 52da4ef..49b2ecc 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -356,6 +356,7 @@ extern "C" { // Immediate next value must be either a number, 'x', 'X', 'd', 'D', 'o', 'O', 'b', or 'B'. if (j > range.stop) { *number = 0; + return F_none; } else if (string[j] > 0x2f && string[j] < 0x3a) { diff --git a/level_1/fl_conversion/c/private-conversion.c b/level_1/fl_conversion/c/private-conversion.c index 7dc15e8..16c10cd 100644 --- a/level_1/fl_conversion/c/private-conversion.c +++ b/level_1/fl_conversion/c/private-conversion.c @@ -60,6 +60,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_signed_) @@ -103,6 +104,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_unsigned_) @@ -167,6 +169,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_signed_) @@ -213,6 +216,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_unsigned_) @@ -277,6 +281,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_signed_) @@ -323,6 +328,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_unsigned_) @@ -497,6 +503,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_signed_) @@ -543,6 +550,7 @@ extern "C" { } // for *number = converted; + return F_none; } #endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_unsigned_) diff --git a/level_1/fl_print/c/print.c b/level_1/fl_print/c/print.c index 8529557..c4e45a8 100644 --- a/level_1/fl_print/c/print.c +++ b/level_1/fl_print/c/print.c @@ -6,28 +6,28 @@ extern "C" { #endif #ifndef _di_fl_print_format_ - f_status_t fl_print_format(const f_string_t string, FILE *output, ...) { + f_status_t fl_print_format(const f_string_t string, FILE *stream, ...) { #ifndef _di_level_1_parameter_checking_ if (!string) return 0; - if (!output) return 0; + if (!stream) return 0; #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; va_list ap; - va_start(ap, output); + va_start(ap, stream); for (f_string_t current = string; *current; current += 1) { if (*current == f_string_ascii_percent_s[0]) { current += 1; - current = private_fl_print_format_convert(current, output, &ap, &status); + current = private_fl_print_format_convert(current, stream, &ap, &status); if (F_status_is_error(status)) break; } else { - if (!fputc_unlocked(*current, output)) { + if (!fputc_unlocked(*current, stream)) { break; } } @@ -40,21 +40,21 @@ extern "C" { #endif // _di_fl_print_format_ #ifndef _di_fl_print_format_convert_ - f_string_t fl_print_format_convert(const f_string_t string, FILE *output, va_list *ap, f_status_t *status) { + f_string_t fl_print_format_convert(const f_string_t string, FILE *stream, va_list *ap, f_status_t *status) { #ifndef _di_level_1_parameter_checking_ - if (!output) return 0; + if (!stream) return 0; if (!ap) return 0; #endif // _di_level_1_parameter_checking_ - return private_fl_print_format_convert(string, output, ap, status); + return private_fl_print_format_convert(string, stream, ap, status); } #endif // _di_fl_print_format_convert_ #ifndef _di_fl_print_string_va_ - f_status_t fl_print_string_va(const f_string_t string, FILE *output, va_list *ap) { + f_status_t fl_print_string_va(const f_string_t string, FILE *stream, va_list *ap) { #ifndef _di_level_1_parameter_checking_ if (!string) return 0; - if (!output) return 0; + if (!stream) return 0; if (!ap) return 0; #endif // _di_level_1_parameter_checking_ @@ -65,11 +65,11 @@ extern "C" { if (*current == f_string_ascii_percent_s[0]) { current += 1; - current = private_fl_print_format_convert(current, output, ap, &status); + current = private_fl_print_format_convert(current, stream, ap, &status); if (F_status_is_error(status)) break; } else { - if (!fputc_unlocked(*current, output)) { + if (!fputc_unlocked(*current, stream)) { break; } } @@ -80,93 +80,93 @@ extern "C" { #endif // _di_fl_print_string_va_ #ifndef _di_fl_print_trim_ - f_status_t fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *output) { + f_status_t fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { return F_data_not; } - return private_fl_print_trim(string, length, output); + return private_fl_print_trim(string, length, stream); } #endif // _di_fl_print_trim_ #ifndef _di_fl_print_trim_raw_ - f_status_t fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *output) { + f_status_t fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { return F_data_not; } - return private_fl_print_trim_raw(string, length, output); + return private_fl_print_trim_raw(string, length, stream); } #endif // _di_fl_print_trim_raw_ #ifndef _di_fl_print_trim_safely_ - f_status_t fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *output) { + f_status_t fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { return F_data_not; } - return private_fl_print_trim_safely(string, length, output); + return private_fl_print_trim_safely(string, length, stream); } #endif // _di_fl_print_trim_safely_ #ifndef _di_fl_print_trim_dynamic_ - f_status_t fl_print_trim_dynamic(const f_string_static_t buffer, FILE *output) { + f_status_t fl_print_trim_dynamic(const f_string_static_t buffer, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { return F_data_not; } - return private_fl_print_trim(buffer.string, buffer.used, output); + return private_fl_print_trim(buffer.string, buffer.used, stream); } #endif // _di_fl_print_trim_dynamic_ #ifndef _di_fl_print_trim_dynamic_raw_ - f_status_t fl_print_trim_dynamic_raw(const f_string_static_t buffer, FILE *output) { + f_status_t fl_print_trim_dynamic_raw(const f_string_static_t buffer, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { return F_data_not; } - return private_fl_print_trim_raw(buffer.string, buffer.used, output); + return private_fl_print_trim_raw(buffer.string, buffer.used, stream); } #endif // _di_fl_print_trim_dynamic_raw_ #ifndef _di_fl_print_trim_dynamic_safely_ - f_status_t fl_print_trim_dynamic_safely(const f_string_static_t buffer, FILE *output) { + f_status_t fl_print_trim_dynamic_safely(const f_string_static_t buffer, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { return F_data_not; } - return private_fl_print_trim_safely(buffer.string, buffer.used, output); + return private_fl_print_trim_safely(buffer.string, buffer.used, stream); } #endif // _di_fl_print_trim_dynamic_safely_ #ifndef _di_fl_print_trim_dynamic_partial_ - f_status_t fl_print_trim_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, FILE *output) { + f_status_t fl_print_trim_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -179,14 +179,14 @@ extern "C" { length = buffer.used - range.start; } - return private_fl_print_trim(buffer.string + range.start, length, output); + return private_fl_print_trim(buffer.string + range.start, length, stream); } #endif // _di_fl_print_trim_dynamic_partial_ #ifndef _di_fl_print_trim_dynamic_partial_raw_ - f_status_t fl_print_trim_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, FILE *output) { + f_status_t fl_print_trim_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -199,14 +199,14 @@ extern "C" { length = buffer.used - range.start; } - return private_fl_print_trim_raw(buffer.string + range.start, length, output); + return private_fl_print_trim_raw(buffer.string + range.start, length, stream); } #endif // _di_fl_print_trim_dynamic_partial_raw_ #ifndef _di_fl_print_trim_dynamic_partial_safely_ - f_status_t fl_print_trim_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, FILE *output) { + f_status_t fl_print_trim_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -219,14 +219,14 @@ extern "C" { length = buffer.used - range.start; } - return private_fl_print_trim_safely(buffer.string + range.start, length, output); + return private_fl_print_trim_safely(buffer.string + range.start, length, stream); } #endif // _di_fl_print_trim_dynamic_partial_safely_ #ifndef _di_fl_print_trim_except_ - f_status_t fl_print_trim_except(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *output) { + f_status_t fl_print_trim_except(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { @@ -235,14 +235,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in(string, offset, length, except_at, except_in, output); + return private_fl_print_trim_except_in(string, offset, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_ #ifndef _di_fl_print_trim_except_raw_ - f_status_t fl_print_trim_except_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *output) { + f_status_t fl_print_trim_except_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { @@ -251,14 +251,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in_raw(string, offset, length, except_at, except_in, output); + return private_fl_print_trim_except_in_raw(string, offset, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_raw_ #ifndef _di_fl_print_trim_except_safely_ - f_status_t fl_print_trim_except_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *output) { + f_status_t fl_print_trim_except_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { @@ -267,14 +267,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in_safely(string, offset, length, except_at, except_in, output); + return private_fl_print_trim_except_in_safely(string, offset, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_safely_ #ifndef _di_fl_print_trim_except_dynamic_ - f_status_t fl_print_trim_except_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *output) { + f_status_t fl_print_trim_except_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { @@ -283,14 +283,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in(buffer.string, 0, buffer.used, except_at, except_in, output); + return private_fl_print_trim_except_in(buffer.string, 0, buffer.used, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_dynamic_ #ifndef _di_fl_print_trim_except_dynamic_raw_ - f_status_t fl_print_trim_except_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *output) { + f_status_t fl_print_trim_except_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { @@ -299,14 +299,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in_raw(buffer.string, 0, buffer.used, except_at, except_in, output); + return private_fl_print_trim_except_in_raw(buffer.string, 0, buffer.used, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_dynamic_raw_ #ifndef _di_fl_print_trim_except_dynamic_safely_ - f_status_t fl_print_trim_except_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *output) { + f_status_t fl_print_trim_except_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { @@ -315,98 +315,98 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in_safely(buffer.string, 0, buffer.used, except_at, except_in, output); + return private_fl_print_trim_except_in_safely(buffer.string, 0, buffer.used, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_dynamic_safely_ #ifndef _di_fl_print_trim_except_in_ - f_status_t fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { return F_data_not; } - return private_fl_print_trim_except_in(string, offset, length, except_at, except_in, output); + return private_fl_print_trim_except_in(string, offset, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_ #ifndef _di_fl_print_trim_except_in_raw_ - f_status_t fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { return F_data_not; } - return private_fl_print_trim_except_in_raw(string, offset, length, except_at, except_in, output); + return private_fl_print_trim_except_in_raw(string, offset, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_raw_ #ifndef _di_fl_print_trim_except_in_safely_ - f_status_t fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!string || !length) { return F_data_not; } - return private_fl_print_trim_except_in_safely(string, offset, length, except_at, except_in, output); + return private_fl_print_trim_except_in_safely(string, offset, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_safely_ #ifndef _di_fl_print_trim_except_in_dynamic_ - f_status_t fl_print_trim_except_in_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { return F_data_not; } - return private_fl_print_trim_except_in(buffer.string, 0, buffer.used, except_at, except_in, output); + return private_fl_print_trim_except_in(buffer.string, 0, buffer.used, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_dynamic_ #ifndef _di_fl_print_trim_except_in_dynamic_raw_ - f_status_t fl_print_trim_except_in_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { return F_data_not; } - return private_fl_print_trim_except_in_raw(buffer.string, 0, buffer.used, except_at, except_in, output); + return private_fl_print_trim_except_in_raw(buffer.string, 0, buffer.used, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_dynamic_raw_ #ifndef _di_fl_print_trim_except_in_dynamic_safely_ - f_status_t fl_print_trim_except_in_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used) { return F_data_not; } - return private_fl_print_trim_except_in_safely(buffer.string, 0, buffer.used, except_at, except_in, output); + return private_fl_print_trim_except_in_safely(buffer.string, 0, buffer.used, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_dynamic_safely_ #ifndef _di_fl_print_trim_except_in_dynamic_partial_ - f_status_t fl_print_trim_except_in_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -419,14 +419,14 @@ extern "C" { length = buffer.used - range.start; } - return private_fl_print_trim_except_in(buffer.string, range.start, length, except_at, except_in, output); + return private_fl_print_trim_except_in(buffer.string, range.start, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_dynamic_partial_ #ifndef _di_fl_print_trim_except_in_dynamic_partial_raw_ - f_status_t fl_print_trim_except_in_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -439,14 +439,14 @@ extern "C" { length = buffer.used - range.start; } - return private_fl_print_trim_except_in_raw(buffer.string, range.start, length, except_at, except_in, output); + return private_fl_print_trim_except_in_raw(buffer.string, range.start, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_dynamic_partial_raw_ #ifndef _di_fl_print_trim_except_in_dynamic_partial_safely_ - f_status_t fl_print_trim_except_in_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t fl_print_trim_except_in_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -459,14 +459,14 @@ extern "C" { length = buffer.used - range.start; } - return private_fl_print_trim_except_in_safely(buffer.string, range.start, length, except_at, except_in, output); + return private_fl_print_trim_except_in_safely(buffer.string, range.start, length, except_at, except_in, stream); } #endif // _di_fl_print_trim_except_in_dynamic_partial_safely_ #ifndef _di_fl_print_trim_except_dynamic_partial_ - f_status_t fl_print_trim_except_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *output) { + f_status_t fl_print_trim_except_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -481,14 +481,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in(buffer.string, range.start, length, except, except_in, output); + return private_fl_print_trim_except_in(buffer.string, range.start, length, except, except_in, stream); } #endif // _di_fl_print_trim_except_dynamic_partial_ #ifndef _di_fl_print_trim_except_dynamic_partial_raw_ - f_status_t fl_print_trim_except_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *output) { + f_status_t fl_print_trim_except_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -503,14 +503,14 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in_raw(buffer.string, range.start, length, except, except_in, output); + return private_fl_print_trim_except_in_raw(buffer.string, range.start, length, except, except_in, stream); } #endif // _di_fl_print_trim_except_dynamic_partial_raw_ #ifndef _di_fl_print_trim_except_dynamic_partial_safely_ - f_status_t fl_print_trim_except_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *output) { + f_status_t fl_print_trim_except_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *stream) { #ifndef _di_level_1_parameter_checking_ - if (!output) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { @@ -525,7 +525,7 @@ extern "C" { const f_string_ranges_t except_in = f_string_ranges_t_initialize; - return private_fl_print_trim_except_in_safely(buffer.string, range.start, length, except, except_in, output); + return private_fl_print_trim_except_in_safely(buffer.string, range.start, length, except, except_in, stream); } #endif // _di_fl_print_trim_except_dynamic_partial_safely_ diff --git a/level_1/fl_print/c/print.h b/level_1/fl_print/c/print.h index 7887545..7c700ec 100644 --- a/level_1/fl_print/c/print.h +++ b/level_1/fl_print/c/print.h @@ -54,111 +54,138 @@ extern "C" { * The order in which basic format flags are processed in regards parameters is a present order irrespective to the order specified. * The basic format flags "/", ";", and ":" are examples of this. * + * Floating and double floating format flags may be immediately followed by one of: + * - "e": Round and convert to [-]d.ddde±dd (exponent notation). + * - "E": Round and convert to [-]d.dddE±dd (exponent notation). + * - "g": Round and convert to notation of either decimal or exponent. + * - "G": Round and convert to notation of either decimal or exponent. + * + * The default format is decimal: [-]ddd.ddd. + * + * The case-sensitivity of above, such as 'e' vs 'E,' does not replace or relate to the case-sensitivity meaning of 'd' or 'D'. + * Instead, when 'e' is specified 'e' is used (such as such as [-]d.ddde±dd), but when 'E' is specified, then 'E' is used (such as [-]d.dddE±dd). + * + * Note: Currently the float/double implementation does not support the notation modes except integer (default) or hexidecimal. + * This is not intended but is simply a result of the temporary use of sprintf() to perform these operations. + * Once a custom implementation is provided, replacing snprintf(), then this can properly support the notation modes. + * Therefore, this function is supposed to support notation modes and does not yet do this (@fixme/@todo). + * + * This "%$" sequence is used to prevent characters from being interpreted. + * For example, consider "%de" vs "%d%$e". + * The first case "%de" is interpretted as a double using the "e" notation. + * The second case "%d%$e" is interpretted as a double followed by the letter "e". + * * For these basic format flags ("/", ";", and ":"), the order is always processed as: - * 1) static/dynamic string. - * 2) partial range. - * 3) ignore at. - * 4) ignore in. + * 1) static/dynamic string. + * 2) partial range. + * 3) ignore at. + * 4) ignore in. * * Uppercase base format flags designates to print the base designation in uppercase and lowercase base format flags designate to print the base designation in lowercase. * There are 5 support base format flags: - * - binary: 0b/0B, representing base-2 units. - * - octal: 0o/0O, representing base-8 units (note that this is a letter O, and not a zero). - * - decimal: 0t/0T, representing base-10 units (this is the default when no base is specified, in which case the 0t/0T is not printed). - * - duodecimal: 0d/0D, representing base-12 units. - * - hexidecimal: 0x/0X, representing base-16 units. + * - binary: 0b/0B, representing base-2 units. + * - octal: 0o/0O, representing base-8 units (note that this is a letter O, and not a zero). + * - decimal: 0t/0T, representing base-10 units (this is the default when no base is specified, in which case the 0t/0T is not printed). + * - duodecimal: 0d/0D, representing base-12 units. + * - hexidecimal: 0x/0X, representing base-16 units. * * When printing digits, using lowercase designates to print alphabetic digits in lowercase and using uppercase designates to print alphabetic digits in uppercase. * * To keep the design simple, this does not support index position variable replacement like fprintf() does (such as '%1$', '%2$', etc..). * * Basic Format Flags: - * - "-": Use left-justification. - * - "#": Use alternate form conversion (prefixing 0b/0B, 0o/0O, 0t/0T, 0d/0D, 0x/0X). - * - ";": Ignore characters in the given positions from a f_array_length_t (only applies to static/dynamic string arguments but not character arguments). - * - ":": Ignore characters in the given ranges from a f_string_range_t (only applies to static/dynamic string arguments but not character arguments). - * - "/", Print only the given range of a string, specified by f_string_range_t (only applies to static/dynamic string arguments but not character arguments). - * - "+", Always show the signs (+ or -). - * - " ", Add a space where a sign would be if the sign is not displayed (this is the space character). - * - "=", Trim leading and trailing whitespaces (only applies to static/dynamic string arguments but not character arguments). - * - "0" to "9", The width to use, however if a leading 0 is used, then a 0 is printed in each leading digit as needed. + * - "-": Use left-justification. + * - "#": Use alternate form conversion (prefixing 0b/0B, 0o/0O, 0t/0T, 0d/0D, 0x/0X). + * - ";": Ignore characters in the given positions from a f_array_length_t (only applies to static/dynamic string arguments but not character arguments). + * - ":": Ignore characters in the given ranges from a f_string_range_t (only applies to static/dynamic string arguments but not character arguments). + * - "/", Print only the given range of a string, specified by f_string_range_t (only applies to static/dynamic string arguments but not character arguments). + * - "+", Always show the signs (+ or -). + * - " ", Add a space where a sign would be if the sign is not displayed (this is the space character). + * - "=", Trim leading and trailing whitespaces (only applies to static/dynamic string arguments but not character arguments). + * - "0" to "9", The width to use, however if a leading 0 is used, then a 0 is printed in each leading digit as needed. + * - "*", For number-based values, designates that the width is specified in the parameter (order is: (width, value)). + * - ".*", For number-based values, designates that the precision is specified in the parameter (order is: (precision, value), but if *.* is specified, then order is: (width, precision, value)). * * Base Format Flags: - * - "!": Display digits in Binary notation. - * - "@": Display digits in Octal notation. - * - "^": Display digits in Decimal notation. - * - "&": Display digits in Duodecimal notation. - * - "_": Display digits in Hexidecimal notation. + * - "!": Display digits in Binary notation. + * - "@": Display digits in Octal notation. + * - "^": Display digits in Decimal notation. + * - "&": Display digits in Duodecimal notation. + * - "_": Display digits in Hexidecimal notation. + * + * Special Format Flags: + * - "$": Ignore flag. + * - "%": Use left-justification. * * Type Format Flags: - * - "c": Type is a 1-byte unsigned character. - * - "C": Type is a 1-byte unsigned character, where control characters and invalid UTF-8 are replaced. - * - "[": Type is a f_color_set_t such that the f_color_set_t.begin is used. - * - "]": Type is a f_color_set_t such that the f_color_set_t.after is used. - * - "iii" "III": Type is a int8_t digit. - * - "ii", "II": Type is a int16_t digit. - * - "i", "I": Type is a int32_t digit. - * - "il", "IL": Type is a signed int64_t digit. - * - "ill", "ILL": Type is a f_int_128_t digit. - * - "in", "IN": Type is a f_number_signed_t digit. - * - "z", "Z": Type is a size_t digit. - * - "s": Type is a NULL terminated string, where the string is printed as-is. - * - "S": Type is a NULL terminated string, where control characters and invalid UTF-8 are replaced. - * - "q": Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed). - * - "Q": Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed), where control characters and invalid UTF-8 are replaced. - * - "r": Type is a f_string_static_t or f_string_dynamic_t and NULLs (and all other control characters) are printed. - * - "R": Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, but control characters and invalid UTF-8 are replaced. @todo not yet implemented. - * - "uii", "UII": Type is a uint8_t digit. - * - "ui", "UI": Type is a uint16_t digit. - * - "u", "U": Type is a uint32_t digit. - * - "ul", "UL": Type is a uint64_t digit. - * - "ull", "ULL": Type is a f_uint_128_t digit. - * - "un", "UN": Type is a f_number_unsigned_t digit (which by default is what f_array_length_t is a type of). + * - "d", "D": Type is a double digit (32-bit), may be immediately followed by an "e", "E", "g", or "G". + * - "dl", "DL": Type is a long double digit (64-bit), may be immediately followed by an "e", "E", "g", or "G". + * - "c": Type is a 1-byte unsigned character. + * - "C": Type is a 1-byte unsigned character, where control characters and invalid UTF-8 are replaced. + * - "[": Type is a f_color_set_t such that the f_color_set_t.begin is used. + * - "]": Type is a f_color_set_t such that the f_color_set_t.after is used. + * - "iii" "III": Type is a int8_t digit. + * - "ii", "II": Type is a int16_t digit. + * - "i", "I": Type is a int32_t digit. + * - "il", "IL": Type is a signed int64_t digit. + * - "ill", "ILL": Type is a f_int_128_t digit. + * - "in", "IN": Type is a f_number_signed_t digit. + * - "z", "Z": Type is a size_t digit. + * - "s": Type is a NULL terminated string, where the string is printed as-is. + * - "S": Type is a NULL terminated string, where control characters and invalid UTF-8 are replaced. + * - "q": Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed). + * - "Q": Type is a f_string_static_t or f_string_dynamic_t and NULLs are ignored (not printed), where control characters and invalid UTF-8 are replaced. + * - "r": Type is a f_string_static_t or f_string_dynamic_t and NULLs (and all other control characters) are printed. + * - "R": Type is a f_string_static_t or f_string_dynamic_t and NULLs are printed, but control characters and invalid UTF-8 are replaced. @todo not yet implemented. + * - "uii", "UII": Type is a uint8_t digit. + * - "ui", "UI": Type is a uint16_t digit. + * - "u", "U": Type is a uint32_t digit. + * - "ul", "UL": Type is a uint64_t digit. + * - "ull", "ULL": Type is a f_uint_128_t digit. + * - "un", "UN": Type is a f_number_unsigned_t digit (which by default is what f_array_length_t is a type of). * * The following are control characters and their replacements for "safe" printing (unknown is used for invalid UTF-8 sequences): - * - "␆": Acknowledge. - * - "␕": Negative Acknowledge. - * - "␈": Backspace. - * - "␇": Bell. - * - "␘": Cancel. - * - "␍": Carriage Return. - * - "␐": Data Link Escape. - * - "␡": Delete. - * - "␑": Device Control 1. - * - "␒": Device Control 2. - * - "␓": Device Control 3. - * - "␔": Device Control 4. - * - "␙": End of Medium. - * - "␃": End of Text. - * - "␄": End of Transmission. - * - "␗": End of Transmission Block. - * - "␅": Enquiry. - * - "␛": Escape. - * - "␌": Form Feed. - * - "␊": Line Feed. - * - "␀": Null. - * - "␜": Separator File. - * - "␝": Separator Group. - * - "␞": Separator Record. - * - "␟": Separator Unit. - * - "␏": Shift In. - * - "␎": Shift Out. - * - "␁": Start Of Header. - * - "␂": Start Of Text. - * - "␚": Substitute. - * - "␖": Synchronous Idle. - * - "␉": Tab. - * - "␋": Vertical Tab. - * - "�": Unknown. + * - "␆": Acknowledge. + * - "␕": Negative Acknowledge. + * - "␈": Backspace. + * - "␇": Bell. + * - "␘": Cancel. + * - "␍": Carriage Return. + * - "␐": Data Link Escape. + * - "␡": Delete. + * - "␑": Device Control 1. + * - "␒": Device Control 2. + * - "␓": Device Control 3. + * - "␔": Device Control 4. + * - "␙": End of Medium. + * - "␃": End of Text. + * - "␄": End of Transmission. + * - "␗": End of Transmission Block. + * - "␅": Enquiry. + * - "␛": Escape. + * - "␌": Form Feed. + * - "␊": Line Feed. + * - "␀": Null. + * - "␜": Separator File. + * - "␝": Separator Group. + * - "␞": Separator Record. + * - "␟": Separator Unit. + * - "␏": Shift In. + * - "␎": Shift Out. + * - "␁": Start Of Header. + * - "␂": Start Of Text. + * - "␚": Substitute. + * - "␖": Synchronous Idle. + * - "␉": Tab. + * - "␋": Vertical Tab. + * - "�": Unknown/Invalid. * * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called. * - * @todo float/double support is not yet implemented, but is intended to eventually be supported. - * * @param string * The formatted string to process and output. * This is a NULL terminated string. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * @param ... * Additional arguments relating to the string. @@ -169,6 +196,7 @@ extern "C" { * * @see fprintf() * @see fputc_unlocked() + * @see snprintf() * @see va_start() * @see va_end() * @@ -181,7 +209,7 @@ extern "C" { * @see f_print_terminated() */ #ifndef _di_fl_print_format_ - extern f_status_t fl_print_format(const f_string_t string, FILE *output, ...); + extern f_status_t fl_print_format(const f_string_t string, FILE *stream, ...); #endif // _di_fl_print_format_ /** @@ -195,8 +223,8 @@ extern "C" { * @param string * The current character position within the string. * This pointer might be updated by this function. - * @param output - * The file stream to output to, including standard streams such as stdout and stderr. + * @param stream + * The file stream to stream to, including standard streams such as stdout and stderr. * @param ap * The variable arguments list. * @param status @@ -240,7 +268,7 @@ extern "C" { * @see f_print_terminated() */ #ifndef _di_fl_print_format_convert_ - extern f_string_t fl_print_format_convert(const f_string_t string, FILE *output, va_list *ap, f_status_t *status); + extern f_string_t fl_print_format_convert(const f_string_t string, FILE *stream, va_list *ap, f_status_t *status); #endif // _di_fl_print_format_convert_ /** @@ -252,7 +280,7 @@ extern "C" { * * @param string * The formatted string to process and output. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * @param ap * The variable list. @@ -292,7 +320,7 @@ extern "C" { * @see fl_print_format() */ #ifndef _di_fl_print_string_va_ - extern f_status_t fl_print_string_va(const f_string_t string, FILE *output, va_list *ap); + extern f_status_t fl_print_string_va(const f_string_t string, FILE *stream, va_list *ap); #endif // _di_fl_print_string_va_ /** @@ -309,7 +337,7 @@ extern "C" { * The string to output. * @param length * The total number of characters to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -327,7 +355,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_ - extern f_status_t fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *output); + extern f_status_t fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *stream); #endif // _di_fl_print_trim_ /** @@ -347,7 +375,7 @@ extern "C" { * The string to output. * @param length * The total number of characters to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -363,7 +391,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_raw_ - extern f_status_t fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *output); + extern f_status_t fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *stream); #endif // _di_fl_print_trim_raw_ /** @@ -381,7 +409,7 @@ extern "C" { * The string to output. * @param length * The total number of characters to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -398,7 +426,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_safely_ - extern f_status_t fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *output); + extern f_status_t fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *stream); #endif // _di_fl_print_trim_safely_ /** @@ -416,7 +444,7 @@ extern "C" { * * @param buffer * The string to output. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -434,7 +462,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_dynamic_ - extern f_status_t fl_print_trim_dynamic(const f_string_static_t buffer, FILE *output); + extern f_status_t fl_print_trim_dynamic(const f_string_static_t buffer, FILE *stream); #endif // _di_fl_print_trim_dynamic_ /** @@ -455,7 +483,7 @@ extern "C" { * * @param buffer * The string to output. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -471,7 +499,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_dynamic_raw_ - extern f_status_t fl_print_trim_dynamic_raw(const f_string_static_t buffer, FILE *output); + extern f_status_t fl_print_trim_dynamic_raw(const f_string_static_t buffer, FILE *stream); #endif // _di_fl_print_trim_dynamic_raw_ /** @@ -490,7 +518,7 @@ extern "C" { * * @param buffer * The string to output. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -507,7 +535,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_dynamic_safely_ - extern f_status_t fl_print_trim_dynamic_safely(const f_string_static_t buffer, FILE *output); + extern f_status_t fl_print_trim_dynamic_safely(const f_string_static_t buffer, FILE *stream); #endif // _di_fl_print_trim_dynamic_safely_ /** @@ -527,7 +555,7 @@ extern "C" { * The string to output. * @param range * The range within the provided string to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -545,7 +573,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_dynamic_partial_ - extern f_status_t fl_print_trim_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, FILE *output); + extern f_status_t fl_print_trim_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, FILE *stream); #endif // _di_fl_print_trim_dynamic_partial_ /** @@ -568,7 +596,7 @@ extern "C" { * The string to output. * @param range * The range within the provided string to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -584,7 +612,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_dynamic_partial_raw_ - extern f_status_t fl_print_trim_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, FILE *output); + extern f_status_t fl_print_trim_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, FILE *stream); #endif // _di_fl_print_trim_dynamic_partial_raw_ /** @@ -605,7 +633,7 @@ extern "C" { * The string to output. * @param range * The range within the provided string to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -622,7 +650,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_dynamic_partial_safely_ - extern f_status_t fl_print_trim_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, FILE *output); + extern f_status_t fl_print_trim_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, FILE *stream); #endif // _di_fl_print_trim_dynamic_partial_safely_ /** @@ -647,7 +675,7 @@ extern "C" { * @param except_at * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -665,7 +693,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_ - extern f_status_t fl_print_trim_except(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *output); + extern f_status_t fl_print_trim_except(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *stream); #endif // _di_fl_print_trim_except_ /** @@ -693,7 +721,7 @@ extern "C" { * @param except_at * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -709,7 +737,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_raw_ - extern f_status_t fl_print_trim_except_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *output); + extern f_status_t fl_print_trim_except_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *stream); #endif // _di_fl_print_trim_except_raw_ /** @@ -735,7 +763,7 @@ extern "C" { * @param except_at * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -752,7 +780,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_safely_ - extern f_status_t fl_print_trim_except_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *output); + extern f_status_t fl_print_trim_except_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, FILE *stream); #endif // _di_fl_print_trim_except_safely_ /** @@ -774,7 +802,7 @@ extern "C" { * @param except_at * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -792,7 +820,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_dynamic_ - extern f_status_t fl_print_trim_except_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *output); + extern f_status_t fl_print_trim_except_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *stream); #endif // _di_fl_print_trim_except_dynamic_ /** @@ -817,7 +845,7 @@ extern "C" { * @param except_at * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -833,7 +861,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_dynamic_raw_ - extern f_status_t fl_print_trim_except_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *output); + extern f_status_t fl_print_trim_except_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *stream); #endif // _di_fl_print_trim_except_dynamic_raw_ /** @@ -856,7 +884,7 @@ extern "C" { * @param except_at * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -873,7 +901,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_dynamic_safely_ - extern f_status_t fl_print_trim_except_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *output); + extern f_status_t fl_print_trim_except_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, FILE *stream); #endif // _di_fl_print_trim_except_dynamic_safely_ /** @@ -902,7 +930,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -920,7 +948,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_ - extern f_status_t fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_ /** @@ -952,7 +980,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -968,7 +996,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_raw_ - extern f_status_t fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_raw_ /** @@ -998,7 +1026,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1015,7 +1043,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_safely_ - extern f_status_t fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_safely_ /** @@ -1043,7 +1071,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1061,7 +1089,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_dynamic_ - extern f_status_t fl_print_trim_except_in_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_dynamic(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_dynamic_ /** @@ -1090,7 +1118,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1106,7 +1134,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_dynamic_raw_ - extern f_status_t fl_print_trim_except_in_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_dynamic_raw(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_dynamic_raw_ /** @@ -1133,7 +1161,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1150,7 +1178,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_dynamic_safely_ - extern f_status_t fl_print_trim_except_in_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_dynamic_safely(const f_string_static_t buffer, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_dynamic_safely_ /** @@ -1178,7 +1206,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1196,7 +1224,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_dynamic_partial_ - extern f_status_t fl_print_trim_except_in_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_dynamic_partial_ /** @@ -1227,7 +1255,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1243,7 +1271,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_dynamic_partial_raw_ - extern f_status_t fl_print_trim_except_in_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_dynamic_partial_raw_ /** @@ -1272,7 +1300,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1289,7 +1317,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_in_dynamic_partial_safely_ - extern f_status_t fl_print_trim_except_in_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output); + extern f_status_t fl_print_trim_except_in_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream); #endif // _di_fl_print_trim_except_in_dynamic_partial_safely_ /** @@ -1313,7 +1341,7 @@ extern "C" { * @param except * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1331,7 +1359,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_dynamic_partial_ - extern f_status_t fl_print_trim_except_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *output); + extern f_status_t fl_print_trim_except_dynamic_partial(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *stream); #endif // _di_fl_print_trim_except_dynamic_partial_ /** @@ -1358,7 +1386,7 @@ extern "C" { * @param except * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1374,7 +1402,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_dynamic_partial_raw_ - extern f_status_t fl_print_trim_except_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *output); + extern f_status_t fl_print_trim_except_dynamic_partial_raw(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *stream); #endif // _di_fl_print_trim_except_dynamic_partial_raw_ /** @@ -1399,7 +1427,7 @@ extern "C" { * @param except * An array of locations within the given string to not print. * The array of locations is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -1416,7 +1444,7 @@ extern "C" { * @see fputc_unlocked() */ #ifndef _di_fl_print_trim_except_dynamic_partial_safely_ - extern f_status_t fl_print_trim_except_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *output); + extern f_status_t fl_print_trim_except_dynamic_partial_safely(const f_string_static_t buffer, const f_string_range_t range, const f_array_lengths_t except, FILE *stream); #endif // _di_fl_print_trim_except_dynamic_partial_safely_ #ifdef __cplusplus diff --git a/level_1/fl_print/c/private-print.c b/level_1/fl_print/c/private-print.c index d8dbd3b..68edfab 100644 --- a/level_1/fl_print/c/private-print.c +++ b/level_1/fl_print/c/private-print.c @@ -6,7 +6,7 @@ extern "C" { #endif #if !defined(_di_fl_print_format_) || !defined(_di_fl_print_format_convert_) - f_string_t private_fl_print_format_convert(f_string_t string, FILE *output, va_list *ap, f_status_t *status) { + f_string_t private_fl_print_format_convert(f_string_t string, FILE *stream, va_list *ap, f_status_t *status) { const f_string_t start = string; @@ -20,7 +20,7 @@ extern "C" { *status = F_none; uint8_t base = 10; - uint16_t flag = 0; + uint32_t flag = 0; uint8_t type = 0; unsigned int width = 1; @@ -54,7 +54,7 @@ extern "C" { // The first percent found represents a literal '%' to be printed, otherwise return as invalid. if (string == start) { - if (!fputc_unlocked(f_string_ascii_percent_s[0], output)) { + if (!fputc_unlocked(f_string_ascii_percent_s[0], stream)) { *status = F_status_set_error(F_output); } } @@ -70,7 +70,7 @@ extern "C" { continue; } else if (*string == f_string_ascii_asterisk_s[0]) { - // @fixme what should I do here? review the fprintf() docs. + flag |= F_print_format_flag_width_d | F_print_format_flag_width_value_d; continue; } else if (*string == f_string_ascii_plus_s[0]) { @@ -99,16 +99,22 @@ extern "C" { ++string; - if (*string < 0x30 || *string > 0x39) { + if (*string == f_string_ascii_asterisk_s[0]) { + flag |= F_print_format_flag_precision_d | F_print_format_flag_precision_value_d; + } + else if (*string < 0x30 || *string > 0x39) { *status = F_status_set_error(F_valid_not); return string; } + else { + string = private_fl_print_convert_number(string, ap, &precision, status); + if (F_status_is_error(*status)) return string; - string = private_fl_print_convert_number(string, ap, &precision, status); - if (F_status_is_error(*status)) return string; + --string; - --string; + flag |= F_print_format_flag_precision_d; + } continue; } @@ -170,10 +176,56 @@ extern "C" { if (*string == f_string_ascii_C_s[0]) { char value[1] = { (char) va_arg(*ap, int) }; - *status = f_print_safely(value, 1, output); + *status = f_print_safely(value, 1, stream); return string; } + else if (*string == f_string_ascii_D_s[0]) { + type = f_print_format_type_double_32; + flag |= F_print_format_flag_uppercase_d; + + if (*(string + 1)) { + if (*(string + 1) == f_string_ascii_L_s[0]) { + type = f_print_format_type_double_64; + + if (*(string + 2) == f_string_ascii_e_s[0]) { + flag |= F_print_format_flag_exponent_d; + string += 2; + } + else if (*(string + 2) == f_string_ascii_E_s[0]) { + flag |= F_print_format_flag_exponent_d | F_print_format_flag_exponent_upper_d; + string += 2; + } + else if (*(string + 2) == f_string_ascii_g_s[0]) { + flag |= F_print_format_flag_exponent_either_d; + string += 2; + } + else if (*(string + 2) == f_string_ascii_G_s[0]) { + flag |= F_print_format_flag_exponent_either_d | F_print_format_flag_exponent_upper_d; + string += 2; + } + else { + ++string; + } + } + else if (*(string + 1) == f_string_ascii_e_s[0]) { + flag |= F_print_format_flag_exponent_d; + ++string; + } + else if (*(string + 1) == f_string_ascii_E_s[0]) { + flag |= F_print_format_flag_exponent_d | F_print_format_flag_exponent_upper_d; + ++string; + } + else if (*(string + 1) == f_string_ascii_g_s[0]) { + flag |= F_print_format_flag_exponent_either_d; + ++string; + } + else if (*(string + 1) == f_string_ascii_G_s[0]) { + flag |= F_print_format_flag_exponent_either_d | F_print_format_flag_exponent_upper_d; + ++string; + } + } + } else if (*string == f_string_ascii_I_s[0]) { type = f_print_format_type_signed_32; flag |= F_print_format_flag_uppercase_d; @@ -231,10 +283,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_safely(value.string, partial.start, length, except_at, except_in, output); + *status = private_fl_print_trim_except_in_safely(value.string, partial.start, length, except_at, except_in, stream); } else { - *status = f_print_except_in_safely(value.string, partial.start, length, except_at, except_in, output); + *status = f_print_except_in_safely(value.string, partial.start, length, except_at, except_in, stream); } } else if (flag & F_print_format_flag_ignore_range_d) { @@ -254,10 +306,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_safely(value.string, partial.start, length, except_at, except_in, output); + *status = private_fl_print_trim_except_in_safely(value.string, partial.start, length, except_at, except_in, stream); } else { - *status = f_print_except_in_safely(value.string, partial.start, length, except_at, except_in, output); + *status = f_print_except_in_safely(value.string, partial.start, length, except_at, except_in, stream); } } else { @@ -277,10 +329,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_safely(value.string + partial.start, length, output); + *status = private_fl_print_trim_safely(value.string + partial.start, length, stream); } else { - *status = f_print_safely(value.string + partial.start, length, output); + *status = f_print_safely(value.string + partial.start, length, stream); } } } @@ -293,10 +345,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_safely(value.string, 0, value.used, except_at, except_in, output); + *status = private_fl_print_trim_except_in_safely(value.string, 0, value.used, except_at, except_in, stream); } else { - *status = f_print_except_in_dynamic_safely(value, except_at, except_in, output); + *status = f_print_except_in_dynamic_safely(value, except_at, except_in, stream); } } else if (flag & F_print_format_flag_ignore_range_d) { @@ -304,18 +356,18 @@ extern "C" { const f_string_ranges_t except_in = va_arg(*ap, f_string_ranges_t); if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_safely(value.string, 0, value.used, except_at, except_in, output); + *status = private_fl_print_trim_except_in_safely(value.string, 0, value.used, except_at, except_in, stream); } else { - *status = f_print_except_in_dynamic_safely(value, except_at, except_in, output); + *status = f_print_except_in_dynamic_safely(value, except_at, except_in, stream); } } else { if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_safely(value.string, value.used, output); + *status = private_fl_print_trim_safely(value.string, value.used, stream); } else { - *status = f_print_dynamic_safely(value, output); + *status = f_print_dynamic_safely(value, stream); } } @@ -324,7 +376,7 @@ extern "C" { else if (*string == f_string_ascii_S_s[0]) { const f_string_t value = va_arg(*ap, f_string_t); - *status = f_print_safely_terminated(value, output); + *status = f_print_safely_terminated(value, stream); return string; } @@ -372,7 +424,7 @@ extern "C" { const f_color_set_t value = va_arg(*ap, f_color_set_t); if (value.before) { - *status = f_print_terminated(value.before->string, output); + *status = f_print_terminated(value.before->string, stream); } return string; @@ -381,7 +433,7 @@ extern "C" { const f_color_set_t value = va_arg(*ap, f_color_set_t); if (value.after) { - *status = f_print_terminated(value.after->string, output); + *status = f_print_terminated(value.after->string, stream); } return string; @@ -406,12 +458,57 @@ extern "C" { if (*string == f_string_ascii_c_s[0]) { const char value = (char) va_arg(*ap, uint32_t); - if (!fputc_unlocked(value, output)) { + if (!fputc_unlocked(value, stream)) { *status = F_status_set_error(F_output); } return string; } + else if (*string == f_string_ascii_d_s[0]) { + type = f_print_format_type_double_32; + + if (*(string + 1)) { + if (*(string + 1) == f_string_ascii_L_s[0]) { + type = f_print_format_type_double_64; + + if (*(string + 2) == f_string_ascii_e_s[0]) { + flag |= F_print_format_flag_exponent_d; + string += 2; + } + else if (*(string + 2) == f_string_ascii_E_s[0]) { + flag |= F_print_format_flag_exponent_d | F_print_format_flag_exponent_upper_d; + string += 2; + } + else if (*(string + 2) == f_string_ascii_g_s[0]) { + flag |= F_print_format_flag_exponent_either_d; + string += 2; + } + else if (*(string + 2) == f_string_ascii_G_s[0]) { + flag |= F_print_format_flag_exponent_either_d | F_print_format_flag_exponent_upper_d; + string += 2; + } + else { + ++string; + } + } + else if (*(string + 1) == f_string_ascii_e_s[0]) { + flag |= F_print_format_flag_exponent_d; + ++string; + } + else if (*(string + 1) == f_string_ascii_E_s[0]) { + flag |= F_print_format_flag_exponent_d | F_print_format_flag_exponent_upper_d; + ++string; + } + else if (*(string + 1) == f_string_ascii_g_s[0]) { + flag |= F_print_format_flag_exponent_either_d; + ++string; + } + else if (*(string + 1) == f_string_ascii_G_s[0]) { + flag |= F_print_format_flag_exponent_either_d | F_print_format_flag_exponent_upper_d; + ++string; + } + } + } else if (*string == f_string_ascii_i_s[0]) { type = f_print_format_type_signed_32; @@ -467,10 +564,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in(value.string, partial.start, length, except_at, except_in, output); + *status = private_fl_print_trim_except_in(value.string, partial.start, length, except_at, except_in, stream); } else { - *status = f_print_except_in(value.string, partial.start, length, except_at, except_in, output); + *status = f_print_except_in(value.string, partial.start, length, except_at, except_in, stream); } } else if (flag & F_print_format_flag_ignore_range_d) { @@ -490,10 +587,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in(value.string, partial.start, length, except_at, except_in, output); + *status = private_fl_print_trim_except_in(value.string, partial.start, length, except_at, except_in, stream); } else { - *status = f_print_except_in(value.string, partial.start, length, except_at, except_in, output); + *status = f_print_except_in(value.string, partial.start, length, except_at, except_in, stream); } } else { @@ -513,10 +610,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim(value.string + partial.start, length, output); + *status = private_fl_print_trim(value.string + partial.start, length, stream); } else { - *status = f_print(value.string + partial.start, length, output); + *status = f_print(value.string + partial.start, length, stream); } } } @@ -529,10 +626,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in(value.string, 0, value.used, except_at, except_in, output); + *status = private_fl_print_trim_except_in(value.string, 0, value.used, except_at, except_in, stream); } else { - *status = f_print_except_in_dynamic(value, except_at, except_in, output); + *status = f_print_except_in_dynamic(value, except_at, except_in, stream); } } else if (flag & F_print_format_flag_ignore_range_d) { @@ -540,18 +637,18 @@ extern "C" { const f_string_ranges_t except_in = va_arg(*ap, f_string_ranges_t); if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in(value.string, 0, value.used, except_at, except_in, output); + *status = private_fl_print_trim_except_in(value.string, 0, value.used, except_at, except_in, stream); } else { - *status = f_print_except_in_dynamic(value, except_at, except_in, output); + *status = f_print_except_in_dynamic(value, except_at, except_in, stream); } } else { if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim(value.string, value.used, output); + *status = private_fl_print_trim(value.string, value.used, stream); } else { - *status = f_print_dynamic(value, output); + *status = f_print_dynamic(value, stream); } } @@ -591,10 +688,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_raw(value.string, partial.start, length, except_at, except_in, output); + *status = private_fl_print_trim_except_in_raw(value.string, partial.start, length, except_at, except_in, stream); } else { - *status = f_print_except_in_raw(value.string, partial.start, length, except_at, except_in, output); + *status = f_print_except_in_raw(value.string, partial.start, length, except_at, except_in, stream); } } else if (flag & F_print_format_flag_ignore_range_d) { @@ -614,10 +711,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_raw(value.string, partial.start, length, except_at, except_in, output); + *status = private_fl_print_trim_except_in_raw(value.string, partial.start, length, except_at, except_in, stream); } else { - *status = f_print_except_in_raw(value.string, partial.start, length, except_at, except_in, output); + *status = f_print_except_in_raw(value.string, partial.start, length, except_at, except_in, stream); } } else { @@ -637,10 +734,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_raw(value.string + partial.start, length, output); + *status = private_fl_print_trim_raw(value.string + partial.start, length, stream); } else { - *status = f_print_raw(value.string + partial.start, length, output); + *status = f_print_raw(value.string + partial.start, length, stream); } } } @@ -653,10 +750,10 @@ extern "C" { } if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_raw(value.string, 0, value.used, except_at, except_in, output); + *status = private_fl_print_trim_except_in_raw(value.string, 0, value.used, except_at, except_in, stream); } else { - *status = f_print_except_in_dynamic_raw(value, except_at, except_in, output); + *status = f_print_except_in_dynamic_raw(value, except_at, except_in, stream); } } else if (flag & F_print_format_flag_ignore_range_d) { @@ -664,18 +761,18 @@ extern "C" { const f_string_ranges_t except_in = va_arg(*ap, f_string_ranges_t); if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_except_in_raw(value.string, 0, value.used, except_at, except_in, output); + *status = private_fl_print_trim_except_in_raw(value.string, 0, value.used, except_at, except_in, stream); } else { - *status = f_print_except_in_dynamic_raw(value, except_at, except_in, output); + *status = f_print_except_in_dynamic_raw(value, except_at, except_in, stream); } } else { if (flag & F_print_format_flag_trim_d) { - *status = private_fl_print_trim_raw(value.string, value.used, output); + *status = private_fl_print_trim_raw(value.string, value.used, stream); } else { - *status = f_print_dynamic_raw(value, output); + *status = f_print_dynamic_raw(value, stream); } } @@ -684,7 +781,7 @@ extern "C" { else if (*string == f_string_ascii_s_s[0]) { const f_string_t value = va_arg(*ap, f_string_t); - *status = f_print_terminated(value, output); + *status = f_print_terminated(value, stream); return string; } @@ -752,6 +849,15 @@ extern "C" { conversion_data.flag |= F_conversion_data_flag_zeros_leading_d; } + if (flag & F_print_format_flag_width_value_d) { + width = va_arg(*ap, int); + } + + if (flag & F_print_format_flag_precision_value_d) { + precision = va_arg(*ap, int); + } + + // @fixme precision and with can be used togethor, see: "'%10.2f'". if (flag & F_print_format_flag_width_d) { conversion_data.width = width; } @@ -760,51 +866,143 @@ extern "C" { } if (type == f_print_format_type_signed_number) { - *status = f_conversion_number_signed_print(va_arg(*ap, f_number_signed_t), conversion_data, output); + *status = f_conversion_number_signed_print(va_arg(*ap, f_number_signed_t), conversion_data, stream); } else if (type == f_print_format_type_signed_64) { - *status = f_conversion_number_signed_print((f_number_signed_t) va_arg(*ap, int64_t), conversion_data, output); + *status = f_conversion_number_signed_print((f_number_signed_t) va_arg(*ap, int64_t), conversion_data, stream); } else if (type == f_print_format_type_signed_128) { - *status = f_conversion_number_signed_print((f_number_signed_t) va_arg(*ap, f_int_128_t), conversion_data, output); + *status = f_conversion_number_signed_print((f_number_signed_t) va_arg(*ap, f_int_128_t), conversion_data, stream); } else if (type == f_print_format_type_signed_32) { - *status = f_conversion_number_signed_print((f_number_signed_t) va_arg(*ap, int32_t), conversion_data, output); + *status = f_conversion_number_signed_print((f_number_signed_t) va_arg(*ap, int32_t), conversion_data, stream); } else if (type == f_print_format_type_signed_16) { const int16_t value = (int16_t) va_arg(*ap, int); - *status = f_conversion_number_signed_print((f_number_signed_t) value, conversion_data, output); + *status = f_conversion_number_signed_print((f_number_signed_t) value, conversion_data, stream); } else if (type == f_print_format_type_signed_8) { const int8_t value = (int8_t) va_arg(*ap, int); - *status = f_conversion_number_signed_print((f_number_signed_t) value, conversion_data, output); + *status = f_conversion_number_signed_print((f_number_signed_t) value, conversion_data, stream); } else if (type == f_print_format_type_size) { - *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, size_t), conversion_data, output); + *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, size_t), conversion_data, stream); } else if (type == f_print_format_type_unsigned_32) { - *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, uint32_t), conversion_data, output); + *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, uint32_t), conversion_data, stream); } else if (type == f_print_format_type_unsigned_16) { const uint16_t value = (uint16_t) va_arg(*ap, unsigned); - *status = f_conversion_number_unsigned_print((f_number_unsigned_t) value, conversion_data, output); + *status = f_conversion_number_unsigned_print((f_number_unsigned_t) value, conversion_data, stream); } else if (type == f_print_format_type_unsigned_8) { const uint8_t value = (uint8_t) va_arg(*ap, unsigned); - *status = f_conversion_number_unsigned_print((f_number_unsigned_t) value, conversion_data, output); + *status = f_conversion_number_unsigned_print((f_number_unsigned_t) value, conversion_data, stream); } else if (type == f_print_format_type_unsigned_64) { - *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, uint64_t), conversion_data, output); + *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, uint64_t), conversion_data, stream); } else if (type == f_print_format_type_unsigned_128) { - *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, f_uint_128_t), conversion_data, output); + *status = f_conversion_number_unsigned_print((f_number_unsigned_t) va_arg(*ap, f_uint_128_t), conversion_data, stream); } else if (type == f_print_format_type_unsigned_number) { - *status = f_conversion_number_unsigned_print(va_arg(*ap, f_number_unsigned_t), conversion_data, output); + *status = f_conversion_number_unsigned_print(va_arg(*ap, f_number_unsigned_t), conversion_data, stream); + } + else if (type == f_print_format_type_double_32 || type == f_print_format_type_double_64) { + int f = 0; + char format[32]; + char buffer[128]; + + format[f++] = '%'; + + if (flag & F_print_format_flag_sign_always_d) { + format[f++] = '+'; + } + else if (flag & F_print_format_flag_sign_pad_d) { + format[f++] = ' '; + } + + if (flag & F_print_format_flag_align_left_d) { + format[f++] = '-'; + } + + if (flag & F_print_format_flag_zeros_leading_d) { + format[f++] = '0'; + } + + if (flag & F_print_format_flag_width_d) { + format[f++] = '*'; + } + + if (flag & F_print_format_flag_precision_d) { + format[f++] = '.'; + format[f++] = '*'; + } + + if (flag & F_print_format_flag_exponent_d) { + if (flag & F_print_format_flag_exponent_upper_d) { + format[f++] = 'E'; + } + else { + format[f++] = 'e'; + } + } + else if (flag & F_print_format_flag_exponent_either_d) { + if (flag & F_print_format_flag_exponent_upper_d) { + format[f++] = 'G'; + } + else { + format[f++] = 'g'; + } + } + else { + format[f++] = 'f'; + } + + format[f] = 0; + + if (type == f_print_format_type_double_32) { + const double value = va_arg(*ap, double); + + if (flag & F_print_format_flag_width_d) { + if (flag & F_print_format_flag_precision_d) { + snprintf(buffer, 128, format, width, precision, value); + } + else { + snprintf(buffer, 128, format, width, value); + } + } + else if (flag & F_print_format_flag_precision_d) { + snprintf(buffer, 128, format, precision, value); + } + else { + snprintf(buffer, 128, format, value); + } + } + else { + const long double value = va_arg(*ap, long double); + + if (flag & F_print_format_flag_width_d) { + if (flag & F_print_format_flag_precision_d) { + snprintf(buffer, 128, format, width, precision, value); + } + else { + snprintf(buffer, 128, format, width, value); + } + } + else if (flag & F_print_format_flag_precision_d) { + snprintf(buffer, 128, format, precision, value); + } + else { + snprintf(buffer, 128, format, value); + } + } + + *status = f_print_terminated(buffer, stream); } return string; @@ -821,7 +1019,7 @@ extern "C" { for (*number = 0; *string; string += 1) { - if (*string > 0x29 && *string < 0x40) { + if (*string > 0x2f && *string < 0x3a) { *number *= 10; *number += 0xf & *string; } @@ -840,7 +1038,7 @@ extern "C" { #endif // !defined(_di_fl_print_format_) || !defined(_di_fl_print_format_convert_) #if !defined(_di_fl_print_trim_except_) || !defined(_di_fl_print_trim_except_dynamic_) || !defined(_di_fl_print_trim_except_dynamic_partial_) || !defined(_di_fl_print_trim_except_in_) || !defined(_di_fl_print_trim_except_in_dynamic_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_) - f_status_t private_fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t private_fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { f_array_length_t i = offset; f_array_length_t j = 0; @@ -1012,22 +1210,22 @@ extern "C" { return F_status_set_error(F_complete_not_utf_stop); } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1064,22 +1262,22 @@ extern "C" { return F_status_set_error(F_utf_not); } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1094,7 +1292,7 @@ extern "C" { #endif // !defined(_di_fl_print_trim_except_) || !defined(_di_fl_print_trim_except_dynamic_) || !defined(_di_fl_print_trim_except_dynamic_partial_) || !defined(_di_fl_print_trim_except_in_) || !defined(_di_fl_print_trim_except_in_dynamic_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_) #if !defined(_di_fl_print_trim_except_raw_) || !defined(_di_fl_print_trim_except_dynamic_raw_) || !defined(_di_fl_print_trim_except_dynamic_partial_raw_) || !defined(_di_fl_print_trim_except_in_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_raw_) - f_status_t private_fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t private_fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { f_array_length_t i = offset; f_array_length_t j = 0; @@ -1233,22 +1431,22 @@ extern "C" { continue; } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1 && i + 1 < length) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2 && i + 2 < length) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3 && i + 3 < length) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1261,22 +1459,22 @@ extern "C" { if (i >= length) break; } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1 && i + 1 < length) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2 && i + 2 < length) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3 && i + 3 < length) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1291,7 +1489,7 @@ extern "C" { #endif // !defined(_di_fl_print_trim_except_raw_) || !defined(_di_fl_print_trim_except_dynamic_raw_) || !defined(_di_fl_print_trim_except_dynamic_partial_raw_) || !defined(_di_fl_print_trim_except_in_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_raw_) #if !defined(_di_fl_print_trim_except_safely_) || !defined(_di_fl_print_trim_except_dynamic_safely_) || !defined(_di_fl_print_trim_except_dynamic_partial_safely_) || !defined(_di_fl_print_trim_except_in_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_safely_) - f_status_t private_fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) { + f_status_t private_fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) { f_array_length_t i = offset; f_array_length_t j = 0; @@ -1431,15 +1629,15 @@ extern "C" { } if (i + macro_f_utf_byte_width(string[i]) >= length) { - if (!fputc_unlocked(f_print_sequence_unknown_s[0], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[0], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[1], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[1], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[2], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[2], stream)) { return F_status_set_error(F_output); } @@ -1456,22 +1654,22 @@ extern "C" { status = f_utf_is_valid(string + i, length - i); if (status == F_true) { - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1479,15 +1677,15 @@ extern "C" { } } else { - if (!fputc_unlocked(f_print_sequence_unknown_s[0], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[0], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[1], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[1], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[2], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[2], stream)) { return F_status_set_error(F_output); } } @@ -1509,15 +1707,15 @@ extern "C" { } if (status == F_false || i + macro_f_utf_byte_width(string[i]) >= length) { - if (!fputc_unlocked(f_print_sequence_unknown_s[0], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[0], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[1], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[1], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[2], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[2], stream)) { return F_status_set_error(F_output); } @@ -1531,22 +1729,22 @@ extern "C" { continue; } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1561,7 +1759,7 @@ extern "C" { #endif // !defined(_di_fl_print_trim_except_safely_) || !defined(_di_fl_print_trim_except_dynamic_safely_) || !defined(_di_fl_print_trim_except_dynamic_partial_safely_) || !defined(_di_fl_print_trim_except_in_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_safely_) #if !defined(_di_fl_print_trim_) || !defined(_di_fl_print_trim_dynamic_) || !defined(_di_fl_print_trim_dynamic_partial_) - f_status_t private_fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *output) { + f_status_t private_fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *stream) { f_array_length_t i = 0; f_array_length_t j = 0; @@ -1647,22 +1845,22 @@ extern "C" { return F_status_set_error(F_complete_not_utf_stop); } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1700,22 +1898,22 @@ extern "C" { } // @todo change logic to use single fwrite() based on byte width rather than multiple fputc... - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1730,7 +1928,7 @@ extern "C" { #endif // !defined(_di_fl_print_trim_) || !defined(_di_fl_print_trim_dynamic_) || !defined(_di_fl_print_trim_dynamic_partial_) #if !defined(_di_fl_print_trim_raw_) || !defined(_di_fl_print_trim_dynamic_raw_) || !defined(_di_fl_print_trim_dynamic_partial_raw_) - f_status_t private_fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *output) { + f_status_t private_fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *stream) { f_array_length_t i = 0; f_array_length_t j = 0; @@ -1783,22 +1981,22 @@ extern "C" { // print all processed whitespace (note: control characters are not whitespace so no checks for this are needed). while (i < j) { - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1 && i + 1 < length) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2 && i + 2 < length) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3 && i + 3 < length) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1811,22 +2009,22 @@ extern "C" { if (i >= length) break; } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1 && i + 1 < length) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2 && i + 2 < length) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3 && i + 3 < length) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1841,7 +2039,7 @@ extern "C" { #endif // !defined(_di_fl_print_trim_raw_) || !defined(_di_fl_print_trim_dynamic_raw_) || !defined(_di_fl_print_trim_dynamic_partial_raw_) #if !defined(_di_fl_print_trim_safely_) || !defined(_di_fl_print_trim_dynamic_safely_) || !defined(_di_fl_print_trim_dynamic_partial_safely_) - f_status_t private_fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *output) { + f_status_t private_fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *stream) { f_array_length_t i = 0; f_array_length_t j = 0; @@ -1895,15 +2093,15 @@ extern "C" { while (i < j) { if (i + macro_f_utf_byte_width(string[i]) >= length) { - if (!fputc_unlocked(f_print_sequence_unknown_s[0], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[0], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[1], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[1], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[2], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[2], stream)) { return F_status_set_error(F_output); } @@ -1920,22 +2118,22 @@ extern "C" { status = f_utf_is_valid(string + i, length - i); if (status == F_true) { - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } @@ -1943,15 +2141,15 @@ extern "C" { } } else { - if (!fputc_unlocked(f_print_sequence_unknown_s[0], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[0], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[1], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[1], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[2], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[2], stream)) { return F_status_set_error(F_output); } } @@ -1973,15 +2171,15 @@ extern "C" { } if (status == F_false || i + macro_f_utf_byte_width(string[i]) >= length) { - if (!fputc_unlocked(f_print_sequence_unknown_s[0], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[0], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[1], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[1], stream)) { return F_status_set_error(F_output); } - if (!fputc_unlocked(f_print_sequence_unknown_s[2], output)) { + if (!fputc_unlocked(f_print_sequence_unknown_s[2], stream)) { return F_status_set_error(F_output); } @@ -1995,22 +2193,22 @@ extern "C" { continue; } - if (!fputc_unlocked(string[i], output)) { + if (!fputc_unlocked(string[i], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 1) { - if (!fputc_unlocked(string[i + 1], output)) { + if (!fputc_unlocked(string[i + 1], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 2) { - if (!fputc_unlocked(string[i + 2], output)) { + if (!fputc_unlocked(string[i + 2], stream)) { return F_status_set_error(F_output); } if (macro_f_utf_byte_width(string[i]) > 3) { - if (!fputc_unlocked(string[i + 3], output)) { + if (!fputc_unlocked(string[i + 3], stream)) { return F_status_set_error(F_output); } } diff --git a/level_1/fl_print/c/private-print.h b/level_1/fl_print/c/private-print.h index 5c32fa8..ac58b30 100644 --- a/level_1/fl_print/c/private-print.h +++ b/level_1/fl_print/c/private-print.h @@ -23,7 +23,7 @@ extern "C" { * * @param string * The current character position within the string. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * @param ap * The variable arguments list. @@ -71,7 +71,7 @@ extern "C" { * @see private_fl_print_convert_number() */ #if !defined(_di_fl_print_format_) || !defined(_di_fl_print_format_convert_) - extern f_string_t private_fl_print_format_convert(f_string_t string, FILE *output, va_list *ap, f_status_t *status) F_attribute_visibility_internal_d; + extern f_string_t private_fl_print_format_convert(f_string_t string, FILE *stream, va_list *ap, f_status_t *status) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_format_) || !defined(_di_fl_print_format_convert_) /** @@ -115,7 +115,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -140,7 +140,7 @@ extern "C" { * @see fl_print_trim_except_in_dynamic_partial() */ #if !defined(_di_fl_print_trim_except_) || !defined(_di_fl_print_trim_except_dynamic_) || !defined(_di_fl_print_trim_except_dynamic_partial_) || !defined(_di_fl_print_trim_except_in_) || !defined(_di_fl_print_trim_except_in_dynamic_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_) - extern f_status_t private_fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) F_attribute_visibility_internal_d; + extern f_status_t private_fl_print_trim_except_in(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_trim_except_) || !defined(_di_fl_print_trim_except_dynamic_) || !defined(_di_fl_print_trim_except_dynamic_partial_) || !defined(_di_fl_print_trim_except_in_) || !defined(_di_fl_print_trim_except_in_dynamic_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_) /** @@ -160,7 +160,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -183,7 +183,7 @@ extern "C" { * @see fl_print_trim_except_in_dynamic_partial_raw() */ #if !defined(_di_fl_print_trim_except_raw_) || !defined(_di_fl_print_trim_except_dynamic_raw_) || !defined(_di_fl_print_trim_except_dynamic_partial_raw_) || !defined(_di_fl_print_trim_except_in_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_raw_) - extern f_status_t private_fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) F_attribute_visibility_internal_d; + extern f_status_t private_fl_print_trim_except_in_raw(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_trim_except_raw_) || !defined(_di_fl_print_trim_except_dynamic_raw_) || !defined(_di_fl_print_trim_except_dynamic_partial_raw_) || !defined(_di_fl_print_trim_except_in_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_raw_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_raw_) /** @@ -203,7 +203,7 @@ extern "C" { * @param except_in * An array of ranges within the string to not print. * The array of ranges is required/assumed to be in linear order. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -227,7 +227,7 @@ extern "C" { * @see fl_print_trim_except_in_dynamic_partial_safely() */ #if !defined(_di_fl_print_trim_except_safely_) || !defined(_di_fl_print_trim_except_dynamic_safely_) || !defined(_di_fl_print_trim_except_dynamic_partial_safely_) || !defined(_di_fl_print_trim_except_in_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_safely_) - extern f_status_t private_fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *output) F_attribute_visibility_internal_d; + extern f_status_t private_fl_print_trim_except_in_safely(const f_string_t string, const f_array_length_t offset, const f_array_length_t length, const f_array_lengths_t except_at, const f_string_ranges_t except_in, FILE *stream) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_trim_except_safely_) || !defined(_di_fl_print_trim_except_dynamic_safely_) || !defined(_di_fl_print_trim_except_dynamic_partial_safely_) || !defined(_di_fl_print_trim_except_in_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_safely_) || !defined(_di_fl_print_trim_except_in_dynamic_partial_safely_) /** @@ -239,7 +239,7 @@ extern "C" { * The string to output. * @param length * The total number of characters to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -261,7 +261,7 @@ extern "C" { * @see fl_print_trim_dynamic_partial() */ #if !defined(_di_fl_print_trim_) || !defined(_di_fl_print_trim_dynamic_) || !defined(_di_fl_print_trim_dynamic_partial_) - extern f_status_t private_fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *output) F_attribute_visibility_internal_d; + extern f_status_t private_fl_print_trim(const f_string_t string, const f_array_length_t length, FILE *stream) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_trim_) || !defined(_di_fl_print_trim_dynamic_) || !defined(_di_fl_print_trim_dynamic_partial_) /** @@ -273,7 +273,7 @@ extern "C" { * The string to output. * @param length * The total number of characters to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -293,7 +293,7 @@ extern "C" { * @see fl_print_trim_dynamic_partial_raw() */ #if !defined(_di_fl_print_trim_raw_) || !defined(_di_fl_print_trim_dynamic_raw_) || !defined(_di_fl_print_trim_dynamic_partial_raw_) - extern f_status_t private_fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *output) F_attribute_visibility_internal_d; + extern f_status_t private_fl_print_trim_raw(const f_string_t string, const f_array_length_t length, FILE *stream) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_trim_raw_) || !defined(_di_fl_print_trim_dynamic_raw_) || !defined(_di_fl_print_trim_dynamic_partial_raw_) /** @@ -305,7 +305,7 @@ extern "C" { * The string to output. * @param length * The total number of characters to print. - * @param output + * @param stream * The file stream to output to, including standard streams such as stdout and stderr. * * @return @@ -326,7 +326,7 @@ extern "C" { * @see fl_print_trim_dynamic_partial_safely() */ #if !defined(_di_fl_print_trim_safely_) || !defined(_di_fl_print_trim_dynamic_safely_) || !defined(_di_fl_print_trim_dynamic_partial_safely_) - extern f_status_t private_fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *output) F_attribute_visibility_internal_d; + extern f_status_t private_fl_print_trim_safely(const f_string_t string, const f_array_length_t length, FILE *stream) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_print_trim_safely_) || !defined(_di_fl_print_trim_dynamic_safely_) || !defined(_di_fl_print_trim_dynamic_partial_safely_) #ifdef __cplusplus