void VM::actAssert(myListStack::const_iterator& it, myListStack::const_iterator& end, VMStack& stack) { IObject *op; if (stack.size() < 1) return; std::cout << "[assert] "; while (++it != end) { op = Factory::makeNumber(*it); try { if (op->ToString() != stack.back()->ToString()) throw 1; if (op->GetType() != stack.back()->GetType()) throw 2; } catch (int e) { std::cout << "The value on top of the stack does " << "not equal the operand." << std::endl; if (e == 1) std::cout << " -> " << op->ToString() << " <> " << stack.back()->ToString() << std::endl; else if (e == 2) std::cout << " -> " << op->GetType() << " <> " << stack.back()->GetType() << std::endl; exit(-1); } } std::cout << "Good test" << std::endl; }
Int32 WindowElastos::ShowCancelableIntent( /* [in] */ IIntent* intent, /* [in] */ IntentCallback* callback, /* [in] */ Int32 errorId) { // ==================before translated====================== // Log.d(TAG, "Can't show intent as context is not an Activity: " + intent); // return START_INTENT_FAILURE; String intentStr; IObject* objTmp = IObject::Probe(intent); objTmp->ToString(&intentStr); Logger::D(TAG, String("Can't show intent as context is not an Activity: ") + intentStr); return START_INTENT_FAILURE; }
void VM::actDiv(myListStack::const_iterator&, myListStack::const_iterator&, VMStack& stack) { IOperand *op1; IOperand *op2; IObject *res; if (stack.size() < 2) return; op2 = static_cast<IOperand*>(stack.back()); stack.pop_back(); op1 = static_cast<IOperand*>(stack.back()); stack.pop_back(); res = op1->Divide(*op2); stack.push_back(res); std::cout << "[div] " << op1->ToString() << " / " << op2->ToString() << " = " << res->ToString() << std::endl; }
bool avm_elem::Equals(const IObject &value) const { return(this->ToString() == value.ToString()); }