Browse Source

Fix a bug raised by Sambeet in

[Ngspice-users] Problems with xspice limiter block:
Don't treat .model limit_comp limit(gain... as a function
if PSPICE compatibility is set.
pre-master-46
Holger Vogt 6 years ago
parent
commit
9e8e50cb57
  1. 10
      src/frontend/inpcom.c

10
src/frontend/inpcom.c

@ -652,7 +652,7 @@ struct card *inp_readall(FILE *fp, const char *dir_name,
inp_remove_excess_ws(working); inp_remove_excess_ws(working);
if(inp_vdmos_model(working)) if(inp_vdmos_model(working))
return NULL;;
return NULL;
/* don't remove unused model if we have an .if clause, because we /* don't remove unused model if we have an .if clause, because we
cannot yet decide here which model we finally will need */ cannot yet decide here which model we finally will need */
@ -3505,6 +3505,14 @@ static char *inp_expand_macro_in_str(struct function_env *env, char *str)
char *orig_ptr = str, *search_ptr = str, *orig_str = copy(str); char *orig_ptr = str, *search_ptr = str, *orig_str = copy(str);
char keep; char keep;
/* If we have '.model mymod mdname(params)', don't treat this as a function,
but skip '.model mymod mdname' and only then start searching for functions. */
if (ciprefix(".model", search_ptr)){
search_ptr = nexttok(search_ptr);
search_ptr = nexttok(search_ptr);
char *end;
findtok_noparen(&search_ptr, &search_ptr, &end);
}
// printf("%s: enter(\"%s\")\n", __FUNCTION__, str); // printf("%s: enter(\"%s\")\n", __FUNCTION__, str);
while ((open_paren_ptr = strchr(search_ptr, '(')) != NULL) { while ((open_paren_ptr = strchr(search_ptr, '(')) != NULL) {

Loading…
Cancel
Save