From 19fc9fd9a26973d87fad437ce549ffaba479df54 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 31 May 2012 00:02:26 +0000 Subject: asy 2.16 sources git-svn-id: svn://tug.org/texlive/trunk@26734 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/program.cc | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'Build/source/utils/asymptote/program.cc') 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 << ""; + // TODO: Try to guess the type from the value. + Int n = get(i); + double x = get(i); + void *p = get(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 << ""; #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(i); else if (i.type() == typeid(double)) @@ -58,7 +76,7 @@ ostream& operator<< (ostream& out, const item& i) out << *(get(i)); else if (i.type() == typeid(frame)) { out << "frame"; -#ifdef DEBUG_FRAME +# ifdef DEBUG_FRAME { frame *f = get(i); if (f) @@ -66,7 +84,7 @@ ostream& operator<< (ostream& out, const item& i) else out << " "; } -#endif +# endif } else out << "type " << demangle(i.type().name()); -- cgit v1.2.3