X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramsyntax.h;h=cbce078e2d65c1eb74bb9985fa2639c4bc525326;hb=7cd066816f7faab6f8f0eba1fca4dee67ee5dc3b;hp=c8b0e1f74ed9d1679e8c652ddb1f52f896872df5;hpb=961715848c111907b5f443c5b545a429b40583e6;p=libs%2Fgl.git diff --git a/source/programsyntax.h b/source/programsyntax.h index c8b0e1f7..cbce078e 100644 --- a/source/programsyntax.h +++ b/source/programsyntax.h @@ -33,6 +33,10 @@ public: NodePtr(T *n = 0): node(n) { } NodePtr(const NodePtr &p): node(clone(p.node)) { } NodePtr &operator=(const NodePtr &p) { delete node; node = clone(p.node); return *this; } +#if __cplusplus>=201103L + NodePtr(NodePtr &&p): node(p.node) { p.node = 0; } + NodePtr &operator=(NodePtr &&p) { delete node; node = p.node; p.node = 0; return *this; } +#endif ~NodePtr() { delete node; } private: @@ -223,7 +227,7 @@ struct FunctionDeclaration: Node struct Conditional: Node { - Expression *condition; + NodePtr condition; Block body; Block else_body; @@ -301,32 +305,29 @@ struct TraversingVisitor: NodeVisitor virtual void visit(Return &); }; -enum ContextType +enum StageType { - GLOBAL, + SHARED, VERTEX, GEOMETRY, FRAGMENT }; -struct Context +struct Stage { - ContextType type; - bool present; - Context *previous; + StageType type; + Stage *previous; ProgramSyntax::Block content; std::map in_variables; std::map out_variables; - Context(ContextType); + Stage(StageType); }; struct Module { - Context global_context; - Context vertex_context; - Context geometry_context; - Context fragment_context; + Stage shared; + std::list stages; Module(); };