From 9dff15507d9b7ee26f6e81cf25afae025f371380 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 28 Nov 2021 16:47:14 +0100 Subject: [PATCH] .probe: Add call to function inp_probe() which resides in inpc_probe.c. Make function insert_new_line() non-static Enable detecting the number of nodes in x-lines (calls to subciruits) in function get_number_terminals() --- src/frontend/inpcom.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index b6f19a812..5a4d412f0 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -190,6 +190,7 @@ static char* eval_tc(char* line, char* tline); static void rem_double_braces(struct card* card); +extern void inp_probe(struct card* card); #ifndef EXT_ASC static void utf8_syntax_check(struct card *deck); #endif @@ -402,7 +403,7 @@ static int is_cider_model(char *buf) #endif /* insert a new card, just behind the given card */ -static struct card *insert_new_line( +struct card *insert_new_line( struct card *card, char *line, int linenum, int linenum_orig) { struct card *x = TMALLOC(struct card, 1); @@ -1024,6 +1025,8 @@ struct card *inp_readall(FILE *fp, const char *dir_name, struct nscope *root = inp_add_levels(working); + inp_probe(working); + inp_fix_for_numparam(subckt_w_params, working); inp_remove_excess_ws(working); @@ -4583,6 +4586,19 @@ int get_number_terminals(char *c) } return i - 2; break; + case 'x': + i = 0; + /* find the first token with "params:" or "=" in the line*/ + while ((i < 100) && (*c != '\0')) { + char *inst = gettok_instance(&c); + strncpy(nam_buf, inst, sizeof(nam_buf) - 1); + txfree(inst); + if (strstr(nam_buf, "params") || strchr(nam_buf, '=')) + break; + i++; + } + return i - 2; + break; case 'u': case 'j': case 'w':