void NAnalog::codeGen(CodeGenerator &c) { std::string childParams = getChildParams(c, NULL, NULL); int channel = c.getChannel(variable); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_analog_operator_new") + std::string("(") + childParams + op + std::string(", ") + intToString(channel) + std::string(");"); c.emitLine(line); }
void NPredicate::codeGen(CodeGenerator &c) { if (lhs) { lhs->codeGen(c); } std::string childParams = getChildParams(c, lhs, NULL); int channel = c.getChannel(variable); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_predicate_new") + std::string("(") + childParams + op + std::string(", ") + intToString(channel) + std::string(", ") + doubleToString(condition) + std::string(");"); c.emitLine(line); }
void NEvent::codeGen(CodeGenerator &c) { std::string channel; std::string condition; if (lhs) { if (lhs->isBoolAtom()) { Node *lhs_ = c.ast->getNode((static_cast<NBoolAtom*>(lhs))->variable); int channel_ = c.getChannel((static_cast<NPredicate*>(lhs_))->variable); channel = std::string(", ") + intToString(channel_); condition = std::string(", ") + doubleToString((static_cast<NPredicate*>(lhs_))->condition); } } std::string childParams = getChildParams(c, NULL, NULL); std::string line = std::string("node *n") + id() + std::string(" = ") + std::string("node_event_new") + std::string("(") + childParams + operator_subtype_strings[subTypeIndex(subtype)] + channel + condition + std::string(");"); c.emitLine(line); }