output.h 2.27 KB
Newer Older
1 2
/*
 * This file is part of ltrace.
3
 * Copyright (C) 2011, 2012, 2013 Petr Machata, Red Hat Inc.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * Copyright (C) 2009 Juan Cespedes
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
Petr Machata's avatar
Petr Machata committed
21 22 23

#ifndef OUTPUT_H
#define OUTPUT_H
24

25
#include "fetch.h"
26 27
#include "forward.h"

28 29
void output_line(struct process *proc, const char *fmt, ...);
void output_left(enum tof type, struct process *proc,
30
		 struct library_symbol *libsym);
31
void output_right(enum tof type, struct process *proc,
32 33
		  struct library_symbol *libsym,
		  struct timedelta *spent);
34

Petr Machata's avatar
Petr Machata committed
35 36 37 38 39 40 41
/* This function is for emitting lists of comma-separated strings.
 *
 * STREAM is where the output should be eventually sent.
 *
 * WRITER is the function to do the output.  It returns number of
 * characters written, or a negative value if there were errors (like
 * what fprintf does).  If WRITER returns 0, it means nothing was
Petr Machata's avatar
Petr Machata committed
42
 * written, and separator shouldn't therefore be emitted either.
Petr Machata's avatar
Petr Machata committed
43 44 45 46 47 48 49 50 51 52
 *
 * NEED_DELIMP serves for keeping state between calls.  It should
 * point to a variable that is initialized to 0.  DATA is passed
 * verbatim to the WRITER.
 *
 * Returns number of characters written to STREAM (including any
 * separators), or a negative value if there were errors.  */
int delim_output(FILE *stream, int *need_delimp,
		 int (*writer)(FILE *stream, void *data), void *data);

53 54 55
/* If C is positive, add it to *COUNTP.  Returns C.  */
int account_output(int *countp, int c);

56 57 58
void report_error(char const *file, unsigned line_no, const char *fmt, ...);
void report_warning(char const *file, unsigned line_no, const char *fmt, ...);
void report_global_error(const char *fmt, ...);
59

Petr Machata's avatar
Petr Machata committed
60
#endif /* OUTPUT_H */