From: Ethan A M. <merritt@u.washington.edu> - 2004-07-10 06:16:01
|
On Friday 09 July 2004 06:07 pm, Hans-Bernhard Broeker <br...@ph... wrote: > I strictly disagree with that reasoning. If df_readline needs to know > what the the plot style is, then IMHO that's a sign that there's something > seriously wrong with df_readline(). Let me present two arguments for passing a pointer to the current plot. The code in datafile.c and elsewhere (df_readline is not so much the culprit here) makes an assumption that it can deduce the style of plot based on the number of input columns requested. Maybe that used to be true back when gnuplot supported fewer plot styles, but it no longer holds. I maintain that if a piece of code needs to know the current plot style it should look in the proper place, the plot structure, rather than trying to guess it from incomplete information. The second reason arose when I added the "datastrings" code that allows reading meta-information related to the plot from the datafile, including axis tic labels, plot key titles, and so on. If you want to argue that these are a bad idea, or propose a different way to accomplish this, please feel free. But if you accept that df_readline is now reading information that has to be stored in the plot structure eventually, then it seems cleaner to me that it receive a pointer to the structure so that it can be stored there directly upon input. I have not looked much at Daniel's "with image" code, except for the terminal API. I am a bit surprised that it needs to call df_readline() at all, since I would have expected that reading a binary file is a distinct operation from reading successive lines of formatted input. Daniel - don't you think it would be cleaner to provide an entirely separate routine, df_readbinary(), and call it instead of df_readline() when needed? You can never mix the two modes of input (is that right?), so it seems a bad idea to mix the code that handles them. -- Ethan A Merritt eme...@es... |