[pypy-commit] pypy reflex-support: make cint back-end work for test_operators
wlav
noreply at buildbot.pypy.org
Sat Aug 6 08:41:33 CEST 2011
Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r46305:e6e71e4c5d19
Date: 2011-08-05 12:40 -0700
http://bitbucket.org/pypy/pypy/changeset/e6e71e4c5d19/
Log: make cint back-end work for test_operators
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
@@ -569,11 +569,17 @@
_converters["char"] = CharConverter
_converters["unsigned char"] = CharConverter
_converters["short int"] = ShortConverter
+_converters["short"] = _converters["short int"]
_converters["short int*"] = ShortPtrConverter
+_converters["short*"] = _converters["short int*"]
_converters["short int[]"] = ShortArrayConverter
+_converters["short[]"] = _converters["short int[]"]
_converters["unsigned short int"] = ShortConverter
+_converters["unsigned short"] = _converters["unsigned short int"]
_converters["unsigned short int*"] = ShortPtrConverter
+_converters["unsigned short*"] = _converters["unsigned short int*"]
_converters["unsigned short int[]"] = ShortArrayConverter
+_converters["unsigned short[]"] = _converters["unsigned short int[]"]
_converters["int"] = IntConverter
_converters["int*"] = IntPtrConverter
_converters["int[]"] = IntArrayConverter
@@ -581,11 +587,17 @@
_converters["unsigned int*"] = UnsignedIntPtrConverter
_converters["unsigned int[]"] = UnsignedIntArrayConverter
_converters["long int"] = LongConverter
+_converters["long"] = _converters["long int"]
_converters["long int*"] = LongPtrConverter
+_converters["long*"] = _converters["long int*"]
_converters["long int[]"] = LongArrayConverter
+_converters["long[]"] = _converters["long int[]"]
_converters["unsigned long int"] = UnsignedLongConverter
+_converters["unsigned long"] = _converters["unsigned long int"]
_converters["unsigned long int*"] = LongPtrConverter
+_converters["unsigned long*"] = _converters["unsigned long int*"]
_converters["unsigned long int[]"] = LongArrayConverter
+_converters["unsigned long[]"] = _converters["unsigned long int[]"]
_converters["float"] = FloatConverter
_converters["float*"] = FloatPtrConverter
_converters["float[]"] = FloatArrayConverter
diff --git a/pypy/module/cppyy/executor.py b/pypy/module/cppyy/executor.py
--- a/pypy/module/cppyy/executor.py
+++ b/pypy/module/cppyy/executor.py
@@ -328,7 +328,9 @@
_executors["char*"] = CStringExecutor
_executors["unsigned char"] = CharExecutor
_executors["short int"] = ShortExecutor
+_executors["short"] = _executors["short int"]
_executors["short int*"] = ShortPtrExecutor
+_executors["short*"] = _executors["short int*"]
_executors["unsigned short int"] = ShortExecutor
_executors["unsigned short int*"] = ShortPtrExecutor
_executors["int"] = IntExecutor
@@ -338,9 +340,13 @@
_executors["unsigned int"] = UnsignedIntExecutor
_executors["unsigned int*"] = UnsignedIntPtrExecutor
_executors["long int"] = LongExecutor
+_executors["long"] = _executors["long int"]
_executors["long int*"] = LongPtrExecutor
+_executors["long*"] = _executors["long int*"]
_executors["unsigned long int"] = UnsignedLongExecutor
+_executors["unsigned long"] = _executors["unsigned long int"]
_executors["unsigned long int*"] = UnsignedLongPtrExecutor
+_executors["unsigned long*"] = _executors["unsigned long int*"]
_executors["float"] = FloatExecutor
_executors["float*"] = FloatPtrExecutor
_executors["double"] = DoubleExecutor
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
@@ -122,6 +122,8 @@
G__InterfaceMethod meth = (G__InterfaceMethod)m->InterfaceMethod();
G__param* libp = (G__param*)((char*)args - offsetof(G__param, para));
assert(libp->paran == numargs);
+ for (int i = 0; i < numargs; ++i)
+ libp->para[i].ref = libp->para[i].obj.i;
// TODO: access to store_struct_offset won't work on Windows
G__setgvp((long)self);
@@ -134,7 +136,7 @@
G__store_struct_offset = store_struct_offset;
- // G__pop_tempobject_nodel(); # TODO: not sure ...
+ G__pop_tempobject_nodel();
return G__int(result);
}
@@ -146,6 +148,8 @@
G__InterfaceMethod meth = (G__InterfaceMethod)m->InterfaceMethod();
G__param* libp = (G__param*)((char*)args - offsetof(G__param, para));
assert(libp->paran == numargs);
+ for (int i = 0; i < numargs; ++i)
+ libp->para[i].ref = libp->para[i].obj.i;
// TODO: access to store_struct_offset won't work on Windows
G__setgvp((long)self);
diff --git a/pypy/module/cppyy/test/Makefile b/pypy/module/cppyy/test/Makefile
--- a/pypy/module/cppyy/test/Makefile
+++ b/pypy/module/cppyy/test/Makefile
@@ -32,6 +32,10 @@
# rootcint -f example01_cint.cxx -c example01.h example01_LinkDef.h
# g++ -I$ROOTSYS/include example01_cint.cxx example01.cxx -shared -o example01Dict.so -L$ROOTSYS/lib -lCore -lCint
+#
+# rootcint -f operators_cint.cxx -c operators.h operators_LinkDef.h
+# g++ -I$ROOTSYS/include operators_cint.cxx operators.cxx -shared -o operatorsDict.so -L$ROOTSYS/lib -lCore -lCint
+
# TODO: methptrgetter causes these tests to crash, so don't use it for now
stltypesDict.so: stltypes.cxx stltypes.h stltypes.xml
diff --git a/pypy/module/cppyy/test/example01_LinkDef.h b/pypy/module/cppyy/test/example01_LinkDef.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/cppyy/test/example01_LinkDef.h
@@ -0,0 +1,10 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class example01;
+#pragma link C++ class payload;
+
+#endif
diff --git a/pypy/module/cppyy/test/operators_LinkDef.h b/pypy/module/cppyy/test/operators_LinkDef.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/cppyy/test/operators_LinkDef.h
@@ -0,0 +1,19 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class number;
+
+#pragma link C++ struct operator_char_star;
+#pragma link C++ struct operator_const_char_star;
+#pragma link C++ struct operator_int;
+#pragma link C++ struct operator_long;
+#pragma link C++ struct operator_double;
+#pragma link C++ struct operator_short;
+#pragma link C++ struct operator_unsigned_int;
+#pragma link C++ struct operator_unsigned_long;
+#pragma link C++ struct operator_float;
+
+#endif
More information about the pypy-commit
mailing list