Hi, here's an other issue about the --batch
option. The last fix did not work for me and the last thread was tagged as closed (#44 ), so I open another one.
I noticed that opening the frequency plot window starts the frequency loop automatically if the batch option is activated. I decided to dig further into main.c
and this piece of code confirms that this behavior is expected:
https://github.com/KJ7LNW/xnec2c/blob/master/src/main.c#L627-L637
As rc_config.main_loop_start
had been set to 1 by the previously modified code.
A quick and dirty modification forces the frequency loop to run if rc_config.main_loop_start
has been set to 1:
// MODIFIED
if( rc_config.main_loop_start )
Start_Frequency_Loop();
/* Re-initiate frequency plots if window open */
if( isFlagSet(PLOT_ENABLED) )
{
GtkWidget *box = Builder_Get_Object( freqplots_window_builder, "freqplots_box" );
gtk_widget_show( box );
// MODIFIED
if( rc_config.main_loop_start )
Main_Freqplots_Activate();
}
This now works as it should, so it's good enough for me. But it shows another flaw: it runs the frequency loop at startup even without the batch
option, because the frequency loop start state is stuck to 1 in my xnec2c.conf
file. That's a 2-bugs-in-1 issue.
I also previously thought about forcing the plot window to show up in --batch
mode, just like it does in --optimize
mode. I didn't manage to do that because my knowledge of xnec2c's source code is very limited, but it would be useful to have a real time preview of your results when doing batch simulations. In addition of that, the logic in the code portion I modified would remain unchanged.
Edit: well, a quick fix for the frequency loop start when neither --batch
nor --optimize
is on would be this little modification. I changed this:
https://github.com/KJ7LNW/xnec2c/blob/master/src/main.c#L383-L384
To this:
if (rc_config.batch_mode)
rc_config.main_loop_start = 1;
else
rc_config.main_loop_start = 0;
Still no change in the conf file, but these flags seem to override what's written inside anyway.