nupa_assignment(), whitespace
This commit is contained in:
parent
0624584370
commit
f0fa06ea26
|
|
@ -1421,11 +1421,13 @@ nupa_assignment(dico_t *dico, const char * const s, char mode)
|
||||||
/* s has the format: ident = expression; ident= expression ... */
|
/* s has the format: ident = expression; ident= expression ... */
|
||||||
const char * const s_end = s + strlen(s);
|
const char * const s_end = s + strlen(s);
|
||||||
const char *p = s;
|
const char *p = s;
|
||||||
|
|
||||||
bool error = 0;
|
bool error = 0;
|
||||||
nupa_type dtype;
|
nupa_type dtype;
|
||||||
int wval = 0;
|
int wval = 0;
|
||||||
double rval = 0.0;
|
double rval = 0.0;
|
||||||
char *t_p; /* dstring contents value */
|
char *t_p; /* dstring contents value */
|
||||||
|
|
||||||
SPICE_DSTRING tstr; /* temporary dstring */
|
SPICE_DSTRING tstr; /* temporary dstring */
|
||||||
SPICE_DSTRING ustr; /* temporary dstring */
|
SPICE_DSTRING ustr; /* temporary dstring */
|
||||||
|
|
||||||
|
|
@ -1451,41 +1453,39 @@ nupa_assignment(dico_t *dico, const char * const s, char mode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assignment expressions */
|
/* assignment expressions */
|
||||||
while ((p <= s_end) && (p[-1] != '='))
|
while ((p <= s_end) && (p[-1] != '='))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (p > s_end) {
|
if (p > s_end) {
|
||||||
error = message(dico, " = sign expected.\n");
|
error = message(dico, " = sign expected.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = getexpress(&dtype, &ustr, p) + 1;
|
||||||
|
|
||||||
|
if (dtype == NUPA_REAL) {
|
||||||
|
const char *tmp = spice_dstring_value(&ustr);
|
||||||
|
rval = formula(dico, tmp, tmp + strlen(tmp), &error);
|
||||||
|
if (error) {
|
||||||
|
message(dico,
|
||||||
|
" Formula() error.\n"
|
||||||
|
" %s\n", s);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (dtype == NUPA_STRING) {
|
||||||
|
wval = (int) (p - s);
|
||||||
|
}
|
||||||
|
|
||||||
p = getexpress(&dtype, &ustr, p) + 1;
|
error = nupa_define(dico, spice_dstring_value(&tstr), mode /* was ' ' */ ,
|
||||||
|
dtype, rval, wval, NULL);
|
||||||
if (dtype == NUPA_REAL) {
|
if (error)
|
||||||
const char *tmp = spice_dstring_value(&ustr);
|
break;
|
||||||
rval = formula(dico, tmp, tmp + strlen(tmp), &error);
|
|
||||||
if (error) {
|
|
||||||
message(dico,
|
|
||||||
" Formula() error.\n"
|
|
||||||
" %s\n", s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (dtype == NUPA_STRING) {
|
|
||||||
wval = (int) (p - s);
|
|
||||||
}
|
|
||||||
|
|
||||||
error = nupa_define(dico, spice_dstring_value(&tstr), mode /* was ' ' */ ,
|
|
||||||
dtype, rval, wval, NULL);
|
|
||||||
if (error)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if ((p < s_end) && (p[-1] != ';')) {
|
if ((p < s_end) && (p[-1] != ';')) {
|
||||||
error = message(dico, " ; sign expected.\n");
|
error = message(dico, " ; sign expected.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* else
|
|
||||||
p++; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spice_dstring_free(&tstr);
|
spice_dstring_free(&tstr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue