1 /* 2 * Copyright (c) 2008 Travis Geiselbrecht 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #pragma once 9 10 #include <stdarg.h> 11 #include <lk/compiler.h> 12 #include <stddef.h> 13 14 __BEGIN_CDECLS 15 16 /* printf engine that parses the format string and generates output */ 17 18 /* function pointer to pass the printf engine, called back during the formatting. 19 * input is a string to output, length bytes to output, 20 * return code is number of characters that would have been written, or error code (if negative) 21 */ 22 typedef int (*_printf_engine_output_func)(const char *str, size_t len, void *state); 23 24 int _printf_engine(_printf_engine_output_func out, void *state, const char *fmt, va_list ap); 25 26 __END_CDECLS 27 28