diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-02-07 19:38:32 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-02-07 22:41:23 -0800 |
commit | 83b2e0b3ceda907b7186acfcc56c214fc04d9c13 (patch) | |
tree | f4dcc8d8b59fd9a633bc2604cc92f0523cc76ee4 /src/map/magic-interpreter-aux.hpp | |
parent | c67c2b7435a13d7ce17b2075e22dc5c6036f702a (diff) | |
download | tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.gz tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.bz2 tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.xz tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.zip |
Remove some macros
Diffstat (limited to 'src/map/magic-interpreter-aux.hpp')
-rw-r--r-- | src/map/magic-interpreter-aux.hpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map/magic-interpreter-aux.hpp b/src/map/magic-interpreter-aux.hpp index 983d3d6..4bb0a82 100644 --- a/src/map/magic-interpreter-aux.hpp +++ b/src/map/magic-interpreter-aux.hpp @@ -1,8 +1,18 @@ #ifndef MAGIC_INTERPRETER_AUX_HPP #define MAGIC_INTERPRETER_AUX_HPP -#define CHECK_TYPE(v, t) ((v)->ty == t) +#include "magic-interpreter.t.hpp" -#define VAR(i) ((!env->vars || env->vars[i].ty == TY_UNDEF)? env->base_env->vars[i] : env->vars[i]) +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 |