Exemplo n.º 1
0
 public override Expression asExpression(Registers r)
 {
     bool transpose = false;
     Expression leftExpression = r.getKExpression(left, line);
     Expression rightExpression = r.getKExpression(right, line);
     if(((left | right) & 256) == 0)
     {
       transpose = r.getUpdated(left, line) > r.getUpdated(right, line);
     }
     else
     {
       transpose = rightExpression.getConstantIndex() < leftExpression.getConstantIndex();
     }
     string op = !transpose ? "<" : ">";
     Expression rtn = new BinaryExpression(op, !transpose ? leftExpression : rightExpression, !transpose ? rightExpression : leftExpression, Expression.PRECEDENCE_COMPARE, Expression.ASSOCIATIVITY_LEFT);
     if(_invert)
     {
       rtn = new UnaryExpression("not ", rtn, Expression.PRECEDENCE_UNARY);
     }
     return rtn;
 }
Exemplo n.º 2
0
        public override Expression asExpression(Registers r)
        {
            bool       transpose       = false;
            Expression leftExpression  = r.getKExpression(left, line);
            Expression rightExpression = r.getKExpression(right, line);

            if (((left | right) & 256) == 0)
            {
                transpose = r.getUpdated(left, line) > r.getUpdated(right, line);
            }
            else
            {
                transpose = rightExpression.getConstantIndex() < leftExpression.getConstantIndex();
            }
            string     op  = !transpose ? "<=" : ">=";
            Expression rtn = new BinaryExpression(op, !transpose ? leftExpression : rightExpression, !transpose ? rightExpression : leftExpression, Expression.PRECEDENCE_COMPARE, Expression.ASSOCIATIVITY_LEFT);

            if (_invert)
            {
                rtn = new UnaryExpression("not ", rtn, Expression.PRECEDENCE_UNARY);
            }
            return(rtn);
        }
Exemplo n.º 3
0
        public override Operation process(Decompiler d)
        {
            if(statements.Count == 1)
            {
              Statement stmt = statements[0];
              if(stmt is Assignment)
              {
            Assignment assign = (Assignment) stmt;
            if(assign.getArity() == 1)
            {
              if(branch is TestNode)
              {
                TestNode node = (TestNode) branch;
                Declaration decl = r.getDeclaration(node.test, node.line);
                if(assign.getFirstTarget().isDeclaration(decl))
                {
                  Expression expr;
                  if(node._invert)
                  {
                    expr = new BinaryExpression("or", new LocalVariable(decl), assign.getFirstValue(), Expression.PRECEDENCE_OR, Expression.ASSOCIATIVITY_NONE);
                  }
                  else
                  {
                    expr = new BinaryExpression("and", new LocalVariable(decl), assign.getFirstValue(), Expression.PRECEDENCE_AND, Expression.ASSOCIATIVITY_NONE);
                  }
                  return new IfThenEndBlockOperation(end - 1, assign, expr);
            //JAVA TO VB & C# CONVERTER TODO TASK: Anonymous inner classes are not converted to .NET:
                  /*{

                    public Statement process(Registers r, Block block)
                    {
                      return new Assignment(assign.getFirstTarget(), expr);
                    }

                  }*/
                }
              }
            }
              }
                    }
            else if(statements.Count == 0 && stack != null)
            {
              int test = branch.getRegister();
              if(test < 0)
              {
            for(int reg = 0; reg < r.registers; reg++)
            {
              if(r.getUpdated(reg, branch.end - 1) >= branch.begin)
              {
                if(test >= 0)
                {
                  test = -1;
                  break;
                }
                test = reg;
              }
            }
              }
              if(test >= 0)
              {
            if(r.getUpdated(test, branch.end - 1) >= branch.begin)
            {
              Expression right = r.getValue(test, branch.end);
              Branch setb = d.popSetCondition(stack, stack.peek().end);
              setb.useExpression(right);
              int testreg = test;
              return new IfThenEndBlockOperation2(end - 1, testreg, branch, setb);
            //JAVA TO VB & C# CONVERTER TODO TASK: Anonymous inner classes are not converted to .NET:
              /*{

                public Statement process(Registers r, Block block)
                {
                  r.setValue(testreg, branch.end - 1, setb.asExpression(r));
                  return null;
                }

              }*/
            }
              }
            }
            return base.process(d);
        }