Lines Matching refs:Out
20 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42 } Out;
44 void out_init_file(Out* out, FILE* f) {
45 memset(out, 0, sizeof(*out));
46 out->file = f;
49 void out_init_buffer(Out* out, wchar_t* buffer, size_t buffer_size) {
50 memset(out, 0, sizeof(*out));
51 out->buffer = buffer;
52 out->buffer_pos = 0;
53 out->buffer_size = buffer_size;
56 void out_write(Out* out, const wchar_t* text, size_t length) {
57 if (out->file != NULL) {
63 fwrite(mb_buffer, 1, mb_len, out->file);
67 size_t avail = out->buffer_size - out->buffer_pos;
70 memcpy((char*)(out->buffer + out->buffer_pos),
73 out->buffer_pos += length;
77 void out_putwc(Out* out, wchar_t wc) {
78 if (out->file)
79 fputwc(wc, out->file);
81 if (out->buffer_pos < out->buffer_size)
82 out->buffer[out->buffer_pos++] = wc;
86 int out_printf(Out* out, const char* format, ...) {
89 if (out->file)
90 return vfprintf(out->file, format, args);
102 out_write(out, wide_buffer, wide_len);
111 int out_error(Out* out) {
112 if (out->file != NULL)
113 return ferror(out->file);
118 int out_overflow(Out* out) {
119 if (out->file != NULL)
120 return feof(out->file);
122 return (out->buffer_pos >= out->buffer_size);
278 static int wprintf_core(Out *out, const wchar_t *fmt, va_list *ap, union arg *nl_arg, int *nl_type)
297 if (!out_error(out)) errno = EOVERFLOW;
309 if (out) out_write(out, a, l);
333 w = out ? va_arg(*ap, int) : 0;
346 p = out ? va_arg(*ap, int) : 0;
367 else if (!out) continue;
370 else if (out) pop_arg(&arg, st, ap);
374 if (!out) continue;
391 out_putwc(out, btowc(arg.i));
395 out_putwc(out, arg.i);
404 if (!(fl&LEFT_ADJ)) out_printf(out, "%.*s", w-p, "");
405 out_write(out, a, p);
406 if ((fl&LEFT_ADJ)) out_printf(out, "%.*s", w-p, "");
416 if (!(fl&LEFT_ADJ)) out_printf(out, "%.*s", w-p, "");
421 out_putwc(out, wc);
423 if ((fl&LEFT_ADJ)) out_printf(out, "%.*s", w-p, "");
438 l = out_printf(out, charfmt, w, p, arg.f);
441 l = out_printf(out, charfmt, w, p, arg.i);
446 if (out) return cnt;
462 Out out[1];
463 out_init_file(out, f);
470 ret = wprintf_core(out, fmt, &ap2, nl_arg, nl_type);
481 Out out[1];
482 out_init_buffer(out, s, l);
484 ret = wprintf_core(out, fmt, &ap2, nl_arg, nl_type);
486 if (out_overflow(out)) return -1;