Petr Machata | d71cf2d | 2012-01-05 18:28:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of ltrace. |
Petr Machata | 8a730f3 | 2013-11-21 20:43:51 +0100 | [diff] [blame] | 3 | * Copyright (C) 2011, 2012, 2013 Petr Machata, Red Hat Inc. |
Petr Machata | d71cf2d | 2012-01-05 18:28:31 +0100 | [diff] [blame] | 4 | * Copyright (C) 2009 Juan Cespedes |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of the |
| 9 | * License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 19 | * 02110-1301 USA |
| 20 | */ |
Petr Machata | e19b781 | 2012-11-01 22:16:30 +0100 | [diff] [blame] | 21 | #ifndef _OUTPUT_H_ |
| 22 | #define _OUTPUT_H_ |
Petr Machata | d71cf2d | 2012-01-05 18:28:31 +0100 | [diff] [blame] | 23 | |
Petr Machata | e19b781 | 2012-11-01 22:16:30 +0100 | [diff] [blame] | 24 | #include "fetch.h" |
Petr Machata | d71cf2d | 2012-01-05 18:28:31 +0100 | [diff] [blame] | 25 | #include "forward.h" |
| 26 | |
Petr Machata | 929bd57 | 2012-12-17 03:20:34 +0100 | [diff] [blame] | 27 | void output_line(struct process *proc, const char *fmt, ...); |
| 28 | void output_left(enum tof type, struct process *proc, |
Petr Machata | 29add4f | 2012-02-18 16:38:05 +0100 | [diff] [blame] | 29 | struct library_symbol *libsym); |
Petr Machata | 929bd57 | 2012-12-17 03:20:34 +0100 | [diff] [blame] | 30 | void output_right(enum tof type, struct process *proc, |
Petr Machata | 8a730f3 | 2013-11-21 20:43:51 +0100 | [diff] [blame] | 31 | struct library_symbol *libsym, |
| 32 | struct timedelta *spent); |
Petr Machata | d71cf2d | 2012-01-05 18:28:31 +0100 | [diff] [blame] | 33 | |
Petr Machata | 9c40098 | 2012-11-01 22:15:01 +0100 | [diff] [blame] | 34 | /* This function is for emitting lists of comma-separated strings. |
| 35 | * |
| 36 | * STREAM is where the output should be eventually sent. |
| 37 | * |
| 38 | * WRITER is the function to do the output. It returns number of |
| 39 | * characters written, or a negative value if there were errors (like |
| 40 | * what fprintf does). If WRITER returns 0, it means nothing was |
Petr Machata | f160884 | 2012-11-03 15:18:46 +0100 | [diff] [blame] | 41 | * written, and separator shouldn't therefore be emitted either. |
Petr Machata | 9c40098 | 2012-11-01 22:15:01 +0100 | [diff] [blame] | 42 | * |
| 43 | * NEED_DELIMP serves for keeping state between calls. It should |
| 44 | * point to a variable that is initialized to 0. DATA is passed |
| 45 | * verbatim to the WRITER. |
| 46 | * |
| 47 | * Returns number of characters written to STREAM (including any |
| 48 | * separators), or a negative value if there were errors. */ |
| 49 | int delim_output(FILE *stream, int *need_delimp, |
| 50 | int (*writer)(FILE *stream, void *data), void *data); |
| 51 | |
Petr Machata | adec201 | 2012-11-01 22:05:04 +0100 | [diff] [blame] | 52 | /* If C is positive, add it to *COUNTP. Returns C. */ |
| 53 | int account_output(int *countp, int c); |
| 54 | |
Petr Machata | 89c5ca2 | 2012-10-27 00:49:38 +0200 | [diff] [blame] | 55 | void report_error(char const *file, unsigned line_no, const char *fmt, ...); |
| 56 | void report_warning(char const *file, unsigned line_no, const char *fmt, ...); |
| 57 | void report_global_error(const char *fmt, ...); |
Petr Machata | e19b781 | 2012-11-01 22:16:30 +0100 | [diff] [blame] | 58 | |
| 59 | #endif /* _OUTPUT_H_ */ |