2 * This file is part of cparser.
3 * Copyright (C) 2007-2009 Matthias Braun <matze@braunis.de>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 * @brief Abstracts away printing strings to a stream so we can reuse our
24 * printing routines for printing to files or into memory
33 #include "string_rep.h"
35 /** print a string into current output */
36 extern void (*print_string)(const char *str);
37 extern void (*print_vformat)(const char *format, va_list ap);
38 /** print a single unicode character to current output (encoded as UTF-8) */
39 extern void (*print_char)(wchar_rep_t c);
41 /** print a printf style format string to current output */
42 static inline void __attribute__((format(printf,1,2))) print_format(const char *format, ...)
46 print_vformat(format, ap);
50 /** Set current output to be a FILE* stream */
51 void print_to_file(FILE *out);
53 /** Set current output to an obstack (grows an object on the obstack) */
54 void print_to_obstack(struct obstack *obst);
56 /** Set current output to be a buffer with limited size */
57 void print_to_buffer(char *buffer, size_t buffer_size);
59 /** Assures that the string in the buffer is 0 terminated */
60 void finish_print_to_buffer(void);
62 /** push current printer output to the (printer output) stack */
63 void printer_push(void);
65 /** pop a printer output from the stack */
66 void printer_pop(void);