summaryrefslogtreecommitdiff
path: root/graphics/asymptote/runstring.cc
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/runstring.cc')
-rw-r--r--graphics/asymptote/runstring.cc106
1 files changed, 53 insertions, 53 deletions
diff --git a/graphics/asymptote/runstring.cc b/graphics/asymptote/runstring.cc
index 89c151026a..cb1d3f713d 100644
--- a/graphics/asymptote/runstring.cc
+++ b/graphics/asymptote/runstring.cc
@@ -90,16 +90,16 @@ static const string defaulttimeformat=string("%a %b %d %T %Z %Y");
#ifdef HAVE_STRFTIME
static const size_t nTime=256;
static char Time[nTime];
-#endif
+#endif
-void checkformat(const char *ptr, bool intformat)
+void checkformat(const char *ptr, bool intformat)
{
while(*ptr != '\0') {
if(*ptr != '%') /* While we have regular characters, print them. */
ptr++;
else { /* We've got a format specifier. */
ptr++;
-
+
while(*ptr && strchr ("-+ #0'I", *ptr)) /* Move past flags. */
ptr++;
@@ -107,7 +107,7 @@ void checkformat(const char *ptr, bool intformat)
ptr++;
else while(isdigit(*ptr)) /* Handle explicit numeric value. */
ptr++;
-
+
if(*ptr == '.') {
ptr++; /* Go past the period. */
if(*ptr == '*') {
@@ -118,7 +118,7 @@ void checkformat(const char *ptr, bool intformat)
}
while(*ptr && strchr ("hlL", *ptr))
ptr++;
-
+
if(*ptr == '%') {++ptr; continue;}
else if(*ptr != '\0') {
if(intformat) {
@@ -133,7 +133,7 @@ void checkformat(const char *ptr, bool intformat)
break;
default:
ostringstream buf;
- buf << "Invalid format '" << *ptr << "' for type "
+ buf << "Invalid format '" << *ptr << "' for type "
<< types::names[types::ty_Int];
error(buf);
break;
@@ -160,7 +160,7 @@ void checkformat(const char *ptr, bool intformat)
} /* End of else statement */
}
}
-
+
// Autogenerated routines:
@@ -257,7 +257,7 @@ void gen_runstring7(stack *Stack)
#line 157 "runstring.in"
if ((size_t) pos < s.length())
{Stack->push<string>(s.erase(pos,n)); return;}
- {Stack->push<string>(s); return;}
+ {Stack->push<string>(s); return;}
}
#line 163 "runstring.in"
@@ -300,7 +300,7 @@ void gen_runstring10(stack *Stack)
for(size_t i=0; i < size;) {
array *a=read<array*>(translate,i);
size_t size2=checkArray(a);
- if(size2 != 2)
+ if(size2 != 2)
error("translation table entry must be an array of length 2");
string* from=read<string*>(a,0);
size_t len=from->length();
@@ -326,7 +326,7 @@ void gen_runstring11(stack *Stack)
ostringstream out;
const char *p0=format->c_str();
checkformat(p0,true);
-
+
const char *p=p0;
const char *start=NULL;
while(*p != 0) {
@@ -337,16 +337,16 @@ void gen_runstring11(stack *Stack)
}
out << *(p++);
}
-
+
if(!start) {Stack->push<string>(out.str()); return;}
-
- // Allow at most 1 argument
+
+ // Allow at most 1 argument
while(*p != 0) {
if(*p == '*' || *p == '$') {Stack->push<string>(out.str()); return;}
if(isupper(*p) || islower(*p)) {p++; break;}
p++;
}
-
+
string f=format->substr(start-p0,p-start);
const char *oldlocale=NULL;
@@ -366,7 +366,7 @@ void gen_runstring11(stack *Stack)
out << p;
delete[] buf;
-
+
if(oldlocale) {
setlocale(LC_ALL,oldlocale);
delete[] oldlocale;
@@ -386,16 +386,16 @@ void gen_runstring12(stack *Stack)
string * format=vm::pop<string *>(Stack);
#line 261 "runstring.in"
if(*format == "%") {Stack->push<string>(""); return;} // Temporary workaround for github Issue #29.
-
+
bool tex=getSetting<string>("tex") != "none";
bool texify=forcemath;
ostringstream out;
-
+
const char *p0=format->c_str();
checkformat(p0,false);
const char *phantom="\\phantom{+}";
-
+
const char *p=p0;
const char *start=NULL;
char prev=0;
@@ -409,16 +409,16 @@ void gen_runstring12(stack *Stack)
}
out << *(p++);
}
-
+
if(!start) {Stack->push<string>(out.str()); return;}
-
- // Allow at most 1 argument
+
+ // Allow at most 1 argument
while(*p != 0) {
if(*p == '*' || *p == '$') {Stack->push<string>(out.str()); return;}
if(isupper(*p) || islower(*p)) {p++; break;}
p++;
}
-
+
const char *tail=p;
string f=format->substr(start-p0,tail-start);
@@ -437,14 +437,14 @@ void gen_runstring12(stack *Stack)
bool trailingzero=f.find("#") < string::npos;
bool plus=f.find("+") < string::npos;
bool space=f.find(" ") < string::npos;
-
+
char *q=buf; // beginning of formatted number
if(*q == ' ' && texify) {
out << phantom;
q++;
}
-
+
const char decimal=*(localeconv()->decimal_point);
// Remove any spurious sign
@@ -461,11 +461,11 @@ void gen_runstring12(stack *Stack)
if((plus || space) && texify) out << phantom;
}
}
-
+
const char *r=p=q;
bool dp=false;
while(*r != 0 && (isspace(*r) || isdigit(*r) || *r == decimal \
- || *r == '+' || *r == '-')) {
+ || *r == '+' || *r == '-')) {
if(*r == decimal) dp=true;
r++;
}
@@ -477,12 +477,12 @@ void gen_runstring12(stack *Stack)
while(q <= r) out << *(q++);
if(!trailingzero) q += n;
}
-
+
bool zero=(r == p && *r == '0') && !trailingzero;
-
+
// Translate "E+/E-/e+/e-" exponential notation to TeX
while(*q != 0) {
- if(texify && (*q == 'E' || *q == 'e') &&
+ if(texify && (*q == 'E' || *q == 'e') &&
(*(q+1) == '+' || *(q+1) == '-')) {
if(!zero) out << separator << "10^{";
bool plus=(*(q+1) == '+');
@@ -497,17 +497,17 @@ void gen_runstring12(stack *Stack)
}
out << *(q++);
}
-
- while(*tail != 0)
+
+ while(*tail != 0)
out << *(tail++);
-
+
delete[] buf;
if(oldlocale) {
setlocale(LC_ALL,oldlocale);
delete[] oldlocale;
}
-
+
{Stack->push<string>(out.str()); return;}
}
@@ -571,7 +571,7 @@ void gen_runstring17(stack *Stack)
{Stack->push<string>(Time); return;}
#else
{Stack->push<string>(format); return;}
-#endif
+#endif
}
#line 430 "runstring.in"
@@ -606,7 +606,7 @@ void gen_runstring19(stack *Stack)
{Stack->push<Int>((Int) mktime(&tm)); return;}
#else
{Stack->push<Int>(-1); return;}
-#endif
+#endif
}
} // namespace run
@@ -620,41 +620,41 @@ void gen_runstring_venv(venv &ve)
#line 119 "runstring.in"
addFunc(ve, run::gen_runstring1, primInt(), SYM(length), formal(primString(), SYM(s), false, false));
#line 124 "runstring.in"
- addFunc(ve, run::gen_runstring2, primInt(), SYM(find), formal(primString(), SYM(s), false, false), formal(primString() , SYM(t), false, false), formal(primInt(), SYM(pos), true, false));
+ addFunc(ve, run::gen_runstring2, primInt(), SYM(find), formal(primString(), SYM(s), false, false), formal(primString(), SYM(t), false, false), formal(primInt(), SYM(pos), true, false));
#line 130 "runstring.in"
- addFunc(ve, run::gen_runstring3, primInt(), SYM(rfind), formal(primString(), SYM(s), false, false), formal(primString() , SYM(t), false, false), formal(primInt(), SYM(pos), true, false));
+ addFunc(ve, run::gen_runstring3, primInt(), SYM(rfind), formal(primString(), SYM(s), false, false), formal(primString(), SYM(t), false, false), formal(primInt(), SYM(pos), true, false));
#line 136 "runstring.in"
- addFunc(ve, run::gen_runstring4, primString() , SYM(reverse), formal(primString() , SYM(s), false, false));
+ addFunc(ve, run::gen_runstring4, primString(), SYM(reverse), formal(primString(), SYM(s), false, false));
#line 142 "runstring.in"
- addFunc(ve, run::gen_runstring5, primString() , SYM(insert), formal(primString() , SYM(s), false, false), formal(primInt(), SYM(pos), false, false), formal(primString() , SYM(t), false, false));
+ addFunc(ve, run::gen_runstring5, primString(), SYM(insert), formal(primString(), SYM(s), false, false), formal(primInt(), SYM(pos), false, false), formal(primString(), SYM(t), false, false));
#line 149 "runstring.in"
- addFunc(ve, run::gen_runstring6, primString() , SYM(substr), formal(primString(), SYM(s), false, false), formal(primInt(), SYM(pos), false, false), formal(primInt(), SYM(n), true, false));
+ addFunc(ve, run::gen_runstring6, primString(), SYM(substr), formal(primString(), SYM(s), false, false), formal(primInt(), SYM(pos), false, false), formal(primInt(), SYM(n), true, false));
#line 156 "runstring.in"
- addFunc(ve, run::gen_runstring7, primString() , SYM(erase), formal(primString() , SYM(s), false, false), formal(primInt(), SYM(pos), false, false), formal(primInt(), SYM(n), false, false));
+ addFunc(ve, run::gen_runstring7, primString(), SYM(erase), formal(primString(), SYM(s), false, false), formal(primInt(), SYM(pos), false, false), formal(primInt(), SYM(n), false, false));
#line 163 "runstring.in"
- addFunc(ve, run::gen_runstring8, primString() , SYM(downcase), formal(primString() , SYM(s), false, false));
+ addFunc(ve, run::gen_runstring8, primString(), SYM(downcase), formal(primString(), SYM(s), false, false));
#line 169 "runstring.in"
- addFunc(ve, run::gen_runstring9, primString() , SYM(upcase), formal(primString() , SYM(s), false, false));
+ addFunc(ve, run::gen_runstring9, primString(), SYM(upcase), formal(primString(), SYM(s), false, false));
#line 175 "runstring.in"
- addFunc(ve, run::gen_runstring10, primString() , SYM(replace), formal(primString(), SYM(s), false, false), formal(stringArray2(), SYM(translate), false, false));
+ addFunc(ve, run::gen_runstring10, primString(), SYM(replace), formal(primString(), SYM(s), false, false), formal(stringArray2(), SYM(translate), false, false));
#line 205 "runstring.in"
- addFunc(ve, run::gen_runstring11, primString() , SYM(format), formal(primString(), SYM(format), false, false), formal(primInt(), SYM(x), false, false), formal(primString() , SYM(locale), true, false));
+ addFunc(ve, run::gen_runstring11, primString(), SYM(format), formal(primString(), SYM(format), false, false), formal(primInt(), SYM(x), false, false), formal(primString(), SYM(locale), true, false));
#line 259 "runstring.in"
- addFunc(ve, run::gen_runstring12, primString() , SYM(format), formal(primString(), SYM(format), false, false), formal(primBoolean(), SYM(forcemath), true, false), formal(primString() , SYM(separator), false, false), formal(primReal(), SYM(x), false, false), formal(primString() , SYM(locale), true, false));
+ addFunc(ve, run::gen_runstring12, primString(), SYM(format), formal(primString(), SYM(format), false, false), formal(primBoolean(), SYM(forcemath), true, false), formal(primString(), SYM(separator), false, false), formal(primReal(), SYM(x), false, false), formal(primString(), SYM(locale), true, false));
#line 388 "runstring.in"
- addFunc(ve, run::gen_runstring13, primInt(), SYM(hex), formal(primString() , SYM(s), false, false));
+ addFunc(ve, run::gen_runstring13, primInt(), SYM(hex), formal(primString(), SYM(s), false, false));
#line 399 "runstring.in"
- addFunc(ve, run::gen_runstring14, primInt(), SYM(ascii), formal(primString() , SYM(s), false, false));
+ addFunc(ve, run::gen_runstring14, primInt(), SYM(ascii), formal(primString(), SYM(s), false, false));
#line 404 "runstring.in"
- addFunc(ve, run::gen_runstring15, primString() , SYM(string), formal(primInt(), SYM(x), false, false));
+ addFunc(ve, run::gen_runstring15, primString(), SYM(string), formal(primInt(), SYM(x), false, false));
#line 411 "runstring.in"
- addFunc(ve, run::gen_runstring16, primString() , SYM(string), formal(primReal(), SYM(x), false, false), formal(primInt(), SYM(digits), true, false));
+ addFunc(ve, run::gen_runstring16, primString(), SYM(string), formal(primReal(), SYM(x), false, false), formal(primInt(), SYM(digits), true, false));
#line 419 "runstring.in"
- addFunc(ve, run::gen_runstring17, primString() , SYM(time), formal(primString() , SYM(format), true, false));
+ addFunc(ve, run::gen_runstring17, primString(), SYM(time), formal(primString(), SYM(format), true, false));
#line 430 "runstring.in"
- addFunc(ve, run::gen_runstring18, primString() , SYM(time), formal(primInt(), SYM(seconds), false, false), formal(primString() , SYM(format), true, false));
+ addFunc(ve, run::gen_runstring18, primString(), SYM(time), formal(primInt(), SYM(seconds), false, false), formal(primString(), SYM(format), true, false));
#line 443 "runstring.in"
- addFunc(ve, run::gen_runstring19, primInt(), SYM(seconds), formal(primString() , SYM(t), true, false), formal(primString() , SYM(format), true, false));
+ addFunc(ve, run::gen_runstring19, primInt(), SYM(seconds), formal(primString(), SYM(t), true, false), formal(primString(), SYM(format), true, false));
}
} // namespace trans