#ifndef _di_fl_print_format_
f_status_t fl_print_format(const f_string_t string, FILE *stream, ...) {
#ifndef _di_level_1_parameter_checking_
- if (!string) return 0;
- if (!stream) return 0;
+ if (!string) return F_status_set_error(F_parameter);
+ if (!stream) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
f_status_t status = F_none;
va_start(ap, stream);
- for (f_string_t current = string; *current; current += 1) {
+ for (f_string_t current = string; *current; ++current) {
if (*current == f_string_ascii_percent_s[0]) {
- current += 1;
+ ++current;
current = private_fl_print_format_convert(current, stream, &ap, &status);
if (F_status_is_error(status)) break;
va_end(ap);
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // _di_fl_print_format_
#ifndef _di_fl_print_string_va_
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 (!stream) return 0;
- if (!ap) return 0;
+ if (!string) return F_status_set_error(F_parameter);
+ if (!stream) return F_status_set_error(F_parameter);
+ if (!ap) return F_status_set_error(F_parameter);
#endif // _di_level_1_parameter_checking_
f_status_t status = F_none;
- for (f_string_t current = string; *current; current += 1) {
+ for (f_string_t current = string; *current; ++current) {
if (*current == f_string_ascii_percent_s[0]) {
- current += 1;
+ ++current;
current = private_fl_print_format_convert(current, stream, ap, &status);
if (F_status_is_error(status)) break;
}
} // for
- return status;
+ if (F_status_is_error(status)) return status;
+
+ return F_none;
}
#endif // _di_fl_print_string_va_
* Additional arguments relating to the string.
*
* @return
- * The number of 1-byte characters processed from the string.
- * Any error will will result in the current count at the time of the error to be returned.
+ * F_none on success.
+ *
+ * F_eos (with error bit) on EOS reached.
+ * F_output (with error bit) on failure to print to the output file.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_valid_not (with error bit) on invalid syntax (such as terminating the string on a single '%').
+ *
+ * Errors (with error bit) from: f_conversion_number_signed_print().
+ * Errors (with error bit) from: f_conversion_number_unsigned_print().
+ * Errors (with error bit) from: f_print_dynamic().
+ * Errors (with error bit) from: f_print_dynamic_raw().
+ * Errors (with error bit) from: f_print_dynamic_safely().
+ * Errors (with error bit) from: f_print_safely().
+ * Errors (with error bit) from: f_print_terminated().
*
* @see fprintf()
* @see fputc_unlocked()
* @return
* F_none on success.
*
+ * F_eos (with error bit) on EOS reached.
* F_output (with error bit) on failure to print to the output file.
+ * F_parameter (with error bit) if a parameter is invalid.
* F_valid_not (with error bit) on invalid syntax (such as terminating the string on a single '%').
*
- * Success from: f_print_dynamic().
- * Success from: f_print_dynamic_raw().
- * Success from: f_print_dynamic_safely().
- * Success from: f_print_safely().
- * Success from: f_print_terminated().
- *
* Errors (with error bit) from: f_conversion_number_signed_print().
* Errors (with error bit) from: f_conversion_number_unsigned_print().
* Errors (with error bit) from: f_print_dynamic().