f_status_t private_f_print(const f_string_t string, const f_array_length_t length, FILE * const output) {
f_array_length_t total = 0;
+ f_array_length_t count = 0;
+
+ clearerr_unlocked(output);
for (register f_array_length_t i = 0; i < length; ) {
total = F_print_write_max_d;
}
- if (fwrite_unlocked(string + i, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + i + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
i += total;
total = 0;
f_array_length_t j = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
+
+ clearerr_unlocked(output);
while (i < stop) {
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (!string[i] || i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
f_array_length_t in = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
+
+ clearerr_unlocked(output);
while (i < stop) {
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (!string[i] || i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
f_array_length_t in = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
+
+ clearerr_unlocked(output);
while (i < stop) {
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
f_array_length_t in = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
+ clearerr_unlocked(output);
+
while (i < stop) {
while (at < except_at.used && except_at.array[at] < i) {
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (safe.used) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
- if (fwrite_unlocked(safe.string, 1, safe.used, output) < safe.used) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(safe.string + count, 1, safe.used - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < safe.used);
i += width;
start = i;
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
start = i;
} // while
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
}
return F_none;
f_array_length_t in = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
+ clearerr_unlocked(output);
+
while (i < stop) {
while (at < except_at.used && except_at.array[at] < i) {
if (at < except_at.used && except_at.array[at] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (in < except_in.used && except_in.array[in].start <= i && except_in.array[in].stop >= i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
return F_status_set_error(F_output);
}
+ } while (count < total);
+
total = 0;
}
}
else {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (safe.used) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
- if (fwrite_unlocked(safe.string, 1, safe.used, output) < safe.used) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(safe.string + count, 1, safe.used - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < safe.used);
i += width;
start = i;
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
start = i;
} // while
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
}
return F_none;
f_array_length_t j = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
+
+ clearerr_unlocked(output);
while (i < stop) {
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (i + 1 == stop || total == F_print_write_max_d) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
f_array_length_t j = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
+ clearerr_unlocked(output);
+
while (i < stop) {
while (j < except.used && except.array[j] < i) {
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (safe.used) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
- if (fwrite_unlocked(safe.string, 1, safe.used, output) < safe.used) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(safe.string + count, 1, safe.used - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < safe.used);
i += width;
start = i;
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
start = i;
f_array_length_t j = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
+ clearerr_unlocked(output);
+
while (i < stop) {
while (j < except.used && except.array[j] < i) {
if (j < except.used && except.array[j] == i) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
}
else {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (safe.used) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
- if (fwrite_unlocked(safe.string, 1, safe.used, output) < safe.used) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(safe.string + count, 1, safe.used - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < safe.used);
i += width;
start = i;
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
start = i;
#if !defined(_di_f_print_raw_) || !defined(_di_f_print_raw_dynamic_) || !defined(_di_f_print_raw_dynamic_partial_)
f_status_t private_f_print_raw(const f_string_t string, const f_array_length_t length, FILE * const output) {
+ f_array_length_t count = 0;
+
+ clearerr_unlocked(output);
+
if (length < F_print_write_max_d) {
- if (fwrite_unlocked(string, 1, length, output) < length) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + count, 1, length - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < length);
}
else {
for (f_array_length_t total = 0; ; total += F_print_write_max_d) {
if (length - total > F_print_write_max_d) {
- if (fwrite_unlocked(string, 1, F_print_write_max_d, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + count, 1, F_print_write_max_d - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < F_print_write_max_d);
}
else {
- if (fwrite_unlocked(string, 1, length - total, output) < length - total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + count, 1, length - total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < length - total);
break;
}
register f_array_length_t i = 0;
f_array_length_t start = 0;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
+ clearerr_unlocked(output);
+
while (i < length) {
if (string[i]) {
if (safe.used) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
- if (!fwrite_unlocked(safe.string, 1, safe.used, output) < safe.used) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(safe.string + count, 1, safe.used - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < safe.used);
i += width;
start = i;
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
start = i;
} // while
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
}
return F_none;
register f_array_length_t i = 0;
f_array_length_t start = 0;
f_array_length_t total = 0;
+ f_array_length_t count = 0;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
+ clearerr_unlocked(output);
+
while (i < length) {
if (string[i]) {
}
else {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
if (safe.used) {
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
}
- if (!fwrite_unlocked(safe.string, 1, safe.used, output) < safe.used) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(safe.string + count, 1, safe.used - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
i += width;
start = i;
}
if (total + width >= F_print_write_max_d) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
total = 0;
start = i;
} // while
if (total) {
- if (fwrite_unlocked(string + start, 1, total, output) < total) {
- return F_status_set_error(F_output);
- }
+ count = 0;
+
+ do {
+ count += fwrite_unlocked(string + start + count, 1, total - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < total);
}
return F_none;
f_status_t private_f_print_terminated(const f_string_t string, FILE * const output) {
const size_t length = strlen(string);
+ f_array_length_t count = 0;
- if (fwrite_unlocked(string, 1, length, output) < length) {
- return F_status_set_error(F_output);
- }
+ clearerr_unlocked(output);
+
+ do {
+ count += fwrite_unlocked(string + count, 1, length - count, output);
+
+ if (ferror_unlocked(output)) {
+ return F_status_set_error(F_output);
+ }
+
+ } while (count < length);
return F_none;
}