From: Petr M. <mi...@ph...> - 2004-04-26 21:30:01
|
> > Currently, inside bla.gp called like > > > > call "bla.gp" one two 3 4 > > > > it is not possible to determine how many parameters were passed into it. > > The only way seems to be a global variable like > > > > params=4; call "bla.gp" one two 3 4 > > > > and to use > > > > if (defined(params) && params==4) ... > Why that complicated? What's wrong with making the number of parameters > the first parameter, i.e. > call "bla.gp" 4 one two 3 4 > ? That's complicated for users. You neither do this in your C programs. > OTOH, what you really need would be a "was parameter number <n> passed > in by the caller?" kind of test, i.e. the equivalent of the Bourne > shell standard phrase > > if [ "x$5" != "x" ] Here it will be if ($# > 5) ... > > I propose to add "variable" $# which will be set to number of available > > $0, $1, ... > > Please keep in mind that '#' is our comment character. So, I've done it, see the enclosed patch (it's very small). Seems to work fine. (And it doesn't clash with # as comment char.) I'll add it shortly, unless there are some complains. New section of NEWS is to be added. BTW, is there to be a split of source code branches into gnuplot 4.0.1 (for a potential bug-fix release) and gnuplot 4.1 with new cool features available at "Patches"? --- PM |