+#include <msp/core/algorithm.h>
#include <msp/core/maputils.h>
#include "syntax.h"
#include "visitor.h"
NodeContainer<C>::NodeContainer(const NodeContainer &c):
C(c)
{
- for(typename C::iterator i=this->begin(); i!=this->end(); ++i)
- *i = (*i)->clone();
+ for(auto &i: *this)
+ i = i->clone();
}
MemberAccess::MemberAccess():
- declaration(0)
+ declaration(0),
+ index(-1)
{ }
MemberAccess::MemberAccess(const MemberAccess &other):
Expression(other),
left(other.left),
member(other.member),
- declaration(0)
+ declaration(0),
+ index(-1)
{ }
void MemberAccess::visit(NodeVisitor &visitor)
BasicTypeDeclaration::BasicTypeDeclaration():
kind(ALIAS),
size(0),
+ sign(true),
base_type(0)
{ }
TypeDeclaration(other),
kind(other.kind),
size(other.size),
+ sign(other.sign),
base(other.base),
base_type(0)
{ }
InterfaceBlock::InterfaceBlock(const InterfaceBlock &other):
Statement(other),
interface(other.interface),
- name(other.name),
+ block_name(other.block_name),
members(other.members),
instance_name(other.instance_name),
array(other.array),
const char *Stage::get_stage_name(Type type)
{
- static const char *names[] = { "shared", "vertex", "geometry", "fragment" };
+ static const char *const names[] = { "shared", "vertex", "geometry", "fragment" };
return names[type];
}
}
}
+int get_layout_value(const Layout &layout, const string &name, int def_value)
+{
+ auto i = find_member(layout.qualifiers, name, &Layout::Qualifier::name);
+ return (i!=layout.qualifiers.end() ? i->value : def_value);
+}
+
+void add_to_chain(Assignment::Target &target, Assignment::Target::ChainType type, unsigned index)
+{
+ if(target.chain_len<7)
+ target.chain[target.chain_len] = type | min<unsigned>(index, 0x3F);
+ ++target.chain_len;
+}
+
} // namespace SL
} // namespace GL
} // namespace Msp