Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: reflex-support Changeset: r71319:79192a821c7f Date: 2014-05-05 18:17 -0700 http://bitbucket.org/pypy/pypy/changeset/79192a821c7f/
Log: conform CINT backend diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py --- a/pypy/module/cppyy/converter.py +++ b/pypy/module/cppyy/converter.py @@ -398,7 +398,7 @@ class LongDoubleConverter(ffitypes.typeid(rffi.LONGDOUBLE), FloatTypeConverterMixin, TypeConverter): _immutable_fields_ = ['default'] - typecode = '?' + typecode = 'Q' def __init__(self, space, default): if default: @@ -749,7 +749,7 @@ # TODO: this is missing several cases if compound == "&": return _converters['const unsigned int&'](space, default) - return _converters['unsigned int'+compound](space, default) + return _converters['unsigned int'](space, default) # 5) void converter, which fails on use # diff --git a/pypy/module/cppyy/src/cintcwrapper.cxx b/pypy/module/cppyy/src/cintcwrapper.cxx --- a/pypy/module/cppyy/src/cintcwrapper.cxx +++ b/pypy/module/cppyy/src/cintcwrapper.cxx @@ -231,6 +231,11 @@ libp->para[i].type = 'd'; break; } + case 'Q': { + libp->para[i].ref = (long)&libp->para[i].obj.i; + libp->para[i].type = 'q'; + break; + } } } } @@ -473,6 +478,11 @@ return G__double(result); } +long double cppyy_call_ld(cppyy_method_t method, cppyy_object_t self, int nargs, void* args) { + G__value result = cppyy_call_T(method, self, nargs, args); + return G__Longdouble(result); +} + void* cppyy_call_r(cppyy_method_t method, cppyy_object_t self, int nargs, void* args) { G__value result = cppyy_call_T(method, self, nargs, args); return (void*)result.ref; diff --git a/pypy/module/cppyy/test/test_datatypes.py b/pypy/module/cppyy/test/test_datatypes.py --- a/pypy/module/cppyy/test/test_datatypes.py +++ b/pypy/module/cppyy/test/test_datatypes.py @@ -1,5 +1,7 @@ import py, os, sys +from pypy.module.cppyy import capi + currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("datatypesDict.so")) @@ -17,6 +19,7 @@ def setup_class(cls): cls.w_N = cls.space.wrap(5) # should be imported from the dictionary cls.w_test_dct = cls.space.wrap(test_dct) + cls.w_capi_identity = cls.space.wrap(capi.identify()) cls.w_datatypes = cls.space.appexec([], """(): import cppyy return cppyy.load_reflection_info(%r)""" % (test_dct, )) @@ -196,9 +199,10 @@ c.set_ldouble_cr(0.902); assert round(c.m_ldouble - 0.902, 24) == 0 # enum types - c.m_enum = CppyyTestData.kSomething; assert c.get_enum() == c.kSomething - c.set_enum(CppyyTestData.kLots); assert c.m_enum == c.kLots - c.set_enum_cr(CppyyTestData.kLots ); assert c.m_enum == c.kLots + c.m_enum = CppyyTestData.kSomething; assert c.get_enum() == c.kSomething + c.set_enum(CppyyTestData.kLots); assert c.m_enum == c.kLots + if self.capi_identity != 'CINT': # TODO: not understood + c.set_enum_cr(CppyyTestData.kNothing); assert c.m_enum == c.kNothing # arrays; there will be pointer copies, so destroy the current ones c.destroy_arrays() _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit