typename boost::disable_if< proto::matches< BOOST_PP_CAT(A, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)) , rule::catch_ > , result_type >::type operator()(Try const & try_, BOOST_PHOENIX_A_const_ref_a, Context const & ctx) const { try { boost::phoenix::eval(proto::child_c<0>(try_), ctx); } BOOST_PP_REPEAT( BOOST_PP_DEC(BOOST_PHOENIX_ITERATION) , BOOST_PHOENIX_TRY_CATCH_EVAL_R, _ ) catch(...) { boost::phoenix::eval( proto::child_c<0>( BOOST_PP_CAT(a, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)) ) , ctx); } }
struct BOOST_PP_CAT(vector,i_) : v_item< BOOST_PP_CAT(T,BOOST_PP_DEC(i_)) , AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),T) > { typedef BOOST_PP_CAT(vector,i_) type; };
struct BOOST_PP_CAT(set,i_) : s_item< BOOST_PP_CAT(T,BOOST_PP_DEC(i_)) , AUX778076_SET_TAIL(set,BOOST_PP_DEC(i_),T) > { typedef BOOST_PP_CAT(set,i_) type; };
struct BOOST_PP_CAT(map,i_) : m_item< typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second , AUX778076_MAP_TAIL(map,BOOST_PP_DEC(i_),P) > { };
struct BOOST_PP_CAT(inherit,n_) : inherit2< typename BOOST_PP_CAT(inherit,BOOST_PP_DEC(n_))< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(n_), T) >::type , BOOST_PP_CAT(T,n_) > { BOOST_MPL_AUX_LAMBDA_SUPPORT( n_ , BOOST_PP_CAT(inherit,n_) , (BOOST_MPL_PP_PARAMS(n_, T)) ) }; BOOST_MPL_AUX_NA_SPEC(n_, BOOST_PP_CAT(inherit,n_))
inline void get_signature_impl(const constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)>*, lua_State* L, string_class& s) { s += "("; type_name_unless_void<A0>::apply(s, L, true); BOOST_PP_REPEAT(BOOST_PP_DEC(LUABIND_MAX_ARITY), LUABIND_ADD_LUA_TYPE_NAME, _) s += ")"; }
namespace sprite { typedef boost::uint_t<32>::exact uint32; typedef boost::int_t<64>::exact int64; // Note: The constructors for a given type are numbered CTOR, CTOR+1, ... enum Tag { FAIL= -4, FWD= -3, CHOICE= -2, OPER= -1, CTOR=0 }; typedef signed char tag_type; typedef uint32 refcnt_type; typedef unsigned char mark_type; struct RuntimeError : std::exception { RuntimeError(std::string const & msg = std::string()) : m_msg("Runtime error: " + msg) {} virtual char const * what() const throw() { return m_msg.c_str(); } virtual ~RuntimeError() throw() {} private: std::string m_msg; }; // Indicates an eager evaluation produced a failure. struct ComputationFailed {}; // The node requires space for 2 pointers (vptr + tag fields) plus // extra to hold the children. The extra space must be at least one // pointer (to hold a pointer to the list of children), and must be // large enough to hold all of the inplace children. size_t const NODE_BYTES = (2 + BOOST_PP_MAX(BOOST_PP_DEC(SPRITE_INPLACE_BOUND), 1)) * sizeof(void *); }
struct BOOST_PP_CAT(BOOST_PP_CAT(set,i_),_c) : s_item< integral_c<T,BOOST_PP_CAT(C,BOOST_PP_DEC(i_))> , AUX778076_SET_C_TAIL(set,BOOST_PP_DEC(i_), T, C) > { typedef BOOST_PP_CAT(BOOST_PP_CAT(set,i_),_c) type; };
inline void get_member_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, string_class& s) { s += "("; #if BOOST_PP_ITERATION() > 0 s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L); BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _) #endif s += ")"; }
struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) : v_item< integral_c<T,BOOST_PP_CAT(C,BOOST_PP_DEC(i_))> , AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),C) > { typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type; typedef T value_type; };
result_type evaluate( Context & ctx , Cond const & cond , Cases const & cases , mpl::int_<BOOST_PHOENIX_ITERATION> , mpl::true_ ) const { typedef typename proto::result_of::flatten<Cases const&>::type flat_view_type; typedef typename fusion::result_of::begin<flat_view_type>::type flat_view_begin; flat_view_type flat_view(proto::flatten(cases)); BOOST_PP_REPEAT( BOOST_PP_DEC(BOOST_PHOENIX_ITERATION) , BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R , BOOST_PHOENIX_ITERATION ) switch(boost::phoenix::eval(cond, ctx)) { BOOST_PP_REPEAT( BOOST_PP_DEC(BOOST_PHOENIX_ITERATION) , BOOST_PHOENIX_SWITCH_EVAL_R, _ ) default: boost::phoenix::eval( proto::child_c<0>( fusion::deref( fusion::advance_c< BOOST_PP_DEC(BOOST_PHOENIX_ITERATION) >(fusion::begin(flat_view)) ) ) , ctx ); } }
inline void get_free_function_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, std::string& s) { (void)f; s += "("; #if BOOST_PP_ITERATION() > 0 s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L); BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _) #endif s += ")"; }
} } //////////////////////////////////////////////////////////////////////////////// // Helper macros //////////////////////////////////////////////////////////////////////////////// #define M0(z,n,t) ptrdiff_t BOOST_PP_CAT(I,BOOST_PP_INC(n)) = BOOST_PP_CAT(I,n) //////////////////////////////////////////////////////////////////////////////// // index<I0,..,In> represents the base index over the Nth dimensions. By default // index<I0,I1> is equivalent to index<I0,I1,I1,...,I1>. // Indexes data are stored in a mpl::vector_c of proper size. //////////////////////////////////////////////////////////////////////////////// namespace nt2 { template< std::ptrdiff_t I0 = 1 , BOOST_PP_ENUM(BOOST_PP_DEC(NT2_MAX_DIMENSIONS),M0,~) > struct index : BOOST_PP_CAT(BOOST_PP_CAT(boost::mpl::vector,NT2_MAX_DIMENSIONS),_c) <std::ptrdiff_t, BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS,I)> {}; } //////////////////////////////////////////////////////////////////////////////// // Register index_ has a valid options::index_ type //////////////////////////////////////////////////////////////////////////////// namespace nt2 { namespace meta { template< BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS,std::ptrdiff_t I) , class Default >
int # ifdef LUABIND_INVOKE_MEMBER invoke_member # else invoke_normal # endif ( lua_State* L, F const& f, Signature, Policies const&, mpl::long_<N> # ifdef LUABIND_INVOKE_VOID , mpl::true_ # else , mpl::false_ # endif ) { typedef typename mpl::begin<Signature>::type first; # ifndef LUABIND_INVOKE_VOID typedef typename mpl::deref<first>::type result_type; typedef typename find_conversion_policy<0, Policies>::type result_policy; typename mpl::apply_wrap2< result_policy, result_type, cpp_to_lua>::type result_converter; # endif # if N > 0 # define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_DECLARE_CONVERTER(n) # define BOOST_PP_LOCAL_LIMITS (0,N-1) # include BOOST_PP_LOCAL_ITERATE() # endif int const arguments = lua_gettop(L); # ifndef LUABIND_INVOKE_VOID result_converter.apply( L, # endif # ifdef LUABIND_INVOKE_MEMBER (c0.apply(L, LUABIND_DECORATE_TYPE(a0), index0).*f)( BOOST_PP_ENUM(BOOST_PP_DEC(N), LUABIND_INVOKE_ARG, BOOST_PP_INC) ) # else # define LUABIND_INVOKE_IDENTITY(x) x f( BOOST_PP_ENUM(N, LUABIND_INVOKE_ARG, LUABIND_INVOKE_IDENTITY) ) # undef LUABIND_INVOKE_IDENTITY # endif # ifndef LUABIND_INVOKE_VOID ) # endif ; # if N > 0 # define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_CONVERTER_POSTCALL(n) # define BOOST_PP_LOCAL_LIMITS (0,N-1) # include BOOST_PP_LOCAL_ITERATE() # endif int const results = lua_gettop(L) - arguments; int const indices[] = { arguments + results BOOST_PP_ENUM_TRAILING_PARAMS(N, index) }; policy_list_postcall<Policies>::apply(L, indices); return maybe_yield(L, results, (Policies*)0); }