summaryrefslogtreecommitdiff
path: root/src/map/magic-interpreter-aux.hpp
blob: 4bb0a827d7f717ff3ed9c808c16e44629a510b10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef MAGIC_INTERPRETER_AUX_HPP
#define MAGIC_INTERPRETER_AUX_HPP

#include "magic-interpreter.t.hpp"

template<class T>
bool CHECK_TYPE(T *v, TYPE t)
{
    return v->ty == t;
}

// FIXME: macro capture!
#define VAR(i)  \
    ((!env->vars || env->vars[i].ty == TYPE::UNDEF)   \
            ? env->base_env->vars[i]                \
            : env->vars[i])

#endif // MAGIC_INTERPRETER_AUX_HPP