Bug #332, reported by M. Hendriks
Add a warning if statements .control ... .endc are misplaced or missing
This commit is contained in:
parent
870958c8bc
commit
157aaee6f1
|
|
@ -143,6 +143,7 @@ static void subckt_params_to_param(struct card *deck);
|
|||
static void inp_fix_temper_in_param(struct card *deck);
|
||||
static void inp_fix_agauss_in_param(struct card *deck, char *fcn);
|
||||
static void inp_vdmos_model(struct card *deck);
|
||||
static void inp_check_control(struct card *deck);
|
||||
|
||||
static char *inp_spawn_brace(char *s);
|
||||
|
||||
|
|
@ -597,6 +598,8 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t
|
|||
pspice_compat_a(working);
|
||||
}
|
||||
|
||||
inp_check_control(working);
|
||||
|
||||
inp_fix_for_numparam(subckt_w_params, working);
|
||||
|
||||
inp_remove_excess_ws(working);
|
||||
|
|
@ -7666,3 +7669,33 @@ ltspice_compat_a(struct card *oldcard)
|
|||
{
|
||||
oldcard->nextcard = ltspice_compat(oldcard->nextcard);
|
||||
}
|
||||
|
||||
/* check if we have a .control ... .endc pair */
|
||||
static void inp_check_control(struct card *deck)
|
||||
{
|
||||
struct card *card;
|
||||
int check_control = 0;
|
||||
for (card = deck; card; card = card->nextcard) {
|
||||
char *cut_line = card->line;
|
||||
if (*cut_line == '*')
|
||||
continue;
|
||||
// check for .control ... .endc
|
||||
if (ciprefix(".control", cut_line)) {
|
||||
if (check_control > 0) {
|
||||
fprintf(cp_err, "\nError: Nesting of .control statements is not allowed!\n\n");
|
||||
controlled_exit(EXIT_BAD);
|
||||
}
|
||||
check_control++;
|
||||
continue;
|
||||
}
|
||||
else if (ciprefix(".endc", cut_line)) {
|
||||
check_control--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (check_control > 0) {
|
||||
fprintf(cp_err, "\nWarning: Missing .endc statement!\n");
|
||||
fprintf(cp_err, " This may cause subsequent errors.\n\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue