+
+int _StackPush(tAST_BlockInfo *Block, tAST_Node *Node, int Type)
+{
+ if(Block->StackDepth == MAX_STACK_DEPTH - 1) {
+ AST_RuntimeError(Node, "BUG - Stack overflow in AST-Bytecode conversion");
+ return -1;
+ }
+
+ Block->Stack[ ++Block->StackDepth ] = Type;
+ return Type;
+}
+
+int _StackPop(tAST_BlockInfo *Block, tAST_Node *Node, int WantedType)
+{
+ if(Block->StackDepth == 0) {
+ AST_RuntimeError(Node, "BUG - Stack underflow in AST-Bytecode conversion");
+ return -1;
+ }
+ if(WantedType != SS_DATATYPE_UNDEF && Block->Stack[ Block->StackDepth ] != SS_DATATYPE_UNDEF)
+ {
+ if( Block->Stack[ Block->StackDepth ] != WantedType ) {
+ // TODO: Message?
+ return -2;
+ }
+ }
+ return Block->Stack[Block->StackDepth--];
+}
+