Browse Source

numparm, cleanup, {}

pre-master-46
rlar 15 years ago
parent
commit
49b7e340d5
  1. 4
      ChangeLog
  2. 42
      src/frontend/numparam/xpressn.c

4
ChangeLog

@ -1,3 +1,7 @@
2011-02-19 Robert Larice
* src/frontend/numparam/xpressn.c :
numparm, cleanup, {}
2011-02-19 Robert Larice 2011-02-19 Robert Larice
* src/frontend/numparam/mystring.c , * src/frontend/numparam/mystring.c ,
* src/frontend/numparam/xpressn.c : * src/frontend/numparam/xpressn.c :

42
src/frontend/numparam/xpressn.c

@ -247,9 +247,8 @@ initdico (tdico * dico)
void dico_free_entry( entry *entry_p ) void dico_free_entry( entry *entry_p )
{ {
if( entry_p->symbol ) if( entry_p->symbol )
{
txfree(entry_p->symbol ) ; txfree(entry_p->symbol ) ;
}
txfree(entry_p) ; txfree(entry_p) ;
} /* end dico_free_entry() */ } /* end dico_free_entry() */
@ -360,9 +359,7 @@ entrynb ( tdico *d, char *s)
{ {
entry_p = (entry *) nghash_find( htable_p, s ) ; entry_p = (entry *) nghash_find( htable_p, s ) ;
if( entry_p ) if( entry_p )
{
return( entry_p ) ; return( entry_p ) ;
}
} }
} }
/* No local symbols - try the global table */ /* No local symbols - try the global table */
@ -396,9 +393,7 @@ fetchnumentry (tdico * dico, char *t, bool *perr)
/*dbg -- if ( k<=0 ) { ws("Dico num lookup fails. ") ;} */ /*dbg -- if ( k<=0 ) { ws("Dico num lookup fails. ") ;} */
while ( entry_p && (entry_p->tp == 'P') ) while ( entry_p && (entry_p->tp == 'P') )
{
entry_p = entry_p->pointer ; entry_p = entry_p->pointer ;
}
if ( entry_p ) if ( entry_p )
if (entry_p->tp != 'R') if (entry_p->tp != 'R')
@ -474,9 +469,8 @@ define (tdico * dico,
{ {
/* can't be lazy anymore */ /* can't be lazy anymore */
if(!(dico->local_symbols[dico->stack_depth])) if(!(dico->local_symbols[dico->stack_depth]))
{
dico->local_symbols[dico->stack_depth] = nghash_init( NGHASH_MIN_SIZE ) ; dico->local_symbols[dico->stack_depth] = nghash_init( NGHASH_MIN_SIZE ) ;
}
htable_p = dico->local_symbols[dico->stack_depth] ; htable_p = dico->local_symbols[dico->stack_depth] ;
} }
else else
@ -631,13 +625,9 @@ deffuma ( /* define function or macro entry. */
{ {
/* old item! */ /* old item! */
if (jumped) if (jumped)
{
j = dico->dat[i].ivl; j = dico->dat[i].ivl;
}
else else
{
err = message (dico, "%s already defined", t); err = message (dico, "%s already defined", t);
}
} }
else else
{ {
@ -1314,9 +1304,7 @@ formula (tdico * dico, char *s, bool *perror)
topop = level; topop = level;
} }
if ((state > 0)) if ((state > 0))
{
oldstate = state; oldstate = state;
}
} /* while */ ; } /* while */ ;
if ((natom == 0) || (oldstate != 4)) if ((natom == 0) || (oldstate != 4))
@ -1394,9 +1382,7 @@ evaluate (tdico * dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode)
entry_p = entrynb (dico, t); entry_p = entrynb (dico, t);
nolookup = !entry_p; nolookup = !entry_p;
while ((entry_p) && (entry_p->tp == 'P')) while ((entry_p) && (entry_p->tp == 'P'))
{
entry_p = entry_p->pointer ; /* follow pointer chain */ entry_p = entry_p->pointer ; /* follow pointer chain */
}
/* pointer chain */ /* pointer chain */
if (entry_p) if (entry_p)
@ -1498,13 +1484,9 @@ scanline (tdico * dico, char *s, char *r, bool err)
k++; k++;
d = s[k - 1]; d = s[k - 1];
if (d == '{') if (d == '{')
{
nnest++; nnest++;
}
else if (d == '}') else if (d == '}')
{
nnest--; nnest--;
}
} }
while ((nnest != 0) && (d != '\0')); while ((nnest != 0) && (d != '\0'));
if (d == '\0') if (d == '\0')
@ -1547,21 +1529,14 @@ scanline (tdico * dico, char *s, char *r, bool err)
{ {
k++; k++;
if (k > ls) if (k > ls)
{
d = '\0'; d = '\0';
}
else else
{
d = s[k - 1]; d = s[k - 1];
}
if (d == '(') if (d == '(')
{
level++; level++;
}
else if (d == ')') else if (d == ')')
{
level--; level--;
}
} }
while ((k <= ls) && !((d == ')') && (level <= 0))); while ((k <= ls) && !((d == ')') && (level <= 0)));
if (k > ls) if (k > ls)
@ -1582,13 +1557,9 @@ scanline (tdico * dico, char *s, char *r, bool err)
{ {
k++; k++;
if (k > ls) if (k > ls)
{
d = '\0'; d = '\0';
}
else else
{
d = s[k - 1]; d = s[k - 1];
}
} }
while ((k <= ls) && (d > ' ')); while ((k <= ls) && (d > ' '));
pscopy (t, s, i, k - i); pscopy (t, s, i, k - i);
@ -1631,9 +1602,8 @@ scanline (tdico * dico, char *s, char *r, bool err)
else else
{ {
if (!spice3) if (!spice3)
{
c = upcase (c); c = upcase (c);
}
cadd (r, c); /* c<>Intro */ ; cadd (r, c); /* c<>Intro */ ;
} }
} /* while */ } /* while */
@ -1900,9 +1870,7 @@ getword (char *s, SPICE_DSTRINGPTR tstr_p, int after, int *pi)
ls = length (s); ls = length (s);
do do
{
i++; i++;
}
while ((i < ls) && !alfa (s[i - 1])); while ((i < ls) && !alfa (s[i - 1]));
spice_dstring_reinit(tstr_p) ; spice_dstring_reinit(tstr_p) ;
@ -1952,9 +1920,7 @@ getexpress (char *s, SPICE_DSTRINGPTR tstr_p, int *pi)
tpe = 'S'; tpe = 'S';
do do
{
i++; i++;
}
while ((i <= ls) && (s[i - 1] <= ' ')); while ((i <= ls) && (s[i - 1] <= ' '));
} }
else else

Loading…
Cancel
Save