From bb1b84d1436f26eb8c1941eedb97e943e81947bb Mon Sep 17 00:00:00 2001 From: Michi Henning Date: Fri, 5 Jul 2002 04:05:42 +0000 Subject: Changed the way 64-bit literals are done in the generated code. The approach used now (a macro) makes the generated source more readable than the previous one. --- cpp/src/slice2cpp/Gen.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index db6643bf6ba..06bec36200c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -214,6 +214,8 @@ Slice::Gen::generate(const UnitPtr& unit) _dllExport += " "; } + printDefInt64Macro(H); + ProxyDeclVisitor proxyDeclVisitor(H, C, _dllExport); unit->visit(&proxyDeclVisitor); @@ -263,6 +265,8 @@ Slice::Gen::generate(const UnitPtr& unit) ImplVisitor implVisitor(implH, implC, _dllExport); unit->visit(&implVisitor); } + + printUndefInt64Macro(H); } Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport) : @@ -935,11 +939,7 @@ Slice::Gen::TypesVisitor::visitConstDef(const ConstDefPtr& p) H << nl << "const " << typeToString(p->type()) << " " << p->name() << " = "; BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type()); - if(bp && bp->kind() != Builtin::KindString) - { - H << p->value(); - } - else + if(bp && bp->kind() == Builtin::KindString) { // // Expand strings into the basic source character set. We can't use isalpha() and the like @@ -981,6 +981,14 @@ Slice::Gen::TypesVisitor::visitConstDef(const ConstDefPtr& p) H << "\""; // Closing " } + else if(bp && bp->kind() == Builtin::KindLong) + { + H << "INT64LITERAL(" << p->value() << ")"; + } + else + { + H << p->value(); + } H << ";"; } -- cgit v1.2.3