[pypy-commit] pypy reflex-support: doc strings with C++ signatures for CINT backend

wlav noreply at buildbot.pypy.org
Thu Mar 29 02:47:52 CEST 2012


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r54050:97fa84af9049
Date: 2012-03-28 17:29 -0700
http://bitbucket.org/pypy/pypy/changeset/97fa84af9049/

Log:	doc strings with C++ signatures for CINT backend

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
@@ -525,6 +525,21 @@
     return cppstring_to_cstring("");
 }
 
+char* cppyy_method_signature(cppyy_scope_t handle, int method_index) {
+    TFunction* f = type_get_method(handle, method_index);
+    TClassRef cr = type_from_handle(handle);
+    std::ostringstream sig;
+    sig << cr.GetClassName() << "::" << f->GetName() << "(";
+    int nArgs = f->GetNargs();
+    for (int iarg = 0; iarg < nArgs; ++iarg) {
+        sig << ((TMethodArg*)f->GetListOfMethodArgs()->At(iarg))->GetFullTypeName();
+        if (iarg != nArgs-1)
+            sig << ", ";
+    }
+    sig << ")" << std::ends;
+    return cppstring_to_cstring(sig.str());
+}
+
 cppyy_method_t cppyy_get_method(cppyy_scope_t handle, int method_index) {
     TFunction* f = type_get_method(handle, method_index);
     return (cppyy_method_t)f->InterfaceMethod();
diff --git a/pypy/module/cppyy/test/fragile_LinkDef.h b/pypy/module/cppyy/test/fragile_LinkDef.h
--- a/pypy/module/cppyy/test/fragile_LinkDef.h
+++ b/pypy/module/cppyy/test/fragile_LinkDef.h
@@ -15,6 +15,7 @@
 #pragma link C++ class fragile::G;
 #pragma link C++ class fragile::H;
 #pragma link C++ class fragile::I;
+#pragma link C++ class fragile::J;
 
 #pragma link C++ variable fragile::gI;
 


More information about the pypy-commit mailing list