I am actively working on built-in file inclusion for gawk; the basics are
implemented but I have to make a final decision on what it will look like.
This issue has been discussed here before. In order to get feedback from
"the community" in a semi-organized fashion, Tim Menzies has helped me
to put up a poll at awk.info.
It can be found at http://awk.info/poll/index.html.
This is the way to provide input to me: discussion in the group will not
carry any weight. I will read but most likely otherwise ignore direct
emails about the topics covered in the poll.
Given that we're now in the holiday season, I will leave the poll up
until at least January 9.
Thanks,
Arnold
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL
Even if one can probably find the correct thread with Google I think it
would be helpful to provide a link to that discussion. I suppose this one
is meant: http://tinyurl.com/yen2twd
But OTOH the actual topic in the poll, "how to implement file inclusion",
sounds as something more simple - something like C's #inlude - than what
had been discussed in that old topic, and you seem to not have commented
that old thread, so probably it's unrelated? Anyway, a link to the thread
or a 3-line rationale what goal to achieve would be helpful, I'm sure.
Janis
I am instead asking for input on a mechanism similar to C's #include,
for adding additional awk source code to the program to be run.
Arnold
In article <hgk96d$sf8$1...@svr7.m-online.net>,
Thanks for clarifying.[*]
I thought that feature would already be part of gawk, but, apparently, I
seem to be confusing that, maybe with xgawk; there's at least some @include
directive there. In case the same semantics is planned for gawk as already
existing in xgawk, wouldn't it make sense to merge those concepts? (Just
asking.)
Janis
[*] That URL was the best match when googling for "file inclusion", so I'd
still be interested in a link to the correct thread, if available.
Appendix A Extensible Gawk Language Extensions
**********************************************
The `xgawk' program adds a few features to the basic `gawk'
capabilities. Here is a quick summary.
1. Adds new `-l' (`--load') command-line option to link in a shared
library. This searches for the library using a new `AWKLIBPATH'
environment variable (with an appropriate default value if none
is
present in the environment). And it automatically tries to
supply
a default suffix appropriate for shared libraries on the build
platform.
2. Adds new `-i' (`--include') command-line option to include `gawk'
source code. This searches for the `gawk' code using the
existing
AWKPATH environment variable as is currently done for `-f'
arguments. And it automatically tries to find the file with and
without a default `.awk' suffix.
3. Enhances `-f' processing to also supply an automatic `.awk'
suffix.
(For each directory in `AWKPATH', it first tries to open the file
without a suffix, and then tries with `.awk' appended.)
4. Adds support for an `@include' directive in the source code.
This
is the same feature provided by the current `igawk' script. This
works the same way as in `igawk' (and as in the new `-i'
command-line option). So the `igawk' script can be removed and
replaced with a symbolic link to the new `gawk' binary. This is
a
little more powerful than `igawk' `@include' because it can
automatically add the `.awk' suffix.
5. Adds support for an `@load' directive in the source code to load
a
shared library. This does the same thing as the new `-l'
command-line option.
Regards,
Andy
> I am actively working on built-in file inclusion for gawk; the basics are
> implemented but I have to make a final decision on what it will look like.
It whould be very nice to see gawk compatible with runawk. In this case
AWK modules developed for runawk (and for AWK interpreters other than
GNU awk) will work for GNU awk and vice versa. In my view, we should
not conflict in this area.
This is how runawk works (I've already voted at that web form):
1) Q: What keyword should be used?
A: #use
2) Q: Should the include mechanism allow more than one filename per line?
A: No
3) Q: What happens when the same file is included more than once?
A: Silently ignored. File is included only once.
4) Q: Allow nested includes?
A: yes
5) Q: Search $AWKPATH?
A: yes
6) Q: If not found, append .awk to the filename and retry?
A: no
Supporting @include for backward compatibility with igawk (and xgawk?)
may also make sense but IMHO it should be declared as deprecated
feature.
> This is the way to provide input to me: discussion in the group will not
> carry any weight.
That's a pity.
--
Best regards, Aleksey Cheusov.
On Jan 5, 6:19 am, Aleksey Cheusov <v...@gmx.net> wrote:
> > Greetings all.
> > I am actively working on built-in file inclusion for gawk; the basics are
> > implemented but I have to make a final decision on what it will look like.
>
> Supporting @include for backward compatibility with igawk (and xgawk?)
> may also make sense but IMHO it should be declared as deprecated
> feature.
>
> > This is the way to provide input to me: discussion in the group will not
> > carry any weight.
>
> That's a pity.
> --
> Best regards, Aleksey Cheusov.
i'm writing awk library routines as well for a forthcoming project
(KNIT: a generic scripting environment supporting unit tests,
literature programming, web-documentation, libraries). i've isolated
all the issues that arnold offers options at awk.info/poll. whatever
he decides, i'll apply to KNIT
i want to suggest to aleksey, and all other awk library authors, is
that we adopt arnold's conventions- not cause they are "right" or
"good" but cause they are "good enough" to get us sharing code-
something we have FAILED doing, so far.
just my $0.02 worth
enjoy!
:-)
t
> i'm writing awk library routines as well for a forthcoming project
> (KNIT: a generic scripting environment supporting unit tests,
> literature programming, web-documentation, libraries). i've isolated
> all the issues that arnold offers options at awk.info/poll. whatever
> he decides, i'll apply to KNIT
This sounds nifty to me.
--
later on,
Mike
1. The topic has been discussed in the newsgroup before. I didn't (and
still don't) think there's a lot to be gained by reopening the discussion.
2. The poll provides a concrete mechanism for reaching a conclusion as
to the "will" of the group. Newsgroups discussions do not.
3. The poll purposely includes Aleksey's #use as an option.
4. Ultimately, *I am the one who does the work!* Years of my life have gone
into gawk, and likely much more time will continue to do so. Not for
profit, either.
Changes made to gawk have to be something I can maintain and that I
think are good design. I've been at it for over 20 years. I've made
mistakes, but I think I've learned from them too, so I think my own
judgement is not too unreliable. :-)
I consider the poll an experiment in trying to open up the gawk
development process to be more inclusive. I will publish the results.
I will even leave it open for another week (through January 16) so that
anyone who's interested has an opportunity to vote.
BTW, this isn't at all pesonal; Aleksey is entitled to voice his
complaint, and it may be that I am being heavy handed.
In my defense, I remind the members of the newsgroup that:
(a) gawk is a volunteer project,
(b) I have a very busy life, leading to
(c) I can only put so much effort into newsgroups discussions and so on.
I'd rather be spending my scarce time improving the code! Thus, I think
the poll is a reasonable compromise as a way to get concrete input.
Thanks,
Arnold
In article <aa45cac1-1e54-4c55...@m3g2000yqf.googlegroups.com>,
The igawk script has shipped with gawk for
a long time, and has defined a syntax for file inclusion.
The xgawk project adopted that syntax for maximum compatibility.
It does not make sense to me to change syntax now. IMHO, igawk
and xgawk have a much deeper history than runawk in setting
a precedent for how this should work.
Regards,
Andy
> The igawk script has shipped with gawk for
> a long time, and has defined a syntax for file inclusion.
> The xgawk project adopted that syntax for maximum compatibility.
> It does not make sense to me to change syntax now. IMHO, igawk
> and xgawk have a much deeper history than runawk in setting
> a precedent for how this should work.
All this is true. Both gawk and xgawk are older than runawk. But the
way runawk handles modules allows to use them with ALL flavours of awk,
not just two: gawk and xgawk. RunAWK modules can even be used without
RunAWK at all with no changes in the code.
Portability of AWK library -- my personal priority.
And I hope this is important to AWK users too.
P.S.
Why RunAWK uses #use instead of @include. Of course I was aware of
igawk's @include. Answer is simple -- #use allows to not create
temporary files. 'runawk program' command is simply translated to
'awk -f module1.awk -f module2.awk ... -f program'.
This is how I understand "good design".
As I described earlier #use directive was choosen because it allowed not
to modify modules code in run time and not to create a temporary file by
catting modified source code into it. @include and @use may look fine
for gawk and xgawk because they are _implementations_. Runawk is
different, it is just a tiny wrapper run on top of any awk
interpreter. So, the goal was to keep it as small and simple as it is
possible. On the other hand, implementing directives (in runawk)
incompatible with AWK language (e.g. @include) may (potentially) have
some benefits, creating a temp file will not be a problem anymore :-).
Anyway, I'm waiting for Aharon's decision just like all others :-).