stripbraces(), whitespace
This commit is contained in:
parent
11e024753a
commit
af78917b98
|
|
@ -102,40 +102,40 @@ stripbraces(SPICE_DSTRINGPTR dstr_p)
|
||||||
|
|
||||||
while ((brace = strchr(p, '{')) != NULL) {
|
while ((brace = strchr(p, '{')) != NULL) {
|
||||||
|
|
||||||
/* something to strip */
|
/* something to strip */
|
||||||
const char *j_ptr = brace + 1;
|
const char *j_ptr = brace + 1;
|
||||||
int nest = 1;
|
int nest = 1;
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
while ((nest > 0) && *j_ptr) {
|
while ((nest > 0) && *j_ptr) {
|
||||||
if (*j_ptr == '{')
|
if (*j_ptr == '{')
|
||||||
nest++;
|
nest++;
|
||||||
else if (*j_ptr == '}')
|
else if (*j_ptr == '}')
|
||||||
nest--;
|
nest--;
|
||||||
j_ptr++;
|
j_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pscopy(&tstr, s, 0, (int) (brace - s));
|
pscopy(&tstr, s, 0, (int) (brace - s));
|
||||||
|
|
||||||
if (brace[-1] > ' ')
|
if (brace[-1] > ' ')
|
||||||
cadd(&tstr, ' ');
|
|
||||||
|
|
||||||
cadd(&tstr, ' ');
|
|
||||||
{
|
|
||||||
char buf[25+1];
|
|
||||||
sprintf(buf, "numparm__________%08lx", ++placeholder);
|
|
||||||
sadd(&tstr, buf);
|
|
||||||
}
|
|
||||||
cadd(&tstr, ' ');
|
cadd(&tstr, ' ');
|
||||||
|
|
||||||
if (*j_ptr >= ' ')
|
cadd(&tstr, ' ');
|
||||||
cadd(&tstr, ' ');
|
{
|
||||||
|
char buf[25+1];
|
||||||
|
sprintf(buf, "numparm__________%08lx", ++placeholder);
|
||||||
|
sadd(&tstr, buf);
|
||||||
|
}
|
||||||
|
cadd(&tstr, ' ');
|
||||||
|
|
||||||
int ilen = spice_dstring_length(&tstr);
|
if (*j_ptr >= ' ')
|
||||||
sadd(&tstr, j_ptr);
|
cadd(&tstr, ' ');
|
||||||
scopyd(dstr_p, &tstr);
|
|
||||||
s = spice_dstring_value(dstr_p);
|
int ilen = spice_dstring_length(&tstr);
|
||||||
p = s + ilen;
|
sadd(&tstr, j_ptr);
|
||||||
|
scopyd(dstr_p, &tstr);
|
||||||
|
s = spice_dstring_value(dstr_p);
|
||||||
|
p = s + ilen;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynsubst = placeholder;
|
dynsubst = placeholder;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue