return o1.toDouble()/d2;
}
+static QVariant fltLt(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toDouble()<o2.toDouble();
+}
+static QVariant fltGt(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toDouble()>o2.toDouble();
+}
+static QVariant fltLe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toDouble()<=o2.toDouble();
+}
+static QVariant fltGe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toDouble()>=o2.toDouble();
+}
+static QVariant fltEq(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toDouble()==o2.toDouble();
+}
+static QVariant fltNe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toDouble()!=o2.toDouble();
+}
+
+
static QVariant floatFunc(const QList<QVariant>&lf,Engine&)
{
if(lf.size()!=1)
eng.unaryOperator("-").setCallback(floatMinus,fid);
eng.unaryOperator("+").setCallback(floatPlus,fid);
//binary
+ eng.binaryOperator("==",60).setCallback(fltEq,fid,fid);
+ eng.binaryOperator("==").setCallback(fltEq,fid,iid);
+ eng.binaryOperator("==").setCallback(fltEq,iid,fid);
+ eng.binaryOperator("!=",60).setCallback(fltNe,fid,fid);
+ eng.binaryOperator("!=").setCallback(fltNe,iid,fid);
+ eng.binaryOperator("!=").setCallback(fltNe,fid,iid);
+ eng.binaryOperator("<=",60).setCallback(fltLe,fid,fid);
+ eng.binaryOperator("<=").setCallback(fltLe,fid,iid);
+ eng.binaryOperator("<=").setCallback(fltLe,iid,fid);
+ eng.binaryOperator(">=",60).setCallback(fltGe,fid,fid);
+ eng.binaryOperator(">=").setCallback(fltGe,iid,fid);
+ eng.binaryOperator(">=").setCallback(fltGe,fid,iid);
+ eng.binaryOperator("<",60).setCallback(fltLt,fid,fid);
+ eng.binaryOperator("<").setCallback(fltLt,iid,fid);
+ eng.binaryOperator("<").setCallback(fltLt,fid,iid);
+ eng.binaryOperator(">",60).setCallback(fltGt,fid,fid);
+ eng.binaryOperator(">").setCallback(fltGt,iid,fid);
+ eng.binaryOperator(">").setCallback(fltGt,fid,iid);
eng.binaryOperator("-",80).setCallback(floatMinus,fid,fid);
eng.binaryOperator("-").setCallback(floatMinus,iid,fid);
eng.binaryOperator("-").setCallback(floatMinus,fid,iid);
return ~o.toLongLong();
}
+static QVariant intLt(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toLongLong()<o2.toLongLong();
+}
+static QVariant intGt(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toLongLong()>o2.toLongLong();
+}
+static QVariant intLe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toLongLong()<=o2.toLongLong();
+}
+static QVariant intGe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toLongLong()>=o2.toLongLong();
+}
+static QVariant intEq(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toLongLong()==o2.toLongLong();
+}
+static QVariant intNe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toLongLong()!=o2.toLongLong();
+}
+
int IntEngine::intParserPrio()
{
eng.unaryOperator("+").setCallback(intPlus,iid);
eng.unaryOperator("~").setCallback(intNot,iid);
//binaries
+ eng.binaryOperator("==",60).setCallback(intEq,iid,iid);
+ eng.binaryOperator("!=",60).setCallback(intNe,iid,iid);
+ eng.binaryOperator("<=",60).setCallback(intLe,iid,iid);
+ eng.binaryOperator(">=",60).setCallback(intGe,iid,iid);
+ eng.binaryOperator("<",60).setCallback(intLt,iid,iid);
+ eng.binaryOperator(">",60).setCallback(intGt,iid,iid);
eng.binaryOperator("-",80).setCallback(intMinus,iid,iid);
eng.binaryOperator("+",80).setCallback(intAdd,iid,iid);
eng.binaryOperator("*",90).setCallback(intMult,iid,iid);
return o1.toString()+o2.toString();
}
+//compare
+static QVariant strEq(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toString()==o2.toString();
+}
+static QVariant strNe(const QVariant&o1,const QVariant&o2,Engine&)
+{
+ return o1.toString()!=o2.toString();
+}
+
+
int StringEngine::stringParserPrio()
{
return 50;
eng.setFunction("strlen",strlenFunc);
eng.setFunction("concat",concatFunc);
//operators
+ eng.binaryOperator("==",60).setCallback(strEq,sid,sid);
+ eng.binaryOperator("==").setCallback(strEq,aid,sid);
+ eng.binaryOperator("==").setCallback(strEq,sid,aid);
+ eng.binaryOperator("!=",60).setCallback(strNe,sid,sid);
+ eng.binaryOperator("!=").setCallback(strNe,sid,aid);
+ eng.binaryOperator("!=").setCallback(strNe,aid,sid);
eng.binaryOperator("+",80).setCallback(strAdd,sid,sid);
- eng.binaryOperator("+",80).setCallback(strAdd,aid,sid);
- eng.binaryOperator("+",80).setCallback(strAdd,sid,aid);
+ eng.binaryOperator("+").setCallback(strAdd,aid,sid);
+ eng.binaryOperator("+").setCallback(strAdd,sid,aid);
}