2 * This file is part of cparser.
3 * Copyright (C) 2012 Matthias Braun <matze@braunis.de>
8 * @brief Abstracts away printing strings to a stream so we can reuse our
9 * printing routines for printing to files or into memory
18 #include "string_rep.h"
20 /** print a string into current output */
21 extern void (*print_string)(const char *str);
22 extern void (*print_vformat)(const char *format, va_list ap);
23 extern void (*print_char)(const char c);
25 /** print a printf style format string to current output */
26 static inline void __attribute__((format(printf,1,2))) print_format(const char *format, ...)
30 print_vformat(format, ap);
34 /** Set current output to be a FILE* stream */
35 void print_to_file(FILE *out);
37 /** Set current output to an obstack (grows an object on the obstack) */
38 void print_to_obstack(struct obstack *obst);
40 /** Set current output to be a buffer with limited size */
41 void print_to_buffer(char *buffer, size_t buffer_size);
43 /** Assures that the string in the buffer is 0 terminated */
44 void finish_print_to_buffer(void);
46 /** push current printer output to the (printer output) stack */
47 void printer_push(void);
49 /** pop a printer output from the stack */
50 void printer_pop(void);