Browse Source

Added -a option for switching on/off netlist autorun

pre-master-46
pnenzi 19 years ago
parent
commit
7703a63230
  1. 6
      ChangeLog
  2. 6
      src/frontend/inpcom.c
  3. 1
      src/frontend/miscvars.c
  4. 16
      src/main.c

6
ChangeLog

@ -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> 2007-10-09 Paolo Nenzi <p.nenzi@ieee.org>
* src/frontend/{device.c, miscvars.c}: added "altshow" option to * src/frontend/{device.c, miscvars.c}: added "altshow" option to
enable the new (Phil Barker) version of the show command. The enable the new (Phil Barker) version of the show command. The

6
src/frontend/inpcom.c

@ -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 found_library, found_lib_name, found_end = FALSE, shell_eol_continuation = FALSE;
bool dir_name_flag = FALSE; bool dir_name_flag = FALSE;
struct variable *v;
/* Must set this to NULL or non-tilde includes segfault. -- Tim Molteno */ /* Must set this to NULL or non-tilde includes segfault. -- Tim Molteno */
/* copys = NULL; */ /* This caused a parse error with gcc 2.96. Why??? */ /* 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_inst_calls_for_numparam(working);
inp_fix_gnd_name(working); inp_fix_gnd_name(working);
inp_chk_for_multi_in_vcvs(working, &line_number); 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; *data = cc;
return; return;

1
src/frontend/miscvars.c

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

16
src/main.c

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

Loading…
Cancel
Save