[v8-juice] r2233 committed - Internal refactoring in some of the generated call-forwarding template...

1 view
Skip to first unread message

v8-j...@googlecode.com

unread,
Apr 8, 2012, 3:58:46 PM4/8/12
to v8-juice-...@googlegroups.com
Revision: 2233
Author: sgbeal
Date: Sun Apr 8 12:56:18 2012
Log: Internal refactoring in some of the generated call-forwarding
templates.
http://code.google.com/p/v8-juice/source/detail?r=2233

Modified:
/convert/createForwarders.sh
/convert/examples/ConvertDemo.cpp
/convert/include/cvv8/detail/invocable_core.hpp
/convert/include/cvv8/detail/invocable_generated.hpp
/convert/include/cvv8/detail/signature_generated.hpp

=======================================
--- /convert/createForwarders.sh Mon Jul 25 09:17:52 2011
+++ /convert/createForwarders.sh Sun Apr 8 12:56:18 2012
@@ -138,12 +138,10 @@
MethodSignature< T const, RV (${aTParam}) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, ${aTDecl} >
struct MethodSignature< T const, RV (T::*)(${aTParam}) const > :
MethodSignature< T const, RV (${aTParam}) >
{};
-#endif


EOF
@@ -175,8 +173,9 @@

mycat <<EOF
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<${count},Sig,UnlockV8> :
FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<${count},Sig,UnlockV8> :
FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (${count} ==
sl::Arity<SignatureType>::Value) ? 1 : -1];
@@ -190,6 +189,13 @@
${unlocker}
return (ReturnType)(*func)( ${castCalls} );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<${count},Sig,UnlockV8> :
FunctionForwarderBase<${count},Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static ${ValHnd} Call( FunctionType func, v8::Arguments const &
argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -197,20 +203,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<${count},Sig,UnlockV8> :
FunctionSignature<Sig>
+ struct FunctionForwarderVoid<${count},Sig,UnlockV8> :
FunctionForwarderBase<${count},Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (${count} ==
sl::Arity<SignatureType>::Value) ? 1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- ${sigTypeDecls}
- ${castTypedefs}
- ${castInits}
- ${unlocker}
- return (ReturnType)(*func)( ${castCalls} );
- }
static ${ValHnd} Call( FunctionType func, v8::Arguments const &
argv )
{
CallNative( func, argv );
=======================================
--- /convert/examples/ConvertDemo.cpp Sat Apr 7 18:36:13 2012
+++ /convert/examples/ConvertDemo.cpp Sun Apr 8 12:56:18 2012
@@ -438,9 +438,9 @@
CATCHER< MethodToInCa<BN, void (BN &),
&BN::nativeParamRef> >::Call)
("nativeParamConstRef",
CATCHER<
- ConstMethodToInCa<BN, void (BN const &),
&BN::nativeParamConstRef>
+ //ConstMethodToInCa<BN, void (BN const &),
&BN::nativeParamConstRef>
//Equivalent:
- //MethodToInCa<const BN, void (BN const &),
&BN::nativeParamConstRef>
+ MethodToInCa<const BN, void (BN const &),
&BN::nativeParamConstRef>
//Equivalent:
//ToInCa<const BN, void (BN const &),
&BN::nativeParamConstRef>
//Equivalent:
@@ -547,22 +547,24 @@
VarToGetter<std::string,&sharedString>(),
ThrowingSetter() )
("sharedString2",
- FunctionToGetter<std::string (), getSharedString>(),
- FunctionToSetter<void (std::string const &),
setSharedString>() )
+ FunctionTo< Getter, std::string (), getSharedString>(),
+ FunctionTo< Setter, void (std::string const &),
setSharedString>() )
("theInt",
- ConstMethodToGetter<T, int (), &T::getInt>(),
- MethodToSetter<T, void (int), &T::setInt>() )
+ MethodTo< Getter, const T, int (), &T::getInt>(),
+ // C++11:
+ //MethodTo< Getter, const T, decltype(&T::getInt),
&T::getInt>(),
+ MethodTo< Setter, T, void (int), &T::setInt>() )
("theIntNC",
- MethodToGetter<T, int (), &T::getIntNonConst>(),
+ MethodTo< Getter, T, int (), &T::getIntNonConst>(),
MethodTo< Setter, T, void (int), &T::setInt>() )
("publicStaticIntRO",
VarToGetter<int,&T::publicStaticInt>::Get )
("publicIntRO",
MemberToGetter<T,int,&T::publicInt>(),
ThrowingSetter() )
;
- typedef MemberToAccessors<T,int,&T::publicInt> acc_publicInt;
+ typedef MemberTo< Accessors, T,int,&T::publicInt>
acc_publicInt;
acc("publicIntRW", acc_publicInt(), acc_publicInt() );
- typedef VarToAccessors<int,&T::publicStaticInt>
acc_publicStaticInt;
+ typedef VarTo< Accessors, int, &T::publicStaticInt>
acc_publicStaticInt;
acc("publicStaticIntRW",
acc_publicStaticInt::Get,
acc_publicStaticInt::Set );
@@ -962,6 +964,10 @@
g = FunctionTo< Getter, int(void), ::getchar>::Get;
s = FunctionTo< Setter, int(int), ::putchar>::Set;

+ //#if __cplusplus >= 201103L /*
http://sourceforge.net/apps/mediawiki/predef/index.php?title=Standards */
+ //typedef FunctionToInCa11< InCa > F11;
+ //#endif
+
// Var-to-X conversions:
g = VarTo< Getter, int, &aBoundInt >::Get;
s = VarTo< Setter, int, &aBoundInt >::Set;
=======================================
--- /convert/include/cvv8/detail/invocable_core.hpp Fri Dec 9 12:19:03 2011
+++ /convert/include/cvv8/detail/invocable_core.hpp Sun Apr 8 12:56:18 2012
@@ -398,6 +398,17 @@
!UnlockV8 ? 1 : (SignatureIsUnlockable< SignatureType >::Value ? 1 :
-1) \
]

+ /**
+ Default (unimplemented) specialization for an internal
+ code-reduction class. Specializations for 1+ args are
+ generated. The 0-arity specialization is never instantiated.
+ */
+ template <int _Arity, typename Sig,
+ bool UnlockV8 = SignatureIsUnlockable< Signature<Sig>
>::Value >
+ struct FunctionForwarderBase
+ {
+ };
+
template <int Arity_, typename Sig,
bool UnlockV8 = SignatureIsUnlockable< Signature<Sig> >::Value
>
struct FunctionForwarder DOXYGEN_FWD_DECL_KLUDGE;
=======================================
--- /convert/include/cvv8/detail/invocable_generated.hpp Sat Jul 23
04:29:28 2011
+++ /convert/include/cvv8/detail/invocable_generated.hpp Sun Apr 8
12:56:18 2012
@@ -1,8 +1,9 @@
/* AUTO-GENERATED CODE! EDIT AT YOUR OWN RISK! */
#if !defined(DOXYGEN)
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<1,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<1,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (1 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -19,6 +20,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<1,Sig,UnlockV8> :
FunctionForwarderBase<1,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -26,23 +34,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<1,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<1,Sig,UnlockV8> :
FunctionForwarderBase<1,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (1 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
-
- typedef ArgCaster<A0> AC0;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -265,8 +260,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<2,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<2,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (2 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -286,6 +282,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<2,Sig,UnlockV8> :
FunctionForwarderBase<2,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -293,26 +296,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<2,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<2,Sig,UnlockV8> :
FunctionForwarderBase<2,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (2 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -550,8 +537,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<3,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<3,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (3 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -574,6 +562,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<3,Sig,UnlockV8> :
FunctionForwarderBase<3,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -581,29 +576,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<3,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<3,Sig,UnlockV8> :
FunctionForwarderBase<3,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (3 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -856,8 +832,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<4,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<4,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (4 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -883,6 +860,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<4,Sig,UnlockV8> :
FunctionForwarderBase<4,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -890,32 +874,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<4,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<4,Sig,UnlockV8> :
FunctionForwarderBase<4,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (4 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -1183,8 +1145,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<5,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<5,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (5 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -1213,6 +1176,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<5,Sig,UnlockV8> :
FunctionForwarderBase<5,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -1220,35 +1190,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<5,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<5,Sig,UnlockV8> :
FunctionForwarderBase<5,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (5 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
- typedef typename sl::At< 4, Signature<Sig> >::Type A4;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
- typedef ArgCaster<A4> AC4;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
- AC4 ac4; A4 arg4(ac4.ToNative(argv[4]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -1531,8 +1476,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<6,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<6,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (6 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -1564,6 +1510,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<6,Sig,UnlockV8> :
FunctionForwarderBase<6,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -1571,38 +1524,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<6,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<6,Sig,UnlockV8> :
FunctionForwarderBase<6,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (6 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
- typedef typename sl::At< 4, Signature<Sig> >::Type A4;
- typedef typename sl::At< 5, Signature<Sig> >::Type A5;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
- typedef ArgCaster<A4> AC4;
- typedef ArgCaster<A5> AC5;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
- AC4 ac4; A4 arg4(ac4.ToNative(argv[4]));
- AC5 ac5; A5 arg5(ac5.ToNative(argv[5]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -1900,8 +1825,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<7,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<7,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (7 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -1936,6 +1862,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<7,Sig,UnlockV8> :
FunctionForwarderBase<7,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -1943,41 +1876,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<7,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<7,Sig,UnlockV8> :
FunctionForwarderBase<7,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (7 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
- typedef typename sl::At< 4, Signature<Sig> >::Type A4;
- typedef typename sl::At< 5, Signature<Sig> >::Type A5;
- typedef typename sl::At< 6, Signature<Sig> >::Type A6;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
- typedef ArgCaster<A4> AC4;
- typedef ArgCaster<A5> AC5;
- typedef ArgCaster<A6> AC6;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
- AC4 ac4; A4 arg4(ac4.ToNative(argv[4]));
- AC5 ac5; A5 arg5(ac5.ToNative(argv[5]));
- AC6 ac6; A6 arg6(ac6.ToNative(argv[6]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -2290,8 +2192,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<8,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<8,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (8 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -2329,6 +2232,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<8,Sig,UnlockV8> :
FunctionForwarderBase<8,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -2336,44 +2246,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<8,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<8,Sig,UnlockV8> :
FunctionForwarderBase<8,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (8 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
- typedef typename sl::At< 4, Signature<Sig> >::Type A4;
- typedef typename sl::At< 5, Signature<Sig> >::Type A5;
- typedef typename sl::At< 6, Signature<Sig> >::Type A6;
- typedef typename sl::At< 7, Signature<Sig> >::Type A7;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
- typedef ArgCaster<A4> AC4;
- typedef ArgCaster<A5> AC5;
- typedef ArgCaster<A6> AC6;
- typedef ArgCaster<A7> AC7;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
- AC4 ac4; A4 arg4(ac4.ToNative(argv[4]));
- AC5 ac5; A5 arg5(ac5.ToNative(argv[5]));
- AC6 ac6; A6 arg6(ac6.ToNative(argv[6]));
- AC7 ac7; A7 arg7(ac7.ToNative(argv[7]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -2701,8 +2577,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<9,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<9,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (9 == sl::Arity<SignatureType>::Value) ?
1 : -1];
@@ -2743,6 +2620,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<9,Sig,UnlockV8> :
FunctionForwarderBase<9,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -2750,47 +2634,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<9,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<9,Sig,UnlockV8> :
FunctionForwarderBase<9,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (9 == sl::Arity<SignatureType>::Value) ?
1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
- typedef typename sl::At< 4, Signature<Sig> >::Type A4;
- typedef typename sl::At< 5, Signature<Sig> >::Type A5;
- typedef typename sl::At< 6, Signature<Sig> >::Type A6;
- typedef typename sl::At< 7, Signature<Sig> >::Type A7;
- typedef typename sl::At< 8, Signature<Sig> >::Type A8;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
- typedef ArgCaster<A4> AC4;
- typedef ArgCaster<A5> AC5;
- typedef ArgCaster<A6> AC6;
- typedef ArgCaster<A7> AC7;
- typedef ArgCaster<A8> AC8;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
- AC4 ac4; A4 arg4(ac4.ToNative(argv[4]));
- AC5 ac5; A5 arg5(ac5.ToNative(argv[5]));
- AC6 ac6; A6 arg6(ac6.ToNative(argv[6]));
- AC7 ac7; A7 arg7(ac7.ToNative(argv[7]));
- AC8 ac8; A8 arg8(ac8.ToNative(argv[8]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
@@ -3133,8 +2980,9 @@
};
}
namespace Detail {
- template <typename Sig, bool UnlockV8>
- struct FunctionForwarder<10,Sig,UnlockV8> : FunctionSignature<Sig>
+
+ template <typename Sig, bool UnlockV8 >
+ struct FunctionForwarderBase<10,Sig,UnlockV8> : FunctionSignature<Sig>
{
typedef FunctionSignature<Sig> SignatureType;
typedef char AssertArity[ (10 ==
sl::Arity<SignatureType>::Value) ? 1 : -1];
@@ -3178,6 +3026,13 @@
V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8, arg9 );
}
+ };
+
+ template <typename Sig, bool UnlockV8>
+ struct FunctionForwarder<10,Sig,UnlockV8> :
FunctionForwarderBase<10,Sig,UnlockV8>
+ {
+ typedef FunctionSignature<Sig> SignatureType;
+ typedef typename SignatureType::FunctionType FunctionType;
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
return CastToJS( CallNative( func, argv ) );
@@ -3185,50 +3040,10 @@
};

template <typename Sig, bool UnlockV8>
- struct FunctionForwarderVoid<10,Sig,UnlockV8> : FunctionSignature<Sig>
+ struct FunctionForwarderVoid<10,Sig,UnlockV8> :
FunctionForwarderBase<10,Sig,UnlockV8>
{
typedef FunctionSignature<Sig> SignatureType;
- typedef char AssertArity[ (10 ==
sl::Arity<SignatureType>::Value) ? 1 : -1];
typedef typename SignatureType::FunctionType FunctionType;
- typedef typename SignatureType::ReturnType ReturnType;
- static ReturnType CallNative( FunctionType func, v8::Arguments
const & argv )
- {
- typedef typename sl::At< 0, Signature<Sig> >::Type A0;
- typedef typename sl::At< 1, Signature<Sig> >::Type A1;
- typedef typename sl::At< 2, Signature<Sig> >::Type A2;
- typedef typename sl::At< 3, Signature<Sig> >::Type A3;
- typedef typename sl::At< 4, Signature<Sig> >::Type A4;
- typedef typename sl::At< 5, Signature<Sig> >::Type A5;
- typedef typename sl::At< 6, Signature<Sig> >::Type A6;
- typedef typename sl::At< 7, Signature<Sig> >::Type A7;
- typedef typename sl::At< 8, Signature<Sig> >::Type A8;
- typedef typename sl::At< 9, Signature<Sig> >::Type A9;
-
- typedef ArgCaster<A0> AC0;
- typedef ArgCaster<A1> AC1;
- typedef ArgCaster<A2> AC2;
- typedef ArgCaster<A3> AC3;
- typedef ArgCaster<A4> AC4;
- typedef ArgCaster<A5> AC5;
- typedef ArgCaster<A6> AC6;
- typedef ArgCaster<A7> AC7;
- typedef ArgCaster<A8> AC8;
- typedef ArgCaster<A9> AC9;
-
- AC0 ac0; A0 arg0(ac0.ToNative(argv[0]));
- AC1 ac1; A1 arg1(ac1.ToNative(argv[1]));
- AC2 ac2; A2 arg2(ac2.ToNative(argv[2]));
- AC3 ac3; A3 arg3(ac3.ToNative(argv[3]));
- AC4 ac4; A4 arg4(ac4.ToNative(argv[4]));
- AC5 ac5; A5 arg5(ac5.ToNative(argv[5]));
- AC6 ac6; A6 arg6(ac6.ToNative(argv[6]));
- AC7 ac7; A7 arg7(ac7.ToNative(argv[7]));
- AC8 ac8; A8 arg8(ac8.ToNative(argv[8]));
- AC9 ac9; A9 arg9(ac9.ToNative(argv[9]));
-
- V8Unlocker<UnlockV8> const & unlocker( V8Unlocker<UnlockV8>()
);
- return (ReturnType)(*func)( arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8, arg9 );
- }
static v8::Handle<v8::Value> Call( FunctionType func,
v8::Arguments const & argv )
{
CallNative( func, argv );
=======================================
--- /convert/include/cvv8/detail/signature_generated.hpp Sun Jul 24
03:35:32 2011
+++ /convert/include/cvv8/detail/signature_generated.hpp Sun Apr 8
12:56:18 2012
@@ -532,12 +532,10 @@
MethodSignature< T const, RV ( A0) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0 >
struct MethodSignature< T const, RV (T::*)( A0) const > :
MethodSignature< T const, RV ( A0) >
{};
-#endif


template <typename T, typename RV, typename A0 >
@@ -572,12 +570,10 @@
MethodSignature< T const, RV ( A0, A1) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1 >
struct MethodSignature< T const, RV (T::*)( A0, A1) const > :
MethodSignature< T const, RV ( A0, A1) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1 >
@@ -612,12 +608,10 @@
MethodSignature< T const, RV ( A0, A1, A2) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2) const > :
MethodSignature< T const, RV ( A0, A1, A2) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2 >
@@ -652,12 +646,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3) const > :
MethodSignature< T const, RV ( A0, A1, A2, A3) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3 >
@@ -692,12 +684,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3, A4) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3, A4) const > :
MethodSignature< T const, RV ( A0, A1, A2, A3, A4) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4 >
@@ -732,12 +722,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3, A4, A5) const
> :
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5 >
@@ -772,12 +760,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3, A4, A5, A6)
const > :
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6 >
@@ -812,12 +798,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6, A7) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6, typename A7 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3, A4, A5, A6,
A7) const > :
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6, A7) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6, typename A7 >
@@ -852,12 +836,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6, A7, A8) >
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6, typename A7, typename
A8 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3, A4, A5, A6,
A7, A8) const > :
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6, A7, A8) >
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6, typename A7, typename
A8 >
@@ -892,12 +874,10 @@
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)
>
{};

-#if 1 // msvc? Apparently this works.
template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6, typename A7, typename
A8, typename A9 >
struct MethodSignature< T const, RV (T::*)( A0, A1, A2, A3, A4, A5, A6,
A7, A8, A9) const > :
MethodSignature< T const, RV ( A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)
>
{};
-#endif


template <typename T, typename RV, typename A0, typename A1, typename A2,
typename A3, typename A4, typename A5, typename A6, typename A7, typename
A8, typename A9 >

Reply all
Reply to author
Forward
0 new messages