Browse Source

create signatures without c++ types

refactoring
Sebastian Junges 8 years ago
parent
commit
ed311bdd22
  1. 21
      resources/pybind11/include/pybind11/pybind11.h
  2. 2
      src/mod_core.cpp

21
resources/pybind11/include/pybind11/pybind11.h

@ -187,7 +187,7 @@ protected:
} }
/* Generate a proper function signature */ /* Generate a proper function signature */
std::string signature;
std::string signature = "(";
size_t type_depth = 0, char_index = 0, type_index = 0, arg_index = 0; size_t type_depth = 0, char_index = 0, type_index = 0, arg_index = 0;
while (true) { while (true) {
char c = text[char_index++]; char c = text[char_index++];
@ -204,7 +204,8 @@ protected:
} else { } else {
signature += "arg" + std::to_string(arg_index - (rec->is_method ? 1 : 0)); signature += "arg" + std::to_string(arg_index - (rec->is_method ? 1 : 0));
} }
signature += ": ";
//signature += ": ";
signature += " ";
} }
++type_depth; ++type_depth;
} else if (c == '}') { } else if (c == '}') {
@ -221,16 +222,20 @@ protected:
if (!t) if (!t)
pybind11_fail("Internal error while parsing type signature (1)"); pybind11_fail("Internal error while parsing type signature (1)");
if (auto tinfo = detail::get_type_info(*t)) { if (auto tinfo = detail::get_type_info(*t)) {
signature += tinfo->type->tp_name;
//signature += tinfo->type->tp_name;
} else { } else {
std::string tname(t->name());
detail::clean_type_id(tname);
signature += tname;
//std::string tname(t->name());
//detail::clean_type_id(tname);
//signature += tname;
} }
} else {
signature += c;
} else if (c == ',') {
if (type_depth == 0) {
signature += ", ";
}
//signature += c;
} }
} }
signature += ")";
if (type_depth != 0 || types[type_index] != nullptr) if (type_depth != 0 || types[type_index] != nullptr)
pybind11_fail("Internal error while parsing type signature (2)"); pybind11_fail("Internal error while parsing type signature (2)");

2
src/mod_core.cpp

@ -11,7 +11,7 @@ PYBIND11_PLUGIN(core) {
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
options.disable_function_signatures();
// options.disable_function_signatures();
#endif #endif

Loading…
Cancel
Save