return prefix+name.substr(offset);
}
-bool InterfaceGenerator::generate_interface(VariableDeclaration &var, const string &iface, const string &name)
+VariableDeclaration *InterfaceGenerator::generate_interface(VariableDeclaration &var, const string &iface, const string &name)
{
if(stage->content.variables.count(name))
- return false;
+ return 0;
VariableDeclaration* iface_var = new VariableDeclaration;
iface_var->sampling = var.sampling;
iface_target_block->body.insert(iface_insert_point, iface_var);
iface_target_block->variables[name] = iface_var;
- return true;
+ return iface_var;
}
-bool InterfaceGenerator::generate_interface(InterfaceBlock &out_block)
+InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block)
{
if(stage->interface_blocks.count(out_block.name))
- return false;
+ return 0;
InterfaceBlock *in_block = new InterfaceBlock;
in_block->interface = "in";
SetForScope<Block *> set_block(current_block, &stage->content);
in_block->visit(*this);
- return true;
+ return in_block;
}
ExpressionStatement &InterfaceGenerator::insert_assignment(const string &left, Expression *right)
static std::string get_out_prefix(Stage::Type);
std::string change_prefix(const std::string &, const std::string &) const;
virtual void visit(Block &);
- bool generate_interface(VariableDeclaration &, const std::string &, const std::string &);
- bool generate_interface(InterfaceBlock &);
+ VariableDeclaration *generate_interface(VariableDeclaration &, const std::string &, const std::string &);
+ InterfaceBlock *generate_interface(InterfaceBlock &);
ExpressionStatement &insert_assignment(const std::string &, Expression *);
virtual void visit(VariableReference &);
virtual void visit(VariableDeclaration &);