Added -a option for switching on/off netlist autorun

This commit is contained in:
pnenzi 2007-10-11 11:14:06 +00:00
parent 1cf9e0dddc
commit 7703a63230
4 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2007-10-11 Paolo Nenzi <p.nenzi@ieee.org>
* src/main.c, src/frontend/{inpcom.c, miscvars.c}: added option -a
and --autorun to add the control section ans run the loaded netlist.
In the original implementation by Phil Barker, the loaded circuit was
always run, both in interactive and batch mode.
2007-10-09 Paolo Nenzi <p.nenzi@ieee.org>
* src/frontend/{device.c, miscvars.c}: added "altshow" option to
enable the new (Phil Barker) version of the show command. The

View File

@ -982,6 +982,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name)
bool found_library, found_lib_name, found_end = FALSE, shell_eol_continuation = FALSE;
bool dir_name_flag = FALSE;
struct variable *v;
/* Must set this to NULL or non-tilde includes segfault. -- Tim Molteno */
/* copys = NULL; */ /* This caused a parse error with gcc 2.96. Why??? */
@ -1493,7 +1495,9 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name)
inp_fix_inst_calls_for_numparam(working);
inp_fix_gnd_name(working);
inp_chk_for_multi_in_vcvs(working, &line_number);
inp_add_control_section(working, &line_number);
if (cp_getvar("addcontrol", VT_BOOL, (char *) &v))
inp_add_control_section(working, &line_number);
}
*data = cc;
return;

View File

@ -25,6 +25,7 @@ bool ft_asyncdb = FALSE;
char *ft_setkwords[] = {
"acct",
"addcontrol",
"altshow",
"appendwrite",
"bypass",

View File

@ -515,6 +515,7 @@ show_help(void)
printf("Usage: %s [OPTION]... [FILE]...\n"
"Simulate the electical circuits in FILE.\n"
"\n"
" -a --autorun run the loaded netlist\n"
" -b, --batch process FILE in batch mode\n"
" -c, --circuitfile=FILE set the circuitfile\n"
" -i, --interactive run in interactive mode\n"
@ -633,6 +634,9 @@ main(int argc, char **argv)
int err;
bool gotone = FALSE;
char* copystring;/*DG*/
char addctrlsect = TRUE; /* PN: for autorun */
#ifdef SIMULATOR
int error2;
@ -738,6 +742,7 @@ main(int argc, char **argv)
{"help", 0, 0, 'h'},
{"version", 0, 0, 'v'},
{"batch", 0, 0, 'b'},
{"autorun", 0, 0, 'a'},
{"circuitfile", 0, 0, 'c'},
{"interactive", 0, 0, 'i'},
{"no-spiceinit", 0, 0, 'n'},
@ -749,7 +754,7 @@ main(int argc, char **argv)
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "hvbc:ihno:qr:st:",
c = getopt_long (argc, argv, "hvbac:ihno:qr:st:",
long_options, &option_index);
if (c == -1)
break;
@ -767,8 +772,17 @@ main(int argc, char **argv)
case 'b': /* Batch mode */
ft_batchmode = TRUE;
addctrlsect = FALSE;
cp_vset("addcontrol",VT_BOOL,&addctrlsect);
break;
case 'a': /* Add control section for autorun */
if (!ft_batchmode) {
addctrlsect = TRUE;
cp_vset("addcontrol",VT_BOOL, &addctrlsect);
}
break;
case 'c': /* Circuit file */
if (optarg) {
if (!(circuit_file = fopen(optarg, "r"))) {