Browse Source

use the type `bool' instead of `unsigned char' in the numparam world

pre-master-46
rlar 16 years ago
parent
commit
96992f770a
  1. 10
      ChangeLog
  2. 35
      src/frontend/numparam/general.h
  3. 48
      src/frontend/numparam/mystring.c
  4. 8
      src/frontend/numparam/numparam.h
  5. 2
      src/frontend/numparam/spicenum.c
  6. 83
      src/frontend/numparam/xpressn.c

10
ChangeLog

@ -1,3 +1,13 @@
2010-11-02 Robert Larice
* src/frontend/numparam/general.h ,
* src/frontend/numparam/mystring.c ,
* src/frontend/numparam/numparam.h ,
* src/frontend/numparam/spicenum.c ,
* src/frontend/numparam/xpressn.c :
use the type `bool' instead of `unsigned char' in the numparam world
bool currently is `unsigned char', plan to change to `int' for better
type comaptibility with `C' boolean expressions
2010-11-02 Robert Larice 2010-11-02 Robert Larice
* src/frontend/inpcom.c , * src/frontend/inpcom.c ,
* src/frontend/parser/lexical.c , * src/frontend/parser/lexical.c ,

35
src/frontend/numparam/general.h

@ -6,6 +6,7 @@
the function code is in 'mystring.c' . the function code is in 'mystring.c' .
*/ */
#include "dstring.h" #include "dstring.h"
#include "bool.h"
#define Use(x) x=0;x=x #define Use(x) x=0;x=x
#define Uses(s) s=s #define Uses(s) s=s
@ -23,23 +24,23 @@ typedef char string[258];
void sfix( SPICE_DSTRINGPTR dstr_p, int len) ; void sfix( SPICE_DSTRINGPTR dstr_p, int len) ;
char * pscopy( SPICE_DSTRINGPTR s, char * a, int i,int j); char * pscopy( SPICE_DSTRINGPTR s, char * a, int i,int j);
char * pscopy_up( SPICE_DSTRINGPTR s, char * a, int i,int j); char * pscopy_up( SPICE_DSTRINGPTR s, char * a, int i,int j);
unsigned char scopyd( SPICE_DSTRINGPTR a, SPICE_DSTRINGPTR b);
unsigned char scopys( SPICE_DSTRINGPTR a, char *b);
unsigned char scopy_up( SPICE_DSTRINGPTR a, char *str) ;
unsigned char scopy_lower( SPICE_DSTRINGPTR a, char *str) ;
unsigned char ccopy( SPICE_DSTRINGPTR a, char c);
unsigned char sadd( SPICE_DSTRINGPTR s, char * t);
unsigned char nadd( SPICE_DSTRINGPTR s, long n);
unsigned char cadd( SPICE_DSTRINGPTR s, char c);
unsigned char naddll( SPICE_DSTRINGPTR s, long long n);
unsigned char cins( SPICE_DSTRINGPTR s, char c);
unsigned char sins( SPICE_DSTRINGPTR s, char * t);
bool scopyd( SPICE_DSTRINGPTR a, SPICE_DSTRINGPTR b);
bool scopys( SPICE_DSTRINGPTR a, char *b);
bool scopy_up( SPICE_DSTRINGPTR a, char *str) ;
bool scopy_lower( SPICE_DSTRINGPTR a, char *str) ;
bool ccopy( SPICE_DSTRINGPTR a, char c);
bool sadd( SPICE_DSTRINGPTR s, char * t);
bool nadd( SPICE_DSTRINGPTR s, long n);
bool cadd( SPICE_DSTRINGPTR s, char c);
bool naddll( SPICE_DSTRINGPTR s, long long n);
bool cins( SPICE_DSTRINGPTR s, char c);
bool sins( SPICE_DSTRINGPTR s, char * t);
int cpos( char c, char *s); int cpos( char c, char *s);
int spos_( char * sub, char * s); int spos_( char * sub, char * s);
int ci_prefix( register char *p, register char *s ); int ci_prefix( register char *p, register char *s );
int length(char * s); int length(char * s);
unsigned char steq(char * s, char * t);
unsigned char stne(char * s, char * t);
bool steq(char * s, char * t);
bool stne(char * s, char * t);
int scompare(char * a, char * b); int scompare(char * a, char * b);
int ord(char c); int ord(char c);
int pred(int i); int pred(int i);
@ -54,10 +55,10 @@ char upcase(char c);
char lowcase(char c); char lowcase(char c);
int hi(long w); int hi(long w);
int lo(long w); int lo(long w);
unsigned char odd(long x);
unsigned char alfa(char c);
unsigned char num(char c);
unsigned char alfanum(char c);
bool odd(long x);
bool alfa(char c);
bool num(char c);
bool alfanum(char c);
char * stupcase( char * s); char * stupcase( char * s);
/***** primitive input-output ***/ /***** primitive input-output ***/

48
src/frontend/numparam/mystring.c

@ -161,7 +161,7 @@ length (char *s)
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
* Function: add string t to dynamic string dstr_p. * Function: add string t to dynamic string dstr_p.
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
sadd ( SPICE_DSTRINGPTR dstr_p, char *t) sadd ( SPICE_DSTRINGPTR dstr_p, char *t)
{ {
spice_dstring_append( dstr_p, t, -1 ) ; spice_dstring_append( dstr_p, t, -1 ) ;
@ -171,7 +171,7 @@ sadd ( SPICE_DSTRINGPTR dstr_p, char *t)
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
* Function: add character c to dynamic string dstr_p. * Function: add character c to dynamic string dstr_p.
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
cadd ( SPICE_DSTRINGPTR dstr_p, char c) cadd ( SPICE_DSTRINGPTR dstr_p, char c)
{ {
char tmp_str[2] ; char tmp_str[2] ;
@ -184,7 +184,7 @@ cadd ( SPICE_DSTRINGPTR dstr_p, char c)
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
* Function: insert character c at front of dynamic string dstr_p * Function: insert character c at front of dynamic string dstr_p
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
cins ( SPICE_DSTRINGPTR dstr_p, char c) cins ( SPICE_DSTRINGPTR dstr_p, char c)
{ {
int i ; int i ;
@ -203,7 +203,7 @@ cins ( SPICE_DSTRINGPTR dstr_p, char c)
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
* Function: insert string t at front of dynamic string dstr_p * Function: insert string t at front of dynamic string dstr_p
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
sins ( SPICE_DSTRINGPTR dstr_p, char *t) sins ( SPICE_DSTRINGPTR dstr_p, char *t)
{ {
int i ; int i ;
@ -254,7 +254,7 @@ upcase (char c)
* Create copy of the dynamic string. Dynamic strings are always NULL * Create copy of the dynamic string. Dynamic strings are always NULL
* terminated. * terminated.
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
scopyd(SPICE_DSTRINGPTR s, SPICE_DSTRINGPTR t) /* returns success flag */ scopyd(SPICE_DSTRINGPTR s, SPICE_DSTRINGPTR t) /* returns success flag */
{ {
spice_dstring_reinit( s ) ; spice_dstring_reinit( s ) ;
@ -266,7 +266,7 @@ scopyd(SPICE_DSTRINGPTR s, SPICE_DSTRINGPTR t) /* returns success flag */
* Create copy of the string in the dynamic string. Dynamic strings * Create copy of the string in the dynamic string. Dynamic strings
* are always NULLterminated. * are always NULLterminated.
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
scopys(SPICE_DSTRINGPTR s, char *t) /* returns success flag */ scopys(SPICE_DSTRINGPTR s, char *t) /* returns success flag */
{ {
spice_dstring_reinit( s ) ; spice_dstring_reinit( s ) ;
@ -278,7 +278,7 @@ scopys(SPICE_DSTRINGPTR s, char *t) /* returns success flag */
* Create an upper case copy of a string and store it in a dynamic string. * Create an upper case copy of a string and store it in a dynamic string.
* Dynamic strings are always NULL * terminated. * Dynamic strings are always NULL * terminated.
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
scopy_up (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */ scopy_up (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */
{ {
char up[2] ; /* short string */ char up[2] ; /* short string */
@ -297,7 +297,7 @@ scopy_up (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */
* Create a lower case copy of a string and store it in a dynamic string. * Create a lower case copy of a string and store it in a dynamic string.
* Dynamic strings are always NULL * terminated. * Dynamic strings are always NULL * terminated.
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
unsigned char
bool
scopy_lower (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */ scopy_lower (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */
{ {
char low[2] ; /* short string */ char low[2] ; /* short string */
@ -312,7 +312,7 @@ scopy_lower (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */
return 1 ; /* Dstrings expand to any length */ return 1 ; /* Dstrings expand to any length */
} }
unsigned char
bool
ccopy ( SPICE_DSTRINGPTR dstr_p, char c) /* returns success flag */ ccopy ( SPICE_DSTRINGPTR dstr_p, char c) /* returns success flag */
{ {
char *s_p ; /* current string */ char *s_p ; /* current string */
@ -396,7 +396,7 @@ succ (int i)
return (++i); return (++i);
} }
unsigned char
bool
nadd ( SPICE_DSTRINGPTR dstr_p, long n) nadd ( SPICE_DSTRINGPTR dstr_p, long n)
/* append a decimal integer to a string */ /* append a decimal integer to a string */
{ {
@ -439,7 +439,7 @@ nadd ( SPICE_DSTRINGPTR dstr_p, long n)
return 1 ; return 1 ;
} }
unsigned char
bool
naddll (SPICE_DSTRINGPTR dstr_p, long long n) naddll (SPICE_DSTRINGPTR dstr_p, long long n)
/* append a decimal integer (but a long long) to a string */ /* append a decimal integer (but a long long) to a string */
{ {
@ -520,7 +520,7 @@ scompare (char *a, char *b)
return k; return k;
} }
unsigned char
bool
steq (char *a, char *b) /* string a==b test */ steq (char *a, char *b) /* string a==b test */
{ {
unsigned short j = 0; unsigned short j = 0;
@ -530,7 +530,7 @@ steq (char *a, char *b) /* string a==b test */
return ((a[j] == 0) && (b[j] == 0)) /* string equality test */ ; return ((a[j] == 0) && (b[j] == 0)) /* string equality test */ ;
} }
unsigned char
bool
stne (char *s, char *t) stne (char *s, char *t)
{ {
return scompare (s, t) != 0; return scompare (s, t) != 0;
@ -557,20 +557,20 @@ lowcase (char c)
return c; return c;
} }
unsigned char
bool
alfa (char c) alfa (char c)
{ {
return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || c == '_' return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || c == '_'
|| c == '[' || c == ']'; || c == '[' || c == ']';
} }
unsigned char
bool
num (char c) num (char c)
{ {
return (c >= '0') && (c <= '9'); return (c >= '0') && (c <= '9');
} }
unsigned char
bool
alfanum (char c) alfanum (char c)
{ {
return alfa (c) || ((c >= '0') && (c <= '9')); return alfa (c) || ((c >= '0') && (c <= '9'));
@ -616,7 +616,7 @@ freadi (FILE * f)
/* reads next integer, but returns 0 if none found. */ /* reads next integer, but returns 0 if none found. */
{ {
long z = 0; long z = 0;
unsigned char minus = 0;
bool minus = 0;
char c; char c;
do do
@ -774,7 +774,7 @@ strif (long i, int f, SPICE_DSTRINGPTR dstr_p)
} }
} }
unsigned char
bool
odd (long x) odd (long x)
{ {
return (x & 1); return (x & 1);
@ -787,7 +787,7 @@ vali (char *s, long *i)
{ {
int k = 0, digit = 0, ls; int k = 0, digit = 0, ls;
long z = 0; long z = 0;
unsigned char minus = 0, ok = 1;
bool minus = 0, ok = 1;
char c; char c;
ls = length (s); ls = length (s);
@ -825,13 +825,13 @@ vali (char *s, long *i)
return k; /* one beyond error position */ return k; /* one beyond error position */
} }
static unsigned char
match (char *s, char *t, int n, int tstart, unsigned char testcase)
static bool
match (char *s, char *t, int n, int tstart, bool testcase)
{ {
/* returns 0 if ( tstart is out of range. But n may be 0 ? */ /* returns 0 if ( tstart is out of range. But n may be 0 ? */
/* 1 if s matches t[tstart...tstart+n] */ /* 1 if s matches t[tstart...tstart+n] */
int i, j, lt; int i, j, lt;
unsigned char ok;
bool ok;
char a, b; char a, b;
i = 0; i = 0;
j = tstart; j = tstart;
@ -862,7 +862,7 @@ posi (char *sub, char *s, int opt)
/* opt=1: like Turbo Pascal Pos, but case insensitive */ /* opt=1: like Turbo Pascal Pos, but case insensitive */
/* opt=2: position in space separated wordlist for scanners */ /* opt=2: position in space separated wordlist for scanners */
int a, b, k, j; int a, b, k, j;
unsigned char ok, tstcase;
bool ok, tstcase;
SPICE_DSTRING tstr ; SPICE_DSTRING tstr ;
ok = 0; ok = 0;
@ -992,7 +992,7 @@ ival (char *s, int *err)
{ {
int k = 0, digit = 0, ls; int k = 0, digit = 0, ls;
long z = 0; long z = 0;
unsigned char minus = 0, ok = 1;
bool minus = 0, ok = 1;
char c; char c;
ls = length (s); ls = length (s);

8
src/frontend/numparam/numparam.h

@ -64,11 +64,11 @@ typedef struct _ttdico {
void initdico(tdico * dico); void initdico(tdico * dico);
int donedico(tdico * dico); int donedico(tdico * dico);
void dico_free_entry( entry *entry_p ) ; void dico_free_entry( entry *entry_p ) ;
unsigned char defsubckt( tdico *dico, char * s, int w, char categ);
bool defsubckt( tdico *dico, char * s, int w, char categ);
int findsubckt( tdico *dico, char * s, SPICE_DSTRINGPTR subname); int findsubckt( tdico *dico, char * s, SPICE_DSTRINGPTR subname);
unsigned char nupa_substitute( tdico *dico, char * s, char * r, unsigned char err);
unsigned char nupa_assignment( tdico *dico, char * s, char mode);
unsigned char nupa_subcktcall( tdico *dico, char * s, char * x, unsigned char err);
bool nupa_substitute( tdico *dico, char * s, char * r, bool err);
bool nupa_assignment( tdico *dico, char * s, char mode);
bool nupa_subcktcall( tdico *dico, char * s, char * x, bool err);
void nupa_subcktexit( tdico *dico); void nupa_subcktexit( tdico *dico);
tdico * nupa_fetchinstance(void); tdico * nupa_fetchinstance(void);
char getidtype( tdico *d, char * s); char getidtype( tdico *d, char * s);

2
src/frontend/numparam/spicenum.c

@ -830,7 +830,7 @@ nupa_eval (char *s, int linenum, int orig_linenum)
char c, keep, *ptr; char c, keep, *ptr;
unsigned int i; unsigned int i;
SPICE_DSTRING subname ; /* dynamic string for subcircuit name */ SPICE_DSTRING subname ; /* dynamic string for subcircuit name */
unsigned char err = 1;
bool err = 1;
spice_dstring_init(&subname) ; spice_dstring_init(&subname) ;
dicoS->srcline = linenum; dicoS->srcline = linenum;

83
src/frontend/numparam/xpressn.c

@ -134,7 +134,7 @@ mathfunction (int f, double z, double x)
return y; return y;
} }
static unsigned char
static bool
message (tdico * dic, char *s) message (tdico * dic, char *s)
/* record 'dic' should know about source file and line */ /* record 'dic' should know about source file and line */
{ {
@ -344,9 +344,9 @@ getidtype (tdico * d, char *s)
} }
static double static double
fetchnumentry (tdico * dico, char *t, unsigned char *perr)
fetchnumentry (tdico * dico, char *t, bool *perr)
{ {
unsigned char err = *perr;
bool err = *perr;
double u; double u;
entry *entry_p ; /* hash table entry */ entry *entry_p ; /* hash table entry */
SPICE_DSTRING s ; /* dynamic string */ SPICE_DSTRING s ; /* dynamic string */
@ -409,7 +409,7 @@ attrib (tdico *dico_p, NGHASHPTR htable_p, char *t, char op)
return entry_p ; return entry_p ;
} }
static unsigned char
static bool
define (tdico * dico, define (tdico * dico,
char *t, /* identifier to define */ char *t, /* identifier to define */
char op, /* option */ char op, /* option */
@ -428,7 +428,7 @@ define (tdico * dico,
we mark each id with its subckt level, and warn if write at higher one. we mark each id with its subckt level, and warn if write at higher one.
*/ */
char c; char c;
unsigned char err, warn;
bool err, warn;
entry *entry_p ; /* spice table entry */ entry *entry_p ; /* spice table entry */
SPICE_DSTRING vartemp ; /* vairable temp */ SPICE_DSTRING vartemp ; /* vairable temp */
NGHASHPTR htable_p ; /* hash table */ NGHASHPTR htable_p ; /* hash table */
@ -495,14 +495,14 @@ define (tdico * dico,
return err; return err;
} }
unsigned char
bool
defsubckt (tdico * dico, char *s, int w, char categ) defsubckt (tdico * dico, char *s, int w, char categ)
/* called on 1st pass of spice source code, /* called on 1st pass of spice source code,
to enter subcircuit (categ=U) and model (categ=O) names to enter subcircuit (categ=U) and model (categ=O) names
*/ */
{ {
SPICE_DSTRING ustr ; /* temp user string */ SPICE_DSTRING ustr ; /* temp user string */
unsigned char err;
bool err;
int i, j, ls; int i, j, ls;
ls = length (s); ls = length (s);
i = 0; i = 0;
@ -577,10 +577,10 @@ findsubckt (tdico * dico, char *s, SPICE_DSTRINGPTR subname)
static int static int
deffuma ( /* define function or macro entry. */ deffuma ( /* define function or macro entry. */
tdico * dico, char *t, char tpe, unsigned short bufstart, tdico * dico, char *t, char tpe, unsigned short bufstart,
unsigned char *pjumped, unsigned char *perr)
unsigned char *pjumped, bool *perr)
{ {
unsigned char jumped = *pjumped; unsigned char jumped = *pjumped;
unsigned char err = *perr;
bool err = *perr;
/* if not jumped, define new function or macro, returns index to buffferstart /* if not jumped, define new function or macro, returns index to buffferstart
if jumped, return index to existing function if jumped, return index to existing function
*/ */
@ -631,7 +631,7 @@ keyword ( SPICE_DSTRINGPTR keys_p, SPICE_DSTRINGPTR tstr_p)
/* return 0 if t not found in list keys, else the ordinal number */ /* return 0 if t not found in list keys, else the ordinal number */
unsigned char i, j, k; unsigned char i, j, k;
int lt, lk; int lt, lk;
unsigned char ok;
bool ok;
char *t ; char *t ;
char *keys ; char *keys ;
lt = spice_dstring_length(tstr_p) ; lt = spice_dstring_length(tstr_p) ;
@ -672,7 +672,7 @@ parseunit (double x, char *s)
{ {
double u = 0; double u = 0;
SPICE_DSTRING t ; SPICE_DSTRING t ;
unsigned char isunit;
bool isunit;
isunit = 1; isunit = 1;
spice_dstring_init(&t) ; spice_dstring_init(&t) ;
@ -710,7 +710,7 @@ fetchid (char *s, SPICE_DSTRINGPTR t, int ls, int i)
/* copy next identifier from s into t, advance and return scan index i */ /* copy next identifier from s into t, advance and return scan index i */
{ {
char c; char c;
unsigned char ok;
bool ok;
c = s[i - 1]; c = s[i - 1];
while ((!alfa (c)) && (i < ls)) while ((!alfa (c)) && (i < ls))
@ -740,15 +740,15 @@ fetchid (char *s, SPICE_DSTRINGPTR t, int ls, int i)
} }
static double static double
exists (tdico * d, char *s, int *pi, unsigned char *perror)
exists (tdico * d, char *s, int *pi, bool *perror)
/* check if s in simboltable 'defined': expect (ident) and return 0 or 1 */ /* check if s in simboltable 'defined': expect (ident) and return 0 or 1 */
{ {
unsigned char error = *perror;
bool error = *perror;
int i = *pi; int i = *pi;
double x; double x;
int ls; int ls;
char c; char c;
unsigned char ok;
bool ok;
SPICE_DSTRING t ; SPICE_DSTRING t ;
ls = length (s); ls = length (s);
@ -795,10 +795,10 @@ exists (tdico * d, char *s, int *pi, unsigned char *perror)
} }
static double static double
fetchnumber (tdico * dico, char *s, int ls, int *pi, unsigned char *perror)
fetchnumber (tdico * dico, char *s, int ls, int *pi, bool *perror)
/* parse a Spice number in string s */ /* parse a Spice number in string s */
{ {
unsigned char error = *perror;
bool error = *perror;
int i = *pi; int i = *pi;
int k, err; int k, err;
char d; char d;
@ -883,7 +883,7 @@ fetchoperator (tdico * dico,
char *s, int ls, char *s, int ls,
int *pi, int *pi,
unsigned char *pstate, unsigned char *plevel, unsigned char *pstate, unsigned char *plevel,
unsigned char *perror)
bool *perror)
/* grab an operator from string s and advance scan index pi. /* grab an operator from string s and advance scan index pi.
each operator has: one-char alias, precedence level, new interpreter state. each operator has: one-char alias, precedence level, new interpreter state.
*/ */
@ -891,7 +891,7 @@ fetchoperator (tdico * dico,
int i = *pi; int i = *pi;
unsigned char state = *pstate; unsigned char state = *pstate;
unsigned char level = *plevel; unsigned char level = *plevel;
unsigned char error = *perror;
bool error = *perror;
char c, d; char c, d;
SPICE_DSTRING vstr ; SPICE_DSTRING vstr ;
c = s[i - 1]; c = s[i - 1];
@ -996,12 +996,12 @@ static char
opfunctkey (tdico * dico, opfunctkey (tdico * dico,
unsigned char kw, char c, unsigned char kw, char c,
unsigned char *pstate, unsigned char *plevel, unsigned char *pstate, unsigned char *plevel,
unsigned char *perror)
bool *perror)
/* handle operator and built-in keywords */ /* handle operator and built-in keywords */
{ {
unsigned char state = *pstate; unsigned char state = *pstate;
unsigned char level = *plevel; unsigned char level = *plevel;
unsigned char error = *perror;
bool error = *perror;
/*if kw operator keyword, c=token*/ /*if kw operator keyword, c=token*/
switch (kw) switch (kw)
{ /* & | ~ DIV MOD Defined */ { /* & | ~ DIV MOD Defined */
@ -1143,7 +1143,7 @@ operate (char op, double x, double y)
} }
static double static double
formula (tdico * dico, char *s, unsigned char *perror)
formula (tdico * dico, char *s, bool *perror)
{ {
/* Expression parser. /* Expression parser.
s is a formula with parentheses and math ops +-* / ... s is a formula with parentheses and math ops +-* / ...
@ -1155,8 +1155,8 @@ formula (tdico * dico, char *s, unsigned char *perror)
Allowed transitions: 1->2->(3,1) and 3->(3,1). Allowed transitions: 1->2->(3,1) and 3->(3,1).
*/ */
typedef enum {nprece=9} _nnprece; /* maximal nb of precedence levels */ typedef enum {nprece=9} _nnprece; /* maximal nb of precedence levels */
unsigned char error = *perror;
unsigned char negate = 0;
bool error = *perror;
bool negate = 0;
unsigned char state, oldstate, topop, ustack, level, kw, fu; unsigned char state, oldstate, topop, ustack, level, kw, fu;
double u = 0.0, v, w = 0.0; double u = 0.0, v, w = 0.0;
double accu[nprece + 1]; double accu[nprece + 1];
@ -1164,7 +1164,7 @@ formula (tdico * dico, char *s, unsigned char *perror)
char uop[nprece + 1]; char uop[nprece + 1];
int i, k, ls, natom, arg2, arg3; int i, k, ls, natom, arg2, arg3;
char c, d; char c, d;
unsigned char ok;
bool ok;
SPICE_DSTRING tstr ; SPICE_DSTRING tstr ;
spice_dstring_init(&tstr) ; spice_dstring_init(&tstr) ;
@ -1378,7 +1378,7 @@ fmttype (double x)
/* find out the "natural" type of format for number x */ /* find out the "natural" type of format for number x */
double ax, dx; double ax, dx;
int rx; int rx;
unsigned char isint, astronomic;
bool isint, astronomic;
ax = absf (x); ax = absf (x);
isint = 0; isint = 0;
astronomic = 0; astronomic = 0;
@ -1403,7 +1403,7 @@ fmttype (double x)
return 'P'; return 'P';
} }
static unsigned char
static bool
evaluate (tdico * dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode) evaluate (tdico * dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode)
{ {
/* transform t to result q. mode 0: expression, mode 1: simple variable */ /* transform t to result q. mode 0: expression, mode 1: simple variable */
@ -1411,8 +1411,8 @@ evaluate (tdico * dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode)
int j, lq; int j, lq;
char dt, fmt; char dt, fmt;
entry *entry_p ; entry *entry_p ;
unsigned char numeric, done, nolookup;
unsigned char err;
bool numeric, done, nolookup;
bool err;
SPICE_DSTRING vstr ; SPICE_DSTRING vstr ;
spice_dstring_init(&vstr) ; spice_dstring_init(&vstr) ;
@ -1493,12 +1493,12 @@ evaluate (tdico * dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode)
} }
#if 0 #if 0
static unsigned char
scanline (tdico * dico, char *s, char *r, unsigned char err)
static bool
scanline (tdico * dico, char *s, char *r, bool err)
/* scan host code line s for macro substitution. r=result line */ /* scan host code line s for macro substitution. r=result line */
{ {
int i, k, ls, level, nd, nnest; int i, k, ls, level, nd, nnest;
unsigned char spice3;
bool spice3;
char c, d; char c, d;
Strbig (Llen, q); Strbig (Llen, q);
Strbig (Llen, t); Strbig (Llen, t);
@ -1754,7 +1754,7 @@ insertnumber (tdico * dico, int i, char *s, SPICE_DSTRINGPTR ustr_p)
SPICE_DSTRING vstr ; /* dynamic string */ SPICE_DSTRING vstr ; /* dynamic string */
SPICE_DSTRING mstr ; /* dynamic string */ SPICE_DSTRING mstr ; /* dynamic string */
char *v_p ; /* value of vstr dyna string */ char *v_p ; /* value of vstr dyna string */
unsigned char found;
bool found;
int ls, k; int ls, k;
long long accu; long long accu;
ls = length (s); ls = length (s);
@ -1820,8 +1820,9 @@ insertnumber (tdico * dico, int i, char *s, SPICE_DSTRINGPTR ustr_p)
} }
return i; return i;
} }
unsigned char
nupa_substitute (tdico * dico, char *s, char *r, unsigned char err)
bool
nupa_substitute (tdico * dico, char *s, char *r, bool err)
/* s: pointer to original source line. /* s: pointer to original source line.
r: pointer to result line, already heavily modified wrt s r: pointer to result line, already heavily modified wrt s
anywhere we find a 10-char numstring in r, substitute it. anywhere we find a 10-char numstring in r, substitute it.
@ -1988,7 +1989,7 @@ getexpress (char *s, SPICE_DSTRINGPTR tstr_p, int *pi)
int i = *pi; int i = *pi;
int ia, ls, level; int ia, ls, level;
char c, d, tpe; char c, d, tpe;
unsigned char comment = 0;
bool comment = 0;
ls = length (s); ls = length (s);
ia = i + 1; ia = i + 1;
@ -2062,7 +2063,7 @@ getexpress (char *s, SPICE_DSTRINGPTR tstr_p, int *pi)
return tpe; return tpe;
} }
unsigned char
bool
nupa_assignment (tdico * dico, char *s, char mode) nupa_assignment (tdico * dico, char *s, char mode)
/* is called for all 'Param' lines of the input file. /* is called for all 'Param' lines of the input file.
is also called for the params: section of a subckt . is also called for the params: section of a subckt .
@ -2073,7 +2074,7 @@ nupa_assignment (tdico * dico, char *s, char mode)
/* s has the format: ident = expression; ident= expression ... */ /* s has the format: ident = expression; ident= expression ... */
int i, j, ls; int i, j, ls;
unsigned char key; unsigned char key;
unsigned char error, err;
bool error, err;
char dtype; char dtype;
int wval = 0; int wval = 0;
double rval = 0.0; double rval = 0.0;
@ -2148,8 +2149,8 @@ nupa_assignment (tdico * dico, char *s, char mode)
return error; return error;
} }
unsigned char
nupa_subcktcall (tdico * dico, char *s, char *x, unsigned char err)
bool
nupa_subcktcall (tdico * dico, char *s, char *x, bool err)
/* s= a subckt define line, with formal params. /* s= a subckt define line, with formal params.
x= a matching subckt call line, with actual params x= a matching subckt call line, with actual params
*/ */
@ -2164,7 +2165,7 @@ nupa_subcktcall (tdico * dico, char *s, char *x, unsigned char err)
char *buf, *token; char *buf, *token;
char *t_p ; char *t_p ;
char *u_p ; char *u_p ;
unsigned char found;
bool found;
spice_dstring_init(&subname) ; spice_dstring_init(&subname) ;
spice_dstring_init(&tstr) ; spice_dstring_init(&tstr) ;
spice_dstring_init(&ustr) ; spice_dstring_init(&ustr) ;

Loading…
Cancel
Save