diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-31 00:02:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-31 00:02:26 +0000 |
commit | 19fc9fd9a26973d87fad437ce549ffaba479df54 (patch) | |
tree | f40a9d2592b3cf827970c8bf54a1eebf9cc8f9c0 /Build/source/utils/asymptote/program.cc | |
parent | 24b3bac312553b2cc61e94fda581aba311967f5c (diff) |
asy 2.16 sources
git-svn-id: svn://tug.org/texlive/trunk@26734 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/program.cc')
-rw-r--r-- | Build/source/utils/asymptote/program.cc | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Build/source/utils/asymptote/program.cc b/Build/source/utils/asymptote/program.cc index 746b9721da5..8da4d48b523 100644 --- a/Build/source/utils/asymptote/program.cc +++ b/Build/source/utils/asymptote/program.cc @@ -40,14 +40,32 @@ string lookupBltin(bltin b) { ostream& operator<< (ostream& out, const item& i) { + if (i.empty()) + return out << "empty"; + + if (isdefault(i)) + return out << "default"; + #if COMPACT - out << "<item>"; + // TODO: Try to guess the type from the value. + Int n = get<Int>(i); + double x = get<double>(i); + void *p = get<void *>(i); + + if (n == BoolTruthValue) + return out << "true"; + if (n == BoolFalseValue) + return out << "false"; + + if (abs(n) < 1000000) + return out << n; + + if (fabs(x) < 1e30 and fabs(x) > 1e-30) + return out << x; + + return out << "<item " << p << ">"; #else // TODO: Make a data structure mapping typeids to print functions. - if (i.empty()) - out << "empty"; - else if (isdefault(i)) - out << "default"; else if (i.type() == typeid(Int)) out << "Int, value = " << get<Int>(i); else if (i.type() == typeid(double)) @@ -58,7 +76,7 @@ ostream& operator<< (ostream& out, const item& i) out << *(get<callable *>(i)); else if (i.type() == typeid(frame)) { out << "frame"; -#ifdef DEBUG_FRAME +# ifdef DEBUG_FRAME { frame *f = get<frame *>(i); if (f) @@ -66,7 +84,7 @@ ostream& operator<< (ostream& out, const item& i) else out << " <null>"; } -#endif +# endif } else out << "type " << demangle(i.type().name()); |