Browse Source

command listing: add option r (runable)

listing r > $inputdir/mycirc_runable.cir
will save the expanded netlist without line numbers,
ready to be sourced again and run in ngspice.
pre-master-46
Holger Vogt 5 years ago
parent
commit
5d116d1fb9
  1. 23
      src/frontend/inp.c
  2. 1
      src/include/ngspice/fteinp.h

23
src/frontend/inp.c

@ -134,7 +134,7 @@ Xprintf(FILE *fdst, const char *fmt, ...)
} }
/* Do a listing. Use is listing [expanded] [logical] [physical] [deck] */
/* Do a listing. Use is listing [expanded] [logical] [physical] [deck] [runable] */
void void
com_listing(wordlist *wl) com_listing(wordlist *wl)
{ {
@ -165,6 +165,11 @@ com_listing(wordlist *wl)
case 'E': case 'E':
expand = TRUE; expand = TRUE;
break; break;
case 'r':
case 'R':
expand = TRUE;
type = LS_RUNABLE;
break;
default: default:
fprintf(cp_err, "Error: bad listing type %s\n", s); fprintf(cp_err, "Error: bad listing type %s\n", s);
return; /* SJB - don't go on after an error */ return; /* SJB - don't go on after an error */
@ -176,7 +181,7 @@ com_listing(wordlist *wl)
if (do_param_listing) { if (do_param_listing) {
nupa_list_params(cp_out); nupa_list_params(cp_out);
} else { } else {
if (type != LS_DECK)
if (type != LS_DECK && type != LS_RUNABLE)
fprintf(cp_out, "\t%s\n\n", ft_curckt->ci_name); fprintf(cp_out, "\t%s\n\n", ft_curckt->ci_name);
inp_list(cp_out, inp_list(cp_out,
expand ? ft_curckt->ci_deck : ft_curckt->ci_origdeck, expand ? ft_curckt->ci_deck : ft_curckt->ci_origdeck,
@ -233,18 +238,23 @@ inp_list(FILE *file, struct card *deck, struct card *extras, int type)
renumber = cp_getvar("renumber", CP_BOOL, NULL, 0); renumber = cp_getvar("renumber", CP_BOOL, NULL, 0);
if (type == LS_LOGICAL) {
if (type == LS_LOGICAL || type == LS_RUNABLE) {
top1: top1:
for (here = deck; here; here = here->nextcard) { for (here = deck; here; here = here->nextcard) {
if (renumber) if (renumber)
here->linenum = i; here->linenum = i;
if (ciprefix(".end", here->line) && !isalpha_c(here->line[4])) if (ciprefix(".end", here->line) && !isalpha_c(here->line[4]))
continue; continue;
if (*here->line != '*') {
if ((*here->line != '*') && (type == LS_LOGICAL)) {
Xprintf(file, "%6d : %s\n", here->linenum, upper(here->line)); Xprintf(file, "%6d : %s\n", here->linenum, upper(here->line));
if (here->error) if (here->error)
Xprintf(file, "%s\n", here->error); Xprintf(file, "%s\n", here->error);
} }
else if ((*here->line != '*') && (type == LS_RUNABLE)) {
Xprintf(file, "%s\n", upper(here->line));
if (here->error)
Xprintf(file, "%s\n", here->error);
}
i++; i++;
} }
@ -254,7 +264,10 @@ inp_list(FILE *file, struct card *deck, struct card *extras, int type)
goto top1; goto top1;
} }
Xprintf(file, "%6d : .end\n", i);
if (type == LS_LOGICAL)
Xprintf(file, "%6d : .end\n", i);
else if (type == LS_RUNABLE)
Xprintf(file, ".end\n");
} else if ((type == LS_PHYSICAL) || (type == LS_DECK)) { } else if ((type == LS_PHYSICAL) || (type == LS_DECK)) {

1
src/include/ngspice/fteinp.h

@ -13,6 +13,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#define LS_LOGICAL 1 #define LS_LOGICAL 1
#define LS_PHYSICAL 2 #define LS_PHYSICAL 2
#define LS_DECK 3 #define LS_DECK 3
#define LS_RUNABLE 4
#endif #endif
Loading…
Cancel
Save