|
From: sfeam (E. Merritt) <eam...@gm...> - 2010-02-14 02:10:06
|
On Saturday 13 February 2010, Teo S Bernhard wrote: > On Sat, Feb 13, 2010 at 8:06 PM, Ethan Merritt <merritt@u.washington.edu> wrote: > > On Saturday 13 February 2010, Teo S Bernhard wrote: > >> On Fri, Feb 12, 2010 at 7:07 PM, Ethan Merritt <merritt@u.washington.edu> wrote: > >> > On Friday 12 February 2010 09:58:45 Teo S Bernhard wrote: > > >> I have looked into the code, plot2d.c, regarding this issue. I have a > >> suggestion for a patch that seems to: > >> 1) solve referred Bug #2907028 > >> 2) also allow trailing assignments to the plot command. > > >> I have tested it on small examples similar to those presented in this thread. > >> Review and comments on the conceptual idea as presented below in a > >> diff-form are appreciated. > > > > The first pass is used for plotting data, > > the second pass is used for evaluating functions. > > If you disable definitions in the first pass, > > you break plotting from a file. Consider > > > > plot col=2, 'data' using 1:col with lines > > > > If you want to pursue this, you will need to use test cases > > that mix both function plots and data plots. > > > > I see , thanks for pointing this out. > > Out of curiosity - is there any way that an approach as the following > could succeed? > a) at start of first pass, copy the the original "namespace(s)" into > temporary one(s) > b) use the temporary "namespace(s)" during the first pass > c) change back to the original "namespace(s)" in the second pass It could work, yes. The iteration code already does this for the iteration variables. Is there some reason you cannot use the iteration syntax rather than using a self-modifying definition? I can think of obscure scenarios that would break your save/restore procedure. For example, it is possible although convoluted to modify a variable based on data read during the first pass. You would lose the new value after the restore operation. I don't claim this is a common thing to do, but we may have to make a decision whether the gain from re-working the mechanism of handling definitions inside a plot statement is worth the loss of admittedly rare options for loading program variables from a data file. > Since these structures are not an argument to define(), am I right in > assuming that these are global structures - of unknown name(s) to me, > but structures defined in eval.h and eval.c? User-defined variables are kept in a linked list of structures. The structure type is udvt_entry. The head of the list is (struct udvt_entry *)first_udv. These are defined in eval.h. |