summaryrefslogtreecommitdiff
path: root/tiger-compiler/tcsh/src/helper.hh
blob: cdbf760c42b5b2f3403b31913407326de7b069a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef SWIG_HELPER_H
#define SWIG_HELPER_H

#define STCONVERT(TYPE, TYPENAME)                                              \
void operator()(const TYPE & e) override                                       \
{                                                                              \
  result = SWIG_NewPointerObj(SWIG_as_voidptr(&e), SWIGTYPE_ ## TYPENAME, 0);  \
}

#define IFTYPECONVERT(TYPE, TYPENAME)                                          \
if (const TYPE* d = dynamic_cast<const TYPE*>(&e); d != nullptr)               \
{                                                                              \
  result = SWIG_NewPointerObj(SWIG_as_voidptr(&e), SWIGTYPE_ ## TYPENAME, 0);  \
}

#endif /* ! SWIG_HELPER_H */