os-workshop

same materials and sample source for RV32 OS projects
git clone http://frotz.net/git/os-workshop.git
Log | Files | Refs

printf-engine.h (747B)


      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 <stddef.h>
     12 
     13 /* printf engine that parses the format string and generates output */
     14 
     15 /* function pointer to pass the printf engine, called back during the formatting.
     16  * input is a string to output, length bytes to output,
     17  * return code is number of characters that would have been written, or error code (if negative)
     18  */
     19 typedef int (*_printf_engine_output_func)(const char *str, size_t len, void *state);
     20 
     21 int _printf_engine(_printf_engine_output_func out, void *state, const char *fmt, va_list ap);
     22