[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] in-place edit request
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] in-place edit request |
Date: |
Wed, 26 Dec 2012 16:00:03 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Dec 26, 2012 at 10:42:44PM +0200, Eli Zaretskii wrote:
> If this is about having 'print', 'printf' etc go to some other file in
> some suitably marked portion of an Awk program, why manipulate stdout
> at all? why not just introduce a command that would make 'print'
> etc. use a stream that is different from stdout, a stream that is
> connected to the file where you want the output to go? Then you won't
> have any problems restoring stdout in the first place.
Yes -- that's how other programs such as perl and sed accomplish this. But in
order to take this approach, I think we would have to follow one of two paths:
1. Add a new non-standard built-in awk function to select the output
destination for print and printf statements.
2. Add an extension API hook that would allow an extension to install such
a function.
As discussed previously, I believe there's an existing set_gawk_output function
that probably does what we want, but it is currently used only by the debugger
and is not exposed for other purposes.
I think that's a perfectly reasonable approach, but I think there's a desire to
avoid touching the main gawk source to support this feature. Since it may be
difficult to implement in-place editing in a thoroughly robust way, it might
not make sense to alter the main gawk source code in an attempt to support
this.
If we want to implement in-place editing entirely inside an extension library,
I think we must resort to manipulating stdout.
Regards,
Andy
- Re: [bug-gawk] in-place edit request, (continued)
- Re: [bug-gawk] in-place edit request, Aharon Robbins, 2012/12/23
- Re: [bug-gawk] in-place edit request, Andrew J. Schorr, 2012/12/23
- Re: [bug-gawk] in-place edit request, Aharon Robbins, 2012/12/23
- Re: [bug-gawk] in-place edit request, Eli Zaretskii, 2012/12/23
- Re: [bug-gawk] in-place edit request, Aharon Robbins, 2012/12/25
- Re: [bug-gawk] in-place edit request, Eli Zaretskii, 2012/12/25
- Re: [bug-gawk] in-place edit request, arnold, 2012/12/26
- Re: [bug-gawk] in-place edit request, Eli Zaretskii, 2012/12/26
- Re: [bug-gawk] in-place edit request, Andrew J. Schorr, 2012/12/26
- Re: [bug-gawk] in-place edit request, Eli Zaretskii, 2012/12/26
- Re: [bug-gawk] in-place edit request,
Andrew J. Schorr <=
- Re: [bug-gawk] in-place edit request, Ed Morton, 2012/12/31
- Re: [bug-gawk] in-place edit request, arnold, 2012/12/31
- Re: [bug-gawk] in-place edit request, Ed Morton, 2012/12/31
- Re: [bug-gawk] in-place edit request, arnold, 2012/12/31
- Re: [bug-gawk] in-place edit request, Ed Morton, 2012/12/31
- Re: [bug-gawk] in-place edit request, Andrew J. Schorr, 2012/12/31
- Re: [bug-gawk] in-place edit request, Ed Morton, 2012/12/31
- Re: [bug-gawk] in-place edit request, Andrew J. Schorr, 2012/12/31
- Re: [bug-gawk] in-place edit request, Ed Morton, 2012/12/31
- Re: [bug-gawk] in-place edit request, Andrew J. Schorr, 2012/12/31