|
From: Daniel J S. <dan...@ie...> - 2003-10-24 18:51:26
|
Hans-Bernhard Broeker wrote:
>>With regard to 2, note that if one types "set output 'name'"
>>followed by no plot commands, but then "set output", the
>>file 'name' will be created. Is there an analogy here between
>>a file and a window?
>>
>>
>
>Not really. Arguably, that behaviour of 'set output' is wrong itself.
>
I've looked at the code in term.c regarding opening the file.
It looks like the terminal initialization is very safely done with
appropriate checks of a variable "term_initialised". I'm
wondering if the actual "fopen()" can't be held off until the
function "term_start_plot()". In graphics.c at the start of
the "do_plot()" routine is
term_init(); /* may set xmax/ymax */
term_start_plot();
and in graph3d.c at the start of the "do_plot3d()" routine is
term_start_plot();
[Why there isn't a term_init() there also, I don't know.]
So, it would mean keeping track of the output file name using
a character pointer and realloc() and keeping track of the
binary/ascii file type. In term_start_plot(), check if the file
name is non-NULL, and if so open the file and free()
the memory for the name and set the pointer back to NULL.
Ethan, right before the term_init() call is a note you left
regarding font sizes. Perhaps you are familiar with the
sequence of events and can tell if a simple change is possible.
Does it seem like that would work?
[Different topic below.]
>>3) Looking at the X11_options() in x11.trm it is very similar
>>to other parsing/interpretting schemes, however it doesn't have
>>the many checks for repeated entry, valid entry, etc. Some
>>commands are sent to gplt_x11 even before the end of parsing.
>>
>>
>
>That's a bug, then. But AFAICS, the only command sent to gplt_x11.c
>before parsing of the options is finished is an update of the window
>number.
>
I've added the necessary checks for duplicate entry. At
the end is a #define switch:
if (duplication) {
#if NOT_PROCESS_IF_DUPLICATION
int_error(c_token-1, "duplicated or contradicting arguments in
X11 term options");
#else
if (!shown_warning)
int_warn(c_token-1, "duplicated or contradicting arguments
in X11 term options");
shown_warning = TRUE;
#endif
}
and nothing is done until after that test. I set the variable
NOT_PROCESS_IF_DUPLICATION true simply because
there are a number of situations where what the user enters
could error inside parse.c and util.c. I don't want to modify
anything there in those files to allow continuation.
So it works fine. But I recall something now. I believe there
was a discussion a while back about the ability to close a
single X11 graph from the command line. So perhaps if both
a "reset" and a number appear in the options, only the plot
associated with that number could be closed. Right now it
will reset the whole thing (i.e., close all windows) and then
switch to plot number. How does that sound?
Dan
--
Dan Sebald
email: daniel . sebald @ ie ee . o rg
URL: ht tp://acer-access.c om/~dsebald @ acer-access.c om/
|