[pypy-commit] pypy reflex-support: void** and void*& support for CINT backend

wlav noreply at buildbot.pypy.org
Tue Aug 30 22:55:41 CEST 2011


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r46934:bd16dfb72989
Date: 2011-08-30 13:55 -0700
http://bitbucket.org/pypy/pypy/changeset/bd16dfb72989/

Log:	void** and void*& support for 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
@@ -430,6 +430,8 @@
         x = rffi.cast(rffi.VOIDPP, address)
         obj_address = get_rawobject(space, w_obj)
         x[0] = obj_address
+        typecode = _direct_ptradd(address, capi.c_function_arg_typeoffset())
+        typecode[0] = 'p'
 
 
 class VoidPtrRefConverter(TypeConverter):
@@ -439,6 +441,8 @@
         x = rffi.cast(rffi.VOIDPP, address)
         obj_address = get_rawobject(space, w_obj)
         x[0] = obj_address
+        typecode = _direct_ptradd(address, capi.c_function_arg_typeoffset())
+        typecode[0] = 'r'
 
 
 class ShortArrayConverter(ArrayTypeConverterMixin, TypeConverter):
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
@@ -78,7 +78,12 @@
 static inline void fixup_args(G__param* libp) {
     for (int i = 0; i < libp->paran; ++i) {
         libp->para[i].ref = libp->para[i].obj.i;
-        if (libp->para[i].type == 'f') {
+        const char partype = libp->para[i].type;
+        if (partype == 'p')
+            libp->para[i].obj.i = (long)&libp->para[i].ref;
+        else if (partype == 'r')
+            libp->para[i].ref = (long)&libp->para[i].obj.i;
+        else if (partype == 'f') {
             assert(sizeof(float) <= sizeof(long));
             long val = libp->para[i].obj.i;
             void* pval = (void*)&val;


More information about the pypy-commit mailing list