StructDeclaration *strct = new StructDeclaration;
strct->source = INTERNAL_SOURCE;
- strct->name = format("_%s_%s", iface.interface, iface.name);
+ strct->name = format("_%s_%s", iface.interface, iface.block_name);
strct->members.body.splice(strct->members.body.begin(), iface.members->body);
stage->content.body.insert(type_insert_point, strct);
stage->types.insert(make_pair(strct->name, strct));
{
/* Block names can be reused in different interfaces. Prefix the name with
the first character of the interface to avoid conflicts. */
- stage->interface_blocks.insert(make_pair(iface.interface+iface.name, &iface));
+ stage->interface_blocks.insert(make_pair(iface.interface+iface.block_name, &iface));
if(!iface.instance_name.empty())
stage->interface_blocks.insert(make_pair("_"+iface.instance_name, &iface));
RefPtr<FunctionCall> call = new FunctionCall;
call->name = type.name;
call->constructor = true;
- call->arguments.push_back(0);
- call->arguments.back() = expr;
+ call->arguments.push_back_nocopy(expr);
call->type = &type;
expr = call;
}
stage inline it if that's reasonable. */
RefPtr<VariableDeclaration> temporary = new VariableDeclaration;
temporary->type = args.front().type->name;
- temporary->name = get_unused_variable_name(*current_block, "_temp", string());
+ temporary->name = get_unused_variable_name(*current_block, "_temp");
temporary->init_expression = call.arguments.front();
current_block->body.insert(insert_point, temporary);
InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block)
{
- if(stage->interface_blocks.count("in"+out_block.name))
+ if(stage->interface_blocks.count("in"+out_block.block_name))
return 0;
InterfaceBlock *in_block = new InterfaceBlock;
in_block->interface = "in";
- in_block->name = out_block.name;
+ in_block->block_name = out_block.block_name;
in_block->members = new Block;
in_block->instance_name = out_block.instance_name;
if(stage->type==Stage::GEOMETRY)
}
iface_target_block->body.insert(iface_insert_point, in_block);
- stage->interface_blocks.insert(make_pair("in"+in_block->name, in_block));
+ stage->interface_blocks.insert(make_pair("in"+in_block->block_name, in_block));
if(!in_block->instance_name.empty())
stage->interface_blocks.insert(make_pair("_"+in_block->instance_name, in_block));
if(!iface.linked_block && stage->previous)
{
const map<string, InterfaceBlock *> &prev_blocks = stage->previous->interface_blocks;
- map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out"+iface.name);
+ map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out"+iface.block_name);
if(i!=prev_blocks.end())
{
iface.linked_block = i->second;