inp_modify_exp(), cleanup #12/17, rename `actchar' --> `c'

This commit is contained in:
rlar 2014-11-03 19:24:32 +01:00
parent 88a01bfd68
commit 970b5ed772
1 changed files with 18 additions and 18 deletions

View File

@ -5507,28 +5507,28 @@ inp_modify_exp(char* expr)
/* scan the expression */ /* scan the expression */
s = expr; s = expr;
while (*s != '\0') { while (*s != '\0') {
char actchar; char c;
s = skip_ws(s); s = skip_ws(s);
if (*s == '\0') if (*s == '\0')
break; break;
actchar = *s; c = *s;
wl_append_word(&wlist, &wl, NULL); wl_append_word(&wlist, &wl, NULL);
if ((actchar == ',') || (actchar == '(') || (actchar == ')') || if ((c == ',') || (c == '(') || (c == ')') ||
(actchar == '*') || (actchar == '/') || (actchar == '^') || (c == '*') || (c == '/') || (c == '^') ||
(actchar == '+') || (actchar == '?') || (actchar == ':')) (c == '+') || (c == '?') || (c == ':'))
{ {
if ((actchar == '*') && (s[1] == '*')) { if ((c == '*') && (s[1] == '*')) {
actchar = '^'; c = '^';
s++; s++;
} }
wl->wl_word = tprintf("%c", actchar); wl->wl_word = tprintf("%c", c);
s++; s++;
if (actchar == ')') if (c == ')')
ustate = S_value; ustate = S_value;
else else
ustate = S_operator; ustate = S_operator;
} else if ((actchar == '>') || (actchar == '<') || } else if ((c == '>') || (c == '<') ||
(actchar == '!') || (actchar == '=')) (c == '!') || (c == '='))
{ {
/* >=, <=, !=, ==, <>, ... */ /* >=, <=, !=, ==, <>, ... */
char *beg = s++; char *beg = s++;
@ -5536,26 +5536,26 @@ inp_modify_exp(char* expr)
s++; s++;
wl->wl_word = copy_substring(beg, s); wl->wl_word = copy_substring(beg, s);
ustate = S_operator; ustate = S_operator;
} else if ((actchar == '|') || (actchar == '&')) { } else if ((c == '|') || (c == '&')) {
char *beg = s++; char *beg = s++;
if ((*s == '|') || (*s == '&')) if ((*s == '|') || (*s == '&'))
s++; s++;
wl->wl_word = copy_substring(beg, s); wl->wl_word = copy_substring(beg, s);
ustate = S_operator; ustate = S_operator;
} else if ((actchar == '-') && (ustate == S_value)) { } else if ((c == '-') && (ustate == S_value)) {
wl->wl_word = tprintf("%c", actchar); wl->wl_word = tprintf("%c", c);
s++; s++;
ustate = S_operator; ustate = S_operator;
} else if ((actchar == '-') && (ustate == S_operator)) { } else if ((c == '-') && (ustate == S_operator)) {
wl->wl_word = copy(""); wl->wl_word = copy("");
s++; s++;
ustate = S_unary_minus; ustate = S_unary_minus;
} else if (isalpha(actchar)) { } else if (isalpha(c)) {
int i = 0; int i = 0;
if (ustate == S_unary_minus) if (ustate == S_unary_minus)
buf[i++] = '-'; buf[i++] = '-';
if (((actchar == 'v') || (actchar == 'i')) && (s[1] == '(')) { if (((c == 'v') || (c == 'i')) && (s[1] == '(')) {
while (*s != ')') { while (*s != ')') {
buf[i++] = *s++; buf[i++] = *s++;
} }
@ -5601,7 +5601,7 @@ inp_modify_exp(char* expr)
} }
} }
ustate = S_value; ustate = S_value;
} else if (isdigit(actchar) || (actchar == '.')) { /* allow .5 format too */ } else if (isdigit(c) || (c == '.')) { /* allow .5 format too */
int error1; int error1;
/* allow 100p, 5MEG etc. */ /* allow 100p, 5MEG etc. */
double dvalue = INPevaluate(&s, &error1, 0); double dvalue = INPevaluate(&s, &error1, 0);