summaryrefslogtreecommitdiff
path: root/src/func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/func.cc')
-rw-r--r--src/func.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/func.cc b/src/func.cc
index 2608960..fd4bd7e 100644
--- a/src/func.cc
+++ b/src/func.cc
@@ -29,8 +29,8 @@
#include "context.h"
#include "dxfdim.h"
#include "builtin.h"
+#include <sstream>
#include "mathc99.h"
-#include <time.h>
AbstractFunction::~AbstractFunction()
{
@@ -70,9 +70,9 @@ QString Function::dump(QString indent, QString name) const
text += QString(", ");
text += argnames[i];
if (argexpr[i])
- text += QString(" = ") + argexpr[i]->dump();
+ text += QString(" = ") + QString::fromStdString(argexpr[i]->toString());
}
- text += QString(") = %1;\n").arg(expr->dump());
+ text += QString(") = %1;\n").arg(QString::fromStdString(expr->toString()));
return text;
}
@@ -164,7 +164,7 @@ Value builtin_rands(const Context *, const QVector<QString>&, const QVector<Valu
for (int i=0; i<args[2].num; i++)
{
Value * r = new Value(frand(args[0].num, args[1].num));
- v.vec.append(r);
+ v.vec.push_back(r);
}
return v;
@@ -304,15 +304,12 @@ Value builtin_ln(const Context *, const QVector<QString>&, const QVector<Value>
Value builtin_str(const Context *, const QVector<QString>&, const QVector<Value> &args)
{
- QString str;
- for (int i = 0; i < args.size(); i++)
- {
- if (args[i].type == Value::STRING)
- str += args[i].text;
- else
- str += args[i].dump();
+ std::stringstream stream;
+
+ for (int i = 0; i < args.size(); i++) {
+ stream << args[i];
}
- return Value(str);
+ return Value(stream.str());
}
Value builtin_lookup(const Context *, const QVector<QString>&, const QVector<Value> &args)
contact: Jan Huwald // Impressum