This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] implement putchar_filtered()
- To: Nicholas Duffek <nsd at redhat dot com>
- Subject: Re: [RFA] implement putchar_filtered()
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Wed, 03 Jan 2001 16:22:48 -0500
- CC: gdb-patches at sources dot redhat dot com
- Organization: Red Hat , Inc. - Toronto
- References: <200101032042.PAA14840@nog.bosbc.com>
We should not be using the functions that default to gdb_stdout anymore.
This makes it impossible to have gdb as a library, to have script
languages front ends etc.
The fputc_filtered() is useful during the transition as it has the
stream as a parameter that can be set to a memory file and retrieved
by the caller.
Fernando
Nicholas Duffek wrote:
>
> This patch adds putchar_filtered() to the collection of stdio-like
> _filtered and _unfiltered functions in utils.c.
>
> ChangeLog:
>
> * defs.h (putchar_filtered): Prototype.
> * utils.c (putchar_filtered): Define.
>
> No regressions on i686-pc-linux-gnu. Okay to apply?
>
> Nicholas Duffek
> <nsd@redhat.com>
>
> [patch follows]
>
> Index: gdb/defs.h
> ===================================================================
> diff -up gdb/defs.h gdb/defs.h
> --- gdb/defs.h Tue Dec 19 11:13:25 2000
> +++ gdb/defs.h Tue Dec 19 11:13:09 2000
> @@ -446,6 +446,8 @@ extern int fputc_filtered (int c, struct
>
> extern int fputc_unfiltered (int c, struct ui_file *);
>
> +extern int putchar_filtered (int c);
> +
> extern int putchar_unfiltered (int c);
>
> extern void puts_filtered (const char *);
> Index: gdb/utils.c
> ===================================================================
> diff -up gdb/utils.c gdb/utils.c
> --- gdb/utils.c Tue Dec 19 11:13:48 2000
> +++ gdb/utils.c Tue Dec 19 11:13:09 2000
> @@ -1867,6 +1867,12 @@ putchar_unfiltered (int c)
> }
>
> int
> +putchar_filtered (int c)
> +{
> + return fputc_filtered (c, gdb_stdout);
> +}
> +
> +int
> fputc_unfiltered (int c, struct ui_file *stream)
> {
> char buf = c;
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9