Browse Source

Modify get_number_terminals() and make it non-static.

Use modified function to replace fixed node number.
pre-master-46
Holger Vogt 5 years ago
parent
commit
c9eeb0ceea
  1. 15
      src/frontend/inpcom.c
  2. 3
      src/frontend/subckt.c

15
src/frontend/inpcom.c

@ -113,7 +113,7 @@ long dynsubst; /* spicenum.c 221 */
static bool has_if = FALSE; /* if we have an .if ... .endif pair */ static bool has_if = FALSE; /* if we have an .if ... .endif pair */
static char *readline(FILE *fd); static char *readline(FILE *fd);
static int get_number_terminals(char *c);
int get_number_terminals(char *c);
static void inp_stripcomments_deck(struct card *deck, bool cs); static void inp_stripcomments_deck(struct card *deck, bool cs);
static void inp_stripcomments_line(char *s, bool cs); static void inp_stripcomments_line(char *s, bool cs);
static void inp_fix_for_numparam( static void inp_fix_for_numparam(
@ -4214,7 +4214,7 @@ static int inp_get_param_level(
} }
static int get_number_terminals(char *c)
int get_number_terminals(char *c)
{ {
int i, j, k; int i, j, k;
char *name[12]; char *name[12];
@ -4250,18 +4250,25 @@ static int get_number_terminals(char *c)
break; break;
case 'm': /* recognition of 4, 5, 6, or 7 nodes for SOI devices needed case 'm': /* recognition of 4, 5, 6, or 7 nodes for SOI devices needed
*/ */
{
i = 0; i = 0;
char* cc, * ccfree;
cc = copy(c);
/* required to make m= 1 a single token m=1 */
ccfree = cc = inp_remove_ws(cc);
/* find the first token with "off" or "=" in the line*/ /* find the first token with "off" or "=" in the line*/
while ((i < 20) && (*c != '\0')) {
char *inst = gettok_instance(&c);
while ((i < 20) && (*cc != '\0')) {
char* inst = gettok_instance(&cc);
strncpy(nam_buf, inst, sizeof(nam_buf) - 1); strncpy(nam_buf, inst, sizeof(nam_buf) - 1);
txfree(inst); txfree(inst);
if (strstr(nam_buf, "off") || strchr(nam_buf, '=') || strstr(nam_buf, "tnodeout") || strstr(nam_buf, "thermal")) if (strstr(nam_buf, "off") || strchr(nam_buf, '=') || strstr(nam_buf, "tnodeout") || strstr(nam_buf, "thermal"))
break; break;
i++; i++;
} }
tfree(ccfree);
return i - 2; return i - 2;
break; break;
}
case 'p': /* recognition of up to 100 cpl nodes */ case 'p': /* recognition of up to 100 cpl nodes */
i = j = 0; i = j = 0;
/* find the last token in the line*/ /* find the last token in the line*/

3
src/frontend/subckt.c

@ -76,6 +76,7 @@ Modified: 2000 AlansFixes
#include "numparam/numpaif.h" #include "numparam/numpaif.h"
extern void line_free_x(struct card *deck, bool recurse); extern void line_free_x(struct card *deck, bool recurse);
extern int get_number_terminals(char* c);
#define line_free(line, flag) \ #define line_free(line, flag) \
do { \ do { \
@ -1395,7 +1396,7 @@ translate(struct card *deck, char *formal, char *actual, char *scname, const cha
/* FIXME anothet hack: if no models found for m devices, set number of nodes to 4 */ /* FIXME anothet hack: if no models found for m devices, set number of nodes to 4 */
if (!modnames && *(c->line) == 'm') if (!modnames && *(c->line) == 'm')
nnodes = 4;
nnodes = get_number_terminals(c->line);
else else
nnodes = numnodes(c->line, subs, modnames); nnodes = numnodes(c->line, subs, modnames);
while (--nnodes >= 0) { while (--nnodes >= 0) {

Loading…
Cancel
Save