1// Copyright 2016 The Fuchsia Authors 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 <zircon/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 */ 22typedef int (*_printf_engine_output_func)(const char *str, size_t len, void *state); 23 24#ifndef PRINTF_DECL 25#define PRINTF_DECL(name) int name 26#endif 27#ifndef PRINTF_CALL 28#define PRINTF_CALL(name) name 29#endif 30 31PRINTF_DECL(_printf_engine)(_printf_engine_output_func out, void *state, const char *fmt, va_list ap); 32 33__END_CDECLS 34