Browse Source

numparm, un-pascal-ify, use '\0'

pre-master-46
rlar 15 years ago
parent
commit
7ad47870ef
  1. 5
      ChangeLog
  2. 18
      src/frontend/numparam/mystring.c
  3. 34
      src/frontend/numparam/xpressn.c

5
ChangeLog

@ -1,3 +1,8 @@
2011-02-19 Robert Larice
* src/frontend/numparam/mystring.c ,
* src/frontend/numparam/xpressn.c :
numparm, un-pascal-ify, use '\0'
2011-02-19 Robert Larice 2011-02-19 Robert Larice
* src/frontend/numparam/mystring.c , * src/frontend/numparam/mystring.c ,
* src/frontend/numparam/nupatest.c : * src/frontend/numparam/nupatest.c :

18
src/frontend/numparam/mystring.c

@ -166,7 +166,7 @@ cadd ( SPICE_DSTRINGPTR dstr_p, char c)
{ {
char tmp_str[2] ; char tmp_str[2] ;
tmp_str[0] = c ; tmp_str[0] = c ;
tmp_str[1] = 0 ;
tmp_str[1] = '\0' ;
spice_dstring_append( dstr_p, tmp_str, -1 ) ; spice_dstring_append( dstr_p, tmp_str, -1 ) ;
return 1 ; return 1 ;
} }
@ -222,7 +222,7 @@ cpos (char c, char *s)
*/ */
{ {
int i = 0; int i = 0;
while ((s[i] != c) && (s[i] != 0))
while ((s[i] != c) && (s[i] != '\0'))
i++; i++;
if (s[i] == c) if (s[i] == c)
@ -275,7 +275,7 @@ scopy_up (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */
char *ptr ; /* position in string */ char *ptr ; /* position in string */
spice_dstring_reinit( dstr_p ) ; spice_dstring_reinit( dstr_p ) ;
up[1] = 0 ;
up[1] = '\0' ;
for( ptr = str ; ptr && *ptr ; ptr++ ) for( ptr = str ; ptr && *ptr ; ptr++ )
{ {
up[0] = upcase ( *ptr ); up[0] = upcase ( *ptr );
@ -295,7 +295,7 @@ scopy_lower (SPICE_DSTRINGPTR dstr_p, char *str) /* returns success flag */
char *ptr ; /* position in string */ char *ptr ; /* position in string */
spice_dstring_reinit( dstr_p ) ; spice_dstring_reinit( dstr_p ) ;
low[1] = 0 ;
low[1] = '\0' ;
for( ptr = str ; ptr && *ptr ; ptr++ ) for( ptr = str ; ptr && *ptr ; ptr++ )
{ {
low[0] = lowcase ( *ptr ); low[0] = lowcase ( *ptr );
@ -425,7 +425,7 @@ nadd ( SPICE_DSTRINGPTR dstr_p, long n)
cadd (dstr_p, '0'); cadd (dstr_p, '0');
else else
{ {
load_str[1] = 0 ;
load_str[1] = '\0' ;
if (sg == '-') if (sg == '-')
{ {
load_str[0] = sg ; load_str[0] = sg ;
@ -470,7 +470,7 @@ naddll (SPICE_DSTRINGPTR dstr_p, long long n)
cadd (dstr_p, '0'); cadd (dstr_p, '0');
else else
{ {
load_str[1] = 0 ;
load_str[1] = '\0' ;
if (sg == '-') if (sg == '-')
{ {
load_str[0] = sg ; load_str[0] = sg ;
@ -587,8 +587,8 @@ freadstr (FILE * f, SPICE_DSTRINGPTR dstr_p)
char str_load[2] ; char str_load[2] ;
int len = 0 ; int len = 0 ;
str_load[0] = 0 ;
str_load[1] = 0 ;
str_load[0] = '\0' ;
str_load[1] = '\0' ;
spice_dstring_reinit(dstr_p) ; spice_dstring_reinit(dstr_p) ;
do do
{ {
@ -650,7 +650,7 @@ stupcase (char *s)
{ {
int i = 0; int i = 0;
while (s[i] != 0)
while (s[i] != '\0')
{ {
s[i] = upcase (s[i]); s[i] = upcase (s[i]);
i++; i++;

34
src/frontend/numparam/xpressn.c

@ -742,7 +742,7 @@ fetchid (char *s, SPICE_DSTRINGPTR t, int ls, int i)
if (i <= ls) if (i <= ls)
c = s[i - 1]; c = s[i - 1];
else else
c = Nul;
c = '\0';
c = upcase (c); c = upcase (c);
ok = alfanum (c) || c == '.'; ok = alfanum (c) || c == '.';
@ -775,13 +775,13 @@ exists (tdico * d, char *s, int *pi, bool *perror)
{ {
i++; i++;
if (i > ls) if (i > ls)
c = Nul;
c = '\0';
else else
c = s[i - 1]; c = s[i - 1];
ok = (c == '('); ok = (c == '(');
} }
while (!(ok || (c == Nul)));
while (!(ok || (c == '\0')));
if (ok) if (ok)
{ {
@ -795,13 +795,13 @@ exists (tdico * d, char *s, int *pi, bool *perror)
i++; i++;
if (i > ls) if (i > ls)
c = Nul;
c = '\0';
else else
c = s[i - 1]; c = s[i - 1];
ok = (c == ')'); ok = (c == ')');
} }
while (!(ok || (c == Nul)));
while (!(ok || (c == '\0')));
} }
if (!ok) if (!ok)
error = message (d, " Defined() syntax"); error = message (d, " Defined() syntax");
@ -865,7 +865,7 @@ fetchoperator (tdico * dico,
if (i < ls) if (i < ls)
d = s[i]; d = s[i];
else else
d = Nul;
d = '\0';
if ((c == '!') && (d == '=')) if ((c == '!') && (d == '='))
{ {
@ -1166,7 +1166,7 @@ formula (tdico * dico, char *s, bool *perror)
{ {
k++; k++;
if (k > ls) if (k > ls)
d = (char)(0);
d = '\0';
else else
d = s[k - 1]; d = s[k - 1];
@ -1506,8 +1506,8 @@ scanline (tdico * dico, char *s, char *r, bool err)
nnest--; nnest--;
} }
} }
while (!((nnest == 0) || (d == 0)));
if (d == 0)
while (!((nnest == 0) || (d == '\0')));
if (d == '\0')
{ {
err = message (dico, "Closing \"}\" not found."); err = message (dico, "Closing \"}\" not found.");
} }
@ -1548,7 +1548,7 @@ scanline (tdico * dico, char *s, char *r, bool err)
k++; k++;
if (k > ls) if (k > ls)
{ {
d = chr (0);
d = '\0';
} }
else else
{ {
@ -1583,7 +1583,7 @@ scanline (tdico * dico, char *s, char *r, bool err)
k++; k++;
if (k > ls) if (k > ls)
{ {
d = chr (0);
d = '\0';
} }
else else
{ {
@ -1791,9 +1791,9 @@ nupa_substitute (tdico * dico, char *s, char *r, bool err)
else if (d == '}') else if (d == '}')
nnest--; nnest--;
} }
while (!((nnest == 0) || (d == 0)));
while (!((nnest == 0) || (d == '\0')));
if (d == 0)
if (d == '\0')
err = message (dico, "Closing \"}\" not found."); err = message (dico, "Closing \"}\" not found.");
else else
{ {
@ -1838,7 +1838,7 @@ nupa_substitute (tdico * dico, char *s, char *r, bool err)
{ {
k++; k++;
if (k > ls) if (k > ls)
d = (char)(0);
d = '\0';
else else
d = s[k - 1]; d = s[k - 1];
@ -1865,7 +1865,7 @@ nupa_substitute (tdico * dico, char *s, char *r, bool err)
{ {
k++; k++;
if (k > ls) if (k > ls)
d = (char)(0);
d = '\0';
else else
d = s[k - 1]; d = s[k - 1];
} }
@ -1983,7 +1983,7 @@ getexpress (char *s, SPICE_DSTRINGPTR tstr_p, int *pi)
i++; i++;
if (i > ls) if (i > ls)
d = Nul;
d = '\0';
else else
d = s[i - 1]; d = s[i - 1];
@ -2062,7 +2062,7 @@ nupa_assignment (tdico * dico, char *s, char mode)
{ {
key = getword (s, &tstr, i, &i); key = getword (s, &tstr, i, &i);
t_p = spice_dstring_value(&tstr) ; t_p = spice_dstring_value(&tstr) ;
if ((t_p[0] == 0) || (key > 0))
if ((t_p[0] == '\0') || (key > 0))
error = message (dico, " Identifier expected"); error = message (dico, " Identifier expected");
if (!error) if (!error)

Loading…
Cancel
Save