Browse Source

enable inp_dodeck() to return an error state,

if error, inp_spsource() will return error as well
pre-master-46
Holger Vogt 6 years ago
parent
commit
e9603dcdeb
  1. 11
      src/frontend/inp.c
  2. 2
      src/include/ngspice/fteext.h

11
src/frontend/inp.c

@ -824,7 +824,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
wl_first = inp_savecurrents(deck, options, wl_first, controls); wl_first = inp_savecurrents(deck, options, wl_first, controls);
/* now load deck into ft_curckt -- the current circuit. */ /* now load deck into ft_curckt -- the current circuit. */
inp_dodeck(deck, tt, wl_first, FALSE, options, filename);
if(inp_dodeck(deck, tt, wl_first, FALSE, options, filename) != 0)
return 1;
if (ft_curckt) { if (ft_curckt) {
ft_curckt->devtlist = devtlist; ft_curckt->devtlist = devtlist;
@ -990,7 +991,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
* It appears that inp_dodeck adds the circuit described by *deck * It appears that inp_dodeck adds the circuit described by *deck
* to the current circuit (ft_curckt). * to the current circuit (ft_curckt).
*-----------------------------------------------------------------*/ *-----------------------------------------------------------------*/
void
int
inp_dodeck( inp_dodeck(
struct card *deck, /*in: the spice deck */ struct card *deck, /*in: the spice deck */
char *tt, /*in: the title of the deck */ char *tt, /*in: the title of the deck */
@ -1156,6 +1157,7 @@ inp_dodeck(
out_printf("Error on line %d :\n %s\n%s\n", out_printf("Error on line %d :\n %s\n%s\n",
dd->linenum_orig, dd->line, dd->error); dd->linenum_orig, dd->line, dd->error);
have_err = TRUE; have_err = TRUE;
return 1;
} }
if (ft_stricterror) if (ft_stricterror)
controlled_exit(EXIT_BAD); controlled_exit(EXIT_BAD);
@ -1277,6 +1279,7 @@ inp_dodeck(
#if 0 #if 0
cp_addkword(CT_CKTNAMES, tt); cp_addkword(CT_CKTNAMES, tt);
#endif #endif
return 0;
} }
@ -1597,7 +1600,9 @@ com_source(wordlist *wl)
if (Infile_Path) if (Infile_Path)
tfree(Infile_Path); tfree(Infile_Path);
Infile_Path = ngdirname(firstfile); Infile_Path = ngdirname(firstfile);
inp_spsource(fp, FALSE, tempfile ? NULL : wl->wl_word, FALSE);
if (inp_spsource(fp, FALSE, tempfile ? NULL : wl->wl_word, FALSE) != 0) {
fprintf(stderr, " Simulation interrupted due to error!\n\n");
}
} }
cp_interactive = inter; cp_interactive = inter;

2
src/include/ngspice/fteext.h

@ -208,7 +208,7 @@ extern bool gr_circular;
/* inp.c */ /* inp.c */
void inp_dodeck(struct card *deck, char *tt, wordlist *end, bool reuse,
int inp_dodeck(struct card *deck, char *tt, wordlist *end, bool reuse,
struct card *options, char *filename); struct card *options, char *filename);
extern void inp_source(const char *file); extern void inp_source(const char *file);
int inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile); int inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile);

Loading…
Cancel
Save