|
|
|
@ -633,50 +633,6 @@ findsubckt(tdico *dico, char *s, SPICE_DSTRINGPTR subname) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if 0 /* unused, from the full macro language... */ |
|
|
|
static int |
|
|
|
deffuma( /* define function or macro entry. */ |
|
|
|
tdico *dico, char *t, char tpe, unsigned short bufstart, |
|
|
|
unsigned char *pjumped, bool *perr) |
|
|
|
{ |
|
|
|
unsigned char jumped = *pjumped; |
|
|
|
bool err = *perr; |
|
|
|
/* if not jumped, define new function or macro, returns index to buffferstart |
|
|
|
if jumped, return index to existing function |
|
|
|
*/ |
|
|
|
int i, j; |
|
|
|
|
|
|
|
Strbig(Llen, v); |
|
|
|
|
|
|
|
i = attrib(dico, t, ' '); |
|
|
|
j = 0; |
|
|
|
|
|
|
|
if (i <= 0) { |
|
|
|
err = message(dico, " Symbol table overflow\n"); |
|
|
|
} else { |
|
|
|
if (dico->dat[i].tp != '?') { |
|
|
|
/* old item! */ |
|
|
|
if (jumped) |
|
|
|
j = dico->dat[i].ivl; |
|
|
|
else |
|
|
|
err = message(dico, "%s already defined\n", t); |
|
|
|
} else { |
|
|
|
dico->dat[i].tp = tpe; |
|
|
|
dico->nfms++; |
|
|
|
j = dico->nfms; |
|
|
|
dico->dat[i].ivl = j; |
|
|
|
dico->fms[j].start = bufstart; |
|
|
|
/* = ibf->bufaddr = start addr in buffer */ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
*pjumped = jumped; |
|
|
|
*perr = err; |
|
|
|
return j; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/************ input scanner stuff **************/ |
|
|
|
|
|
|
|
static unsigned char |
|
|
|
@ -1290,166 +1246,6 @@ evaluate(tdico *dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
static bool |
|
|
|
scanline(tdico *dico, char *s, char *r, bool err) |
|
|
|
/* scan host code line s for macro substitution. r=result line */ |
|
|
|
{ |
|
|
|
int i, k, ls, level, nd, nnest; |
|
|
|
bool spice3; |
|
|
|
char c, d; |
|
|
|
|
|
|
|
Strbig(Llen, q); |
|
|
|
Strbig(Llen, t); |
|
|
|
Str(20, u); |
|
|
|
spice3 = cpos('3', dico->option) > 0; /* we had -3 on the command line */ |
|
|
|
i = 0; |
|
|
|
ls = length(s); |
|
|
|
scopy(r, ""); |
|
|
|
err = 0; |
|
|
|
pscopy(u, s, 1, 3); |
|
|
|
|
|
|
|
if ((ls > 7) && steq(u, "**&")) { |
|
|
|
/* special Comment **&AC #... */ |
|
|
|
pscopy(r, s, 1, 7); |
|
|
|
i = 7; |
|
|
|
} |
|
|
|
|
|
|
|
while ((i < ls) && !err) { |
|
|
|
i++; |
|
|
|
c = s[i - 1]; |
|
|
|
|
|
|
|
if (c == Psp) { |
|
|
|
|
|
|
|
/* try ps expression syntax */ |
|
|
|
k = i; |
|
|
|
nnest = 1; |
|
|
|
|
|
|
|
do |
|
|
|
{ |
|
|
|
k++; |
|
|
|
d = s[k - 1]; |
|
|
|
if (d == '{') |
|
|
|
nnest++; |
|
|
|
else if (d == '}') |
|
|
|
nnest--; |
|
|
|
|
|
|
|
} while ((nnest != 0) && (d != '\0')); |
|
|
|
|
|
|
|
if (d == '\0') { |
|
|
|
err = message(dico, "Closing \"}\" not found.\n"); |
|
|
|
} else { |
|
|
|
pscopy(t, s, i + 1, k - i - 1); |
|
|
|
if (dico->hs_compatibility && (strcasecmp(t, "LAST") == 0)) { |
|
|
|
strcpy(q, "last"); |
|
|
|
err = 0; |
|
|
|
} else { |
|
|
|
err = evaluate(dico, q, t, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
i = k; |
|
|
|
|
|
|
|
if (!err) /* insert number */ |
|
|
|
sadd(r, q); |
|
|
|
else |
|
|
|
err = message(dico, "%s\n", s); |
|
|
|
|
|
|
|
} else if (c == Intro) { |
|
|
|
|
|
|
|
Inc(i); |
|
|
|
while ((i < ls) && (s[i - 1] <= ' ')) |
|
|
|
i++; |
|
|
|
|
|
|
|
k = i; |
|
|
|
|
|
|
|
if (s[k - 1] == '(') { |
|
|
|
/* sub-formula */ |
|
|
|
level = 1; |
|
|
|
|
|
|
|
do |
|
|
|
{ |
|
|
|
k++; |
|
|
|
if (k > ls) |
|
|
|
d = '\0'; |
|
|
|
else |
|
|
|
d = s[k - 1]; |
|
|
|
|
|
|
|
if (d == '(') |
|
|
|
level++; |
|
|
|
else if (d == ')') |
|
|
|
level--; |
|
|
|
|
|
|
|
} while ((k <= ls) && !((d == ')') && (level <= 0))); |
|
|
|
|
|
|
|
if (k > ls) { |
|
|
|
err = message(dico, "Closing \")\" not found.\n"); |
|
|
|
} else { |
|
|
|
pscopy(t, s, i + 1, k - i - 1); |
|
|
|
err = evaluate(dico, q, t, 0); |
|
|
|
} |
|
|
|
|
|
|
|
i = k; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
/* simple identifier may also be string */ |
|
|
|
do |
|
|
|
{ |
|
|
|
k++; |
|
|
|
if (k > ls) |
|
|
|
d = '\0'; |
|
|
|
else |
|
|
|
d = s[k - 1]; |
|
|
|
|
|
|
|
} while ((k <= ls) && (d > ' ')); |
|
|
|
|
|
|
|
pscopy(t, s, i, k - i); |
|
|
|
err = evaluate(dico, q, t, 1); |
|
|
|
i = k - 1; |
|
|
|
} |
|
|
|
|
|
|
|
if (!err) /* insert the number */ |
|
|
|
sadd(r, q); |
|
|
|
else |
|
|
|
message(dico, "%s\n", s); |
|
|
|
|
|
|
|
} else if (c == Nodekey) { |
|
|
|
/* follows: a node keyword */ |
|
|
|
|
|
|
|
do |
|
|
|
i++; |
|
|
|
while (s[i - 1] <= ' '); |
|
|
|
|
|
|
|
k = i; |
|
|
|
|
|
|
|
do |
|
|
|
k++; |
|
|
|
while ((k <= ls) && alfanum(s[k - 1])); |
|
|
|
|
|
|
|
pscopy(q, s, i, k - i); |
|
|
|
nd = parsenode(Addr(dico->nodetab), q); |
|
|
|
|
|
|
|
if (!spice3) |
|
|
|
stri(nd, q); /* substitute by number */ |
|
|
|
|
|
|
|
sadd(r, q); |
|
|
|
i = k - 1; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (!spice3) |
|
|
|
c = upcase(c); |
|
|
|
|
|
|
|
cadd(r, c); /* c<>Intro */ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return err; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/********* interface functions for spice3f5 extension ***********/ |
|
|
|
|
|
|
|
static int |
|
|
|
|