From 6d54aee0c73da5eddce7afd0ce0d1085374c2255 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 30 Oct 2024 17:23:48 +0100 Subject: [PATCH] Remove runtime dependency on interrogatedb --- cmake/macros/Python.cmake | 1 + dtool/Config.cmake | 2 +- dtool/metalibs/dtoolconfig/pydtool.cxx | 3112 ----------------- dtool/src/dtoolbase/CMakeLists.txt | 1 + .../{interrogatedb => dtoolbase}/extension.h | 0 dtool/src/interrogatedb/CMakeLists.txt | 76 +- .../interrogatedb/config_interrogatedb.cxx | 66 - .../src/interrogatedb/config_interrogatedb.h | 25 - dtool/src/interrogatedb/dtool_super_base.cxx | 177 - dtool/src/interrogatedb/indexRemapper.cxx | 68 - dtool/src/interrogatedb/indexRemapper.h | 44 - .../src/interrogatedb/interrogateComponent.I | 123 - .../interrogatedb/interrogateComponent.cxx | 50 - .../src/interrogatedb/interrogateComponent.h | 67 - dtool/src/interrogatedb/interrogateDatabase.I | 89 - .../src/interrogatedb/interrogateDatabase.cxx | 1330 ------- dtool/src/interrogatedb/interrogateDatabase.h | 205 -- dtool/src/interrogatedb/interrogateElement.I | 259 -- .../src/interrogatedb/interrogateElement.cxx | 74 - dtool/src/interrogatedb/interrogateElement.h | 103 - dtool/src/interrogatedb/interrogateFunction.I | 178 - .../src/interrogatedb/interrogateFunction.cxx | 100 - dtool/src/interrogatedb/interrogateFunction.h | 117 - .../interrogateFunctionWrapper.I | 240 -- .../interrogateFunctionWrapper.cxx | 84 - .../interrogateFunctionWrapper.h | 118 - dtool/src/interrogatedb/interrogateMakeSeq.I | 103 - .../src/interrogatedb/interrogateMakeSeq.cxx | 50 - dtool/src/interrogatedb/interrogateMakeSeq.h | 60 - dtool/src/interrogatedb/interrogateManifest.I | 116 - .../src/interrogatedb/interrogateManifest.cxx | 49 - dtool/src/interrogatedb/interrogateManifest.h | 66 - dtool/src/interrogatedb/interrogateType.I | 594 ---- dtool/src/interrogatedb/interrogateType.cxx | 247 -- dtool/src/interrogatedb/interrogateType.h | 239 -- .../src/interrogatedb/interrogate_datafile.I | 51 - .../interrogatedb/interrogate_datafile.cxx | 98 - .../src/interrogatedb/interrogate_datafile.h | 37 - .../interrogatedb/interrogate_interface.cxx | 1043 ------ .../src/interrogatedb/interrogate_interface.h | 581 --- .../src/interrogatedb/interrogate_request.cxx | 37 - .../p3interrogatedb_composite1.cxx | 7 - .../p3interrogatedb_composite2.cxx | 6 - dtool/src/interrogatedb/py_compat.cxx | 50 - dtool/src/interrogatedb/py_panda.cxx | 957 ----- dtool/src/interrogatedb/py_panda.h | 2 + dtool/src/interrogatedb/py_wrappers.cxx | 1791 ---------- dtool/src/parser-inc/algorithm | 6 +- makepanda/installer.nsi | 1 - makepanda/makepanda.py | 36 +- makepanda/makepandacore.py | 4 +- panda/src/express/CMakeLists.txt | 2 +- panda/src/express/memoryUsage.cxx | 1 - panda/src/iphone/ipfreeze.py | 2 +- tests/test_imports.py | 3 + 55 files changed, 23 insertions(+), 12925 deletions(-) delete mode 100644 dtool/metalibs/dtoolconfig/pydtool.cxx rename dtool/src/{interrogatedb => dtoolbase}/extension.h (100%) delete mode 100644 dtool/src/interrogatedb/config_interrogatedb.cxx delete mode 100644 dtool/src/interrogatedb/config_interrogatedb.h delete mode 100644 dtool/src/interrogatedb/dtool_super_base.cxx delete mode 100644 dtool/src/interrogatedb/indexRemapper.cxx delete mode 100644 dtool/src/interrogatedb/indexRemapper.h delete mode 100644 dtool/src/interrogatedb/interrogateComponent.I delete mode 100644 dtool/src/interrogatedb/interrogateComponent.cxx delete mode 100644 dtool/src/interrogatedb/interrogateComponent.h delete mode 100644 dtool/src/interrogatedb/interrogateDatabase.I delete mode 100644 dtool/src/interrogatedb/interrogateDatabase.cxx delete mode 100644 dtool/src/interrogatedb/interrogateDatabase.h delete mode 100644 dtool/src/interrogatedb/interrogateElement.I delete mode 100644 dtool/src/interrogatedb/interrogateElement.cxx delete mode 100644 dtool/src/interrogatedb/interrogateElement.h delete mode 100644 dtool/src/interrogatedb/interrogateFunction.I delete mode 100644 dtool/src/interrogatedb/interrogateFunction.cxx delete mode 100644 dtool/src/interrogatedb/interrogateFunction.h delete mode 100644 dtool/src/interrogatedb/interrogateFunctionWrapper.I delete mode 100644 dtool/src/interrogatedb/interrogateFunctionWrapper.cxx delete mode 100644 dtool/src/interrogatedb/interrogateFunctionWrapper.h delete mode 100644 dtool/src/interrogatedb/interrogateMakeSeq.I delete mode 100644 dtool/src/interrogatedb/interrogateMakeSeq.cxx delete mode 100644 dtool/src/interrogatedb/interrogateMakeSeq.h delete mode 100644 dtool/src/interrogatedb/interrogateManifest.I delete mode 100644 dtool/src/interrogatedb/interrogateManifest.cxx delete mode 100644 dtool/src/interrogatedb/interrogateManifest.h delete mode 100644 dtool/src/interrogatedb/interrogateType.I delete mode 100644 dtool/src/interrogatedb/interrogateType.cxx delete mode 100644 dtool/src/interrogatedb/interrogateType.h delete mode 100644 dtool/src/interrogatedb/interrogate_datafile.I delete mode 100644 dtool/src/interrogatedb/interrogate_datafile.cxx delete mode 100644 dtool/src/interrogatedb/interrogate_datafile.h delete mode 100644 dtool/src/interrogatedb/interrogate_interface.cxx delete mode 100644 dtool/src/interrogatedb/interrogate_interface.h delete mode 100644 dtool/src/interrogatedb/interrogate_request.cxx delete mode 100644 dtool/src/interrogatedb/p3interrogatedb_composite1.cxx delete mode 100644 dtool/src/interrogatedb/p3interrogatedb_composite2.cxx delete mode 100644 dtool/src/interrogatedb/py_compat.cxx delete mode 100644 dtool/src/interrogatedb/py_panda.cxx delete mode 100644 dtool/src/interrogatedb/py_wrappers.cxx diff --git a/cmake/macros/Python.cmake b/cmake/macros/Python.cmake index 32258d4a6d..ce605e00b9 100644 --- a/cmake/macros/Python.cmake +++ b/cmake/macros/Python.cmake @@ -49,6 +49,7 @@ function(add_python_target target) add_library(${target} ${MODULE_TYPE} ${sources}) target_link_libraries(${target} PKG::PYTHON) + target_include_directories(${target} PRIVATE "${PROJECT_SOURCE_DIR}/dtool/src/interrogatedb") if(BUILD_SHARED_LIBS) set(_outdir "${PANDA_OUTPUT_DIR}/${slash_namespace}") diff --git a/dtool/Config.cmake b/dtool/Config.cmake index d94bf11e0c..f3063d86ad 100644 --- a/dtool/Config.cmake +++ b/dtool/Config.cmake @@ -265,7 +265,7 @@ if(BUILD_INTERROGATE) panda3d-interrogate GIT_REPOSITORY https://github.com/panda3d/interrogate.git - GIT_TAG 0951ca5cd3896b6ead8c2a7d2d81e391f0b422ca + GIT_TAG 03418d6d7ddda7fb99abf27230aa42d1d8bd607e PREFIX ${_interrogate_dir} CMAKE_ARGS diff --git a/dtool/metalibs/dtoolconfig/pydtool.cxx b/dtool/metalibs/dtoolconfig/pydtool.cxx deleted file mode 100644 index 38b6e6359a..0000000000 --- a/dtool/metalibs/dtoolconfig/pydtool.cxx +++ /dev/null @@ -1,3112 +0,0 @@ -/* - * This file was generated by: - * interrogate -D EXPCL_DTOOLCONFIG= -nodb -python -promiscuous -I../../../built/include -module panda3d.interrogatedb -library interrogatedb -string -true-names -do-module -oc pydtool.cxx ../../src/interrogatedb/interrogate_interface.h ../../src/interrogatedb/interrogate_request.h - * - */ - -#include - -#include "../../src/interrogatedb/interrogate_interface.h" -#include "../../src/interrogatedb/interrogate_request.h" -#include "dtoolbase.h" - -#undef _POSIX_C_SOURCE -#undef _XOPEN_SOURCE -#define PY_SSIZE_T_CLEAN 1 - -#if PYTHON_FRAMEWORK - #include -#else - #include "Python.h" -#endif - -static PyObject *_inP07yttbRf(PyObject *self, PyObject *args); -static PyObject *_inP07ytda_g(PyObject *self, PyObject *args); -static PyObject *_inP07yt4RgX(PyObject *self, PyObject *args); -static PyObject *_inP07yt3Gip(PyObject *self, PyObject *args); -static PyObject *_inP07ytRKDz(PyObject *self, PyObject *args); -static PyObject *_inP07ytgZ9N(PyObject *self, PyObject *args); -static PyObject *_inP07ytFnRZ(PyObject *self, PyObject *args); -static PyObject *_inP07ytg0Qv(PyObject *self, PyObject *args); -static PyObject *_inP07yttrqw(PyObject *self, PyObject *args); -static PyObject *_inP07ytdmpW(PyObject *self, PyObject *args); -static PyObject *_inP07ytUYgQ(PyObject *self, PyObject *args); -static PyObject *_inP07yt0k7F(PyObject *self, PyObject *args); -static PyObject *_inP07ytfIsr(PyObject *self, PyObject *args); -static PyObject *_inP07ytvysR(PyObject *self, PyObject *args); -static PyObject *_inP07ytYQ_2(PyObject *self, PyObject *args); -static PyObject *_inP07yt3kdv(PyObject *self, PyObject *args); -static PyObject *_inP07ytew01(PyObject *self, PyObject *args); -static PyObject *_inP07ytQna7(PyObject *self, PyObject *args); -static PyObject *_inP07ytkg95(PyObject *self, PyObject *args); -static PyObject *_inP07ytluRc(PyObject *self, PyObject *args); -static PyObject *_inP07yttHdM(PyObject *self, PyObject *args); -static PyObject *_inP07ytDId0(PyObject *self, PyObject *args); -static PyObject *_inP07ytHuAm(PyObject *self, PyObject *args); -static PyObject *_inP07yt_xr0(PyObject *self, PyObject *args); -static PyObject *_inP07ytH5qp(PyObject *self, PyObject *args); -static PyObject *_inP07ytLfJw(PyObject *self, PyObject *args); -static PyObject *_inP07yt_Atg(PyObject *self, PyObject *args); -static PyObject *_inP07ytlBqc(PyObject *self, PyObject *args); -static PyObject *_inP07ytNdUp(PyObject *self, PyObject *args); -static PyObject *_inP07ytlS0p(PyObject *self, PyObject *args); -static PyObject *_inP07ytZZe7(PyObject *self, PyObject *args); -static PyObject *_inP07ytV5S_(PyObject *self, PyObject *args); -static PyObject *_inP07yto9vD(PyObject *self, PyObject *args); -static PyObject *_inP07ytv7tF(PyObject *self, PyObject *args); -static PyObject *_inP07ythOg6(PyObject *self, PyObject *args); -static PyObject *_inP07ytoZUn(PyObject *self, PyObject *args); -static PyObject *_inP07ytq45U(PyObject *self, PyObject *args); -static PyObject *_inP07yt6IPa(PyObject *self, PyObject *args); -static PyObject *_inP07ytU2_B(PyObject *self, PyObject *args); -static PyObject *_inP07ytHFO2(PyObject *self, PyObject *args); -static PyObject *_inP07ytcfjm(PyObject *self, PyObject *args); -static PyObject *_inP07yt3Sjw(PyObject *self, PyObject *args); -static PyObject *_inP07ytgJcX(PyObject *self, PyObject *args); -static PyObject *_inP07ytYlw6(PyObject *self, PyObject *args); -static PyObject *_inP07ytsmnz(PyObject *self, PyObject *args); -static PyObject *_inP07ytxQ10(PyObject *self, PyObject *args); -static PyObject *_inP07yt6gPB(PyObject *self, PyObject *args); -static PyObject *_inP07ytISgV(PyObject *self, PyObject *args); -static PyObject *_inP07ytH3bx(PyObject *self, PyObject *args); -static PyObject *_inP07ytzeUk(PyObject *self, PyObject *args); -static PyObject *_inP07ytUeI5(PyObject *self, PyObject *args); -static PyObject *_inP07ytbmxJ(PyObject *self, PyObject *args); -static PyObject *_inP07ytY8Lc(PyObject *self, PyObject *args); -static PyObject *_inP07ytJAAI(PyObject *self, PyObject *args); -static PyObject *_inP07yt0UXw(PyObject *self, PyObject *args); -static PyObject *_inP07ytuSvx(PyObject *self, PyObject *args); -static PyObject *_inP07ytwpYd(PyObject *self, PyObject *args); -static PyObject *_inP07ytOfNh(PyObject *self, PyObject *args); -static PyObject *_inP07ytf5_U(PyObject *self, PyObject *args); -static PyObject *_inP07ytL3ZB(PyObject *self, PyObject *args); -static PyObject *_inP07ytXw0I(PyObject *self, PyObject *args); -static PyObject *_inP07yt3zru(PyObject *self, PyObject *args); -static PyObject *_inP07ytRrg2(PyObject *self, PyObject *args); -static PyObject *_inP07ytEJCx(PyObject *self, PyObject *args); -static PyObject *_inP07ytWAZr(PyObject *self, PyObject *args); -static PyObject *_inP07ytHQi6(PyObject *self, PyObject *args); -static PyObject *_inP07ytrD_M(PyObject *self, PyObject *args); -static PyObject *_inP07ytYaah(PyObject *self, PyObject *args); -static PyObject *_inP07yt2otr(PyObject *self, PyObject *args); -static PyObject *_inP07ytNP_b(PyObject *self, PyObject *args); -static PyObject *_inP07ytrrrN(PyObject *self, PyObject *args); -static PyObject *_inP07ytjolz(PyObject *self, PyObject *args); -static PyObject *_inP07ytt_JD(PyObject *self, PyObject *args); -static PyObject *_inP07ytwEts(PyObject *self, PyObject *args); -static PyObject *_inP07ytrJWs(PyObject *self, PyObject *args); -static PyObject *_inP07ytpmFD(PyObject *self, PyObject *args); -static PyObject *_inP07ytyYUX(PyObject *self, PyObject *args); -static PyObject *_inP07yt54dn(PyObject *self, PyObject *args); -static PyObject *_inP07ytGMpW(PyObject *self, PyObject *args); -static PyObject *_inP07ytNuBV(PyObject *self, PyObject *args); -static PyObject *_inP07yt9UwA(PyObject *self, PyObject *args); -static PyObject *_inP07yt3FDt(PyObject *self, PyObject *args); -static PyObject *_inP07ytDgOY(PyObject *self, PyObject *args); -static PyObject *_inP07ytf513(PyObject *self, PyObject *args); -static PyObject *_inP07ytsqGH(PyObject *self, PyObject *args); -static PyObject *_inP07yt7shV(PyObject *self, PyObject *args); -static PyObject *_inP07ytA1eF(PyObject *self, PyObject *args); -static PyObject *_inP07yt776V(PyObject *self, PyObject *args); -static PyObject *_inP07ytryup(PyObject *self, PyObject *args); -static PyObject *_inP07ytiytI(PyObject *self, PyObject *args); -static PyObject *_inP07ytZc07(PyObject *self, PyObject *args); -static PyObject *_inP07ytfaH0(PyObject *self, PyObject *args); -static PyObject *_inP07ytGB9D(PyObject *self, PyObject *args); -static PyObject *_inP07ytrppS(PyObject *self, PyObject *args); -static PyObject *_inP07ytO50x(PyObject *self, PyObject *args); -static PyObject *_inP07ytsxxs(PyObject *self, PyObject *args); -static PyObject *_inP07ytMT0z(PyObject *self, PyObject *args); -static PyObject *_inP07ytiW3v(PyObject *self, PyObject *args); -static PyObject *_inP07yt4Px8(PyObject *self, PyObject *args); -static PyObject *_inP07ytNHcs(PyObject *self, PyObject *args); -static PyObject *_inP07ytqHrb(PyObject *self, PyObject *args); -static PyObject *_inP07ytaOqq(PyObject *self, PyObject *args); -static PyObject *_inP07ytpTBb(PyObject *self, PyObject *args); -static PyObject *_inP07ytZUkn(PyObject *self, PyObject *args); -static PyObject *_inP07ytqWOw(PyObject *self, PyObject *args); -static PyObject *_inP07ytHu7x(PyObject *self, PyObject *args); -static PyObject *_inP07ytwGnA(PyObject *self, PyObject *args); -static PyObject *_inP07ytXGxx(PyObject *self, PyObject *args); -static PyObject *_inP07ytj04Z(PyObject *self, PyObject *args); -static PyObject *_inP07ytEOv4(PyObject *self, PyObject *args); -static PyObject *_inP07ytpCqJ(PyObject *self, PyObject *args); -static PyObject *_inP07yt_Pz3(PyObject *self, PyObject *args); -static PyObject *_inP07ytt_06(PyObject *self, PyObject *args); -static PyObject *_inP07ytmuPs(PyObject *self, PyObject *args); -static PyObject *_inP07ytvM8B(PyObject *self, PyObject *args); -static PyObject *_inP07ytap97(PyObject *self, PyObject *args); -static PyObject *_inP07yt0o8D(PyObject *self, PyObject *args); -static PyObject *_inP07ytOoQ2(PyObject *self, PyObject *args); -static PyObject *_inP07ytKuFh(PyObject *self, PyObject *args); -static PyObject *_inP07yto5L6(PyObject *self, PyObject *args); -static PyObject *_inP07ytzgKK(PyObject *self, PyObject *args); -static PyObject *_inP07yt0FIF(PyObject *self, PyObject *args); -static PyObject *_inP07ytZqvD(PyObject *self, PyObject *args); -static PyObject *_inP07ytDyRd(PyObject *self, PyObject *args); -static PyObject *_inP07ytMnKa(PyObject *self, PyObject *args); -static PyObject *_inP07ytRtji(PyObject *self, PyObject *args); -static PyObject *_inP07ytCnbQ(PyObject *self, PyObject *args); -static PyObject *_inP07ytoxqc(PyObject *self, PyObject *args); -static PyObject *_inP07ytZQIS(PyObject *self, PyObject *args); -static PyObject *_inP07ytdUVN(PyObject *self, PyObject *args); -static PyObject *_inP07ytZtNk(PyObject *self, PyObject *args); -static PyObject *_inP07ytihbt(PyObject *self, PyObject *args); -static PyObject *_inP07ytbyPY(PyObject *self, PyObject *args); -static PyObject *_inP07ytAaT6(PyObject *self, PyObject *args); -static PyObject *_inP07ytgL9q(PyObject *self, PyObject *args); -static PyObject *_inP07ytWB97(PyObject *self, PyObject *args); -static PyObject *_inP07ytDUAl(PyObject *self, PyObject *args); -static PyObject *_inP07yt1_Kf(PyObject *self, PyObject *args); -static PyObject *_inP07yt98lD(PyObject *self, PyObject *args); -static PyObject *_inP07yt9SHr(PyObject *self, PyObject *args); -static PyObject *_inP07ytdiZP(PyObject *self, PyObject *args); -static PyObject *_inP07ytTdER(PyObject *self, PyObject *args); -static PyObject *_inP07ytYO56(PyObject *self, PyObject *args); -static PyObject *_inP07ytxtCG(PyObject *self, PyObject *args); -static PyObject *_inP07yt_EB2(PyObject *self, PyObject *args); -static PyObject *_inP07ytEG1l(PyObject *self, PyObject *args); -static PyObject *_inP07yt7tUq(PyObject *self, PyObject *args); -static PyObject *_inP07ytyStU(PyObject *self, PyObject *args); -static PyObject *_inP07ytdM85(PyObject *self, PyObject *args); -static PyObject *_inP07ytk_GN(PyObject *self, PyObject *args); -static PyObject *_inP07yt8QjG(PyObject *self, PyObject *args); -static PyObject *_inP07ytyMtj(PyObject *self, PyObject *args); -static PyObject *_inP07ytHDtN(PyObject *self, PyObject *args); -static PyObject *_inP07ytHFjA(PyObject *self, PyObject *args); -static PyObject *_inP07yt_NPR(PyObject *self, PyObject *args); -static PyObject *_inP07ytcTOH(PyObject *self, PyObject *args); -static PyObject *_inP07ytC5Uk(PyObject *self, PyObject *args); -static PyObject *_inP07ythdU7(PyObject *self, PyObject *args); -static PyObject *_inP07ytQPxU(PyObject *self, PyObject *args); -static PyObject *_inP07ytO7Pz(PyObject *self, PyObject *args); -static PyObject *_inP07ytvu_E(PyObject *self, PyObject *args); -static PyObject *_inP07ytxGUt(PyObject *self, PyObject *args); -static PyObject *_inP07ytzM1P(PyObject *self, PyObject *args); -static PyObject *_inP07ytoY5L(PyObject *self, PyObject *args); -static PyObject *_inP07yte_7S(PyObject *self, PyObject *args); -static PyObject *_inP07ytw_15(PyObject *self, PyObject *args); - - -/* - * Python simple wrapper for - * void interrogate_add_search_directory(char const *dirname) - */ -static PyObject * -_inP07yttbRf(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - (::interrogate_add_search_directory)((char const *)param0); - return Py_BuildValue(""); - } - return nullptr; -} - -/* - * Python simple wrapper for - * void interrogate_add_search_path(char const *pathstring) - */ -static PyObject * -_inP07ytda_g(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - (::interrogate_add_search_path)((char const *)param0); - return Py_BuildValue(""); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_error_flag(void) - */ -static PyObject * -_inP07yt4RgX(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - bool return_value = (::interrogate_error_flag)(); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_number_of_manifests(void) - */ -static PyObject * -_inP07yt3Gip(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - int return_value = (::interrogate_number_of_manifests)(); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * ManifestIndex interrogate_get_manifest(int n) - */ -static PyObject * -_inP07ytRKDz(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - ManifestIndex return_value = (::interrogate_get_manifest)((int)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * ManifestIndex interrogate_get_manifest_by_name(char const *manifest_name) - */ -static PyObject * -_inP07ytgZ9N(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - ManifestIndex return_value = (::interrogate_get_manifest_by_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_manifest_name(ManifestIndex manifest) - */ -static PyObject * -_inP07ytFnRZ(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_manifest_name)((ManifestIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_manifest_definition(ManifestIndex manifest) - */ -static PyObject * -_inP07ytg0Qv(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_manifest_definition)((ManifestIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_manifest_has_type(ManifestIndex manifest) - */ -static PyObject * -_inP07yttrqw(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_manifest_has_type)((ManifestIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_manifest_get_type(ManifestIndex manifest) - */ -static PyObject * -_inP07ytdmpW(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_manifest_get_type)((ManifestIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_manifest_has_getter(ManifestIndex manifest) - */ -static PyObject * -_inP07ytUYgQ(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_manifest_has_getter)((ManifestIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_manifest_getter(ManifestIndex manifest) - */ -static PyObject * -_inP07yt0k7F(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_manifest_getter)((ManifestIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_manifest_has_int_value(ManifestIndex manifest) - */ -static PyObject * -_inP07ytfIsr(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_manifest_has_int_value)((ManifestIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_manifest_get_int_value(ManifestIndex manifest) - */ -static PyObject * -_inP07ytvysR(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_manifest_get_int_value)((ManifestIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_element_name(ElementIndex element) - */ -static PyObject * -_inP07ytYQ_2(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_element_name)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_element_scoped_name(ElementIndex element) - */ -static PyObject * -_inP07yt3kdv(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_element_scoped_name)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_comment(ElementIndex element) - */ -static PyObject * -_inP07ytew01(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_comment)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_element_comment(ElementIndex element) - */ -static PyObject * -_inP07ytQna7(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_element_comment)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * ElementIndex interrogate_get_element_by_name(char const *element_name) - */ -static PyObject * -_inP07ytkg95(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - ElementIndex return_value = (::interrogate_get_element_by_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * ElementIndex interrogate_get_element_by_scoped_name(char const *element_name) - */ -static PyObject * -_inP07ytluRc(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - ElementIndex return_value = (::interrogate_get_element_by_scoped_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_element_type(ElementIndex element) - */ -static PyObject * -_inP07yttHdM(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_element_type)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_getter(ElementIndex element) - */ -static PyObject * -_inP07ytDId0(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_getter)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_getter(ElementIndex element) - */ -static PyObject * -_inP07ytHuAm(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_getter)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_setter(ElementIndex element) - */ -static PyObject * -_inP07yt_xr0(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_setter)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_setter(ElementIndex element) - */ -static PyObject * -_inP07ytH5qp(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_setter)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_has_function(ElementIndex element) - */ -static PyObject * -_inP07ytLfJw(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_has_function)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_has_function(ElementIndex element) - */ -static PyObject * -_inP07yt_Atg(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_has_function)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_clear_function(ElementIndex element) - */ -static PyObject * -_inP07ytlBqc(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_clear_function)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_clear_function(ElementIndex element) - */ -static PyObject * -_inP07ytNdUp(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_clear_function)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_del_function(ElementIndex element) - */ -static PyObject * -_inP07ytlS0p(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_del_function)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_del_function(ElementIndex element) - */ -static PyObject * -_inP07ytZZe7(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_del_function)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_insert_function(ElementIndex element) - */ -static PyObject * -_inP07ytV5S_(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_insert_function)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_insert_function(ElementIndex element) - */ -static PyObject * -_inP07yto9vD(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_insert_function)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_has_getkey_function(ElementIndex element) - */ -static PyObject * -_inP07ytv7tF(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_has_getkey_function)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_getkey_function(ElementIndex element) - */ -static PyObject * -_inP07ythOg6(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_getkey_function)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_element_length_function(ElementIndex element) - */ -static PyObject * -_inP07ytoZUn(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_element_length_function)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_is_sequence(ElementIndex element) - */ -static PyObject * -_inP07ytq45U(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_is_sequence)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_element_is_mapping(ElementIndex element) - */ -static PyObject * -_inP07yt6IPa(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_element_is_mapping)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_number_of_globals(void) - */ -static PyObject * -_inP07ytU2_B(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - int return_value = (::interrogate_number_of_globals)(); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * ElementIndex interrogate_get_global(int n) - */ -static PyObject * -_inP07ytHFO2(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - ElementIndex return_value = (::interrogate_get_global)((int)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_number_of_global_functions(void) - */ -static PyObject * -_inP07ytcfjm(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - int return_value = (::interrogate_number_of_global_functions)(); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_get_global_function(int n) - */ -static PyObject * -_inP07yt3Sjw(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_get_global_function)((int)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_number_of_functions(void) - */ -static PyObject * -_inP07ytgJcX(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - int return_value = (::interrogate_number_of_functions)(); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_get_function(int n) - */ -static PyObject * -_inP07ytYlw6(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_get_function)((int)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_function_name(FunctionIndex function) - */ -static PyObject * -_inP07ytsmnz(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_function_name)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_function_scoped_name(FunctionIndex function) - */ -static PyObject * -_inP07ytxQ10(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_function_scoped_name)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_has_comment(FunctionIndex function) - */ -static PyObject * -_inP07yt6gPB(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_has_comment)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_function_comment(FunctionIndex function) - */ -static PyObject * -_inP07ytISgV(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_function_comment)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_function_prototype(FunctionIndex function) - */ -static PyObject * -_inP07ytH3bx(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_function_prototype)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_is_method(FunctionIndex function) - */ -static PyObject * -_inP07ytzeUk(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_is_method)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_function_class(FunctionIndex function) - */ -static PyObject * -_inP07ytUeI5(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_function_class)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_is_unary_op(FunctionIndex function) - */ -static PyObject * -_inP07ytbmxJ(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_is_unary_op)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_is_operator_typecast(FunctionIndex function) - */ -static PyObject * -_inP07ytY8Lc(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_is_operator_typecast)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_is_constructor(FunctionIndex function) - */ -static PyObject * -_inP07ytJAAI(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_is_constructor)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_is_destructor(FunctionIndex function) - */ -static PyObject * -_inP07yt0UXw(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_is_destructor)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_has_module_name(FunctionIndex function) - */ -static PyObject * -_inP07ytuSvx(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_has_module_name)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_function_module_name(FunctionIndex function) - */ -static PyObject * -_inP07ytwpYd(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_function_module_name)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_has_library_name(FunctionIndex function) - */ -static PyObject * -_inP07ytOfNh(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_has_library_name)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_function_library_name(FunctionIndex function) - */ -static PyObject * -_inP07ytf5_U(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_function_library_name)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_function_is_virtual(FunctionIndex function) - */ -static PyObject * -_inP07ytL3ZB(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_function_is_virtual)((FunctionIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_function_number_of_c_wrappers(FunctionIndex function) - */ -static PyObject * -_inP07ytXw0I(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_function_number_of_c_wrappers)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionWrapperIndex interrogate_function_c_wrapper(FunctionIndex function, int n) - */ -static PyObject * -_inP07yt3zru(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionWrapperIndex return_value = (::interrogate_function_c_wrapper)((FunctionIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_function_number_of_python_wrappers(FunctionIndex function) - */ -static PyObject * -_inP07ytRrg2(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_function_number_of_python_wrappers)((FunctionIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionWrapperIndex interrogate_function_python_wrapper(FunctionIndex function, int n) - */ -static PyObject * -_inP07ytEJCx(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionWrapperIndex return_value = (::interrogate_function_python_wrapper)((FunctionIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_wrapper_name(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytWAZr(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_wrapper_name)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_wrapper_function(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytHQi6(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_wrapper_function)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_is_callable_by_name(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytrD_M(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_is_callable_by_name)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_is_copy_constructor(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytYaah(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_is_copy_constructor)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_is_coerce_constructor(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07yt2otr(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_is_coerce_constructor)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_is_extension(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytNP_b(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_is_extension)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_is_deprecated(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytrrrN(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_is_deprecated)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_has_comment(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytjolz(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_has_comment)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_wrapper_comment(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytt_JD(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_wrapper_comment)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_has_return_value(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytwEts(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_has_return_value)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_wrapper_return_type(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytrJWs(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_wrapper_return_type)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_caller_manages_return_value(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytpmFD(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_caller_manages_return_value)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_wrapper_return_value_destructor(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytyYUX(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_wrapper_return_value_destructor)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_wrapper_number_of_parameters(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07yt54dn(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_wrapper_number_of_parameters)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_wrapper_parameter_type(FunctionWrapperIndex wrapper, int n) - */ -static PyObject * -_inP07ytGMpW(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - TypeIndex return_value = (::interrogate_wrapper_parameter_type)((FunctionWrapperIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n) - */ -static PyObject * -_inP07ytNuBV(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = (::interrogate_wrapper_parameter_has_name)((FunctionWrapperIndex)param0, (int)param1); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n) - */ -static PyObject * -_inP07yt9UwA(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = (::interrogate_wrapper_parameter_name)((FunctionWrapperIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n) - */ -static PyObject * -_inP07yt3FDt(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = (::interrogate_wrapper_parameter_is_this)((FunctionWrapperIndex)param0, (int)param1); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_parameter_is_optional(FunctionWrapperIndex wrapper, int n) - */ -static PyObject * -_inP07ytDgOY(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = (::interrogate_wrapper_parameter_is_optional)((FunctionWrapperIndex)param0, (int)param1); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytf513(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_wrapper_has_pointer)((FunctionWrapperIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * void *interrogate_wrapper_pointer(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07ytsqGH(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - (::interrogate_wrapper_pointer)((FunctionWrapperIndex)param0); - return Py_BuildValue(""); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_wrapper_unique_name(FunctionWrapperIndex wrapper) - */ -static PyObject * -_inP07yt7shV(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_wrapper_unique_name)((FunctionWrapperIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(char const *unique_name) - */ -static PyObject * -_inP07ytA1eF(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - FunctionWrapperIndex return_value = (::interrogate_get_wrapper_by_unique_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_make_seq_seq_name(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07yt776V(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_make_seq_seq_name)((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_make_seq_scoped_name(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07ytryup(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_make_seq_scoped_name)((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_make_seq_has_comment(ElementIndex element) - */ -static PyObject * -_inP07ytiytI(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_make_seq_has_comment)((ElementIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_make_seq_comment(ElementIndex element) - */ -static PyObject * -_inP07ytZc07(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_make_seq_comment)((ElementIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_make_seq_num_name(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07ytfaH0(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_make_seq_num_name)((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_make_seq_element_name(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07ytGB9D(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_make_seq_element_name)((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_make_seq_num_getter(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07ytrppS(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_make_seq_num_getter)((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_make_seq_element_getter(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07ytO50x(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_make_seq_element_getter)((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_number_of_global_types(void) - */ -static PyObject * -_inP07ytsxxs(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - int return_value = (::interrogate_number_of_global_types)(); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_get_global_type(int n) - */ -static PyObject * -_inP07ytMT0z(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_get_global_type)((int)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_number_of_types(void) - */ -static PyObject * -_inP07ytiW3v(PyObject *, PyObject *args) { - if (PyArg_ParseTuple(args, "")) { - int return_value = (::interrogate_number_of_types)(); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_get_type(int n) - */ -static PyObject * -_inP07yt4Px8(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_get_type)((int)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_get_type_by_name(char const *type_name) - */ -static PyObject * -_inP07ytNHcs(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - TypeIndex return_value = (::interrogate_get_type_by_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_get_type_by_scoped_name(char const *type_name) - */ -static PyObject * -_inP07ytqHrb(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - TypeIndex return_value = (::interrogate_get_type_by_scoped_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_get_type_by_true_name(char const *type_name) - */ -static PyObject * -_inP07ytaOqq(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - TypeIndex return_value = (::interrogate_get_type_by_true_name)((char const *)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_global(TypeIndex type) - */ -static PyObject * -_inP07ytpTBb(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_global)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_deprecated(TypeIndex type) - */ -static PyObject * -_inP07ytZUkn(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_deprecated)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_name(TypeIndex type) - */ -static PyObject * -_inP07ytqWOw(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_type_name)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_scoped_name(TypeIndex type) - */ -static PyObject * -_inP07ytHu7x(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_type_scoped_name)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_true_name(TypeIndex type) - */ -static PyObject * -_inP07ytwGnA(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_type_true_name)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_nested(TypeIndex type) - */ -static PyObject * -_inP07ytXGxx(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_nested)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_type_outer_class(TypeIndex type) - */ -static PyObject * -_inP07ytj04Z(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_type_outer_class)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_has_comment(TypeIndex type) - */ -static PyObject * -_inP07ytEOv4(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_has_comment)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_comment(TypeIndex type) - */ -static PyObject * -_inP07ytpCqJ(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_type_comment)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_has_module_name(TypeIndex type) - */ -static PyObject * -_inP07yt_Pz3(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_has_module_name)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_module_name(TypeIndex type) - */ -static PyObject * -_inP07ytt_06(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_type_module_name)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_has_library_name(TypeIndex type) - */ -static PyObject * -_inP07ytmuPs(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_has_library_name)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_library_name(TypeIndex type) - */ -static PyObject * -_inP07ytvM8B(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = (::interrogate_type_library_name)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_atomic(TypeIndex type) - */ -static PyObject * -_inP07ytap97(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_atomic)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * AtomicToken interrogate_type_atomic_token(TypeIndex type) - */ -static PyObject * -_inP07yt0o8D(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - AtomicToken return_value = (::interrogate_type_atomic_token)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_unsigned(TypeIndex type) - */ -static PyObject * -_inP07ytOoQ2(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_unsigned)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_signed(TypeIndex type) - */ -static PyObject * -_inP07ytKuFh(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_signed)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_long(TypeIndex type) - */ -static PyObject * -_inP07yto5L6(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_long)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_longlong(TypeIndex type) - */ -static PyObject * -_inP07ytzgKK(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_longlong)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_short(TypeIndex type) - */ -static PyObject * -_inP07yt0FIF(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_short)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_wrapped(TypeIndex type) - */ -static PyObject * -_inP07ytZqvD(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_wrapped)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_pointer(TypeIndex type) - */ -static PyObject * -_inP07ytDyRd(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_pointer)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_const(TypeIndex type) - */ -static PyObject * -_inP07ytMnKa(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_const)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_typedef(TypeIndex type) - */ -static PyObject * -_inP07ytRtji(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_typedef)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_type_wrapped_type(TypeIndex type) - */ -static PyObject * -_inP07ytCnbQ(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = (::interrogate_type_wrapped_type)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_array(TypeIndex type) - */ -static PyObject * -_inP07ytoxqc(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_array)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_array_size(TypeIndex type) - */ -static PyObject * -_inP07ytZQIS(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_array_size)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_enum(TypeIndex type) - */ -static PyObject * -_inP07ytdUVN(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_enum)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_scoped_enum(TypeIndex type) - */ -static PyObject * -_inP07ytZtNk(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_scoped_enum)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_enum_values(TypeIndex type) - */ -static PyObject * -_inP07ytihbt(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_enum_values)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_enum_value_name(TypeIndex type, int n) - */ -static PyObject * -_inP07ytbyPY(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = (::interrogate_type_enum_value_name)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_enum_value_scoped_name(TypeIndex type, int n) - */ -static PyObject * -_inP07ytAaT6(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = (::interrogate_type_enum_value_scoped_name)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * char const *interrogate_type_enum_value_comment(TypeIndex type, int n) - */ -static PyObject * -_inP07ytgL9q(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = (::interrogate_type_enum_value_comment)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(return_value); -#else - return PyString_FromString(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_enum_value(TypeIndex type, int n) - */ -static PyObject * -_inP07ytWB97(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = (::interrogate_type_enum_value)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_struct(TypeIndex type) - */ -static PyObject * -_inP07ytDUAl(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_struct)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_class(TypeIndex type) - */ -static PyObject * -_inP07yt1_Kf(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_class)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_union(TypeIndex type) - */ -static PyObject * -_inP07yt98lD(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_union)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_fully_defined(TypeIndex type) - */ -static PyObject * -_inP07yt9SHr(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_fully_defined)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_unpublished(TypeIndex type) - */ -static PyObject * -_inP07ytdiZP(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_unpublished)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_constructors(TypeIndex type) - */ -static PyObject * -_inP07ytTdER(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_constructors)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_type_get_constructor(TypeIndex type, int n) - */ -static PyObject * -_inP07ytYO56(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionIndex return_value = (::interrogate_type_get_constructor)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_has_destructor(TypeIndex type) - */ -static PyObject * -_inP07ytxtCG(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_has_destructor)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_destructor_is_inherited(TypeIndex type) - */ -static PyObject * -_inP07yt_EB2(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_destructor_is_inherited)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_type_get_destructor(TypeIndex type) - */ -static PyObject * -_inP07ytEG1l(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - FunctionIndex return_value = (::interrogate_type_get_destructor)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_elements(TypeIndex type) - */ -static PyObject * -_inP07yt7tUq(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_elements)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * ElementIndex interrogate_type_get_element(TypeIndex type, int n) - */ -static PyObject * -_inP07ytyStU(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - ElementIndex return_value = (::interrogate_type_get_element)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_methods(TypeIndex type) - */ -static PyObject * -_inP07ytdM85(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_methods)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_type_get_method(TypeIndex type, int n) - */ -static PyObject * -_inP07ytk_GN(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionIndex return_value = (::interrogate_type_get_method)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_make_seqs(TypeIndex type) - */ -static PyObject * -_inP07yt8QjG(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_make_seqs)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * MakeSeqIndex interrogate_type_get_make_seq(TypeIndex type, int n) - */ -static PyObject * -_inP07ytyMtj(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - MakeSeqIndex return_value = (::interrogate_type_get_make_seq)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_casts(TypeIndex type) - */ -static PyObject * -_inP07ytHDtN(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_casts)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_type_get_cast(TypeIndex type, int n) - */ -static PyObject * -_inP07ytHFjA(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionIndex return_value = (::interrogate_type_get_cast)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_derivations(TypeIndex type) - */ -static PyObject * -_inP07yt_NPR(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_derivations)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_type_get_derivation(TypeIndex type, int n) - */ -static PyObject * -_inP07ytcTOH(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - TypeIndex return_value = (::interrogate_type_get_derivation)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_is_final(TypeIndex type) - */ -static PyObject * -_inP07ytC5Uk(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = (::interrogate_type_is_final)((TypeIndex)param0); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_derivation_has_upcast(TypeIndex type, int n) - */ -static PyObject * -_inP07ythdU7(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = (::interrogate_type_derivation_has_upcast)((TypeIndex)param0, (int)param1); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_type_get_upcast(TypeIndex type, int n) - */ -static PyObject * -_inP07ytQPxU(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionIndex return_value = (::interrogate_type_get_upcast)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_derivation_downcast_is_impossible(TypeIndex type, int n) - */ -static PyObject * -_inP07ytO7Pz(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = (::interrogate_type_derivation_downcast_is_impossible)((TypeIndex)param0, (int)param1); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * bool interrogate_type_derivation_has_downcast(TypeIndex type, int n) - */ -static PyObject * -_inP07ytvu_E(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = (::interrogate_type_derivation_has_downcast)((TypeIndex)param0, (int)param1); - return PyBool_FromLong(return_value); - } - return nullptr; -} - -/* - * Python simple wrapper for - * FunctionIndex interrogate_type_get_downcast(TypeIndex type, int n) - */ -static PyObject * -_inP07ytxGUt(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - FunctionIndex return_value = (::interrogate_type_get_downcast)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * int interrogate_type_number_of_nested_types(TypeIndex type) - */ -static PyObject * -_inP07ytzM1P(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = (::interrogate_type_number_of_nested_types)((TypeIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * TypeIndex interrogate_type_get_nested_type(TypeIndex type, int n) - */ -static PyObject * -_inP07ytoY5L(PyObject *, PyObject *args) { - int param0; - int param1; - if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - TypeIndex return_value = (::interrogate_type_get_nested_type)((TypeIndex)param0, (int)param1); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return nullptr; -} - -/* - * Python simple wrapper for - * void interrogate_request_database(char const *database_filename) - */ -static PyObject * -_inP07yte_7S(PyObject *, PyObject *args) { - char *param0; - if (PyArg_ParseTuple(args, "s", ¶m0)) { - (::interrogate_request_database)((char const *)param0); - return Py_BuildValue(""); - } - return nullptr; -} - -/* - * Python simple wrapper for - * void interrogate_request_module(InterrogateModuleDef *def) - */ -static PyObject * -_inP07ytw_15(PyObject *, PyObject *args) { - Py_ssize_t param0; - if (PyArg_ParseTuple(args, "n", ¶m0)) { - (::interrogate_request_module)((InterrogateModuleDef *)param0); - return Py_BuildValue(""); - } - return nullptr; -} - - -static PyMethodDef python_simple_funcs[] = { - { "interrogate_add_search_directory", &_inP07yttbRf, METH_VARARGS, nullptr }, - { "interrogate_add_search_path", &_inP07ytda_g, METH_VARARGS, nullptr }, - { "interrogate_error_flag", &_inP07yt4RgX, METH_VARARGS, nullptr }, - { "interrogate_number_of_manifests", &_inP07yt3Gip, METH_VARARGS, nullptr }, - { "interrogate_get_manifest", &_inP07ytRKDz, METH_VARARGS, nullptr }, - { "interrogate_get_manifest_by_name", &_inP07ytgZ9N, METH_VARARGS, nullptr }, - { "interrogate_manifest_name", &_inP07ytFnRZ, METH_VARARGS, nullptr }, - { "interrogate_manifest_definition", &_inP07ytg0Qv, METH_VARARGS, nullptr }, - { "interrogate_manifest_has_type", &_inP07yttrqw, METH_VARARGS, nullptr }, - { "interrogate_manifest_get_type", &_inP07ytdmpW, METH_VARARGS, nullptr }, - { "interrogate_manifest_has_getter", &_inP07ytUYgQ, METH_VARARGS, nullptr }, - { "interrogate_manifest_getter", &_inP07yt0k7F, METH_VARARGS, nullptr }, - { "interrogate_manifest_has_int_value", &_inP07ytfIsr, METH_VARARGS, nullptr }, - { "interrogate_manifest_get_int_value", &_inP07ytvysR, METH_VARARGS, nullptr }, - { "interrogate_element_name", &_inP07ytYQ_2, METH_VARARGS, nullptr }, - { "interrogate_element_scoped_name", &_inP07yt3kdv, METH_VARARGS, nullptr }, - { "interrogate_element_has_comment", &_inP07ytew01, METH_VARARGS, nullptr }, - { "interrogate_element_comment", &_inP07ytQna7, METH_VARARGS, nullptr }, - { "interrogate_get_element_by_name", &_inP07ytkg95, METH_VARARGS, nullptr }, - { "interrogate_get_element_by_scoped_name", &_inP07ytluRc, METH_VARARGS, nullptr }, - { "interrogate_element_type", &_inP07yttHdM, METH_VARARGS, nullptr }, - { "interrogate_element_has_getter", &_inP07ytDId0, METH_VARARGS, nullptr }, - { "interrogate_element_getter", &_inP07ytHuAm, METH_VARARGS, nullptr }, - { "interrogate_element_has_setter", &_inP07yt_xr0, METH_VARARGS, nullptr }, - { "interrogate_element_setter", &_inP07ytH5qp, METH_VARARGS, nullptr }, - { "interrogate_element_has_has_function", &_inP07ytLfJw, METH_VARARGS, nullptr }, - { "interrogate_element_has_function", &_inP07yt_Atg, METH_VARARGS, nullptr }, - { "interrogate_element_has_clear_function", &_inP07ytlBqc, METH_VARARGS, nullptr }, - { "interrogate_element_clear_function", &_inP07ytNdUp, METH_VARARGS, nullptr }, - { "interrogate_element_has_del_function", &_inP07ytlS0p, METH_VARARGS, nullptr }, - { "interrogate_element_del_function", &_inP07ytZZe7, METH_VARARGS, nullptr }, - { "interrogate_element_has_insert_function", &_inP07ytV5S_, METH_VARARGS, nullptr }, - { "interrogate_element_insert_function", &_inP07yto9vD, METH_VARARGS, nullptr }, - { "interrogate_element_has_getkey_function", &_inP07ytv7tF, METH_VARARGS, nullptr }, - { "interrogate_element_getkey_function", &_inP07ythOg6, METH_VARARGS, nullptr }, - { "interrogate_element_length_function", &_inP07ytoZUn, METH_VARARGS, nullptr }, - { "interrogate_element_is_sequence", &_inP07ytq45U, METH_VARARGS, nullptr }, - { "interrogate_element_is_mapping", &_inP07yt6IPa, METH_VARARGS, nullptr }, - { "interrogate_number_of_globals", &_inP07ytU2_B, METH_VARARGS, nullptr }, - { "interrogate_get_global", &_inP07ytHFO2, METH_VARARGS, nullptr }, - { "interrogate_number_of_global_functions", &_inP07ytcfjm, METH_VARARGS, nullptr }, - { "interrogate_get_global_function", &_inP07yt3Sjw, METH_VARARGS, nullptr }, - { "interrogate_number_of_functions", &_inP07ytgJcX, METH_VARARGS, nullptr }, - { "interrogate_get_function", &_inP07ytYlw6, METH_VARARGS, nullptr }, - { "interrogate_function_name", &_inP07ytsmnz, METH_VARARGS, nullptr }, - { "interrogate_function_scoped_name", &_inP07ytxQ10, METH_VARARGS, nullptr }, - { "interrogate_function_has_comment", &_inP07yt6gPB, METH_VARARGS, nullptr }, - { "interrogate_function_comment", &_inP07ytISgV, METH_VARARGS, nullptr }, - { "interrogate_function_prototype", &_inP07ytH3bx, METH_VARARGS, nullptr }, - { "interrogate_function_is_method", &_inP07ytzeUk, METH_VARARGS, nullptr }, - { "interrogate_function_class", &_inP07ytUeI5, METH_VARARGS, nullptr }, - { "interrogate_function_is_unary_op", &_inP07ytbmxJ, METH_VARARGS, nullptr }, - { "interrogate_function_is_operator_typecast", &_inP07ytY8Lc, METH_VARARGS, nullptr }, - { "interrogate_function_is_constructor", &_inP07ytJAAI, METH_VARARGS, nullptr }, - { "interrogate_function_is_destructor", &_inP07yt0UXw, METH_VARARGS, nullptr }, - { "interrogate_function_has_module_name", &_inP07ytuSvx, METH_VARARGS, nullptr }, - { "interrogate_function_module_name", &_inP07ytwpYd, METH_VARARGS, nullptr }, - { "interrogate_function_has_library_name", &_inP07ytOfNh, METH_VARARGS, nullptr }, - { "interrogate_function_library_name", &_inP07ytf5_U, METH_VARARGS, nullptr }, - { "interrogate_function_is_virtual", &_inP07ytL3ZB, METH_VARARGS, nullptr }, - { "interrogate_function_number_of_c_wrappers", &_inP07ytXw0I, METH_VARARGS, nullptr }, - { "interrogate_function_c_wrapper", &_inP07yt3zru, METH_VARARGS, nullptr }, - { "interrogate_function_number_of_python_wrappers", &_inP07ytRrg2, METH_VARARGS, nullptr }, - { "interrogate_function_python_wrapper", &_inP07ytEJCx, METH_VARARGS, nullptr }, - { "interrogate_wrapper_name", &_inP07ytWAZr, METH_VARARGS, nullptr }, - { "interrogate_wrapper_function", &_inP07ytHQi6, METH_VARARGS, nullptr }, - { "interrogate_wrapper_is_callable_by_name", &_inP07ytrD_M, METH_VARARGS, nullptr }, - { "interrogate_wrapper_is_copy_constructor", &_inP07ytYaah, METH_VARARGS, nullptr }, - { "interrogate_wrapper_is_coerce_constructor", &_inP07yt2otr, METH_VARARGS, nullptr }, - { "interrogate_wrapper_is_extension", &_inP07ytNP_b, METH_VARARGS, nullptr }, - { "interrogate_wrapper_is_deprecated", &_inP07ytrrrN, METH_VARARGS, nullptr }, - { "interrogate_wrapper_has_comment", &_inP07ytjolz, METH_VARARGS, nullptr }, - { "interrogate_wrapper_comment", &_inP07ytt_JD, METH_VARARGS, nullptr }, - { "interrogate_wrapper_has_return_value", &_inP07ytwEts, METH_VARARGS, nullptr }, - { "interrogate_wrapper_return_type", &_inP07ytrJWs, METH_VARARGS, nullptr }, - { "interrogate_wrapper_caller_manages_return_value", &_inP07ytpmFD, METH_VARARGS, nullptr }, - { "interrogate_wrapper_return_value_destructor", &_inP07ytyYUX, METH_VARARGS, nullptr }, - { "interrogate_wrapper_number_of_parameters", &_inP07yt54dn, METH_VARARGS, nullptr }, - { "interrogate_wrapper_parameter_type", &_inP07ytGMpW, METH_VARARGS, nullptr }, - { "interrogate_wrapper_parameter_has_name", &_inP07ytNuBV, METH_VARARGS, nullptr }, - { "interrogate_wrapper_parameter_name", &_inP07yt9UwA, METH_VARARGS, nullptr }, - { "interrogate_wrapper_parameter_is_this", &_inP07yt3FDt, METH_VARARGS, nullptr }, - { "interrogate_wrapper_parameter_is_optional", &_inP07ytDgOY, METH_VARARGS, nullptr }, - { "interrogate_wrapper_has_pointer", &_inP07ytf513, METH_VARARGS, nullptr }, - { "interrogate_wrapper_pointer", &_inP07ytsqGH, METH_VARARGS, nullptr }, - { "interrogate_wrapper_unique_name", &_inP07yt7shV, METH_VARARGS, nullptr }, - { "interrogate_get_wrapper_by_unique_name", &_inP07ytA1eF, METH_VARARGS, nullptr }, - { "interrogate_make_seq_seq_name", &_inP07yt776V, METH_VARARGS, nullptr }, - { "interrogate_make_seq_scoped_name", &_inP07ytryup, METH_VARARGS, nullptr }, - { "interrogate_make_seq_has_comment", &_inP07ytiytI, METH_VARARGS, nullptr }, - { "interrogate_make_seq_comment", &_inP07ytZc07, METH_VARARGS, nullptr }, - { "interrogate_make_seq_num_name", &_inP07ytfaH0, METH_VARARGS, nullptr }, - { "interrogate_make_seq_element_name", &_inP07ytGB9D, METH_VARARGS, nullptr }, - { "interrogate_make_seq_num_getter", &_inP07ytrppS, METH_VARARGS, nullptr }, - { "interrogate_make_seq_element_getter", &_inP07ytO50x, METH_VARARGS, nullptr }, - { "interrogate_number_of_global_types", &_inP07ytsxxs, METH_VARARGS, nullptr }, - { "interrogate_get_global_type", &_inP07ytMT0z, METH_VARARGS, nullptr }, - { "interrogate_number_of_types", &_inP07ytiW3v, METH_VARARGS, nullptr }, - { "interrogate_get_type", &_inP07yt4Px8, METH_VARARGS, nullptr }, - { "interrogate_get_type_by_name", &_inP07ytNHcs, METH_VARARGS, nullptr }, - { "interrogate_get_type_by_scoped_name", &_inP07ytqHrb, METH_VARARGS, nullptr }, - { "interrogate_get_type_by_true_name", &_inP07ytaOqq, METH_VARARGS, nullptr }, - { "interrogate_type_is_global", &_inP07ytpTBb, METH_VARARGS, nullptr }, - { "interrogate_type_is_deprecated", &_inP07ytZUkn, METH_VARARGS, nullptr }, - { "interrogate_type_name", &_inP07ytqWOw, METH_VARARGS, nullptr }, - { "interrogate_type_scoped_name", &_inP07ytHu7x, METH_VARARGS, nullptr }, - { "interrogate_type_true_name", &_inP07ytwGnA, METH_VARARGS, nullptr }, - { "interrogate_type_is_nested", &_inP07ytXGxx, METH_VARARGS, nullptr }, - { "interrogate_type_outer_class", &_inP07ytj04Z, METH_VARARGS, nullptr }, - { "interrogate_type_has_comment", &_inP07ytEOv4, METH_VARARGS, nullptr }, - { "interrogate_type_comment", &_inP07ytpCqJ, METH_VARARGS, nullptr }, - { "interrogate_type_has_module_name", &_inP07yt_Pz3, METH_VARARGS, nullptr }, - { "interrogate_type_module_name", &_inP07ytt_06, METH_VARARGS, nullptr }, - { "interrogate_type_has_library_name", &_inP07ytmuPs, METH_VARARGS, nullptr }, - { "interrogate_type_library_name", &_inP07ytvM8B, METH_VARARGS, nullptr }, - { "interrogate_type_is_atomic", &_inP07ytap97, METH_VARARGS, nullptr }, - { "interrogate_type_atomic_token", &_inP07yt0o8D, METH_VARARGS, nullptr }, - { "interrogate_type_is_unsigned", &_inP07ytOoQ2, METH_VARARGS, nullptr }, - { "interrogate_type_is_signed", &_inP07ytKuFh, METH_VARARGS, nullptr }, - { "interrogate_type_is_long", &_inP07yto5L6, METH_VARARGS, nullptr }, - { "interrogate_type_is_longlong", &_inP07ytzgKK, METH_VARARGS, nullptr }, - { "interrogate_type_is_short", &_inP07yt0FIF, METH_VARARGS, nullptr }, - { "interrogate_type_is_wrapped", &_inP07ytZqvD, METH_VARARGS, nullptr }, - { "interrogate_type_is_pointer", &_inP07ytDyRd, METH_VARARGS, nullptr }, - { "interrogate_type_is_const", &_inP07ytMnKa, METH_VARARGS, nullptr }, - { "interrogate_type_is_typedef", &_inP07ytRtji, METH_VARARGS, nullptr }, - { "interrogate_type_wrapped_type", &_inP07ytCnbQ, METH_VARARGS, nullptr }, - { "interrogate_type_is_array", &_inP07ytoxqc, METH_VARARGS, nullptr }, - { "interrogate_type_array_size", &_inP07ytZQIS, METH_VARARGS, nullptr }, - { "interrogate_type_is_enum", &_inP07ytdUVN, METH_VARARGS, nullptr }, - { "interrogate_type_is_scoped_enum", &_inP07ytZtNk, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_enum_values", &_inP07ytihbt, METH_VARARGS, nullptr }, - { "interrogate_type_enum_value_name", &_inP07ytbyPY, METH_VARARGS, nullptr }, - { "interrogate_type_enum_value_scoped_name", &_inP07ytAaT6, METH_VARARGS, nullptr }, - { "interrogate_type_enum_value_comment", &_inP07ytgL9q, METH_VARARGS, nullptr }, - { "interrogate_type_enum_value", &_inP07ytWB97, METH_VARARGS, nullptr }, - { "interrogate_type_is_struct", &_inP07ytDUAl, METH_VARARGS, nullptr }, - { "interrogate_type_is_class", &_inP07yt1_Kf, METH_VARARGS, nullptr }, - { "interrogate_type_is_union", &_inP07yt98lD, METH_VARARGS, nullptr }, - { "interrogate_type_is_fully_defined", &_inP07yt9SHr, METH_VARARGS, nullptr }, - { "interrogate_type_is_unpublished", &_inP07ytdiZP, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_constructors", &_inP07ytTdER, METH_VARARGS, nullptr }, - { "interrogate_type_get_constructor", &_inP07ytYO56, METH_VARARGS, nullptr }, - { "interrogate_type_has_destructor", &_inP07ytxtCG, METH_VARARGS, nullptr }, - { "interrogate_type_destructor_is_inherited", &_inP07yt_EB2, METH_VARARGS, nullptr }, - { "interrogate_type_get_destructor", &_inP07ytEG1l, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_elements", &_inP07yt7tUq, METH_VARARGS, nullptr }, - { "interrogate_type_get_element", &_inP07ytyStU, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_methods", &_inP07ytdM85, METH_VARARGS, nullptr }, - { "interrogate_type_get_method", &_inP07ytk_GN, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_make_seqs", &_inP07yt8QjG, METH_VARARGS, nullptr }, - { "interrogate_type_get_make_seq", &_inP07ytyMtj, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_casts", &_inP07ytHDtN, METH_VARARGS, nullptr }, - { "interrogate_type_get_cast", &_inP07ytHFjA, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_derivations", &_inP07yt_NPR, METH_VARARGS, nullptr }, - { "interrogate_type_get_derivation", &_inP07ytcTOH, METH_VARARGS, nullptr }, - { "interrogate_type_is_final", &_inP07ytC5Uk, METH_VARARGS, nullptr }, - { "interrogate_type_derivation_has_upcast", &_inP07ythdU7, METH_VARARGS, nullptr }, - { "interrogate_type_get_upcast", &_inP07ytQPxU, METH_VARARGS, nullptr }, - { "interrogate_type_derivation_downcast_is_impossible", &_inP07ytO7Pz, METH_VARARGS, nullptr }, - { "interrogate_type_derivation_has_downcast", &_inP07ytvu_E, METH_VARARGS, nullptr }, - { "interrogate_type_get_downcast", &_inP07ytxGUt, METH_VARARGS, nullptr }, - { "interrogate_type_number_of_nested_types", &_inP07ytzM1P, METH_VARARGS, nullptr }, - { "interrogate_type_get_nested_type", &_inP07ytoY5L, METH_VARARGS, nullptr }, - { "interrogate_request_database", &_inP07yte_7S, METH_VARARGS, nullptr }, - { "interrogate_request_module", &_inP07ytw_15, METH_VARARGS, nullptr }, - { nullptr, nullptr, 0, nullptr } -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef python_simple_module = { - PyModuleDef_HEAD_INIT, - "panda3d.interrogatedb", - nullptr, - -1, - python_simple_funcs, - nullptr, nullptr, nullptr, nullptr -}; - -#define INIT_FUNC PyObject *PyInit_interrogatedb -#else -#define INIT_FUNC void initinterrogatedb -#endif - -#ifdef _WIN32 -extern "C" __declspec(dllexport) INIT_FUNC(); -#elif __GNUC__ >= 4 -extern "C" __attribute__((visibility("default"))) INIT_FUNC(); -#else -extern "C" INIT_FUNC(); -#endif - -INIT_FUNC() { -#if PY_MAJOR_VERSION >= 3 - return PyModule_Create(&python_simple_module); -#else - Py_InitModule("interrogatedb", python_simple_funcs); -#endif -} - diff --git a/dtool/src/dtoolbase/CMakeLists.txt b/dtool/src/dtoolbase/CMakeLists.txt index 7e9340ec71..d62f879029 100644 --- a/dtool/src/dtoolbase/CMakeLists.txt +++ b/dtool/src/dtoolbase/CMakeLists.txt @@ -24,6 +24,7 @@ set(P3DTOOLBASE_HEADERS deletedChain.h deletedChain.I dtoolbase.h dtoolbase_cc.h dtoolsymbols.h dtool_platform.h + extension.h fakestringstream.h indent.I indent.h memoryBase.h diff --git a/dtool/src/interrogatedb/extension.h b/dtool/src/dtoolbase/extension.h similarity index 100% rename from dtool/src/interrogatedb/extension.h rename to dtool/src/dtoolbase/extension.h diff --git a/dtool/src/interrogatedb/CMakeLists.txt b/dtool/src/interrogatedb/CMakeLists.txt index 4004680279..f137a7b802 100644 --- a/dtool/src/interrogatedb/CMakeLists.txt +++ b/dtool/src/interrogatedb/CMakeLists.txt @@ -1,76 +1,8 @@ -set(P3INTERROGATEDB_HEADERS - config_interrogatedb.h indexRemapper.h interrogateComponent.I - interrogateComponent.h interrogateDatabase.I - interrogateDatabase.h interrogateElement.I - interrogateElement.h interrogateFunction.I - interrogateFunction.h interrogateFunctionWrapper.I - interrogateFunctionWrapper.h - interrogateMakeSeq.I interrogateMakeSeq.h - interrogateManifest.I interrogateManifest.h - interrogateType.I interrogateType.h - interrogate_datafile.I interrogate_datafile.h - interrogate_interface.h interrogate_request.h -) - -set(P3INTERROGATEDB_SOURCES - config_interrogatedb.cxx - indexRemapper.cxx - interrogateComponent.cxx interrogateDatabase.cxx - interrogateElement.cxx interrogateFunction.cxx - interrogateFunctionWrapper.cxx - interrogateMakeSeq.cxx - interrogateManifest.cxx - interrogateType.cxx interrogate_datafile.cxx - interrogate_interface.cxx interrogate_request.cxx -) - -set(P3INTERROGATEDB_IGATE - interrogate_interface.h - interrogate_request.h -) - set(P3IGATERUNTIME_HEADERS - extension.h py_compat.h py_panda.h py_panda.I py_wrappers.h + interrogate_request.h + py_compat.h + py_panda.h py_panda.I + py_wrappers.h ) -composite_sources(p3interrogatedb P3INTERROGATEDB_SOURCES) -add_library(p3interrogatedb - ${P3INTERROGATEDB_HEADERS} ${P3INTERROGATEDB_SOURCES}) -set_target_properties(p3interrogatedb PROPERTIES DEFINE_SYMBOL BUILDING_INTERROGATEDB) -target_link_libraries(p3interrogatedb p3dconfig p3prc) - -install(TARGETS p3interrogatedb - EXPORT Core COMPONENT Core - DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d - ARCHIVE COMPONENT CoreDevel) -install(FILES ${P3INTERROGATEDB_HEADERS} COMPONENT CoreDevel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d) install(FILES ${P3IGATERUNTIME_HEADERS} COMPONENT CoreDevel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d) - -# ALSO: This has an Interrogate binding! Take care of that if we want it. -# Note we don't use the regular Interrogate macros; this has some custom flags -# that would make it not worthwhile. - -if(NOT INTERROGATE_PYTHON_INTERFACE) - return() -endif() - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/interrogatedb_module.cxx" - COMMAND interrogate - -D EXPCL_INTERROGATEDB= - -nodb -python -promiscuous - -module panda3d.interrogatedb - -library interrogatedb - -string -true-names -do-module - -srcdir "${CMAKE_CURRENT_SOURCE_DIR}" - -oc "${CMAKE_CURRENT_BINARY_DIR}/interrogatedb_module.cxx" - ${P3INTERROGATEDB_IGATE} - - DEPENDS interrogate ${P3INTERROGATEDB_IGATE} - COMMENT "Interrogating interrogatedb") - -add_python_target(panda3d.interrogatedb - "${CMAKE_CURRENT_BINARY_DIR}/interrogatedb_module.cxx") -target_link_libraries(panda3d.interrogatedb p3interrogatedb) diff --git a/dtool/src/interrogatedb/config_interrogatedb.cxx b/dtool/src/interrogatedb/config_interrogatedb.cxx deleted file mode 100644 index 16986de56b..0000000000 --- a/dtool/src/interrogatedb/config_interrogatedb.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file config_interrogatedb.cxx - * @author drose - * @date 2000-08-01 - */ - -#include "config_interrogatedb.h" -#include "interrogate_request.h" -#include "configVariableBool.h" -#include "configVariableSearchPath.h" -#include "dconfig.h" - -#if defined(_MSC_VER) && defined(_DEBUG) -// _DEBUG assumes you are linking to msvcrt70d.dll, not msvcrt70.dll -#define USE_WIN32_DBGHEAP -#include -#endif - -Configure(config_interrogatedb); -NotifyCategoryDef(interrogatedb, ""); - -ConfigureFn(config_interrogatedb) { - // interrogate_request_library("types"); - -#ifdef USE_WIN32_DBGHEAP - ConfigVariableBool use_win32_dbgheap("use-win32-dbgheap", false); - ConfigVariableBool win32_report_leaks("win32-report-leaks", false); - - int dbg_flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - - if (use_win32_dbgheap.get_string_value() == "full") { - // "full" means check the heap after *every* allocdealloc. Expensive. - dbg_flags |= (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | - _CRTDBG_CHECK_CRT_DF); - - } else { - // Otherwise, it's a bool flag. true means check the heap normally, false - // means don't do any debug checking. - if (!use_win32_dbgheap) { - // deflt disable complete heap verify every 1024 allocations (VC7 - // deflt). With vc7 stl small-string-optimization causing more allocs, - // this can cause order-of-magnitude slowdowns in dbg builds - dbg_flags = 0; - } - } - - if (win32_report_leaks) { - // Report memory still allocated at program termination. Not sure how - // useful this is, as many things get allocated once and never freed, but - // they aren't really leaks. - dbg_flags |= _CRTDBG_LEAK_CHECK_DF; - } - - _CrtSetDbgFlag(dbg_flags); -#endif -} - -ConfigVariableSearchPath interrogatedb_path -("interrogatedb-path", "The search path for interrogate's *.in files."); diff --git a/dtool/src/interrogatedb/config_interrogatedb.h b/dtool/src/interrogatedb/config_interrogatedb.h deleted file mode 100644 index 1a99702d0e..0000000000 --- a/dtool/src/interrogatedb/config_interrogatedb.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file config_interrogatedb.h - * @author drose - * @date 2000-08-01 - */ - -#ifndef CONFIG_INTERROGATEDB_H -#define CONFIG_INTERROGATEDB_H - -#include "dtoolbase.h" -#include "notifyCategoryProxy.h" -#include "configVariableSearchPath.h" - -NotifyCategoryDecl(interrogatedb, EXPCL_INTERROGATEDB, EXPTP_INTERROGATEDB); - -extern ConfigVariableSearchPath interrogatedb_path; - -#endif diff --git a/dtool/src/interrogatedb/dtool_super_base.cxx b/dtool/src/interrogatedb/dtool_super_base.cxx deleted file mode 100644 index c42b39c823..0000000000 --- a/dtool/src/interrogatedb/dtool_super_base.cxx +++ /dev/null @@ -1,177 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file dtool_super_base.cxx - * @author drose - * @date 2005-07-04 - */ - -#include "py_panda.h" - -#ifdef HAVE_PYTHON - -static PyMemberDef standard_type_members[] = { - {(char *)"this", (sizeof(void*) == sizeof(int)) ? T_UINT : T_ULONGLONG, offsetof(Dtool_PyInstDef, _ptr_to_object), READONLY, (char *)"C++ 'this' pointer, if any"}, - {(char *)"this_ownership", T_BOOL, offsetof(Dtool_PyInstDef, _memory_rules), READONLY, (char *)"C++ 'this' ownership rules"}, - {(char *)"this_const", T_BOOL, offsetof(Dtool_PyInstDef, _is_const), READONLY, (char *)"C++ 'this' const flag"}, -// {(char *)"this_signature", T_INT, offsetof(Dtool_PyInstDef, _signature), -// READONLY, (char *)"A type check signature"}, - {(char *)"this_metatype", T_OBJECT_EX, offsetof(Dtool_PyInstDef, _My_Type), READONLY, (char *)"The dtool meta object"}, - {nullptr} /* Sentinel */ -}; - -static PyObject *GetSuperBase(PyObject *self) { - Dtool_PyTypedObject *super_base = Dtool_GetSuperBase(); - return Py_XNewRef((PyObject *)&super_base->_PyType); -}; - -static void Dtool_PyModuleClassInit_DTOOL_SUPER_BASE(PyObject *module) { - if (module != nullptr) { - Dtool_PyTypedObject *super_base = Dtool_GetSuperBase(); - PyModule_AddObjectRef(module, "DTOOL_SUPER_BASE", (PyObject *)&super_base->_PyType); - } -} - -static void *Dtool_UpcastInterface_DTOOL_SUPER_BASE(PyObject *self, Dtool_PyTypedObject *requested_type) { - return nullptr; -} - -static PyObject *Dtool_Wrap_DTOOL_SUPER_BASE(void *from_this, PyTypeObject *from_type) { - return nullptr; -} - -static int Dtool_Init_DTOOL_SUPER_BASE(PyObject *self, PyObject *args, PyObject *kwds) { - assert(self != nullptr); - PyErr_Format(PyExc_TypeError, "cannot init constant class %s", Py_TYPE(self)->tp_name); - return -1; -} - -static void Dtool_FreeInstance_DTOOL_SUPER_BASE(PyObject *self) { - Py_TYPE(self)->tp_free(self); -} - -/** - * Returns a pointer to the DTOOL_SUPER_BASE class that is the base class of - * all Panda types. This pointer is shared by all modules. - */ -Dtool_PyTypedObject *Dtool_GetSuperBase() { - Dtool_TypeMap *type_map = Dtool_GetGlobalTypeMap(); - - // If we don't have the GIL, we have to protect this with a lock to make - // sure that there is only one DTOOL_SUPER_BASE instance in the world. -#ifdef Py_GIL_DISABLED - PyMutex_Lock(&type_map->_lock); -#endif - - auto it = type_map->find("DTOOL_SUPER_BASE"); - if (it != type_map->end()) { -#ifdef Py_GIL_DISABLED - PyMutex_Unlock(&type_map->_lock); -#endif - return it->second; - } - - static PyMethodDef methods[] = { - { "DtoolGetSuperBase", (PyCFunction)&GetSuperBase, METH_NOARGS, "Will Return SUPERbase Class"}, - { nullptr, nullptr, 0, nullptr } - }; - - static Dtool_PyTypedObject super_base_type = { - { - PyVarObject_HEAD_INIT(nullptr, 0) - "dtoolconfig.DTOOL_SUPER_BASE", - sizeof(Dtool_PyInstDef), - 0, // tp_itemsize - &Dtool_FreeInstance_DTOOL_SUPER_BASE, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr -#if PY_MAJOR_VERSION >= 3 - nullptr, // tp_compare -#else - &DtoolInstance_ComparePointers, -#endif - nullptr, // tp_repr - nullptr, // tp_as_number - nullptr, // tp_as_sequence - nullptr, // tp_as_mapping - &DtoolInstance_HashPointer, - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES), - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear -#if PY_MAJOR_VERSION >= 3 - &DtoolInstance_RichComparePointers, -#else - nullptr, // tp_richcompare -#endif - 0, // tp_weaklistoffset - nullptr, // tp_iter - nullptr, // tp_iternext - methods, - standard_type_members, - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - Dtool_Init_DTOOL_SUPER_BASE, - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }, - TypeHandle::none(), - Dtool_PyModuleClassInit_DTOOL_SUPER_BASE, - Dtool_UpcastInterface_DTOOL_SUPER_BASE, - Dtool_Wrap_DTOOL_SUPER_BASE, - nullptr, - nullptr, - }; - - super_base_type._PyType.tp_dict = PyDict_New(); - PyDict_SetItemString(super_base_type._PyType.tp_dict, "DtoolClassDict", super_base_type._PyType.tp_dict); - - if (PyType_Ready((PyTypeObject *)&super_base_type) < 0) { - PyErr_SetString(PyExc_TypeError, "PyType_Ready(Dtool_DTOOL_SUPER_BASE)"); -#ifdef Py_GIL_DISABLED - PyMutex_Unlock(&type_map->_lock); -#endif - return nullptr; - } - Py_INCREF(&super_base_type._PyType); - - PyDict_SetItemString(super_base_type._PyType.tp_dict, "DtoolGetSuperBase", PyCFunction_New(&methods[0], (PyObject *)&super_base_type)); - - (*type_map)["DTOOL_SUPER_BASE"] = &super_base_type; -#ifdef Py_GIL_DISABLED - PyMutex_Unlock(&type_map->_lock); -#endif - return &super_base_type; -} - -#endif // HAVE_PYTHON diff --git a/dtool/src/interrogatedb/indexRemapper.cxx b/dtool/src/interrogatedb/indexRemapper.cxx deleted file mode 100644 index 7c606bec06..0000000000 --- a/dtool/src/interrogatedb/indexRemapper.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file indexRemapper.cxx - * @author drose - * @date 2000-08-05 - */ - -#include "indexRemapper.h" - - -/** - * - */ -IndexRemapper:: -IndexRemapper() { -} - -/** - * - */ -IndexRemapper:: -~IndexRemapper() { -} - -/** - * Removes all mappings from the object. - */ -void IndexRemapper:: -clear() { - _map_int.clear(); -} - -/** - * Adds a mapping from the integer 'from' to 'to'. - */ -void IndexRemapper:: -add_mapping(int from, int to) { - _map_int[from] = to; -} - -/** - * Returns true if the given 'from' integer has been assigned a mapping, false - * if it has not. - */ -bool IndexRemapper:: -in_map(int from) const { - return _map_int.count(from) != 0; -} - -/** - * Returns the integer that the given 'from' integer had been set to map to, - * or the same integer if nothing had been set for it. - */ -int IndexRemapper:: -map_from(int from) const { - std::map::const_iterator mi; - mi = _map_int.find(from); - if (mi == _map_int.end()) { - return from; - } - return (*mi).second; -} diff --git a/dtool/src/interrogatedb/indexRemapper.h b/dtool/src/interrogatedb/indexRemapper.h deleted file mode 100644 index c89a7a2988..0000000000 --- a/dtool/src/interrogatedb/indexRemapper.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file indexRemapper.h - * @author drose - * @date 2000-08-05 - */ - -#ifndef INDEXREMAPPER_H -#define INDEXREMAPPER_H - -#include "dtoolbase.h" - -#include - -/** - * This class manages a mapping of integers to integers. It's used in this - * package to resequence some or all of the index numbers in the database to a - * different sequence. - * - * This class is just a wrapper around STL map. The only reason it exists is - * because Microsoft can't export STL map outside of the DLL. - */ -class EXPCL_INTERROGATEDB IndexRemapper { -public: - IndexRemapper(); - ~IndexRemapper(); - - void clear(); - void add_mapping(int from, int to); - - bool in_map(int from) const; - int map_from(int from) const; - -private: - std::map _map_int; -}; - -#endif diff --git a/dtool/src/interrogatedb/interrogateComponent.I b/dtool/src/interrogatedb/interrogateComponent.I deleted file mode 100644 index dddbb421fb..0000000000 --- a/dtool/src/interrogatedb/interrogateComponent.I +++ /dev/null @@ -1,123 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateComponent.I - * @author drose - * @date 2000-08-08 - */ - -/** - * - */ -INLINE InterrogateComponent:: -InterrogateComponent(InterrogateModuleDef *def) : - _def(def) -{ -} - -/** - * - */ -INLINE InterrogateComponent:: -InterrogateComponent(const InterrogateComponent ©) : - _def(copy._def), - _name(copy._name) -{ -} - -/** - * - */ -INLINE void InterrogateComponent:: -operator = (const InterrogateComponent ©) { - _def = copy._def; - _name = copy._name; -} - -/** - * Returns true if we have a known library name, false if we do not. See - * get_library_name(). - */ -INLINE bool InterrogateComponent:: -has_library_name() const { - const char *name = get_library_name(); - return (name != nullptr && name[0] != '\0'); -} - -/** - * Returns the library name, if it is known, or NULL if it is not. This is - * the name of the library that this particular component was built into. - * Typically this will be a one-to-one correspondance with an invocation of - * the interrogate command. Typical examples are "libutil" and "liblinmath". - */ -INLINE const char *InterrogateComponent:: -get_library_name() const { - if (_def != nullptr) { - return _def->library_name; - } - return nullptr; -} - -/** - * Returns true if we have a known module name, false if we do not. See - * get_module_name(). - */ -INLINE bool InterrogateComponent:: -has_module_name() const { - const char *name = get_module_name(); - return (name != nullptr && name[0] != '\0'); -} - -/** - * Returns the module name, if it is known, or NULL if it is not. This is the - * name of the module that this particular component is associated with. This - * is a higher grouping than library. Typical examples are "panda" and - * "pandaegg". - */ -INLINE const char *InterrogateComponent:: -get_module_name() const { - if (_def != nullptr) { - return _def->module_name; - } - return nullptr; -} - -/** - * - */ -INLINE bool InterrogateComponent:: -has_name() const { - return !_name.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateComponent:: -get_name() const { - return _name; -} - -/** - * - */ -INLINE int InterrogateComponent:: -get_num_alt_names() const { - return _alt_names.size(); -} - -/** - * - */ -INLINE const std::string &InterrogateComponent:: -get_alt_name(int n) const { - if (n >= 0 && n < (int)_alt_names.size()) { - return _alt_names[n]; - } - return _empty_string; -} diff --git a/dtool/src/interrogatedb/interrogateComponent.cxx b/dtool/src/interrogatedb/interrogateComponent.cxx deleted file mode 100644 index 61398f686f..0000000000 --- a/dtool/src/interrogatedb/interrogateComponent.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateComponent.cxx - * @author drose - * @date 2000-08-08 - */ - -#include "interrogateComponent.h" -#include "interrogate_datafile.h" - -// This static string is just kept around as a handy bogus return value for -// functions that must return a const string reference. -std::string InterrogateComponent::_empty_string; - -/** - * Formats the component for output to a data file. - */ -void InterrogateComponent:: -output(std::ostream &out) const { - idf_output_string(out, _name); - out << _alt_names.size() << " "; - - Strings::const_iterator vi; - for (vi = _alt_names.begin(); vi != _alt_names.end(); ++vi) { - idf_output_string(out, *vi); - } -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateComponent:: -input(std::istream &in) { - idf_input_string(in, _name); - - int num_alt_names; - in >> num_alt_names; - _alt_names.reserve(num_alt_names); - for (int i = 0; i < num_alt_names; ++i) { - std::string alt_name; - idf_input_string(in, alt_name); - _alt_names.push_back(alt_name); - } -} diff --git a/dtool/src/interrogatedb/interrogateComponent.h b/dtool/src/interrogatedb/interrogateComponent.h deleted file mode 100644 index 2555769756..0000000000 --- a/dtool/src/interrogatedb/interrogateComponent.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateComponent.h - * @author drose - * @date 2000-08-08 - */ - -#ifndef INTERROGATECOMPONENT_H -#define INTERROGATECOMPONENT_H - -#include "dtoolbase.h" - -#include "interrogate_interface.h" -#include "interrogate_request.h" - -#include - -class IndexRemapper; - -/** - * The base class for things that are part of the interrogate database. This - * includes types, functions, and function wrappers. - */ -class EXPCL_INTERROGATEDB InterrogateComponent { -public: - INLINE InterrogateComponent(InterrogateModuleDef *def = nullptr); - INLINE InterrogateComponent(const InterrogateComponent ©); - INLINE void operator = (const InterrogateComponent ©); - - INLINE bool has_library_name() const; - INLINE const char *get_library_name() const; - - INLINE bool has_module_name() const; - INLINE const char *get_module_name() const; - - INLINE bool has_name() const; - INLINE const std::string &get_name() const; - - INLINE int get_num_alt_names() const; - INLINE const std::string &get_alt_name(int n) const; - - void output(std::ostream &out) const; - void input(std::istream &in); - -protected: - static std::string _empty_string; - -private: - InterrogateModuleDef *_def; - std::string _name; - - typedef std::vector Strings; - Strings _alt_names; - - friend class InterrogateBuilder; - friend class FunctionRemap; -}; - -#include "interrogateComponent.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateDatabase.I b/dtool/src/interrogatedb/interrogateDatabase.I deleted file mode 100644 index cf15d962bf..0000000000 --- a/dtool/src/interrogatedb/interrogateDatabase.I +++ /dev/null @@ -1,89 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateDatabase.I - * @author drose - * @date 2000-08-01 - */ - -/** - * Checks that all the latest data for all the libraries have been loaded. - * Loads them if not. - */ -INLINE void InterrogateDatabase:: -check_latest() { - if (!_requests.empty()) { - load_latest(); - } -} - -/** - * Returns the TypeIndex associated with the first type found with the given - * name, or 0 if no type has this name. - */ -INLINE TypeIndex InterrogateDatabase:: -lookup_type_by_name(const std::string &name) { - check_latest(); - return lookup(name, _types_by_name, LT_type_name, - &InterrogateDatabase::freshen_types_by_name); -} - -/** - * Returns the TypeIndex associated with the first type found with the given - * scoped name, or 0 if no type has this name. - */ -INLINE TypeIndex InterrogateDatabase:: -lookup_type_by_scoped_name(const std::string &name) { - check_latest(); - return lookup(name, _types_by_scoped_name, LT_type_scoped_name, - &InterrogateDatabase::freshen_types_by_scoped_name); -} - -/** - * Returns the TypeIndex associated with the first type found with the given - * true name, or 0 if no type has this name. - */ -INLINE TypeIndex InterrogateDatabase:: -lookup_type_by_true_name(const std::string &name) { - check_latest(); - return lookup(name, _types_by_true_name, LT_type_true_name, - &InterrogateDatabase::freshen_types_by_true_name); -} - -/** - * Returns the ManifestIndex associated with the first manifest found with the - * given name, or 0 if no manifest has this name. - */ -INLINE ManifestIndex InterrogateDatabase:: -lookup_manifest_by_name(const std::string &name) { - check_latest(); - return lookup(name, _manifests_by_name, LT_manifest_name, - &InterrogateDatabase::freshen_manifests_by_name); -} - -/** - * Returns the ElementIndex associated with the first element found with the - * given name, or 0 if no element has this name. - */ -INLINE ElementIndex InterrogateDatabase:: -lookup_element_by_name(const std::string &name) { - check_latest(); - return lookup(name, _elements_by_name, LT_element_name, - &InterrogateDatabase::freshen_elements_by_name); -} - -/** - * Returns the ElementIndex associated with the first element found with the - * given scoped name, or 0 if no element has this name. - */ -INLINE ElementIndex InterrogateDatabase:: -lookup_element_by_scoped_name(const std::string &name) { - check_latest(); - return lookup(name, _elements_by_scoped_name, LT_element_scoped_name, - &InterrogateDatabase::freshen_elements_by_scoped_name); -} diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx deleted file mode 100644 index afdb7a11f7..0000000000 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ /dev/null @@ -1,1330 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateDatabase.cxx - * @author drose - * @date 2000-08-01 - */ - -#include "interrogateDatabase.h" -#include "config_interrogatedb.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" - -using std::map; -using std::string; - -InterrogateDatabase *InterrogateDatabase::_global_ptr = nullptr; -int InterrogateDatabase::_file_major_version = 0; -int InterrogateDatabase::_file_minor_version = 0; -int InterrogateDatabase::_current_major_version = 3; -int InterrogateDatabase::_current_minor_version = 3; - -/** - * - */ -InterrogateDatabase:: -InterrogateDatabase() { - _error_flag = false; - _next_index = 1; - _lookups_fresh = 0; -} - -/** - * Returns the global pointer to the one InterrogateDatabase. - */ -InterrogateDatabase *InterrogateDatabase:: -get_ptr() { - if (_global_ptr == nullptr) { - if (interrogatedb_cat->is_debug()) { - interrogatedb_cat->debug() - << "Creating interrogate database\n"; - } - _global_ptr = new InterrogateDatabase; - } - return _global_ptr; -} - -/** - * Requests that the interrogate data for the given module be made available. - * The function pointers will be made available immediately, while the - * database file will be read later, the next time someone asks for - * interrogate data that requires it. - */ -void InterrogateDatabase:: -request_module(InterrogateModuleDef *def) { - if (interrogatedb_cat->is_debug()) { - if (def->library_name == nullptr) { - interrogatedb_cat->debug() - << "Got interrogate data for anonymous module\n"; - } else { - interrogatedb_cat->debug() - << "Got interrogate data for module " << def->library_name << "\n"; - } - } - - int num_indices = def->next_index - def->first_index; - if (num_indices > 0) { - // If the module def has any definitions--any index numbers used--assign - // it to its own unique range of index numbers. - def->first_index = _next_index; - _next_index += num_indices; - def->next_index = _next_index; - - // Assign a reference to the module def by index number. When we need to - // look up a function by its index number, we'll be able to use this. - _modules.push_back(def); - } - - if (def->num_unique_names > 0 && def->library_name != nullptr) { - // Define a lookup by hash for this module, mainly so we can look up - // functions by their unique names. - _modules_by_hash[def->library_hash_name] = def; - } - - if (def->database_filename != nullptr) { - _requests.push_back(def); - } -} - -/** - * Returns the global error flag. This will be set true if there was some - * problem importing the database (e.g. cannot find an .in file), or false if - * everything is ok. - */ -bool InterrogateDatabase:: -get_error_flag() { - return _error_flag; -} - -/** - * Returns the total number of "global" types known to the interrogate - * database. These are types defined at the global level that should be - * considered for exporting, but not the incidental types (like pointers, - * etc.) that must be defined to support these. - */ -int InterrogateDatabase:: -get_num_global_types() { - check_latest(); - return _global_types.size(); -} - -/** - * Returns the index of the nth global type known to the interrogate database. - */ -TypeIndex InterrogateDatabase:: -get_global_type(int n) { - check_latest(); - if (n >= 0 && n < (int)_global_types.size()) { - return _global_types[n]; - } - return 0; -} - -/** - * Returns the total number of types known to the interrogate database. This - * includes all known types, global as well as incidental. See also - * get_num_global_types(). - */ -int InterrogateDatabase:: -get_num_all_types() { - check_latest(); - return _all_types.size(); -} - -/** - * Returns the index of the nth type known to the interrogate database. - */ -TypeIndex InterrogateDatabase:: -get_all_type(int n) { - check_latest(); - if (n >= 0 && n < (int)_all_types.size()) { - return _all_types[n]; - } - return 0; -} - -/** - * Returns the total number of global functions known to the interrogate - * database. These are functions defined at the global level, e.g. non- - * member functions. - */ -int InterrogateDatabase:: -get_num_global_functions() { - check_latest(); - return _global_functions.size(); -} - -/** - * Returns the index of the nth global function known to the interrogate - * database. - */ -FunctionIndex InterrogateDatabase:: -get_global_function(int n) { - check_latest(); - if (n >= 0 && n < (int)_global_functions.size()) { - return _global_functions[n]; - } - return 0; -} - -/** - * Returns the total number of functions known to the interrogate database. - * This includes all known functions, global, method, or synthesized. See - * also get_num_global_functions(). - */ -int InterrogateDatabase:: -get_num_all_functions() { - check_latest(); - return _all_functions.size(); -} - -/** - * Returns the index of the nth function known to the interrogate database. - */ -FunctionIndex InterrogateDatabase:: -get_all_function(int n) { - check_latest(); - if (n >= 0 && n < (int)_all_functions.size()) { - return _all_functions[n]; - } - return 0; -} - -/** - * Returns the total number of global manifest constants known to the - * interrogate database. - */ -int InterrogateDatabase:: -get_num_global_manifests() { - check_latest(); - return _global_manifests.size(); -} - -/** - * Returns the index of the nth global manifest constant known to the - * interrogate database. - */ -ManifestIndex InterrogateDatabase:: -get_global_manifest(int n) { - check_latest(); - if (n >= 0 && n < (int)_global_manifests.size()) { - return _global_manifests[n]; - } - return 0; -} - -/** - * Returns the total number of global data elements known to the interrogate - * database. - */ -int InterrogateDatabase:: -get_num_global_elements() { - check_latest(); - return _global_elements.size(); -} - -/** - * Returns the index of the nth global data element known to the interrogate - * database. - */ -ElementIndex InterrogateDatabase:: -get_global_element(int n) { - check_latest(); - if (n >= 0 && n < (int)_global_elements.size()) { - return _global_elements[n]; - } - return 0; -} - -/** - * Returns the type associated with the given TypeIndex, if there is one. - */ -const InterrogateType &InterrogateDatabase:: -get_type(TypeIndex type) { - static InterrogateType bogus_type; - - check_latest(); - TypeMap::const_iterator ti; - ti = _type_map.find(type); - if (ti == _type_map.end()) { - return bogus_type; - } - return (*ti).second; -} - -/** - * Returns the function associated with the given FunctionIndex, if there is - * one. - */ -const InterrogateFunction &InterrogateDatabase:: -get_function(FunctionIndex function) { - static InterrogateFunction bogus_function; - - check_latest(); - FunctionMap::const_iterator fi; - fi = _function_map.find(function); - if (fi == _function_map.end()) { - return bogus_function; - } - return *(*fi).second; -} - -/** - * Returns the function wrapper associated with the given - * FunctionWrapperIndex, if there is one. - */ -const InterrogateFunctionWrapper &InterrogateDatabase:: -get_wrapper(FunctionWrapperIndex wrapper) { - static InterrogateFunctionWrapper bogus_wrapper; - - check_latest(); - FunctionWrapperMap::const_iterator wi; - wi = _wrapper_map.find(wrapper); - if (wi == _wrapper_map.end()) { - return bogus_wrapper; - } - return (*wi).second; -} - -/** - * Returns the manifest constant associated with the given ManifestIndex, if - * there is one. - */ -const InterrogateManifest &InterrogateDatabase:: -get_manifest(ManifestIndex manifest) { - static InterrogateManifest bogus_manifest; - - check_latest(); - ManifestMap::const_iterator mi; - mi = _manifest_map.find(manifest); - if (mi == _manifest_map.end()) { - return bogus_manifest; - } - return (*mi).second; -} - -/** - * Returns the data element associated with the given ElementIndex, if there - * is one. - */ -const InterrogateElement &InterrogateDatabase:: -get_element(ElementIndex element) { - static InterrogateElement bogus_element; - - check_latest(); - ElementMap::const_iterator ei; - ei = _element_map.find(element); - if (ei == _element_map.end()) { - return bogus_element; - } - return (*ei).second; -} - -/** - * Returns the make_seq associated with the given MakeSeqIndex, if there is - * one. - */ -const InterrogateMakeSeq &InterrogateDatabase:: -get_make_seq(MakeSeqIndex make_seq) { - static InterrogateMakeSeq bogus_make_seq; - - check_latest(); - MakeSeqMap::const_iterator si; - si = _make_seq_map.find(make_seq); - if (si == _make_seq_map.end()) { - return bogus_make_seq; - } - return (*si).second; -} - -/** - * Erases the type from the database. - */ -void InterrogateDatabase:: -remove_type(TypeIndex type) { - _type_map.erase(type); -} - -/** - * Returns the function pointer associated with the given function wrapper, if - * it has a pointer available. Returns NULL if the pointer is not available. - */ -void *InterrogateDatabase:: -get_fptr(FunctionWrapperIndex wrapper) { - InterrogateModuleDef *def; - int module_index; - if (find_module(wrapper, def, module_index)) { - if (module_index >= 0 && module_index < def->num_fptrs) { - return def->fptrs[module_index]; - } - } - return nullptr; -} - -/** - * Looks up the function wrapper corresponding to the given unique name, if - * available. Returns the corresponding wrapper index, or 0 if no such - * wrapper is found. - */ -FunctionWrapperIndex InterrogateDatabase:: -get_wrapper_by_unique_name(const string &unique_name) { - // First, split the unique_name into a library_hash_name and a - // wrapper_hash_name. - - // The first four characters are always the library_name. - string library_hash_name = unique_name.substr(0, 4); - string wrapper_hash_name = unique_name.substr(4); - - // Is the library_name defined? - ModulesByHash::const_iterator mi; - mi = _modules_by_hash.find(library_hash_name); - if (mi == _modules_by_hash.end()) { - return 0; - } - - InterrogateModuleDef *def = (*mi).second; - int index_offset = - binary_search_wrapper_hash(def->unique_names, - def->unique_names + def->num_unique_names, - wrapper_hash_name); - if (index_offset >= 0) { - return def->first_index + index_offset; - } - - return 0; -} - -/** - * Returns the major version number of the interrogate database file currently - * being read. - */ -int InterrogateDatabase:: -get_file_major_version() { - return _file_major_version; -} - -/** - * Returns the minor version number of the interrogate database file currently - * being read. - */ -int InterrogateDatabase:: -get_file_minor_version() { - return _file_minor_version; -} - -/** - * Returns the major version number currently expected in interrogate database - * files generated by this code base. - */ -int InterrogateDatabase:: -get_current_major_version() { - return _current_major_version; -} - -/** - * Returns the minor version number currently expected in interrogate database - * files generated by this code base. - */ -int InterrogateDatabase:: -get_current_minor_version() { - return _current_minor_version; -} - -/** - * Sets the global error flag. This should be set true if there was some - * problem importing the database (e.g. cannot find an .in file). - */ -void InterrogateDatabase:: -set_error_flag(bool error_flag) { - _error_flag = error_flag; -} - -/** - * Returns a new index number suitable for the next thing, that will not be - * shared with any other index numbers. - */ -int InterrogateDatabase:: -get_next_index() { - return _next_index++; -} - -/** - * Adds the indicated type to the database at the given index number. - */ -void InterrogateDatabase:: -add_type(TypeIndex index, const InterrogateType &type) { - assert(index != 0); - bool inserted = - _type_map.insert(TypeMap::value_type(index, type)).second; - - if (!inserted) { - // If there was already a type at that index, maybe it was a forward - // reference. If its _fully_defined bit isn't set, then it's ok. - InterrogateType &old_type = _type_map[index]; - assert(!old_type.is_fully_defined()); - - // It was a forward reference. Merge it with the new one. - old_type.merge_with(type); - } - - if (type.is_global()) { - _global_types.push_back(index); - } - _all_types.push_back(index); -} - -/** - * Adds the indicated function to the database at the given index number. - */ -void InterrogateDatabase:: -add_function(FunctionIndex index, InterrogateFunction *function) { - bool inserted = - _function_map.insert(FunctionMap::value_type(index, function)).second; - assert(inserted); - - if (function->is_global()) { - _global_functions.push_back(index); - } - _all_functions.push_back(index); -} - -/** - * Adds the indicated function wrapper to the database at the given index - * number. - */ -void InterrogateDatabase:: -add_wrapper(FunctionWrapperIndex index, - const InterrogateFunctionWrapper &wrapper) { - bool inserted = - _wrapper_map.insert(FunctionWrapperMap::value_type(index, wrapper)).second; - assert(inserted); -} - -/** - * Adds the indicated manifest constant to the database at the given index - * number. - */ -void InterrogateDatabase:: -add_manifest(ManifestIndex index, const InterrogateManifest &manifest) { - bool inserted = - _manifest_map.insert(ManifestMap::value_type(index, manifest)).second; - assert(inserted); - - _global_manifests.push_back(index); -} - -/** - * Adds the indicated data element to the database at the given index number. - */ -void InterrogateDatabase:: -add_element(ElementIndex index, const InterrogateElement &element) { - bool inserted = - _element_map.insert(ElementMap::value_type(index, element)).second; - assert(inserted); - - if (element.is_global()) { - _global_elements.push_back(index); - } -} - -/** - * Adds the indicated make_seq to the database at the given index number. - */ -void InterrogateDatabase:: -add_make_seq(MakeSeqIndex index, const InterrogateMakeSeq &make_seq) { - bool inserted = - _make_seq_map.insert(MakeSeqMap::value_type(index, make_seq)).second; - assert(inserted); -} - -/** - * Returns a non-const reference to the indicated type, allowing the user to - * update it. - */ -InterrogateType &InterrogateDatabase:: -update_type(TypeIndex type) { - assert(type != 0); - check_latest(); - return _type_map[type]; -} - -/** - * Returns a non-const reference to the indicated function, allowing the user - * to update it. - */ -InterrogateFunction &InterrogateDatabase:: -update_function(FunctionIndex function) { - check_latest(); - return *_function_map[function]; -} - -/** - * Returns a non-const reference to the indicated function wrapper, allowing - * the user to update it. - */ -InterrogateFunctionWrapper &InterrogateDatabase:: -update_wrapper(FunctionWrapperIndex wrapper) { - check_latest(); - return _wrapper_map[wrapper]; -} - -/** - * Returns a non-const reference to the indicated manifest constant, allowing - * the user to update it. - */ -InterrogateManifest &InterrogateDatabase:: -update_manifest(ManifestIndex manifest) { - check_latest(); - return _manifest_map[manifest]; -} - -/** - * Returns a non-const reference to the indicated data element, allowing the - * user to update it. - */ -InterrogateElement &InterrogateDatabase:: -update_element(ElementIndex element) { - check_latest(); - return _element_map[element]; -} - -/** - * Returns a non-const reference to the indicated make_seq, allowing the user - * to update it. - */ -InterrogateMakeSeq &InterrogateDatabase:: -update_make_seq(MakeSeqIndex make_seq) { - check_latest(); - return _make_seq_map[make_seq]; -} - -/** - * Resequences all of the various index numbers so that all of the functions - * start at first_index and increment consecutively from there, and then all - * of the types follow. Returns the next available index number. - */ -int InterrogateDatabase:: -remap_indices(int first_index) { - IndexRemapper remap; - return remap_indices(first_index, remap); -} - -/** - * This flavor of remap_indices() accepts a map that should be empty on - * initial call, and will be filled with the mapping of old index number to - * new index number. This allows the caller to update its own data structures - * to match the new index numbers. - */ -int InterrogateDatabase:: -remap_indices(int first_index, IndexRemapper &remap) { - remap.clear(); - - // First, build up the complete map. - - // Get the wrapper indices first. This is important, because the - // InterrogateBuilder wants these to be first, and consecutive. - FunctionWrapperMap new_wrapper_map; - FunctionWrapperMap::iterator wi; - for (wi = _wrapper_map.begin(); wi != _wrapper_map.end(); ++wi) { - remap.add_mapping((*wi).first, first_index); - new_wrapper_map[first_index] = (*wi).second; - first_index++; - } - - // Everything else can follow; it doesn't matter so much. - FunctionMap new_function_map; - FunctionMap::iterator fi; - for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { - remap.add_mapping((*fi).first, first_index); - new_function_map[first_index] = (*fi).second; - first_index++; - } - - TypeMap new_type_map; - TypeMap::iterator ti; - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - assert((*ti).first != 0); - remap.add_mapping((*ti).first, first_index); - new_type_map[first_index] = (*ti).second; - first_index++; - } - - ManifestMap new_manifest_map; - ManifestMap::iterator mi; - for (mi = _manifest_map.begin(); mi != _manifest_map.end(); ++mi) { - remap.add_mapping((*mi).first, first_index); - new_manifest_map[first_index] = (*mi).second; - first_index++; - } - - ElementMap new_element_map; - ElementMap::iterator ei; - for (ei = _element_map.begin(); ei != _element_map.end(); ++ei) { - remap.add_mapping((*ei).first, first_index); - new_element_map[first_index] = (*ei).second; - first_index++; - } - - MakeSeqMap new_make_seq_map; - MakeSeqMap::iterator si; - for (si = _make_seq_map.begin(); si != _make_seq_map.end(); ++si) { - remap.add_mapping((*si).first, first_index); - new_make_seq_map[first_index] = (*si).second; - first_index++; - } - - _next_index = first_index; - - _wrapper_map.swap(new_wrapper_map); - _function_map.swap(new_function_map); - _type_map.swap(new_type_map); - _manifest_map.swap(new_manifest_map); - _element_map.swap(new_element_map); - _make_seq_map.swap(new_make_seq_map); - - // Then, go back through and update all of the internal references. - for (wi = _wrapper_map.begin(); wi != _wrapper_map.end(); ++wi) { - (*wi).second.remap_indices(remap); - } - for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { - (*fi).second->remap_indices(remap); - } - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - (*ti).second.remap_indices(remap); - } - for (mi = _manifest_map.begin(); mi != _manifest_map.end(); ++mi) { - (*mi).second.remap_indices(remap); - } - for (ei = _element_map.begin(); ei != _element_map.end(); ++ei) { - (*ei).second.remap_indices(remap); - } - for (si = _make_seq_map.begin(); si != _make_seq_map.end(); ++si) { - (*si).second.remap_indices(remap); - } - GlobalFunctions::iterator gfi; - for (gfi = _global_functions.begin(); gfi != _global_functions.end(); ++gfi) { - (*gfi) = remap.map_from(*gfi); - } - for (gfi = _all_functions.begin(); gfi != _all_functions.end(); ++gfi) { - (*gfi) = remap.map_from(*gfi); - } - GlobalTypes::iterator gti; - for (gti = _global_types.begin(); gti != _global_types.end(); ++gti) { - (*gti) = remap.map_from(*gti); - } - for (gti = _all_types.begin(); gti != _all_types.end(); ++gti) { - (*gti) = remap.map_from(*gti); - } - GlobalManifests::iterator gmi; - for (gmi = _global_manifests.begin(); gmi != _global_manifests.end(); ++gmi) { - (*gmi) = remap.map_from(*gmi); - } - GlobalElements::iterator gei; - for (gei = _global_elements.begin(); gei != _global_elements.end(); ++gei) { - (*gei) = remap.map_from(*gei); - } - - return _next_index; -} - -/** - * Writes the database to the indicated stream for later reading. - */ -void InterrogateDatabase:: -write(std::ostream &out, InterrogateModuleDef *def) const { - // Write out the file header. - out << def->file_identifier << "\n" - << _current_major_version << " " << _current_minor_version << "\n"; - - // Write out the module definition. - idf_output_string(out, def->library_name); - idf_output_string(out, def->library_hash_name); - idf_output_string(out, def->module_name); - out << "\n"; - - // Now write out the components. - - out << _function_map.size() << "\n"; - FunctionMap::const_iterator fi; - for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { - out << (*fi).first << " " << *(*fi).second << "\n"; - } - - out << _wrapper_map.size() << "\n"; - FunctionWrapperMap::const_iterator wi; - for (wi = _wrapper_map.begin(); wi != _wrapper_map.end(); ++wi) { - out << (*wi).first << " " << (*wi).second << "\n"; - } - - out << _type_map.size() << "\n"; - TypeMap::const_iterator ti; - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - out << (*ti).first << " " << (*ti).second << "\n"; - } - - out << _manifest_map.size() << "\n"; - ManifestMap::const_iterator mi; - for (mi = _manifest_map.begin(); mi != _manifest_map.end(); ++mi) { - out << (*mi).first << " " << (*mi).second << "\n"; - } - - out << _element_map.size() << "\n"; - ElementMap::const_iterator ei; - for (ei = _element_map.begin(); ei != _element_map.end(); ++ei) { - out << (*ei).first << " " << (*ei).second << "\n"; - } - - out << _make_seq_map.size() << "\n"; - MakeSeqMap::const_iterator si; - for (si = _make_seq_map.begin(); si != _make_seq_map.end(); ++si) { - out << (*si).first << " " << (*si).second << "\n"; - } -} - -/** - * Reads a database from the indicated stream, associated with the indicated - * module definition and merges it with any existing data in the database, - * according to the expected index numbers specified in the module def. The - * header information has already been read. - * - * Returns true if the file is read successfully, false if there is an error. - */ -bool InterrogateDatabase:: -read(std::istream &in, InterrogateModuleDef *def) { - InterrogateDatabase temp; - if (!temp.read_new(in, def)) { - return false; - } - - if (def->first_index == 0 && def->next_index == 0) { - _next_index = temp.remap_indices(_next_index); - - } else { - int next = temp.remap_indices(def->first_index); - if (next != def->next_index) { - interrogatedb_cat->error() - << "Module database file " << def->database_filename - << " is out of date.\n"; - return false; - } - } - - merge_from(temp); - return true; -} - -/** - * Reads in the latest interrogate data. - */ -void InterrogateDatabase:: -load_latest() { - const DSearchPath &searchpath = interrogatedb_path; - - Requests copy_requests; - copy_requests.swap(_requests); - - Requests::const_iterator ri; - for (ri = copy_requests.begin(); ri != copy_requests.end(); ++ri) { - InterrogateModuleDef *def = (*ri); - - if (def->database_filename != nullptr) { - Filename filename = def->database_filename; - Filename pathname = filename; - if (!pathname.empty() && pathname[0] != '/') { - pathname = searchpath.find_file(pathname); - } - - if (pathname.empty()) { - interrogatedb_cat->error() - << "Unable to find " << filename << " on " << searchpath << "\n"; - set_error_flag(true); - - } else { - - pifstream input; - pathname.set_text(); - if (!pathname.open_read(input)) { - interrogatedb_cat->error() << "Unable to read " << pathname << ".\n"; - set_error_flag(true); - - } else { - int file_identifier; - input >> file_identifier - >> _file_major_version >> _file_minor_version; - - if (def->file_identifier != 0 && - file_identifier != def->file_identifier) { - interrogatedb_cat->warning() - << "Interrogate data in " << pathname - << " is out of sync with the compiled-in data" - << " (" << file_identifier << " != " << def->file_identifier << ").\n"; - set_error_flag(true); - } - - if (_file_major_version != _current_major_version || - _file_minor_version > _current_minor_version) { - interrogatedb_cat->error() - << "Cannot read interrogate data in " << pathname - << "; database is version " << _file_major_version << "." - << _file_minor_version << " while we are expecting " - << _current_major_version << "." << _current_minor_version - << ".\n"; - set_error_flag(true); - - } else { - if (interrogatedb_cat->is_debug()) { - interrogatedb_cat->debug() - << "Reading " << filename << "\n"; - } - if (!read(input, def)) { - interrogatedb_cat->error() - << "Error reading " << pathname << ".\n"; - set_error_flag(true); - } - } - } - } - } - } - - _requests.clear(); -} - -/** - * Reads from the indicated stream (the header information has already been - * read) into the newly-created database. It is an error if the database - * already has some data in it. - */ -bool InterrogateDatabase:: -read_new(std::istream &in, InterrogateModuleDef *def) { - // We've already read the header. Read the module definition. - idf_input_string(in, def->library_name); - idf_input_string(in, def->library_hash_name); - idf_input_string(in, def->module_name); - - // Now read all of the components. - - { // Functions. - int num_functions; - in >> num_functions; - if (in.fail()) { - return false; - } - - while (num_functions > 0) { - FunctionIndex index; - InterrogateFunction *function = new InterrogateFunction(def); - in >> index >> *function; - if (in.fail()) { - delete function; - return false; - } - - add_function(index, function); - num_functions--; - } - } - - { // Wrappers. - int num_wrappers; - in >> num_wrappers; - if (in.fail()) { - return false; - } - - while (num_wrappers > 0) { - FunctionWrapperIndex index; - InterrogateFunctionWrapper wrapper(def); - in >> index >> wrapper; - if (in.fail()) { - return false; - } - - add_wrapper(index, wrapper); - num_wrappers--; - } - } - - { // Types. - int num_types; - in >> num_types; - if (in.fail()) { - return false; - } - - while (num_types > 0) { - TypeIndex index; - InterrogateType type(def); - in >> index >> type; - if (in.fail()) { - return false; - } - - add_type(index, type); - num_types--; - - // Older versions of interrogate were not setting these flags. - const InterrogateType &itype = get_type(index); - FunctionIndex dtor = itype.get_destructor(); - if (dtor != 0) { - update_function(dtor)._flags |= InterrogateFunction::F_destructor; - } - for (int i = 0; i < itype.number_of_constructors(); ++i) { - FunctionIndex ctor = itype.get_constructor(i); - update_function(ctor)._flags |= InterrogateFunction::F_constructor; - } - } - } - - { // Manifests. - int num_manifests; - in >> num_manifests; - if (in.fail()) { - return false; - } - - while (num_manifests > 0) { - ManifestIndex index; - InterrogateManifest manifest(def); - in >> index >> manifest; - if (in.fail()) { - return false; - } - - add_manifest(index, manifest); - num_manifests--; - } - } - - { // Elements. - int num_elements; - in >> num_elements; - if (in.fail()) { - return false; - } - - while (num_elements > 0) { - ElementIndex index; - InterrogateElement element(def); - in >> index >> element; - if (in.fail()) { - return false; - } - - add_element(index, element); - num_elements--; - } - } - - { // MakeSeqs. - int num_make_seqs; - in >> num_make_seqs; - if (in.fail()) { - return false; - } - - while (num_make_seqs > 0) { - MakeSeqIndex index; - InterrogateMakeSeq make_seq(def); - in >> index >> make_seq; - if (in.fail()) { - return false; - } - - add_make_seq(index, make_seq); - num_make_seqs--; - } - } - - return true; -} - -/** - * Copies all the data from the indicated database into this one. It is an - * error if any index numbers are shared between the two databases. - */ -void InterrogateDatabase:: -merge_from(const InterrogateDatabase &other) { - // We want to collapse shared types together. - IndexRemapper remap; - - // First, we need to build a set of types by name, so we know what types we - // already have. - map types_by_name; - - TypeMap::const_iterator ti; - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - const InterrogateType &type = (*ti).second; - if (type.has_true_name()) { - types_by_name[type.get_true_name()] = (*ti).first; - } - } - - // Now go through the other set of types and determine the mapping into this - // set. - for (ti = other._type_map.begin(); ti != other._type_map.end(); ++ti) { - TypeIndex other_type_index = (*ti).first; - const InterrogateType &other_type = (*ti).second; - - if (other_type.has_name()) { - map::iterator ni; - ni = types_by_name.find(other_type.get_true_name()); - if (ni != types_by_name.end()) { - // Here's a type that we seem to have in common! We'll have to merge - // them. - TypeIndex this_type_index = (*ni).second; - remap.add_mapping(other_type_index, this_type_index); - } - } - } - - // Now that we know the full type-to-type mapping, we can copy the new - // types, one at a time. - for (ti = other._type_map.begin(); ti != other._type_map.end(); ++ti) { - TypeIndex other_type_index = (*ti).first; - const InterrogateType &other_type = (*ti).second; - - if (!remap.in_map(other_type_index)) { - // Here's a new type. - add_type(other_type_index, other_type); - update_type(other_type_index).remap_indices(remap); - - } else { - // Here's a type to merge. - TypeIndex this_type_index = remap.map_from(other_type_index); - - InterrogateType &this_type = update_type(this_type_index); - if (!this_type.is_global() && other_type.is_global()) { - // If the type is about to become global, we need to add it to our - // global_types list. - _global_types.push_back(this_type_index); - } - - InterrogateType merge_type = other_type; - merge_type.remap_indices(remap); - this_type.merge_with(merge_type); - } - } - - // And copy all of the functions, wrappers, manifests, and elements. - FunctionMap::const_iterator fi; - for (fi = other._function_map.begin(); - fi != other._function_map.end(); - ++fi) { - FunctionIndex other_function_index = (*fi).first; - InterrogateFunction *other_function = (*fi).second; - add_function(other_function_index, other_function); - update_function(other_function_index).remap_indices(remap); - } - - FunctionWrapperMap::const_iterator wi; - for (wi = other._wrapper_map.begin(); - wi != other._wrapper_map.end(); - ++wi) { - FunctionWrapperIndex other_wrapper_index = (*wi).first; - const InterrogateFunctionWrapper &other_wrapper = (*wi).second; - add_wrapper(other_wrapper_index, other_wrapper); - update_wrapper(other_wrapper_index).remap_indices(remap); - } - - ManifestMap::const_iterator mi; - for (mi = other._manifest_map.begin(); - mi != other._manifest_map.end(); - ++mi) { - ManifestIndex other_manifest_index = (*mi).first; - const InterrogateManifest &other_manifest = (*mi).second; - add_manifest(other_manifest_index, other_manifest); - update_manifest(other_manifest_index).remap_indices(remap); - } - - ElementMap::const_iterator ei; - for (ei = other._element_map.begin(); - ei != other._element_map.end(); - ++ei) { - ElementIndex other_element_index = (*ei).first; - const InterrogateElement &other_element = (*ei).second; - add_element(other_element_index, other_element); - update_element(other_element_index).remap_indices(remap); - } - - MakeSeqMap::const_iterator si; - for (si = other._make_seq_map.begin(); - si != other._make_seq_map.end(); - ++si) { - MakeSeqIndex other_make_seq_index = (*si).first; - const InterrogateMakeSeq &other_make_seq = (*si).second; - add_make_seq(other_make_seq_index, other_make_seq); - update_make_seq(other_make_seq_index).remap_indices(remap); - } - - _lookups_fresh = 0; -} - -/** - * Looks up the wrapper definition in the set of module defs that are loaded - * in at runtime and represent the part of the interrogate database that's - * compiled in. - * - * If the wrapper definition is not found, returns false. If it is found, - * returns true and sets def and module_index to the particular module and the - * index within the module where the wrapper is defined. - */ -bool InterrogateDatabase:: -find_module(FunctionWrapperIndex wrapper, InterrogateModuleDef *&def, - int &module_index) { - if (_modules.empty()) { - return false; - } - - int mi = binary_search_module(0, _modules.size(), wrapper); - assert(mi >= 0 && mi < (int)_modules.size()); - def = _modules[mi]; - module_index = wrapper - def->first_index; - - return (wrapper < def->next_index); -} - -/** - * Searches for the function module that includes the given function index by - * binary search. - */ -int InterrogateDatabase:: -binary_search_module(int begin, int end, FunctionIndex function) { - int mid = begin + (end - begin) / 2; - if (mid == begin) { - return mid; - } - - int index = _modules[mid]->first_index; - if (index <= function) { - return binary_search_module(mid, end, function); - - } else { - return binary_search_module(begin, mid, function); - } -} - -/** - * Searches for the particular function wrapper's hash name within a given - * module. Returns the index number local to the module, or -1 if it is not - * found. - */ -int InterrogateDatabase:: -binary_search_wrapper_hash(InterrogateUniqueNameDef *begin, - InterrogateUniqueNameDef *end, - const string &wrapper_hash_name) { - if (end <= begin) { - return -1; - } - - InterrogateUniqueNameDef *mid = begin + (end - begin) / 2; - string name = mid->name; - if (name < wrapper_hash_name) { - return binary_search_wrapper_hash(mid, end, wrapper_hash_name); - - } else if (wrapper_hash_name < name) { - return binary_search_wrapper_hash(begin, mid, wrapper_hash_name); - - } else { - return mid->index_offset; - } -} - -/** - * Builds up the lookup of types by name. - */ -void InterrogateDatabase:: -freshen_types_by_name() { - _types_by_name.clear(); - TypeMap::const_iterator ti; - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - _types_by_name[(*ti).second.get_name()] = (*ti).first; - } -} - -/** - * Builds up the lookup of types by scoped name. - */ -void InterrogateDatabase:: -freshen_types_by_scoped_name() { - _types_by_scoped_name.clear(); - TypeMap::const_iterator ti; - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - _types_by_scoped_name[(*ti).second.get_scoped_name()] = (*ti).first; - } -} - -/** - * Builds up the lookup of types by true name. - */ -void InterrogateDatabase:: -freshen_types_by_true_name() { - _types_by_true_name.clear(); - TypeMap::const_iterator ti; - for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { - _types_by_true_name[(*ti).second.get_true_name()] = (*ti).first; - } -} - -/** - * Builds up the lookup of manifests by name. - */ -void InterrogateDatabase:: -freshen_manifests_by_name() { - _manifests_by_name.clear(); - ManifestMap::const_iterator ti; - for (ti = _manifest_map.begin(); ti != _manifest_map.end(); ++ti) { - _manifests_by_name[(*ti).second.get_name()] = (*ti).first; - } -} - -/** - * Builds up the lookup of elements by name. - */ -void InterrogateDatabase:: -freshen_elements_by_name() { - _elements_by_name.clear(); - ElementMap::const_iterator ti; - for (ti = _element_map.begin(); ti != _element_map.end(); ++ti) { - _elements_by_name[(*ti).second.get_name()] = (*ti).first; - } -} - -/** - * Builds up the lookup of elements by scoped name. - */ -void InterrogateDatabase:: -freshen_elements_by_scoped_name() { - _elements_by_scoped_name.clear(); - ElementMap::const_iterator ti; - for (ti = _element_map.begin(); ti != _element_map.end(); ++ti) { - _elements_by_scoped_name[(*ti).second.get_scoped_name()] = (*ti).first; - } -} - -/** - * Looks up a type, manifest, or element in the indicated lookup table by - * name. This is an internal support function. - */ -int InterrogateDatabase:: -lookup(const string &name, Lookup &lookup, LookupType type, - void (InterrogateDatabase::*freshen)()) { - if ((_lookups_fresh & (int)type) == 0) { - // The lookup table isn't fresh; we need to freshen it. - (this->*freshen)(); - _lookups_fresh |= (int)type; - } - - Lookup::const_iterator li; - li = lookup.find(name); - if (li != lookup.end()) { - return (*li).second; - } - return 0; -} diff --git a/dtool/src/interrogatedb/interrogateDatabase.h b/dtool/src/interrogatedb/interrogateDatabase.h deleted file mode 100644 index 9c60b0318e..0000000000 --- a/dtool/src/interrogatedb/interrogateDatabase.h +++ /dev/null @@ -1,205 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateDatabase.h - * @author drose - * @date 2000-08-01 - */ - -#ifndef INTERROGATEDATABASE_H -#define INTERROGATEDATABASE_H - -#include "dtoolbase.h" - -#include "interrogate_interface.h" -#include "interrogateType.h" -#include "interrogateFunction.h" -#include "interrogateFunctionWrapper.h" -#include "interrogateManifest.h" -#include "interrogateElement.h" -#include "interrogateMakeSeq.h" -#include "interrogate_request.h" - -#include - -class IndexRemapper; - -/** - * This stores all of the interrogate data and handles reading the data from a - * disk file when necessary. - */ -class EXPCL_INTERROGATEDB InterrogateDatabase { -private: - InterrogateDatabase(); - -public: - static InterrogateDatabase *get_ptr(); - void request_module(InterrogateModuleDef *def); - -public: - // Functions to read the database. - bool get_error_flag(); - - int get_num_global_types(); - TypeIndex get_global_type(int n); - int get_num_all_types(); - TypeIndex get_all_type(int n); - int get_num_global_functions(); - FunctionIndex get_global_function(int n); - int get_num_all_functions(); - FunctionIndex get_all_function(int n); - int get_num_global_manifests(); - ManifestIndex get_global_manifest(int n); - int get_num_global_elements(); - ElementIndex get_global_element(int n); - - const InterrogateType &get_type(TypeIndex type); - const InterrogateFunction &get_function(FunctionIndex function); - const InterrogateFunctionWrapper &get_wrapper(FunctionWrapperIndex wrapper); - const InterrogateManifest &get_manifest(ManifestIndex manifest); - const InterrogateElement &get_element(ElementIndex element); - const InterrogateMakeSeq &get_make_seq(MakeSeqIndex element); - - INLINE TypeIndex lookup_type_by_name(const std::string &name); - INLINE TypeIndex lookup_type_by_scoped_name(const std::string &name); - INLINE TypeIndex lookup_type_by_true_name(const std::string &name); - INLINE ManifestIndex lookup_manifest_by_name(const std::string &name); - INLINE ElementIndex lookup_element_by_name(const std::string &name); - INLINE ElementIndex lookup_element_by_scoped_name(const std::string &name); - - void remove_type(TypeIndex type); - - void *get_fptr(FunctionWrapperIndex wrapper); - - FunctionWrapperIndex get_wrapper_by_unique_name(const std::string &unique_name); - - static int get_file_major_version(); - static int get_file_minor_version(); - static int get_current_major_version(); - static int get_current_minor_version(); - -public: - // Functions to build the database. - void set_error_flag(bool error_flag); - - int get_next_index(); - void add_type(TypeIndex index, const InterrogateType &type); - void add_function(FunctionIndex index, InterrogateFunction *function); - void add_wrapper(FunctionWrapperIndex index, - const InterrogateFunctionWrapper &wrapper); - void add_manifest(ManifestIndex index, const InterrogateManifest &manifest); - void add_element(ElementIndex index, const InterrogateElement &element); - void add_make_seq(MakeSeqIndex index, const InterrogateMakeSeq &make_seq); - - InterrogateType &update_type(TypeIndex type); - InterrogateFunction &update_function(FunctionIndex function); - InterrogateFunctionWrapper &update_wrapper(FunctionWrapperIndex wrapper); - InterrogateManifest &update_manifest(ManifestIndex manifest); - InterrogateElement &update_element(ElementIndex element); - InterrogateMakeSeq &update_make_seq(MakeSeqIndex make_seq); - - int remap_indices(int first_index); - int remap_indices(int first_index, IndexRemapper &remap); - - void write(std::ostream &out, InterrogateModuleDef *def) const; - bool read(std::istream &in, InterrogateModuleDef *def); - -private: - INLINE void check_latest(); - void load_latest(); - - bool read_new(std::istream &in, InterrogateModuleDef *def); - void merge_from(const InterrogateDatabase &other); - - bool find_module(FunctionWrapperIndex wrapper, - InterrogateModuleDef *&def, int &module_index); - int binary_search_module(int begin, int end, FunctionIndex function); - int binary_search_wrapper_hash(InterrogateUniqueNameDef *begin, - InterrogateUniqueNameDef *end, - const std::string &wrapper_hash_name); - - // This data is loaded from the various database files. - typedef std::map TypeMap; - TypeMap _type_map; - typedef std::map FunctionMap; - FunctionMap _function_map; - typedef std::map FunctionWrapperMap; - FunctionWrapperMap _wrapper_map; - - typedef std::map ManifestMap; - ManifestMap _manifest_map; - typedef std::map ElementMap; - ElementMap _element_map; - - typedef std::map MakeSeqMap; - MakeSeqMap _make_seq_map; - - typedef std::vector GlobalTypes; - GlobalTypes _global_types; - GlobalTypes _all_types; - typedef std::vector GlobalFunctions; - GlobalFunctions _global_functions; - GlobalFunctions _all_functions; - typedef std::vector GlobalManifests; - GlobalManifests _global_manifests; - typedef std::vector GlobalElements; - GlobalElements _global_elements; - - // This data is compiled in directly to the shared libraries that we link - // with. - typedef std::vector Modules; - Modules _modules; - typedef std::map ModulesByHash; - ModulesByHash _modules_by_hash; - - // This records the set of database files that are still to be loaded. - typedef std::vector Requests; - Requests _requests; - - bool _error_flag; - int _next_index; - - enum LookupType { - LT_type_name = 0x001, - LT_type_scoped_name = 0x002, - LT_type_true_name = 0x004, - LT_manifest_name = 0x008, - LT_element_name = 0x010, - LT_element_scoped_name = 0x020, - }; - - int _lookups_fresh; - typedef std::map Lookup; - Lookup _types_by_name; - Lookup _types_by_scoped_name; - Lookup _types_by_true_name; - Lookup _manifests_by_name; - Lookup _elements_by_name; - Lookup _elements_by_scoped_name; - - void freshen_types_by_name(); - void freshen_types_by_scoped_name(); - void freshen_types_by_true_name(); - void freshen_manifests_by_name(); - void freshen_elements_by_name(); - void freshen_elements_by_scoped_name(); - - int lookup(const std::string &name, - Lookup &lookup, LookupType type, - void (InterrogateDatabase::*freshen)()); - - static InterrogateDatabase *_global_ptr; - static int _file_major_version; - static int _file_minor_version; - static int _current_major_version; - static int _current_minor_version; -}; - -#include "interrogateDatabase.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateElement.I b/dtool/src/interrogatedb/interrogateElement.I deleted file mode 100644 index 93e6889b16..0000000000 --- a/dtool/src/interrogatedb/interrogateElement.I +++ /dev/null @@ -1,259 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateElement.I - * @author drose - * @date 2000-08-11 - */ - -/** - * - */ -INLINE InterrogateElement:: -InterrogateElement(InterrogateModuleDef *def) : - InterrogateComponent(def) -{ - _flags = 0; - _type = 0; - _getter = 0; - _setter = 0; - _has_function = 0; - _clear_function = 0; - _del_function = 0; - _insert_function = 0; - _getkey_function = 0; - _length_function = 0; - _make_property = nullptr; -} - -/** - * - */ -INLINE InterrogateElement:: -InterrogateElement(const InterrogateElement ©) { - (*this) = copy; -} - -/** - * - */ -INLINE void InterrogateElement:: -operator = (const InterrogateElement ©) { - InterrogateComponent::operator = (copy); - _flags = copy._flags; - _scoped_name = copy._scoped_name; - _comment = copy._comment; - _type = copy._type; - _getter = copy._getter; - _setter = copy._setter; - _has_function = copy._has_function; - _clear_function = copy._clear_function; - _del_function = copy._del_function; - _insert_function = copy._insert_function; - _getkey_function = copy._getkey_function; - _length_function = copy._length_function; - _make_property = copy._make_property; -} - -/** - * Returns true if the element is marked as 'global'. This means only that it - * should appear in the global element list. - */ -INLINE bool InterrogateElement:: -is_global() const { - return (_flags & F_global) != 0; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_scoped_name() const { - return !_scoped_name.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateElement:: -get_scoped_name() const { - return _scoped_name; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_comment() const { - return !_comment.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateElement:: -get_comment() const { - return _comment; -} - -/** - * - */ -INLINE TypeIndex InterrogateElement:: -get_type() const { - return _type; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_getter() const { - return (_flags & F_has_getter) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_getter() const { - return _getter; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_setter() const { - return (_flags & F_has_setter) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_setter() const { - return _setter; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_has_function() const { - return (_flags & F_has_has_function) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_has_function() const { - return _has_function; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_clear_function() const { - return (_flags & F_has_clear_function) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_clear_function() const { - return _clear_function; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_del_function() const { - return (_flags & F_has_del_function) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_del_function() const { - return _del_function; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_insert_function() const { - return (_flags & F_has_insert_function) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_insert_function() const { - return _insert_function; -} - -/** - * - */ -INLINE bool InterrogateElement:: -has_getkey_function() const { - return (_flags & F_has_getkey_function) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_getkey_function() const { - return _getkey_function; -} - -/** - * - */ -INLINE bool InterrogateElement:: -is_sequence() const { - return (_flags & F_sequence) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateElement:: -get_length_function() const { - return _length_function; -} - -/** - * - */ -INLINE bool InterrogateElement:: -is_mapping() const { - return (_flags & F_mapping) != 0; -} - - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateElement &element) { - element.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateElement &element) { - element.input(in); - return in; -} diff --git a/dtool/src/interrogatedb/interrogateElement.cxx b/dtool/src/interrogatedb/interrogateElement.cxx deleted file mode 100644 index 4b6b3d948f..0000000000 --- a/dtool/src/interrogatedb/interrogateElement.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateElement.cxx - * @author drose - * @date 2000-08-11 - */ - -#include "interrogateElement.h" -#include "interrogateDatabase.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" - -/** - * Formats the InterrogateElement data for output to a data file. - */ -void InterrogateElement:: -output(std::ostream &out) const { - InterrogateComponent::output(out); - out << _flags << " " - << _type << " " - << _getter << " " - << _setter << " " - << _has_function << " " - << _clear_function << " " - << _del_function << " " - << _length_function << " " - << _insert_function << " " - << _getkey_function << " "; - idf_output_string(out, _scoped_name); - idf_output_string(out, _comment, '\n'); -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateElement:: -input(std::istream &in) { - InterrogateComponent::input(in); - in >> _flags >> _type >> _getter >> _setter; - if (InterrogateDatabase::get_file_minor_version() >= 1) { - in >> _has_function >> _clear_function; - if (InterrogateDatabase::get_file_minor_version() >= 2) { - in >> _del_function >> _length_function; - if (InterrogateDatabase::get_file_minor_version() >= 3) { - in >> _insert_function >> _getkey_function; - } - } - } - idf_input_string(in, _scoped_name); - idf_input_string(in, _comment); -} - -/** - * Remaps all internal index numbers according to the indicated map. This - * called from InterrogateDatabase::remap_indices(). - */ -void InterrogateElement:: -remap_indices(const IndexRemapper &remap) { - _type = remap.map_from(_type); - _getter = remap.map_from(_getter); - _setter = remap.map_from(_setter); - _has_function = remap.map_from(_has_function); - _clear_function = remap.map_from(_clear_function); - _del_function = remap.map_from(_del_function); - _insert_function = remap.map_from(_insert_function); - _getkey_function = remap.map_from(_getkey_function); - _length_function = remap.map_from(_length_function); -} diff --git a/dtool/src/interrogatedb/interrogateElement.h b/dtool/src/interrogatedb/interrogateElement.h deleted file mode 100644 index e3d55569f0..0000000000 --- a/dtool/src/interrogatedb/interrogateElement.h +++ /dev/null @@ -1,103 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateElement.h - * @author drose - * @date 2000-08-11 - */ - -#ifndef INTERROGATEELEMENT_H -#define INTERROGATEELEMENT_H - -#include "dtoolbase.h" - -#include "interrogateComponent.h" - -class IndexRemapper; -class CPPMakeProperty; - -/** - * An internal representation of a data element, like a data member or a - * global variable. - */ -class EXPCL_INTERROGATEDB InterrogateElement : public InterrogateComponent { -public: - INLINE InterrogateElement(InterrogateModuleDef *def = nullptr); - INLINE InterrogateElement(const InterrogateElement ©); - INLINE void operator = (const InterrogateElement ©); - - INLINE bool is_global() const; - - INLINE bool has_scoped_name() const; - INLINE const std::string &get_scoped_name() const; - - INLINE bool has_comment() const; - INLINE const std::string &get_comment() const; - - INLINE TypeIndex get_type() const; - INLINE bool has_getter() const; - INLINE FunctionIndex get_getter() const; - INLINE bool has_setter() const; - INLINE FunctionIndex get_setter() const; - INLINE bool has_has_function() const; - INLINE FunctionIndex get_has_function() const; - INLINE bool has_clear_function() const; - INLINE FunctionIndex get_clear_function() const; - INLINE bool has_del_function() const; - INLINE FunctionIndex get_del_function() const; - INLINE bool has_insert_function() const; - INLINE FunctionIndex get_insert_function() const; - INLINE bool has_getkey_function() const; - INLINE FunctionIndex get_getkey_function() const; - INLINE bool is_sequence() const; - INLINE FunctionIndex get_length_function() const; - INLINE bool is_mapping() const; - - void output(std::ostream &out) const; - void input(std::istream &in); - - void remap_indices(const IndexRemapper &remap); - -private: - enum Flags { - F_global = 0x0001, - F_has_getter = 0x0002, - F_has_setter = 0x0004, - F_has_has_function= 0x0008, - F_has_clear_function= 0x0010, - F_has_del_function= 0x0020, - F_sequence = 0x0040, - F_mapping = 0x0080, - F_has_insert_function= 0x0100, - F_has_getkey_function= 0x0200, - }; - - int _flags; - std::string _scoped_name; - std::string _comment; - TypeIndex _type; - FunctionIndex _length_function; - FunctionIndex _getter; - FunctionIndex _setter; - FunctionIndex _has_function; - FunctionIndex _clear_function; - FunctionIndex _del_function; - FunctionIndex _insert_function; - FunctionIndex _getkey_function; - - CPPMakeProperty *_make_property; - - friend class InterrogateBuilder; -}; - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateElement &element); -INLINE std::istream &operator >> (std::istream &in, InterrogateElement &element); - -#include "interrogateElement.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateFunction.I b/dtool/src/interrogatedb/interrogateFunction.I deleted file mode 100644 index 6c36fec5d3..0000000000 --- a/dtool/src/interrogatedb/interrogateFunction.I +++ /dev/null @@ -1,178 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateFunction.I - * @author drose - * @date 2000-08-01 - */ - -/** - * Returns true if the function is marked as 'global'. This means only that it - * should appear in the global function list. - */ -INLINE bool InterrogateFunction:: -is_global() const { - return (_flags & F_global) != 0; -} - -/** - * Returns true if the function is virtual, for whatever that's worth. - */ -INLINE bool InterrogateFunction:: -is_virtual() const { - return (_flags & F_virtual) != 0; -} - -/** - * Returns true if the function is a class method. - */ -INLINE bool InterrogateFunction:: -is_method() const { - return (_flags & F_method) != 0; -} - -/** - * Returns true if the function is flagged as a special unary operator, like - * operator -() with no parameters. - */ -INLINE bool InterrogateFunction:: -is_unary_op() const { - return (_flags & F_unary_op) != 0; -} - -/** - * Returns true if the function is a special typecast operator, like operator - * bool(). - */ -INLINE bool InterrogateFunction:: -is_operator_typecast() const { - return (_flags & F_operator_typecast) != 0; -} - -/** - * Returns true if the function is a constructor. - */ -INLINE bool InterrogateFunction:: -is_constructor() const { - return (_flags & F_constructor) != 0; -} - -/** - * Returns true if the function is a destructor. - */ -INLINE bool InterrogateFunction:: -is_destructor() const { - return (_flags & F_destructor) != 0; -} - -/** - * Return the class that owns the method, if is_method() returns true. - */ -INLINE TypeIndex InterrogateFunction:: -get_class() const { - return _class; -} - -/** - * - */ -INLINE bool InterrogateFunction:: -has_scoped_name() const { - return !_scoped_name.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateFunction:: -get_scoped_name() const { - return _scoped_name; -} - -/** - * - */ -INLINE bool InterrogateFunction:: -has_comment() const { - return !_comment.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateFunction:: -get_comment() const { - return _comment; -} - -/** - * - */ -INLINE bool InterrogateFunction:: -has_prototype() const { - return !_prototype.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateFunction:: -get_prototype() const { - return _prototype; -} - -/** - * - */ -INLINE int InterrogateFunction:: -number_of_c_wrappers() const { - return _c_wrappers.size(); -} - -/** - * - */ -INLINE FunctionWrapperIndex InterrogateFunction:: -get_c_wrapper(int n) const { - if (n >= 0 && n < (int)_c_wrappers.size()) { - return _c_wrappers[n]; - } - return 0; -} - -/** - * - */ -INLINE int InterrogateFunction:: -number_of_python_wrappers() const { - return _python_wrappers.size(); -} - -/** - * - */ -INLINE FunctionWrapperIndex InterrogateFunction:: -get_python_wrapper(int n) const { - if (n >= 0 && n < (int)_python_wrappers.size()) { - return _python_wrappers[n]; - } - return 0; -} - - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateFunction &function) { - function.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateFunction &function) { - function.input(in); - return in; -} diff --git a/dtool/src/interrogatedb/interrogateFunction.cxx b/dtool/src/interrogatedb/interrogateFunction.cxx deleted file mode 100644 index db70cc0b9c..0000000000 --- a/dtool/src/interrogatedb/interrogateFunction.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateFunction.cxx - * @author drose - * @date 2000-08-01 - */ - -#include "interrogateFunction.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" -#include "interrogateDatabase.h" - -/** - * - */ -InterrogateFunction:: -InterrogateFunction(InterrogateModuleDef *def) : - InterrogateComponent(def) -{ - _flags = 0; - _class = 0; - _instances = nullptr; -} - -/** - * - */ -InterrogateFunction:: -InterrogateFunction(const InterrogateFunction ©) { - (*this) = copy; -} - -/** - * - */ -void InterrogateFunction:: -operator = (const InterrogateFunction ©) { - InterrogateComponent::operator = (copy); - _flags = copy._flags; - _scoped_name = copy._scoped_name; - _comment = copy._comment; - _prototype = copy._prototype; - _class = copy._class; - _c_wrappers = copy._c_wrappers; - _python_wrappers = copy._python_wrappers; - - _instances = copy._instances; - _expression = copy._expression; -} - -/** - * Formats the InterrogateFunction data for output to a data file. - */ -void InterrogateFunction:: -output(std::ostream &out) const { - InterrogateComponent::output(out); - out << _flags << " " - << _class << " "; - idf_output_string(out, _scoped_name); - idf_output_vector(out, _c_wrappers); - idf_output_vector(out, _python_wrappers); - idf_output_string(out, _comment, '\n'); - idf_output_string(out, _prototype, '\n'); -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateFunction:: -input(std::istream &in) { - InterrogateComponent::input(in); - in >> _flags >> _class; - idf_input_string(in, _scoped_name); - idf_input_vector(in, _c_wrappers); - idf_input_vector(in, _python_wrappers); - idf_input_string(in, _comment); - idf_input_string(in, _prototype); -} - -/** - * Remaps all internal index numbers according to the indicated map. This - * called from InterrogateDatabase::remap_indices(). - */ -void InterrogateFunction:: -remap_indices(const IndexRemapper &remap) { - _class = remap.map_from(_class); - Wrappers::iterator wi; - for (wi = _c_wrappers.begin(); wi != _c_wrappers.end(); ++wi) { - (*wi) = remap.map_from(*wi); - } - for (wi = _python_wrappers.begin(); wi != _python_wrappers.end(); ++wi) { - (*wi) = remap.map_from(*wi); - } -} diff --git a/dtool/src/interrogatedb/interrogateFunction.h b/dtool/src/interrogatedb/interrogateFunction.h deleted file mode 100644 index 76f4f20ccd..0000000000 --- a/dtool/src/interrogatedb/interrogateFunction.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateFunction.h - * @author drose - * @date 2000-08-01 - */ - -#ifndef INTERROGATEFUNCTION_H -#define INTERROGATEFUNCTION_H - -#include "dtoolbase.h" - -#include "interrogateComponent.h" - -#include -#include - -class IndexRemapper; -class CPPInstance; - -/** - * An internal representation of a function. - */ -class EXPCL_INTERROGATEDB InterrogateFunction : public InterrogateComponent { -public: - InterrogateFunction(InterrogateModuleDef *def = nullptr); - InterrogateFunction(const InterrogateFunction ©); - void operator = (const InterrogateFunction ©); - - INLINE bool is_global() const; - INLINE bool is_virtual() const; - INLINE bool is_method() const; - INLINE bool is_unary_op() const; - INLINE bool is_operator_typecast() const; - INLINE bool is_constructor() const; - INLINE bool is_destructor() const; - INLINE TypeIndex get_class() const; - - INLINE bool has_scoped_name() const; - INLINE const std::string &get_scoped_name() const; - - INLINE bool has_comment() const; - INLINE const std::string &get_comment() const; - - INLINE bool has_prototype() const; - INLINE const std::string &get_prototype() const; - - INLINE int number_of_c_wrappers() const; - INLINE FunctionWrapperIndex get_c_wrapper(int n) const; - - INLINE int number_of_python_wrappers() const; - INLINE FunctionWrapperIndex get_python_wrapper(int n) const; - - void output(std::ostream &out) const; - void input(std::istream &in); - - void remap_indices(const IndexRemapper &remap); - -private: - enum Flags { - F_global = 0x0001, - F_virtual = 0x0002, - F_method = 0x0004, - F_typecast = 0x0008, - F_getter = 0x0010, - F_setter = 0x0020, - F_unary_op = 0x0040, - F_operator_typecast = 0x0080, - F_constructor = 0x0100, - F_destructor = 0x0200, - F_item_assignment = 0x0400, - }; - - int _flags; - std::string _scoped_name; - std::string _comment; - std::string _prototype; - TypeIndex _class; - - typedef std::vector Wrappers; - Wrappers _c_wrappers; - Wrappers _python_wrappers; - -public: - // The rest of the members in this class aren't part of the public interface - // to interrogate, but are used internally as the interrogate database is - // built. They are valid only during the session of interrogate that - // generates the database, and will not be filled in when the database is - // reloaded from disk. - - // This must be a pointer, rather than a concrete map, so we don't risk - // trying to create a map in one DLL and access it in another. Silly - // Windows. - typedef std::map Instances; - Instances *_instances; - std::string _expression; - - friend class InterrogateBuilder; - friend class InterrogateDatabase; - friend class InterfaceMakerC; - friend class InterfaceMakerPythonSimple; - friend class InterfaceMakerPythonNative; - friend class FunctionRemap; -}; - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateFunction &function); -INLINE std::istream &operator >> (std::istream &in, InterrogateFunction &function); - -#include "interrogateFunction.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateFunctionWrapper.I b/dtool/src/interrogatedb/interrogateFunctionWrapper.I deleted file mode 100644 index 93fff488b0..0000000000 --- a/dtool/src/interrogatedb/interrogateFunctionWrapper.I +++ /dev/null @@ -1,240 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateFunctionWrapper.I - * @author drose - * @date 2000-08-06 - */ - -/** - * - */ -INLINE InterrogateFunctionWrapper:: -InterrogateFunctionWrapper(InterrogateModuleDef *def) : - InterrogateComponent(def) -{ - _flags = 0; - _function = 0; - _return_type = 0; - _return_value_destructor = 0; -} - -/** - * - */ -INLINE InterrogateFunctionWrapper:: -InterrogateFunctionWrapper(const InterrogateFunctionWrapper ©) { - (*this) = copy; -} - -/** - * - */ -INLINE void InterrogateFunctionWrapper:: -operator = (const InterrogateFunctionWrapper ©) { - InterrogateComponent::operator = (copy); - _flags = copy._flags; - _function = copy._function; - _return_type = copy._return_type; - _return_value_destructor = copy._return_value_destructor; - _unique_name = copy._unique_name; - _comment = copy._comment; - _parameters = copy._parameters; -} - -/** - * Returns the FunctionIndex of the function that this wrapper corresponds to. - */ -INLINE FunctionIndex InterrogateFunctionWrapper:: -get_function() const { - return _function; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -is_callable_by_name() const { - return (_flags & F_callable_by_name) != 0; -} - -/** - * @since 1.10.13 - */ -INLINE bool InterrogateFunctionWrapper:: -is_copy_constructor() const { - return (_flags & F_copy_constructor) != 0; -} - -/** - * @since 1.10.13 - */ -INLINE bool InterrogateFunctionWrapper:: -is_coerce_constructor() const { - return (_flags & F_coerce_constructor) != 0; -} - -/** - * @since 1.10.13 - */ -INLINE bool InterrogateFunctionWrapper:: -is_extension() const { - return (_flags & F_extension) != 0; -} - -/** - * @since 1.11.0 - */ -INLINE bool InterrogateFunctionWrapper:: -is_deprecated() const { - return (_flags & F_deprecated) != 0; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -has_return_value() const { - return (_flags & F_has_return) != 0; -} - -/** - * - */ -INLINE TypeIndex InterrogateFunctionWrapper:: -get_return_type() const { - return _return_type; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -caller_manages_return_value() const { - return (_flags & F_caller_manages) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateFunctionWrapper:: -get_return_value_destructor() const { - return _return_value_destructor; -} - -/** - * - */ -INLINE int InterrogateFunctionWrapper:: -number_of_parameters() const { - return _parameters.size(); -} - -/** - * - */ -INLINE TypeIndex InterrogateFunctionWrapper:: -parameter_get_type(int n) const { - if (n >= 0 && n < (int)_parameters.size()) { - return _parameters[n]._type; - } - return 0; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -parameter_has_name(int n) const { - if (n >= 0 && n < (int)_parameters.size()) { - return (_parameters[n]._parameter_flags & PF_has_name) != 0; - } - return false; -} - -/** - * - */ -INLINE const std::string &InterrogateFunctionWrapper:: -parameter_get_name(int n) const { - static std::string bogus_string; - if (n >= 0 && n < (int)_parameters.size()) { - return _parameters[n]._name; - } - return bogus_string; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -parameter_is_this(int n) const { - if (n >= 0 && n < (int)_parameters.size()) { - return (_parameters[n]._parameter_flags & PF_is_this) != 0; - } - return false; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -parameter_is_optional(int n) const { - if (n >= 0 && n < (int)_parameters.size()) { - return (_parameters[n]._parameter_flags & PF_is_optional) != 0; - } - return false; -} - -/** - * - */ -INLINE const std::string &InterrogateFunctionWrapper:: -get_unique_name() const { - return _unique_name; -} - -/** - * - */ -INLINE bool InterrogateFunctionWrapper:: -has_comment() const { - return !_comment.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateFunctionWrapper:: -get_comment() const { - return _comment; -} - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateFunctionWrapper &wrapper) { - wrapper.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateFunctionWrapper &wrapper) { - wrapper.input(in); - return in; -} - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateFunctionWrapper::Parameter &p) { - p.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateFunctionWrapper::Parameter &p) { - p.input(in); - return in; -} diff --git a/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx b/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx deleted file mode 100644 index 9cad10ef4e..0000000000 --- a/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateFunctionWrapper.cxx - * @author drose - * @date 2000-08-06 - */ - -#include "interrogateFunctionWrapper.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" - -#include - -using std::istream; -using std::ostream; - -/** - * - */ -void InterrogateFunctionWrapper::Parameter:: -output(ostream &out) const { - idf_output_string(out, _name); - out << _parameter_flags << " " << _type << " "; -} - -/** - * - */ -void InterrogateFunctionWrapper::Parameter:: -input(istream &in) { - idf_input_string(in, _name); - in >> _parameter_flags >> _type; -} - -/** - * Formats the InterrogateFunctionWrapper data for output to a data file. - */ -void InterrogateFunctionWrapper:: -output(ostream &out) const { - InterrogateComponent::output(out); - out << _flags << " " - << _function << " " - << _return_type << " " - << _return_value_destructor << " "; - idf_output_string(out, _unique_name); - idf_output_string(out, _comment); - idf_output_vector(out, _parameters); -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateFunctionWrapper:: -input(istream &in) { - InterrogateComponent::input(in); - in >> _flags - >> _function - >> _return_type - >> _return_value_destructor; - idf_input_string(in, _unique_name); - idf_input_string(in, _comment); - idf_input_vector(in, _parameters); -} - -/** - * Remaps all internal index numbers according to the indicated map. This - * called from InterrogateDatabase::remap_indices(). - */ -void InterrogateFunctionWrapper:: -remap_indices(const IndexRemapper &remap) { - _return_value_destructor = remap.map_from(_return_value_destructor); - _return_type = remap.map_from(_return_type); - - Parameters::iterator pi; - for (pi = _parameters.begin(); pi != _parameters.end(); ++pi) { - (*pi)._type = remap.map_from((*pi)._type); - } -} diff --git a/dtool/src/interrogatedb/interrogateFunctionWrapper.h b/dtool/src/interrogatedb/interrogateFunctionWrapper.h deleted file mode 100644 index 3fca6f3400..0000000000 --- a/dtool/src/interrogatedb/interrogateFunctionWrapper.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateFunctionWrapper.h - * @author drose - * @date 2000-08-06 - */ - -#ifndef INTERROGATEFUNCTIONWRAPPER_H -#define INTERROGATEFUNCTIONWRAPPER_H - -#include "dtoolbase.h" - -#include "interrogateComponent.h" - -#include - -class IndexRemapper; - -/** - * An internal representation of a callable function. - */ -class EXPCL_INTERROGATEDB InterrogateFunctionWrapper : public InterrogateComponent { -public: - INLINE InterrogateFunctionWrapper(InterrogateModuleDef *def = nullptr); - INLINE InterrogateFunctionWrapper(const InterrogateFunctionWrapper ©); - INLINE void operator = (const InterrogateFunctionWrapper ©); - - INLINE FunctionIndex get_function() const; - - INLINE bool is_callable_by_name() const; - INLINE bool is_copy_constructor() const; - INLINE bool is_coerce_constructor() const; - INLINE bool is_extension() const; - INLINE bool is_deprecated() const; - - INLINE bool has_return_value() const; - INLINE TypeIndex get_return_type() const; - INLINE bool caller_manages_return_value() const; - INLINE FunctionIndex get_return_value_destructor() const; - - INLINE int number_of_parameters() const; - INLINE TypeIndex parameter_get_type(int n) const; - INLINE bool parameter_has_name(int n) const; - INLINE const std::string ¶meter_get_name(int n) const; - INLINE bool parameter_is_this(int n) const; - INLINE bool parameter_is_optional(int n) const; - - INLINE const std::string &get_unique_name() const; - - INLINE bool has_comment() const; - INLINE const std::string &get_comment() const; - - void output(std::ostream &out) const; - void input(std::istream &in); - - void remap_indices(const IndexRemapper &remap); - -private: - enum Flags { - F_caller_manages = 0x0001, - F_has_return = 0x0002, - F_callable_by_name = 0x0004, - F_copy_constructor = 0x0008, - F_coerce_constructor = 0x0010, - F_extension = 0x0020, - F_deprecated = 0x0040, - }; - - enum ParameterFlags { - PF_has_name = 0x0001, - PF_is_this = 0x0002, - PF_is_optional = 0x0004, - }; - - int _flags; - FunctionIndex _function; - TypeIndex _return_type; - FunctionIndex _return_value_destructor; - std::string _unique_name; - std::string _comment; - -public: - // This nested class must be declared public just so we can declare the - // external ostream and istream IO operator functions, on the SGI compiler. - // Arguably a compiler bug, but what can you do. - class Parameter { - public: - void output(std::ostream &out) const; - void input(std::istream &in); - - int _parameter_flags; - TypeIndex _type; - std::string _name; - }; - -private: - typedef std::vector Parameters; - Parameters _parameters; - - friend class InterrogateBuilder; - friend class FunctionRemap; -}; - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateFunctionWrapper &wrapper); -INLINE std::istream &operator >> (std::istream &in, InterrogateFunctionWrapper &wrapper); - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateFunctionWrapper::Parameter &p); -INLINE std::istream &operator >> (std::istream &in, InterrogateFunctionWrapper::Parameter &p); - -#include "interrogateFunctionWrapper.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.I b/dtool/src/interrogatedb/interrogateMakeSeq.I deleted file mode 100644 index 82e01761ea..0000000000 --- a/dtool/src/interrogatedb/interrogateMakeSeq.I +++ /dev/null @@ -1,103 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateMakeSeq.I - * @author drose - * @date 2009-09-15 - */ - -/** - * - */ -INLINE InterrogateMakeSeq:: -InterrogateMakeSeq(InterrogateModuleDef *def) : - InterrogateComponent(def) -{ - _length_getter = 0; - _element_getter = 0; -} - -/** - * - */ -INLINE InterrogateMakeSeq:: -InterrogateMakeSeq(const InterrogateMakeSeq ©) { - (*this) = copy; -} - -/** - * - */ -INLINE void InterrogateMakeSeq:: -operator = (const InterrogateMakeSeq ©) { - InterrogateComponent::operator = (copy); - _scoped_name = copy._scoped_name; - _comment = copy._comment; - _length_getter = copy._length_getter; - _element_getter = copy._element_getter; -} - -/** - * - */ -INLINE bool InterrogateMakeSeq:: -has_scoped_name() const { - return !_scoped_name.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateMakeSeq:: -get_scoped_name() const { - return _scoped_name; -} - -/** - * - */ -INLINE bool InterrogateMakeSeq:: -has_comment() const { - return !_comment.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateMakeSeq:: -get_comment() const { - return _comment; -} - -/** - * - */ -INLINE FunctionIndex InterrogateMakeSeq:: -get_length_getter() const { - return _length_getter; -} - -/** - * - */ -INLINE FunctionIndex InterrogateMakeSeq:: -get_element_getter() const { - return _element_getter; -} - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateMakeSeq &make_seq) { - make_seq.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateMakeSeq &make_seq) { - make_seq.input(in); - return in; -} diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.cxx b/dtool/src/interrogatedb/interrogateMakeSeq.cxx deleted file mode 100644 index d875a91809..0000000000 --- a/dtool/src/interrogatedb/interrogateMakeSeq.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateMakeSeq.cxx - * @author drose - * @date 2009-09-15 - */ - -#include "interrogateMakeSeq.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" - -/** - * Formats the InterrogateMakeSeq data for output to a data file. - */ -void InterrogateMakeSeq:: -output(std::ostream &out) const { - InterrogateComponent::output(out); - out << _length_getter << " " - << _element_getter << " "; - idf_output_string(out, _scoped_name); - idf_output_string(out, _comment, '\n'); -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateMakeSeq:: -input(std::istream &in) { - InterrogateComponent::input(in); - - in >> _length_getter >> _element_getter; - idf_input_string(in, _scoped_name); - idf_input_string(in, _comment); -} - -/** - * Remaps all internal index numbers according to the indicated map. This - * called from InterrogateDatabase::remap_indices(). - */ -void InterrogateMakeSeq:: -remap_indices(const IndexRemapper &remap) { - _length_getter = remap.map_from(_length_getter); - _element_getter = remap.map_from(_element_getter); -} diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.h b/dtool/src/interrogatedb/interrogateMakeSeq.h deleted file mode 100644 index 5d6e1858b2..0000000000 --- a/dtool/src/interrogatedb/interrogateMakeSeq.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateMakeSeq.h - * @author drose - * @date 2009-09-15 - */ - -#ifndef INTERROGATEMAKESEQ_H -#define INTERROGATEMAKESEQ_H - -#include "dtoolbase.h" - -#include "interrogateComponent.h" - -class IndexRemapper; - -/** - * Represents a synthetic method created via the MAKE_SEQ() macro. - */ -class EXPCL_INTERROGATEDB InterrogateMakeSeq : public InterrogateComponent { -public: - INLINE InterrogateMakeSeq(InterrogateModuleDef *def = nullptr); - INLINE InterrogateMakeSeq(const InterrogateMakeSeq ©); - INLINE void operator = (const InterrogateMakeSeq ©); - - INLINE bool has_scoped_name() const; - INLINE const std::string &get_scoped_name() const; - - INLINE bool has_comment() const; - INLINE const std::string &get_comment() const; - - INLINE FunctionIndex get_length_getter() const; - INLINE FunctionIndex get_element_getter() const; - - void output(std::ostream &out) const; - void input(std::istream &in); - - void remap_indices(const IndexRemapper &remap); - -private: - std::string _scoped_name; - std::string _comment; - FunctionIndex _length_getter; - FunctionIndex _element_getter; - - friend class InterrogateBuilder; -}; - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateMakeSeq &make_seq); -INLINE std::istream &operator >> (std::istream &in, InterrogateMakeSeq &make_seq); - -#include "interrogateMakeSeq.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateManifest.I b/dtool/src/interrogatedb/interrogateManifest.I deleted file mode 100644 index 2aedf8a682..0000000000 --- a/dtool/src/interrogatedb/interrogateManifest.I +++ /dev/null @@ -1,116 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateManifest.I - * @author drose - * @date 2000-08-11 - */ - -/** - * - */ -INLINE InterrogateManifest:: -InterrogateManifest(InterrogateModuleDef *def) : - InterrogateComponent(def) -{ - _flags = 0; - _int_value = 0; - _type = 0; - _getter = 0; -} - -/** - * - */ -INLINE InterrogateManifest:: -InterrogateManifest(const InterrogateManifest ©) { - (*this) = copy; -} - -/** - * - */ -INLINE void InterrogateManifest:: -operator = (const InterrogateManifest ©) { - InterrogateComponent::operator = (copy); - _flags = copy._flags; - _definition = copy._definition; - _int_value = copy._int_value; - _type = copy._type; - _getter = copy._getter; -} - - -/** - * - */ -INLINE const std::string &InterrogateManifest:: -get_definition() const { - return _definition; -} - -/** - * - */ -INLINE bool InterrogateManifest:: -has_type() const { - return (_flags & F_has_type) != 0; -} - -/** - * - */ -INLINE TypeIndex InterrogateManifest:: -get_type() const { - return _type; -} - -/** - * - */ -INLINE bool InterrogateManifest:: -has_getter() const { - return (_flags & F_has_getter) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateManifest:: -get_getter() const { - return _getter; -} - -/** - * - */ -INLINE bool InterrogateManifest:: -has_int_value() const { - return (_flags & F_has_int_value) != 0; -} - -/** - * - */ -INLINE int InterrogateManifest:: -get_int_value() const { - return _int_value; -} - - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateManifest &manifest) { - manifest.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateManifest &manifest) { - manifest.input(in); - return in; -} diff --git a/dtool/src/interrogatedb/interrogateManifest.cxx b/dtool/src/interrogatedb/interrogateManifest.cxx deleted file mode 100644 index a078e868f4..0000000000 --- a/dtool/src/interrogatedb/interrogateManifest.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateManifest.cxx - * @author drose - * @date 2000-08-11 - */ - -#include "interrogateManifest.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" - -/** - * Formats the InterrogateManifest data for output to a data file. - */ -void InterrogateManifest:: -output(std::ostream &out) const { - InterrogateComponent::output(out); - out << _flags << " " - << _int_value << " " - << _type << " " - << _getter << " "; - idf_output_string(out, _definition); -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateManifest:: -input(std::istream &in) { - InterrogateComponent::input(in); - in >> _flags >> _int_value >> _type >> _getter; - idf_input_string(in, _definition); -} - -/** - * Remaps all internal index numbers according to the indicated map. This - * called from InterrogateDatabase::remap_indices(). - */ -void InterrogateManifest:: -remap_indices(const IndexRemapper &remap) { - _type = remap.map_from(_type); - _getter = remap.map_from(_getter); -} diff --git a/dtool/src/interrogatedb/interrogateManifest.h b/dtool/src/interrogatedb/interrogateManifest.h deleted file mode 100644 index a038cc0ce1..0000000000 --- a/dtool/src/interrogatedb/interrogateManifest.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateManifest.h - * @author drose - * @date 2000-08-11 - */ - -#ifndef INTERROGATEMANIFEST_H -#define INTERROGATEMANIFEST_H - -#include "dtoolbase.h" - -#include "interrogateComponent.h" - -class IndexRemapper; - -/** - * An internal representation of a manifest constant. - */ -class EXPCL_INTERROGATEDB InterrogateManifest : public InterrogateComponent { -public: - INLINE InterrogateManifest(InterrogateModuleDef *def = nullptr); - INLINE InterrogateManifest(const InterrogateManifest ©); - INLINE void operator = (const InterrogateManifest ©); - - INLINE const std::string &get_definition() const; - INLINE bool has_type() const; - INLINE TypeIndex get_type() const; - INLINE bool has_getter() const; - INLINE FunctionIndex get_getter() const; - INLINE bool has_int_value() const; - INLINE int get_int_value() const; - - void output(std::ostream &out) const; - void input(std::istream &in); - - void remap_indices(const IndexRemapper &remap); - -private: - enum Flags { - F_has_type = 0x0001, - F_has_getter = 0x0002, - F_has_int_value = 0x0004 - }; - - int _flags; - std::string _definition; - int _int_value; - TypeIndex _type; - FunctionIndex _getter; - - friend class InterrogateBuilder; -}; - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateManifest &manifest); -INLINE std::istream &operator >> (std::istream &in, InterrogateManifest &manifest); - -#include "interrogateManifest.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogateType.I b/dtool/src/interrogatedb/interrogateType.I deleted file mode 100644 index 64c164e83e..0000000000 --- a/dtool/src/interrogatedb/interrogateType.I +++ /dev/null @@ -1,594 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateType.I - * @author drose - * @date 2000-07-31 - */ - -/** - * Returns true if the type is marked as 'global'. This means only that it - * should appear in the global type list. - */ -INLINE bool InterrogateType:: -is_global() const { - return (_flags & F_global) != 0; -} - -/** - * Returns true if the type is marked as 'deprecated'. - * - * @since 1.11.0 - */ -INLINE bool InterrogateType:: -is_deprecated() const { - return (_flags & F_deprecated) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -has_scoped_name() const { - return !_scoped_name.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateType:: -get_scoped_name() const { - return _scoped_name; -} - -/** - * - */ -INLINE bool InterrogateType:: -has_true_name() const { - return !_true_name.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateType:: -get_true_name() const { - return _true_name; -} - -/** - * - */ -INLINE bool InterrogateType:: -has_comment() const { - return !_comment.empty(); -} - -/** - * - */ -INLINE const std::string &InterrogateType:: -get_comment() const { - return _comment; -} - -/** - * Returns true if this type is nested within some class definition. - */ -INLINE bool InterrogateType:: -is_nested() const { - return (_flags & F_nested) != 0; -} - -/** - * If is_nested() returns true, this is the class within which this type is - * defined. - */ -INLINE TypeIndex InterrogateType:: -get_outer_class() const { - return _outer_class; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_atomic() const { - return (_flags & F_atomic) != 0; -} - -/** - * - */ -INLINE AtomicToken InterrogateType:: -get_atomic_token() const { - return _atomic_token; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_unsigned() const { - return (_flags & F_unsigned) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_signed() const { - return (_flags & F_signed) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_long() const { - return (_flags & F_long) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_longlong() const { - return (_flags & F_longlong) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_short() const { - return (_flags & F_short) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_wrapped() const { - return (_flags & F_wrapped) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_pointer() const { - return (_flags & F_pointer) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_const() const { - return (_flags & F_const) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_typedef() const { - return (_flags & F_typedef) != 0; -} - -/** - * - */ -INLINE TypeIndex InterrogateType:: -get_wrapped_type() const { - return _wrapped_type; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_array() const { - return (_flags & F_array) != 0; -} - -/** - * - */ -INLINE int InterrogateType:: -get_array_size() const { - return _array_size; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_enum() const { - return (_flags & F_enum) != 0; -} - -/** - * Returns true if enum values are only available under a scope. - */ -INLINE bool InterrogateType:: -is_scoped_enum() const { - return (_flags & F_scoped_enum) != 0; -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_enum_values() const { - return _enum_values.size(); -} - -/** - * - */ -INLINE const std::string &InterrogateType:: -get_enum_value_name(int n) const { - if (n >= 0 && n < (int)_enum_values.size()) { - return _enum_values[n]._name; - } - return _empty_string; -} - -/** - * - */ -INLINE const std::string &InterrogateType:: -get_enum_value_scoped_name(int n) const { - if (n >= 0 && n < (int)_enum_values.size()) { - return _enum_values[n]._scoped_name; - } - return _empty_string; -} - -/** - * - */ -INLINE const std::string &InterrogateType:: -get_enum_value_comment(int n) const { - if (n >= 0 && n < (int)_enum_values.size()) { - return _enum_values[n]._comment; - } - return _empty_string; -} - -/** - * - */ -INLINE int InterrogateType:: -get_enum_value(int n) const { - if (n >= 0 && n < (int)_enum_values.size()) { - return _enum_values[n]._value; - } - return 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_struct() const { - return (_flags & F_struct) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_class() const { - return (_flags & F_class) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_union() const { - return (_flags & F_union) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_final() const { - return (_flags & F_final) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -is_fully_defined() const { - return (_flags & F_fully_defined) != 0; -} - -/** - * Returns true if the type is an unpublished type. This either means the - * type is a nested type, and it is protected or private within its scope, or - * that its definition is simply not marked as 'published'. - */ -INLINE bool InterrogateType:: -is_unpublished() const { - return (_flags & F_unpublished) != 0; -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_constructors() const { - return _constructors.size(); -} - -/** - * - */ -INLINE FunctionIndex InterrogateType:: -get_constructor(int n) const { - if (n >= 0 && n < (int)_constructors.size()) { - return _constructors[n]; - } else { - return 0; - } -} - -/** - * - */ -INLINE bool InterrogateType:: -has_destructor() const { - return (_destructor != 0); -} - -/** - * - */ -INLINE bool InterrogateType:: -destructor_is_inherited() const { - return (_flags & F_inherited_destructor) != 0; -} - -/** - * - */ -INLINE bool InterrogateType:: -destructor_is_implicit() const { - return (_flags & F_implicit_destructor) != 0; -} - -/** - * - */ -INLINE FunctionIndex InterrogateType:: -get_destructor() const { - return _destructor; -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_elements() const { - return _elements.size(); -} - -/** - * - */ -INLINE ElementIndex InterrogateType:: -get_element(int n) const { - if (n >= 0 && n < (int)_elements.size()) { - return _elements[n]; - } else { - return 0; - } -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_methods() const { - return _methods.size(); -} - -/** - * - */ -INLINE FunctionIndex InterrogateType:: -get_method(int n) const { - if (n >= 0 && n < (int)_methods.size()) { - return _methods[n]; - } else { - return 0; - } -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_make_seqs() const { - return _make_seqs.size(); -} - -/** - * - */ -INLINE MakeSeqIndex InterrogateType:: -get_make_seq(int n) const { - if (n >= 0 && n < (int)_make_seqs.size()) { - return _make_seqs[n]; - } else { - return 0; - } -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_casts() const { - return _casts.size(); -} - -/** - * - */ -INLINE FunctionIndex InterrogateType:: -get_cast(int n) const { - if (n >= 0 && n < (int)_casts.size()) { - return _casts[n]; - } else { - return 0; - } -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_derivations() const { - return _derivations.size(); -} - -/** - * - */ -INLINE TypeIndex InterrogateType:: -get_derivation(int n) const { - if (n >= 0 && n < (int)_derivations.size()) { - return _derivations[n]._base; - } else { - return 0; - } -} - -/** - * - */ -INLINE bool InterrogateType:: -derivation_has_upcast(int n) const { - if (n >= 0 && n < (int)_derivations.size()) { - return (_derivations[n]._flags & DF_upcast) != 0; - } else { - return false; - } -} - -/** - * - */ -INLINE TypeIndex InterrogateType:: -derivation_get_upcast(int n) const { - if (n >= 0 && n < (int)_derivations.size()) { - return _derivations[n]._upcast; - } else { - return 0; - } -} - -/** - * - */ -INLINE bool InterrogateType:: -derivation_downcast_is_impossible(int n) const { - if (n >= 0 && n < (int)_derivations.size()) { - return (_derivations[n]._flags & DF_downcast_impossible) != 0; - } else { - return false; - } -} - -/** - * - */ -INLINE bool InterrogateType:: -derivation_has_downcast(int n) const { - if (n >= 0 && n < (int)_derivations.size()) { - return (_derivations[n]._flags & DF_downcast) != 0; - } else { - return false; - } -} - -/** - * - */ -INLINE TypeIndex InterrogateType:: -derivation_get_downcast(int n) const { - if (n >= 0 && n < (int)_derivations.size()) { - return _derivations[n]._downcast; - } else { - return 0; - } -} - -/** - * - */ -INLINE int InterrogateType:: -number_of_nested_types() const { - return _nested_types.size(); -} - -/** - * - */ -INLINE TypeIndex InterrogateType:: -get_nested_type(int n) const { - if (n >= 0 && n < (int)_nested_types.size()) { - return _nested_types[n]; - } else { - return 0; - } -} - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateType &type) { - type.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateType &type) { - type.input(in); - return in; -} - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateType::Derivation &d) { - d.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateType::Derivation &d) { - d.input(in); - return in; -} - -INLINE std::ostream & -operator << (std::ostream &out, const InterrogateType::EnumValue &ev) { - ev.output(out); - return out; -} - -INLINE std::istream & -operator >> (std::istream &in, InterrogateType::EnumValue &ev) { - ev.input(in); - return in; -} diff --git a/dtool/src/interrogatedb/interrogateType.cxx b/dtool/src/interrogatedb/interrogateType.cxx deleted file mode 100644 index a9b9404cd4..0000000000 --- a/dtool/src/interrogatedb/interrogateType.cxx +++ /dev/null @@ -1,247 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateType.cxx - * @author drose - * @date 2000-07-31 - */ - -#include "interrogateType.h" -#include "indexRemapper.h" -#include "interrogate_datafile.h" -#include "interrogateDatabase.h" - -#include - -using std::istream; -using std::ostream; - -/** - * - */ -InterrogateType:: -InterrogateType(InterrogateModuleDef *def) : - InterrogateComponent(def) -{ - _flags = 0; - _outer_class = 0; - _atomic_token = AT_not_atomic; - _wrapped_type = 0; - _array_size = 1; - _destructor = 0; - - _cpptype = nullptr; - _cppscope = nullptr; -} - -/** - * - */ -InterrogateType:: -InterrogateType(const InterrogateType ©) { - (*this) = copy; -} - -/** - * - */ -void InterrogateType::Derivation:: -output(ostream &out) const { - out << _flags << " " << _base << " " << _upcast << " " << _downcast; -} - -/** - * - */ -void InterrogateType::Derivation:: -input(istream &in) { - in >> _flags >> _base >> _upcast >> _downcast; -} - -/** - * - */ -void InterrogateType::EnumValue:: -output(ostream &out) const { - idf_output_string(out, _name); - idf_output_string(out, _scoped_name); - idf_output_string(out, _comment, '\n'); - out << _value; -} - -/** - * - */ -void InterrogateType::EnumValue:: -input(istream &in) { - idf_input_string(in, _name); - idf_input_string(in, _scoped_name); - idf_input_string(in, _comment); - in >> _value; -} - -/** - * - */ -void InterrogateType:: -operator = (const InterrogateType ©) { - InterrogateComponent::operator = (copy); - _flags = copy._flags; - _scoped_name = copy._scoped_name; - _true_name = copy._true_name; - _comment = copy._comment; - _outer_class = copy._outer_class; - _atomic_token = copy._atomic_token; - _wrapped_type = copy._wrapped_type; - _array_size = copy._array_size; - _constructors = copy._constructors; - _destructor = copy._destructor; - _elements = copy._elements; - _methods = copy._methods; - _make_seqs = copy._make_seqs; - _casts = copy._casts; - _derivations = copy._derivations; - _enum_values = copy._enum_values; - _nested_types = copy._nested_types; - - _cpptype = copy._cpptype; - _cppscope = copy._cppscope; -} - -/** - * Combines type with the other similar definition. If one type is "fully - * defined" and the other one isn't, the fully-defined type wins. If both - * types are fully defined, whichever type is marked "global" wins. - */ -void InterrogateType:: -merge_with(const InterrogateType &other) { - // The only thing we care about copying from the non-fully-defined type - // right now is the global flag. - - if (is_fully_defined() && - (!other.is_fully_defined() || (other._flags & F_global) == 0)) { - // We win. - _flags |= (other._flags & F_global); - - } else { - // They win. - int old_flags = (_flags & F_global); - (*this) = other; - _flags |= old_flags; - } -} - -/** - * Formats the InterrogateType data for output to a data file. - */ -void InterrogateType:: -output(ostream &out) const { - InterrogateComponent::output(out); - - out << _flags << " "; - idf_output_string(out, _scoped_name); - idf_output_string(out, _true_name); - out << _outer_class << " " - << (int)_atomic_token << " " - << _wrapped_type << " "; - - if (is_array()) { - out << _array_size << " "; - } - - idf_output_vector(out, _constructors); - out << _destructor << " "; - idf_output_vector(out, _elements); - idf_output_vector(out, _methods); - idf_output_vector(out, _make_seqs); - idf_output_vector(out, _casts); - idf_output_vector(out, _derivations); - idf_output_vector(out, _enum_values); - idf_output_vector(out, _nested_types); - idf_output_string(out, _comment, '\n'); -} - -/** - * Reads the data file as previously formatted by output(). - */ -void InterrogateType:: -input(istream &in) { - InterrogateComponent::input(in); - - in >> _flags; - idf_input_string(in, _scoped_name); - idf_input_string(in, _true_name); - - in >> _outer_class; - int token; - in >> token; - _atomic_token = (AtomicToken)token; - in >> _wrapped_type; - - if (is_array()) { - in >> _array_size; - } - - idf_input_vector(in, _constructors); - in >> _destructor; - - idf_input_vector(in, _elements); - idf_input_vector(in, _methods); - idf_input_vector(in, _make_seqs); - idf_input_vector(in, _casts); - idf_input_vector(in, _derivations); - idf_input_vector(in, _enum_values); - idf_input_vector(in, _nested_types); - idf_input_string(in, _comment); -} - -/** - * Remaps all internal index numbers according to the indicated map. This - * called from InterrogateDatabase::remap_indices(). - */ -void InterrogateType:: -remap_indices(const IndexRemapper &remap) { - _outer_class = remap.map_from(_outer_class); - _wrapped_type = remap.map_from(_wrapped_type); - - Functions::iterator fi; - for (fi = _constructors.begin(); fi != _constructors.end(); ++fi) { - (*fi) = remap.map_from(*fi); - } - _destructor = remap.map_from(_destructor); - - Elements::iterator ei; - for (ei = _elements.begin(); ei != _elements.end(); ++ei) { - (*ei) = remap.map_from(*ei); - } - - for (fi = _methods.begin(); fi != _methods.end(); ++fi) { - (*fi) = remap.map_from(*fi); - } - for (fi = _casts.begin(); fi != _casts.end(); ++fi) { - (*fi) = remap.map_from(*fi); - } - - MakeSeqs::iterator si; - for (si = _make_seqs.begin(); si != _make_seqs.end(); ++si) { - (*si) = remap.map_from(*si); - } - - Derivations::iterator di; - for (di = _derivations.begin(); di != _derivations.end(); ++di) { - (*di)._base = remap.map_from((*di)._base); - (*di)._upcast = remap.map_from((*di)._upcast); - (*di)._downcast = remap.map_from((*di)._downcast); - } - - Types::iterator ti; - for (ti = _nested_types.begin(); ti != _nested_types.end(); ++ti) { - (*ti) = remap.map_from(*ti); - } - -} diff --git a/dtool/src/interrogatedb/interrogateType.h b/dtool/src/interrogatedb/interrogateType.h deleted file mode 100644 index c9f67aff26..0000000000 --- a/dtool/src/interrogatedb/interrogateType.h +++ /dev/null @@ -1,239 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogateType.h - * @author drose - * @date 2000-07-31 - */ - -#ifndef INTERROGATETYPE_H -#define INTERROGATETYPE_H - -#include "dtoolbase.h" - -#include "interrogateComponent.h" - -#include - -class IndexRemapper; -class CPPType; -class CPPScope; - -/** - * An internal representation of a type. - */ -class EXPCL_INTERROGATEDB InterrogateType : public InterrogateComponent { -public: - InterrogateType(InterrogateModuleDef *def = nullptr); - InterrogateType(const InterrogateType ©); - void operator = (const InterrogateType ©); - - INLINE bool is_global() const; - INLINE bool is_deprecated() const; - - INLINE bool has_scoped_name() const; - INLINE const std::string &get_scoped_name() const; - - INLINE bool has_true_name() const; - INLINE const std::string &get_true_name() const; - - INLINE bool has_comment() const; - INLINE const std::string &get_comment() const; - - INLINE bool is_nested() const; - INLINE TypeIndex get_outer_class() const; - - INLINE bool is_atomic() const; - INLINE AtomicToken get_atomic_token() const; - INLINE bool is_unsigned() const; - INLINE bool is_signed() const; - INLINE bool is_long() const; - INLINE bool is_longlong() const; - INLINE bool is_short() const; - - INLINE bool is_wrapped() const; - INLINE bool is_pointer() const; - INLINE bool is_const() const; - INLINE bool is_typedef() const; - INLINE TypeIndex get_wrapped_type() const; - - INLINE bool is_array() const; - INLINE int get_array_size() const; - - INLINE bool is_enum() const; - INLINE bool is_scoped_enum() const; - INLINE int number_of_enum_values() const; - INLINE const std::string &get_enum_value_name(int n) const; - INLINE const std::string &get_enum_value_scoped_name(int n) const; - INLINE const std::string &get_enum_value_comment(int n) const; - INLINE int get_enum_value(int n) const; - - INLINE bool is_struct() const; - INLINE bool is_class() const; - INLINE bool is_union() const; - INLINE bool is_final() const; - - INLINE bool is_fully_defined() const; - INLINE bool is_unpublished() const; - INLINE int number_of_constructors() const; - INLINE FunctionIndex get_constructor(int n) const; - INLINE bool has_destructor() const; - INLINE bool destructor_is_inherited() const; - INLINE bool destructor_is_implicit() const; - INLINE FunctionIndex get_destructor() const; - INLINE int number_of_elements() const; - INLINE ElementIndex get_element(int n) const; - INLINE int number_of_methods() const; - INLINE FunctionIndex get_method(int n) const; - INLINE int number_of_make_seqs() const; - INLINE MakeSeqIndex get_make_seq(int n) const; - - INLINE int number_of_casts() const; - INLINE FunctionIndex get_cast(int n) const; - - INLINE int number_of_derivations() const; - INLINE TypeIndex get_derivation(int n) const; - - INLINE bool derivation_has_upcast(int n) const; - INLINE FunctionIndex derivation_get_upcast(int n) const; - - INLINE bool derivation_downcast_is_impossible(int n) const; - INLINE bool derivation_has_downcast(int n) const; - INLINE FunctionIndex derivation_get_downcast(int n) const; - - INLINE int number_of_nested_types() const; - INLINE TypeIndex get_nested_type(int n) const; - - void merge_with(const InterrogateType &other); - void output(std::ostream &out) const; - void input(std::istream &in); - - void remap_indices(const IndexRemapper &remap); - -private: - enum Flags { - F_global = 0x000001, - F_atomic = 0x000002, - F_unsigned = 0x000004, - F_signed = 0x000008, - F_long = 0x000010, - F_longlong = 0x000020, - F_short = 0x000040, - F_wrapped = 0x000080, - F_pointer = 0x000100, - F_const = 0x000200, - F_struct = 0x000400, - F_class = 0x000800, - F_union = 0x001000, - F_fully_defined = 0x002000, - F_true_destructor = 0x004000, - F_private_destructor = 0x008000, - F_inherited_destructor = 0x010000, - F_implicit_destructor = 0x020000, - F_nested = 0x040000, - F_enum = 0x080000, - F_unpublished = 0x100000, - F_typedef = 0x200000, - F_array = 0x400000, - F_scoped_enum = 0x800000, - F_final =0x1000000, - F_deprecated =0x2000000, - }; - -public: - int _flags; - - std::string _scoped_name; - std::string _true_name; - std::string _comment; - TypeIndex _outer_class; - AtomicToken _atomic_token; - TypeIndex _wrapped_type; - int _array_size; - - typedef std::vector Functions; - Functions _constructors; - FunctionIndex _destructor; - - typedef std::vector Elements; - Elements _elements; - Functions _methods; - Functions _casts; - - typedef std::vector MakeSeqs; - MakeSeqs _make_seqs; - - enum DerivationFlags { - DF_upcast = 0x01, - DF_downcast = 0x02, - DF_downcast_impossible = 0x04 - }; - -public: - // This nested class must be declared public just so we can declare the - // external ostream and istream IO operator functions, on the SGI compiler. - // Arguably a compiler bug, but what can you do. - class Derivation { - public: - void output(std::ostream &out) const; - void input(std::istream &in); - - int _flags; - TypeIndex _base; - FunctionIndex _upcast; - FunctionIndex _downcast; - }; - -private: - typedef std::vector Derivations; - Derivations _derivations; - -public: - // This nested class must also be public, for the same reason. - class EnumValue { - public: - void output(std::ostream &out) const; - void input(std::istream &in); - - std::string _name; - std::string _scoped_name; - std::string _comment; - int _value; - }; - -private: - typedef std::vector EnumValues; - EnumValues _enum_values; - - typedef std::vector Types; - Types _nested_types; - -public: - // The rest of the members in this class aren't part of the public interface - // to interrogate, but are used internally as the interrogate database is - // built. They are valid only during the session of interrogate that - // generates the database, and will not be filled in when the database is - // reloaded from disk. - CPPType *_cpptype; - CPPScope *_cppscope; - - friend class InterrogateBuilder; -}; - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateType &type); -INLINE std::istream &operator >> (std::istream &in, InterrogateType &type); - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateType::Derivation &d); -INLINE std::istream &operator >> (std::istream &in, InterrogateType::Derivation &d); - -INLINE std::ostream &operator << (std::ostream &out, const InterrogateType::EnumValue &d); -INLINE std::istream &operator >> (std::istream &in, InterrogateType::EnumValue &d); - -#include "interrogateType.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogate_datafile.I b/dtool/src/interrogatedb/interrogate_datafile.I deleted file mode 100644 index cb020861e2..0000000000 --- a/dtool/src/interrogatedb/interrogate_datafile.I +++ /dev/null @@ -1,51 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogate_datafile.I - * @author drose - * @date 2000-08-09 - */ - -/** - * Writes the indicated vector to the output file. Each component is written - * using its normal ostream output operator. - */ -template -void -idf_output_vector(std::ostream &out, const std::vector &vec) { - out << vec.size() << " "; - typename std::vector::const_iterator vi; - for (vi = vec.begin(); vi != vec.end(); ++vi) { - out << (*vi) << " "; - } -} - - -/** - * Reads the given vector from the input file, as previously written by - * output_string(). Each component is read using its normal istream input - * operator. - */ -template -void -idf_input_vector(std::istream &in, std::vector &vec) { - int length; - in >> length; - if (in.fail()) { - return; - } - - vec.clear(); - vec.reserve(length); - while (length > 0) { - Element elem; - in >> elem; - vec.push_back(elem); - length--; - } -} diff --git a/dtool/src/interrogatedb/interrogate_datafile.cxx b/dtool/src/interrogatedb/interrogate_datafile.cxx deleted file mode 100644 index a61defb368..0000000000 --- a/dtool/src/interrogatedb/interrogate_datafile.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogate_datafile.cxx - * @author drose - * @date 2000-08-09 - */ - -#include "interrogate_datafile.h" - -using std::istream; -using std::ostream; -using std::string; - - -/** - * Writes the indicated string to the output file. Uses the given whitespace - * character to separate the string's length and its contents. - */ -void -idf_output_string(ostream &out, const string &str, char whitespace) { - out << str.length() << whitespace; - if (!str.empty()) { - out << str << whitespace; - } -} - -/** - * Reads the given string from the input file, as previously written by - * output_string(). - */ -void -idf_input_string(istream &in, string &str) { - int length; - in >> length; - if (in.fail()) { - return; - } - - // Skip one character of whitespace, and then read the string. - in.get(); - str = ""; - while (length > 0) { - str += in.get(); - length--; - } -} - -/** - * Writes the indicated string to the output file. Uses the given whitespace - * character to separate the string's length and its contents. - */ -void -idf_output_string(ostream &out, const char *str, char whitespace) { - if (str == nullptr) { - out << "0 "; - } else { - out << strlen(str) << whitespace; - if (str[0] != '\0') { - out << str << whitespace; - } - } -} - -/** - * Reads the given string from the input file, as previously written by - * output_string(). - */ -void -idf_input_string(istream &in, const char *&str) { - int length; - in >> length; - if (in.fail()) { - return; - } - - if (length == 0) { - // Don't change the string if the input length is zero. - return; - } - - // Skip one character of whitespace, and then read the string. - in.get(); - char *readstr = new char[length + 1]; - int p = 0; - while (p < length) { - readstr[p] = in.get(); - p++; - } - readstr[p] = '\0'; - - str = readstr; -} diff --git a/dtool/src/interrogatedb/interrogate_datafile.h b/dtool/src/interrogatedb/interrogate_datafile.h deleted file mode 100644 index 8432123fdf..0000000000 --- a/dtool/src/interrogatedb/interrogate_datafile.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogate_datafile.h - * @author drose - * @date 2000-08-09 - */ - -#ifndef INTERROGATE_DATAFILE_H -#define INTERROGATE_DATAFILE_H - -// This file defines some convenience functions for reading and writing the -// interrogate database files. - -#include "dtoolbase.h" -#include - -void idf_output_string(std::ostream &out, const std::string &str, char whitespace = ' '); -void idf_input_string(std::istream &in, std::string &str); - -void idf_output_string(std::ostream &out, const char *str, char whitespace = ' '); -void idf_input_string(std::istream &in, const char *&str); - -template -void idf_output_vector(std::ostream &out, const std::vector &vec); - -template -void idf_input_vector(std::istream &in, std::vector &vec); - -#include "interrogate_datafile.I" - -#endif diff --git a/dtool/src/interrogatedb/interrogate_interface.cxx b/dtool/src/interrogatedb/interrogate_interface.cxx deleted file mode 100644 index a0b4ff356a..0000000000 --- a/dtool/src/interrogatedb/interrogate_interface.cxx +++ /dev/null @@ -1,1043 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogate_interface.cxx - * @author drose - * @date 2000-07-31 - */ - -#include "interrogate_interface.h" -#include "interrogateDatabase.h" -#include "interrogateType.h" -#include "interrogateFunction.h" -#include "config_interrogatedb.h" - -using std::string; - -// This function adds one more directory to the list of directories search for -// interrogate (*.in) files. In the past, this list has been defined the -// environment variable ETC_PATH, but now it is passed in by the code -// generator. -void -interrogate_add_search_directory(const char *dirname) { - // cerr << "interrogate_add_search_directory(" << dirname << ")\n"; - interrogatedb_path.append_directory(Filename::from_os_specific(dirname)); -} - -// This function works similar to the above, but adds a complete path string-- -// a list of multiple directories, separated by the standard delimiter--to the -// search path. -void -interrogate_add_search_path(const char *pathstring) { - // cerr << "interrogate_add_search_path(" << pathstring << ")\n"; - interrogatedb_path.append_path(pathstring); -} - -bool interrogate_error_flag() { - // cerr << "interrogate_error_flag\n"; - return InterrogateDatabase::get_ptr()->get_error_flag(); -} - -int -interrogate_number_of_manifests() { - // cerr << "interrogate_number_of_manifests\n"; - return InterrogateDatabase::get_ptr()->get_num_global_manifests(); -} - -ManifestIndex -interrogate_get_manifest(int n) { - // cerr << "interrogate_get_manifest(" << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_global_manifest(n); -} - -ManifestIndex -interrogate_get_manifest_by_name(const char *manifest_name) { - // cerr << "interrogate_get_manifest_by_name(" << manifest_name << ")\n"; - return InterrogateDatabase::get_ptr()->lookup_manifest_by_name(manifest_name); -} - -const char * -interrogate_manifest_name(ManifestIndex manifest) { - // cerr << "interrogate_manifest_name(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).get_name().c_str(); -} - -const char * -interrogate_manifest_definition(ManifestIndex manifest) { - // cerr << "interrogate_manifest_definition(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).get_definition().c_str(); -} - -bool -interrogate_manifest_has_type(ManifestIndex manifest) { - // cerr << "interrogate_manifest_has_type(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).has_type(); -} - -TypeIndex -interrogate_manifest_get_type(ManifestIndex manifest) { - // cerr << "interrogate_manifest_get_type(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).get_type(); -} - -bool -interrogate_manifest_has_getter(ManifestIndex manifest) { - // cerr << "interrogate_manifest_has_getter(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).has_getter(); -} - -FunctionIndex -interrogate_manifest_getter(ManifestIndex manifest) { - // cerr << "interrogate_manifest_getter(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).get_getter(); -} - -bool -interrogate_manifest_has_int_value(ManifestIndex manifest) { - // cerr << "interrogate_manifest_has_int_value(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).has_int_value(); -} - -int -interrogate_manifest_get_int_value(ManifestIndex manifest) { - // cerr << "interrogate_manifest_get_int_value(" << manifest << ")\n"; - return InterrogateDatabase::get_ptr()->get_manifest(manifest).get_int_value(); -} - -const char * -interrogate_element_name(ElementIndex element) { - // cerr << "interrogate_element_name(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_name().c_str(); -} - -const char * -interrogate_element_scoped_name(ElementIndex element) { - // cerr << "interrogate_element_scoped_name(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_scoped_name().c_str(); -} - -bool -interrogate_element_has_comment(ElementIndex element) { - // cerr << "interrogate_element_has_comment(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_comment(); -} - -const char * -interrogate_element_comment(ElementIndex element) { - // cerr << "interrogate_element_comment(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_comment().c_str(); -} - -ElementIndex -interrogate_get_element_by_name(const char *element_name) { - // cerr << "interrogate_get_element_by_name(" << element_name << ")\n"; - return InterrogateDatabase::get_ptr()->lookup_element_by_name(element_name); -} - -ElementIndex -interrogate_get_element_by_scoped_name(const char *element_name) { - // cerr << "interrogate_get_element_by_scoped_name(" << element_name << - // ")\n"; - return InterrogateDatabase::get_ptr()->lookup_element_by_scoped_name(element_name); -} - -TypeIndex -interrogate_element_type(ElementIndex element) { - // cerr << "interrogate_element_type(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_type(); -} - -bool -interrogate_element_has_getter(ElementIndex element) { - // cerr << "interrogate_element_has_getter(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_getter(); -} - -FunctionIndex -interrogate_element_getter(ElementIndex element) { - // cerr << "interrogate_element_getter(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_getter(); -} - -bool -interrogate_element_has_setter(ElementIndex element) { - // cerr << "interrogate_element_has_setter(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_setter(); -} - -FunctionIndex -interrogate_element_setter(ElementIndex element) { - // cerr << "interrogate_element_setter(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_setter(); -} - -bool -interrogate_element_has_has_function(ElementIndex element) { - // cerr << "interrogate_element_has_has_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_has_function(); -} - -FunctionIndex -interrogate_element_has_function(ElementIndex element) { - // cerr << "interrogate_element_has_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_has_function(); -} - -bool -interrogate_element_has_clear_function(ElementIndex element) { - // cerr << "interrogate_element_has_clear_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_clear_function(); -} - -FunctionIndex -interrogate_element_clear_function(ElementIndex element) { - // cerr << "interrogate_element_clear_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_clear_function(); -} - -bool -interrogate_element_has_del_function(ElementIndex element) { - // cerr << "interrogate_element_has_del_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_del_function(); -} - -FunctionIndex -interrogate_element_del_function(ElementIndex element) { - // cerr << "interrogate_element_del_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_del_function(); -} - -bool -interrogate_element_has_insert_function(ElementIndex element) { - // cerr << "interrogate_element_has_insert_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_insert_function(); -} - -FunctionIndex -interrogate_element_insert_function(ElementIndex element) { - // cerr << "interrogate_element_insert_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_insert_function(); -} - -bool -interrogate_element_has_getkey_function(ElementIndex element) { - // cerr << "interrogate_element_has_getkey_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).has_getkey_function(); -} - -FunctionIndex -interrogate_element_getkey_function(ElementIndex element) { - // cerr << "interrogate_element_getkey_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_getkey_function(); -} - -FunctionIndex -interrogate_element_length_function(ElementIndex element) { - // cerr << "interrogate_element_length_function(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).get_length_function(); -} - -bool -interrogate_element_is_sequence(ElementIndex element) { - // cerr << "interrogate_element_is_sequence(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).is_sequence(); -} - -bool -interrogate_element_is_mapping(ElementIndex element) { - // cerr << "interrogate_element_is_mapping(" << element << ")\n"; - return InterrogateDatabase::get_ptr()->get_element(element).is_mapping(); -} - -int -interrogate_number_of_globals() { - // cerr << "interrogate_number_of_globals()\n"; - return InterrogateDatabase::get_ptr()->get_num_global_elements(); -} - -ElementIndex -interrogate_get_global(int n) { - // cerr << "interrogate_get_global(" << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_global_element(n); -} - -int -interrogate_number_of_global_functions() { - // cerr << "interrogate_number_of_global_functions()\n"; - return InterrogateDatabase::get_ptr()->get_num_global_functions(); -} - -FunctionIndex -interrogate_get_global_function(int n) { - // cerr << "interrogate_get_global_function(" << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_global_function(n); -} - -int -interrogate_number_of_functions() { - // cerr << "interrogate_number_of_functions()\n"; - return InterrogateDatabase::get_ptr()->get_num_all_functions(); -} - -FunctionIndex -interrogate_get_function(int n) { - // cerr << "interrogate_get_function(" << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_all_function(n); -} - -const char * -interrogate_function_name(FunctionIndex function) { - // cerr << "interrogate_function_name(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_name().c_str(); -} - -const char * -interrogate_function_scoped_name(FunctionIndex function) { - // cerr << "interrogate_function_scoped_name(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_scoped_name().c_str(); -} - -bool -interrogate_function_has_comment(FunctionIndex function) { - // cerr << "interrogate_function_has_comment(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).has_comment(); -} - -const char * -interrogate_function_comment(FunctionIndex function) { - // cerr << "interrogate_function_comment(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_comment().c_str(); -} - -const char * -interrogate_function_prototype(FunctionIndex function) { - // cerr << "interrogate_function_prototype(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_prototype().c_str(); -} - -bool -interrogate_function_is_method(FunctionIndex function) { - // cerr << "interrogate_function_is_method(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).is_method(); -} - -TypeIndex -interrogate_function_class(FunctionIndex function) { - // cerr << "interrogate_function_class(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_class(); -} - -bool -interrogate_function_is_unary_op(FunctionIndex function) { - // cerr << "interrogate_function_is_unary_op(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).is_unary_op(); -} - -bool -interrogate_function_is_operator_typecast(FunctionIndex function) { - // cerr << "interrogate_function_is_operator_typecast(" << function << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).is_operator_typecast(); -} - -bool -interrogate_function_is_constructor(FunctionIndex function) { - // cerr << "interrogate_function_is_constructor(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).is_constructor(); -} - -bool -interrogate_function_is_destructor(FunctionIndex function) { - // cerr << "interrogate_function_is_destructor(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).is_destructor(); -} - -bool -interrogate_function_has_module_name(FunctionIndex function) { - // cerr << "interrogate_function_has_module_name(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).has_module_name(); -} - -const char * -interrogate_function_module_name(FunctionIndex function) { - // cerr << "interrogate_function_module_name(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_module_name(); -} - -bool -interrogate_function_has_library_name(FunctionIndex function) { - // cerr << "interrogate_function_has_library_name(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).has_library_name(); -} - -const char * -interrogate_function_library_name(FunctionIndex function) { - // cerr << "interrogate_function_library_name(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_library_name(); -} - - - -bool -interrogate_function_is_virtual(FunctionIndex function) { - // cerr << "interrogate_function_is_virtual(" << function << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).is_virtual(); -} - -int -interrogate_function_number_of_c_wrappers(FunctionIndex function) { - // cerr << "interrogate_function_number_of_c_wrappers(" << function << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).number_of_c_wrappers(); -} - -FunctionWrapperIndex -interrogate_function_c_wrapper(FunctionIndex function, int n) { - // cerr << "interrogate_function_c_wrapper(" << function << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_c_wrapper(n); -} - -int -interrogate_function_number_of_python_wrappers(FunctionIndex function) { - // cerr << "interrogate_function_number_of_python_wrappers(" << function << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).number_of_python_wrappers(); -} - -FunctionWrapperIndex -interrogate_function_python_wrapper(FunctionIndex function, int n) { - // cerr << "interrogate_function_python_wrapper(" << function << ", " << n - // << ")\n"; - return InterrogateDatabase::get_ptr()->get_function(function).get_python_wrapper(n); -} - -const char * -interrogate_wrapper_name(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_name(" << wrapper << ")\n"; - static string result; - result = InterrogateDatabase::get_ptr()->get_wrapper(wrapper).get_name(); - return result.c_str(); -} - -FunctionIndex -interrogate_wrapper_function(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_function(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).get_function(); -} - -bool -interrogate_wrapper_is_callable_by_name(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_is_callable_by_name(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).is_callable_by_name(); -} - -bool -interrogate_wrapper_is_copy_constructor(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_is_copy_constructor(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).is_copy_constructor(); -} - -bool -interrogate_wrapper_is_coerce_constructor(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_is_coerce_constructor(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).is_coerce_constructor(); -} - -bool -interrogate_wrapper_is_extension(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_is_extension(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).is_extension(); -} - -bool -interrogate_wrapper_is_deprecated(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_is_deprecated(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).is_deprecated(); -} - -bool -interrogate_wrapper_has_comment(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_has_comment(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).has_comment(); -} - -const char * -interrogate_wrapper_comment(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_comment(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).get_comment().c_str(); -} - -bool -interrogate_wrapper_has_return_value(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_has_return_value(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).has_return_value(); -} - -TypeIndex -interrogate_wrapper_return_type(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_return_type(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).get_return_type(); -} - -bool -interrogate_wrapper_caller_manages_return_value(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_caller_manages_return_value(" << wrapper << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).caller_manages_return_value(); -} - -FunctionIndex -interrogate_wrapper_return_value_destructor(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_return_value_destructor(" << wrapper << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).get_return_value_destructor(); -} - -int -interrogate_wrapper_number_of_parameters(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_number_of_parameters(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).number_of_parameters(); -} - -TypeIndex -interrogate_wrapper_parameter_type(FunctionWrapperIndex wrapper, int n) { - // cerr << "interrogate_wrapper_parameter_type(" << wrapper << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_get_type(n); -} - -bool -interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n) { - // cerr << "interrogate_wrapper_parameter_has_name(" << wrapper << ", " << n - // << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_has_name(n); -} - -const char * -interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n) { - // cerr << "interrogate_wrapper_parameter_name(" << wrapper << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_get_name(n).c_str(); -} - -bool -interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n) { - // cerr << "interrogate_wrapper_is_this(" << wrapper << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_is_this(n); -} - -bool -interrogate_wrapper_parameter_is_optional(FunctionWrapperIndex wrapper, int n) { - // cerr << "interrogate_wrapper_is_optional(" << wrapper << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_is_optional(n); -} - -bool -interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_has_pointer(" << wrapper << ")\n"; - return (InterrogateDatabase::get_ptr()->get_fptr(wrapper) != nullptr); -} - -void * -interrogate_wrapper_pointer(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_pointer(" << wrapper << ")\n"; - return InterrogateDatabase::get_ptr()->get_fptr(wrapper); -} - -const char * -interrogate_wrapper_unique_name(FunctionWrapperIndex wrapper) { - // cerr << "interrogate_wrapper_unique_name(" << wrapper << ")\n"; - static string result; - result = InterrogateDatabase::get_ptr()->get_wrapper(wrapper).get_unique_name(); - return result.c_str(); -} - -FunctionWrapperIndex -interrogate_get_wrapper_by_unique_name(const char *unique_name) { - // cerr << "interrogate_get_wrapper_by_unique_name(" << unique_name << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_wrapper_by_unique_name(unique_name); -} - -const char * -interrogate_make_seq_seq_name(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_seq_name(" << make_seq << ")\n"; - static string result; - result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_name(); - return result.c_str(); -} - -const char * -interrogate_make_seq_scoped_name(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_seq_name(" << make_seq << ")\n"; - static string result; - result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_scoped_name(); - return result.c_str(); -} - -bool -interrogate_make_seq_has_comment(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_has_comment(" << make_seq << ")\n"; - return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).has_comment(); -} - -const char * -interrogate_make_seq_comment(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_comment(" << make_seq << ")\n"; - return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_comment().c_str(); -} - -const char * -interrogate_make_seq_num_name(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_num_name(" << make_seq << ")\n"; - FunctionIndex function = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_length_getter(); - return interrogate_function_name(function); -} - -const char * -interrogate_make_seq_element_name(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_element_name(" << make_seq << ")\n"; - FunctionIndex function = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_element_getter(); - return interrogate_function_name(function); -} - -FunctionIndex -interrogate_make_seq_num_getter(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_num_getter(" << make_seq << ")\n"; - return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_length_getter(); -} - -FunctionIndex -interrogate_make_seq_element_getter(MakeSeqIndex make_seq) { - // cerr << "interrogate_make_seq_element_getter(" << make_seq << ")\n"; - return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_element_getter(); -} - -int -interrogate_number_of_global_types() { - // cerr << "interrogate_number_of_global_types()\n"; - return InterrogateDatabase::get_ptr()->get_num_global_types(); -} - -TypeIndex -interrogate_get_global_type(int n) { - // cerr << "interrogate_get_global_type(" << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_global_type(n); -} - -int -interrogate_number_of_types() { - // cerr << "interrogate_number_of_types()\n"; - return InterrogateDatabase::get_ptr()->get_num_all_types(); -} - -TypeIndex -interrogate_get_type(int n) { - // cerr << "interrogate_get_type(" << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_all_type(n); -} - -TypeIndex -interrogate_get_type_by_name(const char *type_name) { - // cerr << "interrogate_get_type_by_name(" << type_name << ")\n"; - return InterrogateDatabase::get_ptr()->lookup_type_by_name(type_name); -} - -TypeIndex -interrogate_get_type_by_scoped_name(const char *type_name) { - // cerr << "interrogate_get_type_by_scoped_name(" << type_name << ")\n"; - return InterrogateDatabase::get_ptr()->lookup_type_by_scoped_name(type_name); -} - -TypeIndex -interrogate_get_type_by_true_name(const char *type_name) { - // cerr << "interrogate_get_type_by_true_name(" << type_name << ")\n"; - return InterrogateDatabase::get_ptr()->lookup_type_by_true_name(type_name); -} - -bool -interrogate_type_is_global(TypeIndex type) { - // cerr << "interrogate_type_is_global(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_global(); -} - -bool -interrogate_type_is_deprecated(TypeIndex type) { - // cerr << "interrogate_type_is_deprecated(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_deprecated(); -} - -const char * -interrogate_type_name(TypeIndex type) { - // cerr << "interrogate_type_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_name().c_str(); -} - -const char * -interrogate_type_scoped_name(TypeIndex type) { - // cerr << "interrogate_type_scoped_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_scoped_name().c_str(); -} - -const char * -interrogate_type_true_name(TypeIndex type) { - // cerr << "interrogate_type_true_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_true_name().c_str(); -} - -bool -interrogate_type_is_nested(TypeIndex type) { - // cerr << "interrogate_type_is_nested(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_nested(); -} - -TypeIndex -interrogate_type_outer_class(TypeIndex type) { - // cerr << "interrogate_type_outer_class(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_outer_class(); -} - -bool -interrogate_type_has_comment(TypeIndex type) { - // cerr << "interrogate_type_has_comment(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).has_comment(); -} - -const char * -interrogate_type_comment(TypeIndex type) { - // cerr << "interrogate_type_comment(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_comment().c_str(); -} - -bool -interrogate_type_has_module_name(TypeIndex type) { - // cerr << "interrogate_type_has_module_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).has_module_name(); -} - -const char * -interrogate_type_module_name(TypeIndex type) { - // cerr << "interrogate_type_module_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_module_name(); -} - -bool -interrogate_type_has_library_name(TypeIndex type) { - // cerr << "interrogate_type_has_library_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).has_library_name(); -} - -const char * -interrogate_type_library_name(TypeIndex type) { - // cerr << "interrogate_type_library_name(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_library_name(); -} - - -bool -interrogate_type_is_atomic(TypeIndex type) { - // cerr << "interrogate_type_is_atomic(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_atomic(); -} - -AtomicToken -interrogate_type_atomic_token(TypeIndex type) { - // cerr << "interrogate_type_atomic_token(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_atomic_token(); -} - -bool -interrogate_type_is_unsigned(TypeIndex type) { - // cerr << "interrogate_type_is_unsigned(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_unsigned(); -} - -bool -interrogate_type_is_signed(TypeIndex type) { - // cerr << "interrogate_type_is_signed(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_signed(); -} - -bool -interrogate_type_is_long(TypeIndex type) { - // cerr << "interrogate_type_is_long(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_long(); -} - -bool -interrogate_type_is_longlong(TypeIndex type) { - // cerr << "interrogate_type_is_longlong(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_longlong(); -} - -bool -interrogate_type_is_short(TypeIndex type) { - // cerr << "interrogate_type_is_short(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_short(); -} - -bool -interrogate_type_is_wrapped(TypeIndex type) { - // cerr << "interrogate_type_is_wrapped(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_wrapped(); -} - -bool -interrogate_type_is_pointer(TypeIndex type) { - // cerr << "interrogate_type_is_pointer(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_pointer(); -} - -bool -interrogate_type_is_const(TypeIndex type) { - // cerr << "interrogate_type_is_const(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_const(); -} - -bool -interrogate_type_is_typedef(TypeIndex type) { - // cerr << "interrogate_type_is_typedef(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_typedef(); -} - -TypeIndex -interrogate_type_wrapped_type(TypeIndex type) { - // cerr << "interrogate_type_wrapped_type(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_wrapped_type(); -} - -bool -interrogate_type_is_array(TypeIndex type) { - // cerr << "interrogate_type_is_array(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_array(); -} - -int -interrogate_type_array_size(TypeIndex type) { - // cerr << "interrogate_type_array_size(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_array_size(); -} - -bool -interrogate_type_is_enum(TypeIndex type) { - // cerr << "interrogate_type_is_enum(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_enum(); -} - -bool -interrogate_type_is_scoped_enum(TypeIndex type) { - // cerr << "interrogate_type_is_scoped_enum(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_scoped_enum(); -} - -int -interrogate_type_number_of_enum_values(TypeIndex type) { - // cerr << "interrogate_type_number_of_enum_values(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_enum_values(); -} - -const char * -interrogate_type_enum_value_name(TypeIndex type, int n) { - // cerr << "interrogate_type_enum_value_name(" << type << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_enum_value_name(n).c_str(); -} - -const char * -interrogate_type_enum_value_scoped_name(TypeIndex type, int n) { - // cerr << "interrogate_type_enum_value_scoped_name(" << type << ", " << n - // << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_enum_value_scoped_name(n).c_str(); -} - -const char * -interrogate_type_enum_value_comment(TypeIndex type, int n) { - // cerr << "interrogate_type_enum_value_comment(" << type << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_enum_value_comment(n).c_str(); -} - -int -interrogate_type_enum_value(TypeIndex type, int n) { - // cerr << "interrogate_type_enum_value(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_enum_value(n); -} - -bool -interrogate_type_is_struct(TypeIndex type) { - // cerr << "interrogate_type_is_struct(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_struct(); -} - -bool -interrogate_type_is_class(TypeIndex type) { - // cerr << "interrogate_type_is_class(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_class(); -} - -bool -interrogate_type_is_union(TypeIndex type) { - // cerr << "interrogate_type_is_union(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_union(); -} - -bool -interrogate_type_is_fully_defined(TypeIndex type) { - // cerr << "interrogate_type_is_fully_defined(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_fully_defined(); -} - -bool -interrogate_type_is_unpublished(TypeIndex type) { - // cerr << "interrogate_type_is_unpublished(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_unpublished(); -} - -int -interrogate_type_number_of_constructors(TypeIndex type) { - // cerr << "interrogate_type_number_of_constructors(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_constructors(); -} - -FunctionIndex -interrogate_type_get_constructor(TypeIndex type, int n) { - // cerr << "interrogate_type_get_constructor(" << type << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_constructor(n); -} - -bool -interrogate_type_has_destructor(TypeIndex type) { - // cerr << "interrogate_type_has_destructor(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).has_destructor(); -} - -bool -interrogate_type_destructor_is_inherited(TypeIndex type) { - // cerr << "interrogate_type_destructor_is_inherited(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).destructor_is_inherited(); -} - -FunctionIndex -interrogate_type_get_destructor(TypeIndex type) { - // cerr << "interrogate_type_get_destructor(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_destructor(); -} - -int -interrogate_type_number_of_elements(TypeIndex type) { - // cerr << "interrogate_type_number_of_elements(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_elements(); -} - -ElementIndex -interrogate_type_get_element(TypeIndex type, int n) { - // cerr << "interrogate_type_get_element(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_element(n); -} - -int -interrogate_type_number_of_methods(TypeIndex type) { - // cerr << "interrogate_type_number_of_methods(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_methods(); -} - -FunctionIndex -interrogate_type_get_method(TypeIndex type, int n) { - // cerr << "interrogate_type_get_method(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_method(n); -} - -int -interrogate_type_number_of_make_seqs(TypeIndex type) { - // cerr << "interrogate_type_number_of_make_seqs(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_make_seqs(); -} - -MakeSeqIndex -interrogate_type_get_make_seq(TypeIndex type, int n) { - // cerr << "interrogate_type_get_make_seq(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_make_seq(n); -} - -int -interrogate_type_number_of_casts(TypeIndex type) { - // cerr << "interrogate_type_number_of_casts(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_casts(); -} - -FunctionIndex -interrogate_type_get_cast(TypeIndex type, int n) { - // cerr << "interrogate_type_get_cast(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_cast(n); -} - -int -interrogate_type_number_of_derivations(TypeIndex type) { - // cerr << "interrogate_type_number_of_derivations(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_derivations(); -} - -TypeIndex -interrogate_type_get_derivation(TypeIndex type, int n) { - // cerr << "interrogate_type_get_derivation(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_derivation(n); -} - -bool -interrogate_type_is_final(TypeIndex type) { - // cerr << "interrogate_type_is_final(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).is_final(); -} - -bool -interrogate_type_derivation_has_upcast(TypeIndex type, int n) { - // cerr << "interrogate_type_derivation_has_upcast(" << type << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).derivation_has_upcast(n); -} - -FunctionIndex -interrogate_type_get_upcast(TypeIndex type, int n) { - // cerr << "interrogate_type_get_upcast(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).derivation_get_upcast(n); -} - -bool -interrogate_type_derivation_downcast_is_impossible(TypeIndex type, int n) { - // cerr << "interrogate_type_derivation_downcast_is_impossible(" << type << - // ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).derivation_downcast_is_impossible(n); -} - -bool -interrogate_type_derivation_has_downcast(TypeIndex type, int n) { - // cerr << "interrogate_type_derivation_has_downcast(" << type << ", " << n - // << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).derivation_has_downcast(n); -} - -FunctionIndex -interrogate_type_get_downcast(TypeIndex type, int n) { - // cerr << "interrogate_type_get_downcast(" << type << ", " << n << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).derivation_get_downcast(n); -} - -int -interrogate_type_number_of_nested_types(TypeIndex type) { - // cerr << "interrogate_type_number_of_nested_types(" << type << ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).number_of_nested_types(); -} - -TypeIndex -interrogate_type_get_nested_type(TypeIndex type, int n) { - // cerr << "interrogate_type_get_nested_type(" << type << ", " << n << - // ")\n"; - return InterrogateDatabase::get_ptr()->get_type(type).get_nested_type(n); -} diff --git a/dtool/src/interrogatedb/interrogate_interface.h b/dtool/src/interrogatedb/interrogate_interface.h deleted file mode 100644 index 6ae1bdcb24..0000000000 --- a/dtool/src/interrogatedb/interrogate_interface.h +++ /dev/null @@ -1,581 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogate_interface.h - * @author frang - * @date 1999-11-09 - */ - -#ifndef INTERROGATE_INTERFACE_H -#define INTERROGATE_INTERFACE_H - -#include "dtoolbase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// This file defines the interface to the interrogate database. This database -// is generated by running interrogate on a package's source code; interrogate -// parses the C++ syntax, determines the public interface, generates C-style -// wrapper functions where necessary, and builds up a table of functions and -// classes and their relationships. - -/* - * Some of this data (in particular, the wrapper functions, and the table of - * unique names for these functions) is linked in along with the codebase, - * permanently a part of the library file, and is always available; the rest - * of it is stored in external files (named *.in) and read in when needed. - * For this reason, most of the interface functions defined here will force a - * load of the complete interrogate database the first time any of them are - * called. The three exceptions are noted below; they are - * interrogate_wrapper_has_pointer(), interrogate_wrapper_pointer(), and - * interrogate_get_wrapper_by_unique_name(). - */ - - -// The interface here is intentionally made to be as simple as possible, to -// maximize portability. All that is required of a scripting language is a -// foreign function interface capable of calling C functions. - - -// In general, the interrogate database consists of a number of query -// functions that allow the caller to walk through the list of available -// types, functions, manifests, etc. For each of these, a unique index number -// is returned; this index number may then be used to query details about the -// type, function, etc. The index numbers are only guaranteed to remain -// unchanged during a particular session; from one session to another they may -// differ. - -// All index numbers are ordinary integers. Each has a unique typedef here -// for clarity of meaning, but they may be treated as ordinary integers by the -// caller. -typedef int ManifestIndex; -typedef int ElementIndex; -typedef int TypeIndex; -typedef int FunctionIndex; -typedef int FunctionWrapperIndex; -typedef int MakeSeqIndex; - -// Atomic types are those that are built in to C. This enumerated value is -// returned by interrogate_type_atomic_token() when a type is known to be one -// of the atomic types. -enum AtomicToken { - AT_not_atomic = 0, - AT_int = 1, - AT_float = 2, - AT_double = 3, - AT_bool = 4, - AT_char = 5, - AT_void = 6, - - // There isn't an atomic string type in C, but there is one in almost all - // other languages. If -string is supplied to the interrogate command line, - // functions may be reported as returning and accepting objects of type - // atomic string. For the C calling convention wrappers, atomic string - // means (const char *); for other calling convention wrappers, atomic - // string means whatever the native string representation is. - AT_string = 7, - - AT_longlong = 8, - - // This is not a type that C has, but C++ and many scripting languages do; - // it indicates a null value, or the absence of any value. - AT_null = 9, -}; - -EXPCL_INTERROGATEDB void interrogate_add_search_directory(const char *dirname); -EXPCL_INTERROGATEDB void interrogate_add_search_path(const char *pathstring); -EXPCL_INTERROGATEDB bool interrogate_error_flag(); - -// Manifest Symbols - -/* - * These correspond to #define constants that appear in the C code. (These - * are only the manifest constants--those #define's that take no parameters. - * Manifest functions, #define's that take one or more parameters, are not - * exported.) They cannot be set, of course, but they often have a meaningful - * value that may be get. The scripting language may choose to get the value - * as a literal string via interrogate_manifest_definition(), or as a value of - * a particular type (whatever type interrogate thinks it is), as returned by - * the getter function given by interrogate_manifest_getter(). - */ - -EXPCL_INTERROGATEDB int interrogate_number_of_manifests(); -EXPCL_INTERROGATEDB ManifestIndex interrogate_get_manifest(int n); -EXPCL_INTERROGATEDB ManifestIndex interrogate_get_manifest_by_name(const char *manifest_name); -EXPCL_INTERROGATEDB const char *interrogate_manifest_name(ManifestIndex manifest); -EXPCL_INTERROGATEDB const char *interrogate_manifest_definition(ManifestIndex manifest); -EXPCL_INTERROGATEDB bool interrogate_manifest_has_type(ManifestIndex manifest); -EXPCL_INTERROGATEDB TypeIndex interrogate_manifest_get_type(ManifestIndex manifest); -EXPCL_INTERROGATEDB bool interrogate_manifest_has_getter(ManifestIndex manifest); -EXPCL_INTERROGATEDB FunctionIndex interrogate_manifest_getter(ManifestIndex manifest); - -// An exception is made for manifest constants that have an integer type -// value, since these are so common. The scripting language can query these -// values directly, which saves having to generate a wrapper function for each -// stupid little manifest. In this case, there will be no getter function -// available. -EXPCL_INTERROGATEDB bool interrogate_manifest_has_int_value(ManifestIndex manifest); -EXPCL_INTERROGATEDB int interrogate_manifest_get_int_value(ManifestIndex manifest); - - -// Data Elements - -// These correspond to data members of a class, or global data elements. -// Interrogate automatically generates a getter function and, if possible, a -// setter function. - -EXPCL_INTERROGATEDB const char *interrogate_element_name(ElementIndex element); -EXPCL_INTERROGATEDB const char *interrogate_element_scoped_name(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_comment(ElementIndex element); -EXPCL_INTERROGATEDB const char *interrogate_element_comment(ElementIndex element); -EXPCL_INTERROGATEDB ElementIndex interrogate_get_element_by_name(const char *element_name); -EXPCL_INTERROGATEDB ElementIndex interrogate_get_element_by_scoped_name(const char *element_name); - -// Be careful with this function. The element's bare type is not likely to be -// directly useful to the scripting language. This is a different answer than -// the return value of the getter. - -// The element type might well be something concrete that the scripting -// language can't handle directly, e.g. a Node, while the getter will return -// (and the setter accept) a pointer to a Node, which is what the scripting -// language actually works with. -EXPCL_INTERROGATEDB TypeIndex interrogate_element_type(ElementIndex element); - -EXPCL_INTERROGATEDB bool interrogate_element_has_getter(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_getter(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_setter(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_setter(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_has_function(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_has_function(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_clear_function(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_clear_function(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_del_function(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_del_function(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_insert_function(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_insert_function(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_has_getkey_function(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_getkey_function(ElementIndex element); -EXPCL_INTERROGATEDB FunctionIndex interrogate_element_length_function(ElementIndex element); - -EXPCL_INTERROGATEDB bool interrogate_element_is_sequence(ElementIndex element); -EXPCL_INTERROGATEDB bool interrogate_element_is_mapping(ElementIndex element); - -// Global Data - -// This is the list of global data elements. - -EXPCL_INTERROGATEDB int interrogate_number_of_globals(); -EXPCL_INTERROGATEDB ElementIndex interrogate_get_global(int n); - -// Functions - -// There is a unique FunctionIndex associated with each of the functions that -// interrogate knows about. This includes member functions, nonmember -// functions, synthesized getters and setters, and upcastdowncast functions. - - -// These are the global (nonmember) functions that appear outside of any class -// definition. -EXPCL_INTERROGATEDB int interrogate_number_of_global_functions(); -EXPCL_INTERROGATEDB FunctionIndex interrogate_get_global_function(int n); - -// This can be used to traverse through *all* the functions known to -// interrogate. It's usually not what you want, since this includes global -// functions, class methods, and synthesized functions like upcasts and -// downcasts. You probably want to use instead -// interrogate_number_of_global_functions(), above. -EXPCL_INTERROGATEDB int interrogate_number_of_functions(); -EXPCL_INTERROGATEDB FunctionIndex interrogate_get_function(int n); - -// This is the function's name. It is not unique; it may be shared between -// multiple different functions that have the same name but different -// parameter types (this is C++'s function overloading). Two different classes -// might also have member functions that have the same name, or the same name -// as a global function (but also see the scoped_name, below). -EXPCL_INTERROGATEDB const char *interrogate_function_name(FunctionIndex function); - -// The scoped name is the function name prefixed with the name of the class -// that includes the function, if the function is a class method. If it is a -// global function, the scoped name is the same as the name returned above. -// In the absence of C++ function overloading, this name will be unique to -// each function. -EXPCL_INTERROGATEDB const char *interrogate_function_scoped_name(FunctionIndex function); - -// This returns the C++ comment written for the function, either in the header -// file or in the .C file, or both. -EXPCL_INTERROGATEDB bool interrogate_function_has_comment(FunctionIndex function); -EXPCL_INTERROGATEDB const char *interrogate_function_comment(FunctionIndex function); - -// This defines the function prototype as it appears in the C++ source, useful -// primarily for documentation purposes. -EXPCL_INTERROGATEDB const char *interrogate_function_prototype(FunctionIndex function); - -// This can be used to determine the class that the function is a method for, -// if the function is a class method. -EXPCL_INTERROGATEDB bool interrogate_function_is_method(FunctionIndex function); -EXPCL_INTERROGATEDB TypeIndex interrogate_function_class(FunctionIndex function); -EXPCL_INTERROGATEDB bool interrogate_function_is_unary_op(FunctionIndex function); -EXPCL_INTERROGATEDB bool interrogate_function_is_operator_typecast(FunctionIndex function); -EXPCL_INTERROGATEDB bool interrogate_function_is_constructor(FunctionIndex function); -EXPCL_INTERROGATEDB bool interrogate_function_is_destructor(FunctionIndex function); - -// This returns the module name reported for the function, if available. -EXPCL_INTERROGATEDB bool interrogate_function_has_module_name(FunctionIndex function); -EXPCL_INTERROGATEDB const char *interrogate_function_module_name(FunctionIndex function); - -// This returns the library name reported for the function, if available. -EXPCL_INTERROGATEDB bool interrogate_function_has_library_name(FunctionIndex function); -EXPCL_INTERROGATEDB const char *interrogate_function_library_name(FunctionIndex function); - -// This is true for virtual member functions. It's not likely that this will -// be important to the scripting language. -EXPCL_INTERROGATEDB bool interrogate_function_is_virtual(FunctionIndex function); - - -// The actual callable function interface is defined via one or more wrappers -// for each function. (There might be multiple wrappers for the same function -// to allow for default parameter values.) - -// At present, interrogate can generate wrappers that use the C calling -// convention or the Python calling convention. The set of wrappers that will -// actually be available depends on the parameters passed to the interrogate -// command line. -EXPCL_INTERROGATEDB int interrogate_function_number_of_c_wrappers(FunctionIndex function); -EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_function_c_wrapper(FunctionIndex function, int n); - -EXPCL_INTERROGATEDB int interrogate_function_number_of_python_wrappers(FunctionIndex function); -EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_function_python_wrapper(FunctionIndex function, int n); - -// Function wrappers - -// These define the way to call a given function. Depending on the parameters -// supplied to interrogate, a function wrapper may be able to supply either a -// void * pointer to the function, or the name of the function in the library, -// or both. - - -// This returns the actual name of the wrapper function, as opposed to the -// name of the function it wraps. It's probably not terribly useful to the -// scripting language, unless the -fnames option was given to interrogate, in -// which case this name may be used to call the wrapper function (see -// is_callable_by_name, below). It will usually be an ugly hashed name, not -// intended for human consumption. - -// Don't confuse this with the unique_name, below. The two are related, but -// not identical. -EXPCL_INTERROGATEDB const char *interrogate_wrapper_name(FunctionWrapperIndex wrapper); - -// Returns the function that this wrapper belongs to. -EXPCL_INTERROGATEDB FunctionIndex interrogate_wrapper_function(FunctionWrapperIndex wrapper); - -// This returns true if -fnames was given to interrogate, making the wrapper -// function callable directly by its name. -EXPCL_INTERROGATEDB bool interrogate_wrapper_is_callable_by_name(FunctionWrapperIndex wrapper); - -// This returns true if this is a copy constructor. -EXPCL_INTERROGATEDB bool interrogate_wrapper_is_copy_constructor(FunctionWrapperIndex wrapper); - -// This returns true if this is a constructor that is not marked "explicit". -EXPCL_INTERROGATEDB bool interrogate_wrapper_is_coerce_constructor(FunctionWrapperIndex wrapper); - -// This returns true if this is an extension function, rather than a real -// function defined in the C++ code. -EXPCL_INTERROGATEDB bool interrogate_wrapper_is_extension(FunctionWrapperIndex wrapper); - -// This returns true if function is marked as deprecated. -EXPCL_INTERROGATEDB bool interrogate_wrapper_is_deprecated(FunctionWrapperIndex wrapper); - -// This returns the C++ comment written for the function wrapper, usually from -// the .cpp file. There may be a different comment for each overload of a -// given function. -EXPCL_INTERROGATEDB bool interrogate_wrapper_has_comment(FunctionWrapperIndex wrapper); -EXPCL_INTERROGATEDB const char *interrogate_wrapper_comment(FunctionWrapperIndex wrapper); - -// Every function wrapper has zero or more parameters and may or may not have -// a return value. Each parameter has a type and may or may not have a name. -// For member functions, the first parameter may be a 'this' parameter, which -// should receive a pointer to the class object. (If a member function does -// not have a 'this' parameter as its first parameter, it is a static member -// function, also called a class method.) - -EXPCL_INTERROGATEDB bool interrogate_wrapper_has_return_value(FunctionWrapperIndex wrapper); -EXPCL_INTERROGATEDB TypeIndex interrogate_wrapper_return_type(FunctionWrapperIndex wrapper); - -/* - * Sometimes interrogate must synthesize a wrapper that allocates its return - * value from the free store. Other times (especially if -refcount is - * supplied to interrogate), interrogate will automatically increment the - * count of a reference-counted object that it returns. In cases like these, - * interrogate_wrapper_caller_manages_return_value() will return true, and it - * is the responsibility of the scripting language to eventually call the - * destructor supplied by interrogate_wrapper_return_value_destructor() on - * this value when it is no longer needed (which will generally be the same - * destructor as that for the class). Otherwise, this function will return - * false, and the scripting language should *not* call any destructor on this - * value. - */ -EXPCL_INTERROGATEDB bool interrogate_wrapper_caller_manages_return_value(FunctionWrapperIndex wrapper); -EXPCL_INTERROGATEDB FunctionIndex interrogate_wrapper_return_value_destructor(FunctionWrapperIndex wrapper); - -// These define the parameters of the function. -EXPCL_INTERROGATEDB int interrogate_wrapper_number_of_parameters(FunctionWrapperIndex wrapper); -EXPCL_INTERROGATEDB TypeIndex interrogate_wrapper_parameter_type(FunctionWrapperIndex wrapper, int n); -EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n); -EXPCL_INTERROGATEDB const char *interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n); -EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n); -EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_is_optional(FunctionWrapperIndex wrapper, int n); - -// This returns a pointer to a function that may be called to invoke the -// function, if the -fptrs option to return function pointers was specified to -// interrogate. Be sure to push the required parameters on the stack, -// according to the calling convention, before calling the function. - -// These two functions may be called without forcing a load of the complete -// interrogate database. -EXPCL_INTERROGATEDB bool interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper); -EXPCL_INTERROGATEDB void *interrogate_wrapper_pointer(FunctionWrapperIndex wrapper); - -// This function will return a name that is guaranteed to be unique to this -// particular function wrapper, and that will (usually) be consistent across -// multiple runtime sessions. (It will only change between sessions if the -// database was regenerated in the interim with some new function that -// happened to introduce a hash conflict.) - -// The unique name is an ugly hashed name, not safe for human consumption. -// Its sole purpose is to provide some consistent way to identify function -// wrappers between sessions. -EXPCL_INTERROGATEDB const char *interrogate_wrapper_unique_name(FunctionWrapperIndex wrapper); - -// This function provides a reverse-lookup on the above unique name, returning -// the wrapper index corresponding to the given name. It depends on data -// having been compiled directly into the library, and thus is only available -// if the option -unique-names was given to interrogate. - -// This function may be called without forcing a load of the complete -// interrogate database. -EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(const char *unique_name); - -// MakeSeqs - -// These are special synthesized methods that iterate through a list. They -// are generated in C++ code via the MAKE_SEQ macro. The normal pattern is -// that a pair of actual C++ methods like get_num_things() and get_thing(n) -// are used to synthesize a new method called get_things(). - -EXPCL_INTERROGATEDB const char *interrogate_make_seq_seq_name(MakeSeqIndex make_seq); -EXPCL_INTERROGATEDB const char *interrogate_make_seq_scoped_name(MakeSeqIndex make_seq); -EXPCL_INTERROGATEDB bool interrogate_make_seq_has_comment(ElementIndex element); -EXPCL_INTERROGATEDB const char *interrogate_make_seq_comment(ElementIndex element); -// The name of the real method that returns the length, e.g. "get_num_things" -EXPCL_INTERROGATEDB const char *interrogate_make_seq_num_name(MakeSeqIndex make_seq); -// The name of the real method that returns the nth element, e.g. "get_thing" -EXPCL_INTERROGATEDB const char *interrogate_make_seq_element_name(MakeSeqIndex make_seq); -EXPCL_INTERROGATEDB FunctionIndex interrogate_make_seq_num_getter(MakeSeqIndex make_seq); -EXPCL_INTERROGATEDB FunctionIndex interrogate_make_seq_element_getter(MakeSeqIndex make_seq); - -// Types - -// These are all the types that interrogate knows about. This includes atomic -// types like ints and floats, type wrappers like pointers and const pointers, -// enumerated types, and classes. - -/* - * Two lists of types are maintained: the list of global types, which includes - * only those types intended to be wrapped in the API (for instance, all of - * the classes). The second list is the complete list of all types, which - * probably does not need to be traversed--this includes *all* types known to - * the interrogate database, including simple types and pointers and const - * pointers to classes. These types are necessary to fully define all of the - * function parameters, but need not themselves be wrapped. - */ - -EXPCL_INTERROGATEDB int interrogate_number_of_global_types(); -EXPCL_INTERROGATEDB TypeIndex interrogate_get_global_type(int n); -EXPCL_INTERROGATEDB int interrogate_number_of_types(); -EXPCL_INTERROGATEDB TypeIndex interrogate_get_type(int n); -EXPCL_INTERROGATEDB TypeIndex interrogate_get_type_by_name(const char *type_name); -EXPCL_INTERROGATEDB TypeIndex interrogate_get_type_by_scoped_name(const char *type_name); -EXPCL_INTERROGATEDB TypeIndex interrogate_get_type_by_true_name(const char *type_name); -EXPCL_INTERROGATEDB bool interrogate_type_is_global(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_deprecated(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_name(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_scoped_name(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_true_name(TypeIndex type); - -// A given type might be a nested type, meaning it is entirely defined within -// (and scoped within) some different C++ class. In this case, the -// type_name() will return the local name of the type as seen within the -// class, while the scoped_name() will return the fully-qualified name of the -// type, and is_nested() and outer_class() can be used to determine the class -// it is nested within. -EXPCL_INTERROGATEDB bool interrogate_type_is_nested(TypeIndex type); -EXPCL_INTERROGATEDB TypeIndex interrogate_type_outer_class(TypeIndex type); - -EXPCL_INTERROGATEDB bool interrogate_type_has_comment(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_comment(TypeIndex type); - -// This returns the module name reported for the type, if available. -EXPCL_INTERROGATEDB bool interrogate_type_has_module_name(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_module_name(TypeIndex type); - -// This returns the library name reported for the type, if available. -EXPCL_INTERROGATEDB bool interrogate_type_has_library_name(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_library_name(TypeIndex type); - - -// If interrogate_type_is_atomic() returns true, the type is one of the basic -// C types enumerated in AtomicToken, above. The type may then be further -// modified by one or more of unsigned, signed, long, longlong, or short. -// However, it will not be a pointer. -EXPCL_INTERROGATEDB bool interrogate_type_is_atomic(TypeIndex type); -EXPCL_INTERROGATEDB AtomicToken interrogate_type_atomic_token(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_unsigned(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_signed(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_long(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_longlong(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_short(TypeIndex type); - -// If interrogate_type_is_wrapped() returns true, this is a composite type -// "wrapped" around some simpler type, for instance a pointer to a class. The -// type will be either a pointer or a const wrapper--it cannot be a -// combination of these. (When combinations are required, they use multiple -// wrappers. A const char pointer, for example, is represented as a pointer -// wrapper around a const wrapper around an atomic char.) -EXPCL_INTERROGATEDB bool interrogate_type_is_wrapped(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_pointer(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_const(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_typedef(TypeIndex type); -EXPCL_INTERROGATEDB TypeIndex interrogate_type_wrapped_type(TypeIndex type); - -// If interrogate_type_is_array() returns true, this is an array type. -EXPCL_INTERROGATEDB bool interrogate_type_is_array(TypeIndex type); -EXPCL_INTERROGATEDB int interrogate_type_array_size(TypeIndex type); - -// If interrogate_type_is_enum() returns true, this is an enumerated type, -// which means it may take any one of a number of named integer values. -EXPCL_INTERROGATEDB bool interrogate_type_is_enum(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_scoped_enum(TypeIndex type); -EXPCL_INTERROGATEDB int interrogate_type_number_of_enum_values(TypeIndex type); -EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_name(TypeIndex type, int n); -EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_scoped_name(TypeIndex type, int n); -EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_comment(TypeIndex type, int n); -EXPCL_INTERROGATEDB int interrogate_type_enum_value(TypeIndex type, int n); - -// If none of the above is true, the type is some extension type. It may be a -// struct, class, or union (and the distinction between these three is not -// likely to be important to the scripting language). In any case, it may -// contain zero or more constructors, zero or one destructor, zero or more -// member functions, and zero or more data members; all of the remaining type -// functions may apply. -EXPCL_INTERROGATEDB bool interrogate_type_is_struct(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_class(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_is_union(TypeIndex type); - -// If is_fully_defined() returns false, this classstruct was a forward -// reference, and we really don't know anything about it. (In this case, it -// will appear to have no methods or members.) -EXPCL_INTERROGATEDB bool interrogate_type_is_fully_defined(TypeIndex type); - -// If is_unpublished() returns false, the classstruct is unknown because it -// was not marked to be published (or, in promiscuous mode, it is a protected -// or private nested class). -EXPCL_INTERROGATEDB bool interrogate_type_is_unpublished(TypeIndex type); - -/* - * Otherwise, especially if the type is a struct or class, we may have a - * number of member functions, including zero or more constructors and zero or - * one destructor. A constructor function may be called to allocate a new - * instance of the type; its return value will be a pointer to the new - * instance. The destructor may be called to destroy the instance; however, - * it usually should not be explicitly called by the user, since the proper - * support of the interrogate_caller_manages_return_value() interface, above, - * will ensure that the appropriate destructors are called when they should - * be. - */ - -/* - * In certain circumstances, the destructor might be inherited from a parent - * or ancestor class. This happens when the destructor wrapper from the - * ancestor class is an acceptable substitute for this destructor; this is - * only possible in the case of a virtual C++ destructor. In this case, the - * destructor returned here will be the same function index as the one - * returned by the ancestor class, and - * interrogate_type_destructor_is_inherited() will return true for this class. - */ -EXPCL_INTERROGATEDB int interrogate_type_number_of_constructors(TypeIndex type); -EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_constructor(TypeIndex type, int n); -EXPCL_INTERROGATEDB bool interrogate_type_has_destructor(TypeIndex type); -EXPCL_INTERROGATEDB bool interrogate_type_destructor_is_inherited(TypeIndex type); -EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_destructor(TypeIndex type); - -// This is the set of exposed data elements in the struct or class. -EXPCL_INTERROGATEDB int interrogate_type_number_of_elements(TypeIndex type); -EXPCL_INTERROGATEDB ElementIndex interrogate_type_get_element(TypeIndex type, int n); - -// This is the set of exposed member functions in the struct or class. -EXPCL_INTERROGATEDB int interrogate_type_number_of_methods(TypeIndex type); -EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_method(TypeIndex type, int n); - -// This is the set of MAKE_SEQ wrappers in the struct or class. -EXPCL_INTERROGATEDB int interrogate_type_number_of_make_seqs(TypeIndex type); -EXPCL_INTERROGATEDB MakeSeqIndex interrogate_type_get_make_seq(TypeIndex type, int n); - -// A C++ class may also define a number of explicit cast operators, which -// define how to convert an object of this type to an object of some other -// type (the type can be inferred by the return type of the cast function). -// This is not related to upcast and downcast, defined below. -EXPCL_INTERROGATEDB int interrogate_type_number_of_casts(TypeIndex type); -EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_cast(TypeIndex type, int n); - -// A C++ class may inherit from zero or more base classes. This defines the -// list of base classes for this particular type. -EXPCL_INTERROGATEDB int interrogate_type_number_of_derivations(TypeIndex type); -EXPCL_INTERROGATEDB TypeIndex interrogate_type_get_derivation(TypeIndex type, int n); -EXPCL_INTERROGATEDB bool interrogate_type_is_final(TypeIndex type); - -// For each base class, we might need to define an explicit upcast or downcast -// operation to convert the pointer to the derived class to an appropriate -// pointer to its base class (upcast) or vice-versa (downcast). This is -// particularly true in the presence of multiple inheritance or virtual -// inheritance, in which case you cannot simply use the same pointer as either -// type. - -// If interrogate_type_derivation_has_upcast() returns true for a particular -// typederivation combination, you must use the indicated upcast function to -// convert pointers of this type to pointers of the base type before calling -// any of the inherited methods from the base class. If this returns false, -// you may simply use the same pointer as either a derived class pointer or a -// base class pointer without any extra step. -EXPCL_INTERROGATEDB bool interrogate_type_derivation_has_upcast(TypeIndex type, int n); -EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_upcast(TypeIndex type, int n); - -/* - * Although it is always possible to upcast a pointer to a base class, it is - * not always possible to downcast from a base class to the derived class - * (particularly in the presence of virtual inheritance). If - * interrogate_type_derivation_downcast_is_impossible() returns true, forget - * it. Otherwise, downcasting works the same way as upcasting. (Of course, - * it is the caller's responsibility to guarantee that the pointer actually - * represents an object of the type being downcast to.) - */ -EXPCL_INTERROGATEDB bool interrogate_type_derivation_downcast_is_impossible(TypeIndex type, int n); -EXPCL_INTERROGATEDB bool interrogate_type_derivation_has_downcast(TypeIndex type, int n); -EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_downcast(TypeIndex type, int n); - -// A C++ class may also define any number of nested types--classes or enums -// defined within the scope of this class. -EXPCL_INTERROGATEDB int interrogate_type_number_of_nested_types(TypeIndex type); -EXPCL_INTERROGATEDB TypeIndex interrogate_type_get_nested_type(TypeIndex type, int n); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/dtool/src/interrogatedb/interrogate_request.cxx b/dtool/src/interrogatedb/interrogate_request.cxx deleted file mode 100644 index 3e02a9eecb..0000000000 --- a/dtool/src/interrogatedb/interrogate_request.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file interrogate_request.cxx - * @author drose - * @date 2000-08-01 - */ - -#include "interrogate_request.h" -#include "interrogateDatabase.h" - -#include // for strdup - -void -interrogate_request_database(const char *database_filename) { - InterrogateModuleDef *def = new InterrogateModuleDef; - memset(def, 0, sizeof(InterrogateModuleDef)); -#ifdef _WIN32 - def->database_filename = _strdup(database_filename); -#else - def->database_filename = strdup(database_filename); -#endif - - // Don't think of this as a leak; think of it as a one-time database - // allocation. - InterrogateDatabase::get_ptr()->request_module(def); -} - -void -interrogate_request_module(InterrogateModuleDef *def) { - InterrogateDatabase::get_ptr()->request_module(def); -} diff --git a/dtool/src/interrogatedb/p3interrogatedb_composite1.cxx b/dtool/src/interrogatedb/p3interrogatedb_composite1.cxx deleted file mode 100644 index 4e54cee5a9..0000000000 --- a/dtool/src/interrogatedb/p3interrogatedb_composite1.cxx +++ /dev/null @@ -1,7 +0,0 @@ -#include "config_interrogatedb.cxx" -#include "indexRemapper.cxx" -#include "interrogateComponent.cxx" -#include "interrogateDatabase.cxx" -#include "interrogateElement.cxx" -#include "interrogateFunction.cxx" -#include "interrogateFunctionWrapper.cxx" diff --git a/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx b/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx deleted file mode 100644 index 41453e5f3e..0000000000 --- a/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "interrogateMakeSeq.cxx" -#include "interrogateManifest.cxx" -#include "interrogateType.cxx" -#include "interrogate_datafile.cxx" -#include "interrogate_interface.cxx" -#include "interrogate_request.cxx" diff --git a/dtool/src/interrogatedb/py_compat.cxx b/dtool/src/interrogatedb/py_compat.cxx deleted file mode 100644 index 91fe93d456..0000000000 --- a/dtool/src/interrogatedb/py_compat.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file py_compat.cxx - * @author rdb - * @date 2017-12-03 - */ - -#include "py_compat.h" -#include "py_panda.h" - -#ifdef HAVE_PYTHON - -#if PY_MAJOR_VERSION < 3 -/** - * Given a long or int, returns a size_t, or raises an OverflowError if it is - * out of range. - */ -size_t PyLongOrInt_AsSize_t(PyObject *vv) { - if (PyInt_Check(vv)) { - long value = PyInt_AS_LONG(vv); - if (value < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t)-1; - } - return (size_t)value; - } - - if (!PyLong_Check(vv)) { - Dtool_Raise_TypeError("a long or int was expected"); - return (size_t)-1; - } - - size_t bytes; - int one = 1; - int res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes, - SIZEOF_SIZE_T, (int)*(unsigned char*)&one, 0, -#if PY_VERSION_HEX >= 0x030d0000 - , 1 // with_exceptions -#endif - ); - - if (res < 0) { - return (size_t)res; - } else { - return bytes; - } -} -#endif - -#endif // HAVE_PYTHON diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx deleted file mode 100644 index fd2f8d621c..0000000000 --- a/dtool/src/interrogatedb/py_panda.cxx +++ /dev/null @@ -1,957 +0,0 @@ -/** - * @file py_panda.cxx - * @author drose - * @date 2005-07-04 - */ - -#include "py_panda.h" -#include "config_interrogatedb.h" -#include "executionEnvironment.h" - -#ifdef HAVE_PYTHON - -#define _STRINGIFY_VERSION(a, b) (#a "." #b) -#define STRINGIFY_VERSION(a, b) _STRINGIFY_VERSION(a, b) - -using std::string; - -/** - - */ -void DTOOL_Call_ExtractThisPointerForType(PyObject *self, Dtool_PyTypedObject *classdef, void **answer) { - if (DtoolInstance_Check(self)) { - *answer = DtoolInstance_UPCAST(self, *classdef); - } else { - *answer = nullptr; - } -} - -/** - * This is a support function for the Python bindings: it extracts the - * underlying C++ pointer of the given type for a given Python object. If it - * was of the wrong type, raises an AttributeError. - */ -bool Dtool_Call_ExtractThisPointer(PyObject *self, Dtool_PyTypedObject &classdef, void **answer) { - if (self == nullptr || !DtoolInstance_Check(self) || DtoolInstance_VOID_PTR(self) == nullptr) { - Dtool_Raise_TypeError("C++ object is not yet constructed, or already destructed."); - return false; - } - - *answer = DtoolInstance_UPCAST(self, classdef); - return true; -} - -/** - * The same thing as Dtool_Call_ExtractThisPointer, except that it performs - * the additional check that the pointer is a non-const pointer. This is - * called by function wrappers for functions of which all overloads are non- - * const, and saves a bit of code. - * - * The extra method_name argument is used in formatting the error message. - */ -bool Dtool_Call_ExtractThisPointer_NonConst(PyObject *self, Dtool_PyTypedObject &classdef, - void **answer, const char *method_name) { - - if (self == nullptr || !DtoolInstance_Check(self) || DtoolInstance_VOID_PTR(self) == nullptr) { - Dtool_Raise_TypeError("C++ object is not yet constructed, or already destructed."); - return false; - } - - if (DtoolInstance_IS_CONST(self)) { - // All overloads of this function are non-const. - PyErr_Format(PyExc_TypeError, - "Cannot call %s() on a const object.", - method_name); - return false; - } - - *answer = DtoolInstance_UPCAST(self, classdef); - return true; -} - -/** - * Extracts the C++ pointer for an object, given its Python wrapper object, - * for passing as the parameter to a C++ function. - * - * self is the Python wrapper object in question. - * - * classdef is the Python class wrapper for the C++ class in which the this - * pointer should be returned. (This may require an upcast operation, if self - * is not already an instance of classdef.) - * - * param and function_name are used for error reporting only, and describe the - * particular function and parameter index for this parameter. - * - * const_ok is true if the function is declared const and can therefore be - * called with either a const or non-const "this" pointer, or false if the - * function is declared non-const, and can therefore be called with only a - * non-const "this" pointer. - * - * The return value is the C++ pointer that was extracted, or NULL if there - * was a problem (in which case the Python exception state will have been - * set). - */ -void * -DTOOL_Call_GetPointerThisClass(PyObject *self, Dtool_PyTypedObject *classdef, - int param, const string &function_name, bool const_ok, - bool report_errors) { - // if (PyErr_Occurred()) { return nullptr; } - if (self == nullptr) { - if (report_errors) { - return Dtool_Raise_TypeError("self is nullptr"); - } - return nullptr; - } - - if (DtoolInstance_Check(self)) { - void *result = DtoolInstance_UPCAST(self, *classdef); - - if (result != nullptr) { - if (const_ok || !DtoolInstance_IS_CONST(self)) { - return result; - } - - if (report_errors) { - return PyErr_Format(PyExc_TypeError, - "%s() argument %d may not be const", - function_name.c_str(), param); - } - return nullptr; - } - } - - if (report_errors) { - return Dtool_Raise_ArgTypeError(self, param, function_name.c_str(), classdef->_PyType.tp_name); - } - - return nullptr; -} - -/** - * This is similar to a PyErr_Occurred() check, except that it also checks - * Notify to see if an assertion has occurred. If that is the case, then it - * raises an AssertionError. - * - * Returns true if there is an active exception, false otherwise. - * - * In the NDEBUG case, this is simply a #define to PyErr_Occurred(). - */ -bool _Dtool_CheckErrorOccurred() { - if (PyErr_Occurred()) { - return true; - } - if (Notify::ptr()->has_assert_failed()) { - Dtool_Raise_AssertionError(); - return true; - } - return false; -} - -/** - * Raises an AssertionError containing the last thrown assert message, and - * clears the assertion flag. Returns NULL. - */ -PyObject *Dtool_Raise_AssertionError() { - Notify *notify = Notify::ptr(); -#if PY_MAJOR_VERSION >= 3 - PyObject *message = PyUnicode_FromString(notify->get_assert_error_message().c_str()); -#else - PyObject *message = PyString_FromString(notify->get_assert_error_message().c_str()); -#endif - PyErr_SetObject(PyExc_AssertionError, message); - notify->clear_assert_failed(); - return nullptr; -} - -/** - * Raises a TypeError with the given message, and returns NULL. - */ -PyObject *Dtool_Raise_TypeError(const char *message) { - PyErr_SetString(PyExc_TypeError, message); - return nullptr; -} - -/** - * Raises a TypeError of the form: function_name() argument n must be type, - * not type for a given object passed to a function. - * - * Always returns NULL so that it can be conveniently used as a return - * expression for wrapper functions that return a PyObject pointer. - */ -PyObject *Dtool_Raise_ArgTypeError(PyObject *obj, int param, const char *function_name, const char *type_name) { -#if PY_MAJOR_VERSION >= 3 - PyObject *message = PyUnicode_FromFormat( -#else - PyObject *message = PyString_FromFormat( -#endif - "%s() argument %d must be %s, not %s", - function_name, param, type_name, - Py_TYPE(obj)->tp_name); - - PyErr_SetObject(PyExc_TypeError, message); - return nullptr; -} - -/** - * Raises an AttributeError of the form: 'type' has no attribute 'attr' - * - * Always returns NULL so that it can be conveniently used as a return - * expression for wrapper functions that return a PyObject pointer. - */ -PyObject *Dtool_Raise_AttributeError(PyObject *obj, const char *attribute) { -#if PY_MAJOR_VERSION >= 3 - PyObject *message = PyUnicode_FromFormat( -#else - PyObject *message = PyString_FromFormat( -#endif - "'%.100s' object has no attribute '%.200s'", - Py_TYPE(obj)->tp_name, attribute); - - PyErr_SetObject(PyExc_AttributeError, message); - return nullptr; -} - -/** - * Raises a TypeError of the form: Arguments must match: - * - * However, in release builds, this instead is defined to a function that just - * prints out a generic message, to help reduce the amount of strings in the - * compiled library. - * - * If there is already an exception set, does nothing. - * - * Always returns NULL so that it can be conveniently used as a return - * expression for wrapper functions that return a PyObject pointer. - */ -PyObject *_Dtool_Raise_BadArgumentsError(const char *message) { - if (!PyErr_Occurred()) { - return PyErr_Format(PyExc_TypeError, "Arguments must match:\n%s", message); - } - return nullptr; -} - -/** - * Overload that prints a generic message instead. - */ -PyObject *_Dtool_Raise_BadArgumentsError() { - if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "arguments do not match any function overload"); - } - return nullptr; -} - -/** - * Overload that returns -1 instead of nullptr. - */ -int _Dtool_Raise_BadArgumentsError_Int(const char *message) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "Arguments must match:\n%s", message); - } - return -1; -} - -/** - * Overload that returns -1 instead of nullptr and prints a generic message. - */ -int _Dtool_Raise_BadArgumentsError_Int() { - if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "arguments do not match any function overload"); - } - return -1; -} - -/** - * Convenience method that checks for exceptions, and if one occurred, returns - * NULL, otherwise Py_None. - */ -PyObject *_Dtool_Return_None() { - if (UNLIKELY(PyErr_Occurred())) { - return nullptr; - } -#ifndef NDEBUG - if (UNLIKELY(Notify::ptr()->has_assert_failed())) { - return Dtool_Raise_AssertionError(); - } -#endif - return Py_NewRef(Py_None); -} - -/** - * Convenience method that checks for exceptions, and if one occurred, returns - * NULL, otherwise the given boolean value as a PyObject *. - */ -PyObject *Dtool_Return_Bool(bool value) { - if (UNLIKELY(PyErr_Occurred())) { - return nullptr; - } -#ifndef NDEBUG - if (UNLIKELY(Notify::ptr()->has_assert_failed())) { - return Dtool_Raise_AssertionError(); - } -#endif - return Py_NewRef(value ? Py_True : Py_False); -} - -/** - * Convenience method that checks for exceptions, and if one occurred, returns - * NULL, otherwise the given return value. Its reference count is not - * increased. - */ -PyObject *_Dtool_Return(PyObject *value) { - if (UNLIKELY(PyErr_Occurred())) { - return nullptr; - } -#ifndef NDEBUG - if (UNLIKELY(Notify::ptr()->has_assert_failed())) { - return Dtool_Raise_AssertionError(); - } -#endif - return value; -} - -#if PY_VERSION_HEX < 0x03040000 -/** - * This function converts an int value to the appropriate enum instance. - */ -static PyObject *Dtool_EnumType_New(PyTypeObject *subtype, PyObject *args, PyObject *kwds) { - PyObject *arg; - if (!Dtool_ExtractArg(&arg, args, kwds, "value")) { - return PyErr_Format(PyExc_TypeError, - "%s() missing 1 required argument: 'value'", - subtype->tp_name); - } - - if (Py_IS_TYPE(arg, subtype)) { - return Py_NewRef(arg); - } - - PyObject *value2member = PyDict_GetItemString(subtype->tp_dict, "_value2member_map_"); - nassertr_always(value2member != nullptr, nullptr); - - PyObject *member; - if (PyDict_GetItemRef(value2member, arg, &member) > 0) { - return member; - } - - PyObject *repr = PyObject_Repr(arg); - PyErr_Format(PyExc_ValueError, "%s is not a valid %s", -#if PY_MAJOR_VERSION >= 3 - PyUnicode_AS_STRING(repr), -#else - PyString_AS_STRING(repr), -#endif - subtype->tp_name); - Py_DECREF(repr); - return nullptr; -} - -static PyObject *Dtool_EnumType_Str(PyObject *self) { - PyObject *name = PyObject_GetAttrString(self, "name"); -#if PY_MAJOR_VERSION >= 3 - PyObject *repr = PyUnicode_FromFormat("%s.%s", Py_TYPE(self)->tp_name, PyString_AS_STRING(name)); -#else - PyObject *repr = PyString_FromFormat("%s.%s", Py_TYPE(self)->tp_name, PyString_AS_STRING(name)); -#endif - Py_DECREF(name); - return repr; -} - -static PyObject *Dtool_EnumType_Repr(PyObject *self) { - PyObject *name = PyObject_GetAttrString(self, "name"); - PyObject *value = PyObject_GetAttrString(self, "value"); -#if PY_MAJOR_VERSION >= 3 - PyObject *repr = PyUnicode_FromFormat("<%s.%s: %ld>", Py_TYPE(self)->tp_name, PyString_AS_STRING(name), PyLongOrInt_AS_LONG(value)); -#else - PyObject *repr = PyString_FromFormat("<%s.%s: %ld>", Py_TYPE(self)->tp_name, PyString_AS_STRING(name), PyLongOrInt_AS_LONG(value)); -#endif - Py_DECREF(name); - Py_DECREF(value); - return repr; -} -#endif - -/** - * Creates a Python 3.4-style enum type. Steals reference to 'names', which - * should be a tuple of (name, value) pairs. - */ -PyTypeObject *Dtool_EnumType_Create(const char *name, PyObject *names, const char *module) { -#if PY_VERSION_HEX >= 0x03040000 - PyObject *enum_module = PyImport_ImportModule("enum"); - nassertr_always(enum_module != nullptr, nullptr); - - PyObject *enum_meta = PyObject_GetAttrString(enum_module, "EnumMeta"); - nassertr(enum_meta != nullptr, nullptr); - - PyObject *enum_class = PyObject_GetAttrString(enum_module, "Enum"); - Py_DECREF(enum_module); - nassertr(enum_class != nullptr, nullptr); - - PyObject *enum_create = PyObject_GetAttrString(enum_meta, "_create_"); - Py_DECREF(enum_meta); - - PyObject *result = PyObject_CallFunction(enum_create, (char *)"OsN", enum_class, name, names); - Py_DECREF(enum_create); - Py_DECREF(enum_class); - nassertr(result != nullptr, nullptr); -#else - static PyObject *enum_class = nullptr; - static PyObject *name_str; - static PyObject *name_sunder_str; - static PyObject *value_str; - static PyObject *value_sunder_str; - static PyObject *value2member_map_sunder_str; - // Emulate something vaguely like the enum module. - if (enum_class == nullptr) { -#if PY_MAJOR_VERSION >= 3 - name_str = PyUnicode_InternFromString("name"); - value_str = PyUnicode_InternFromString("value"); - name_sunder_str = PyUnicode_InternFromString("_name_"); - value_sunder_str = PyUnicode_InternFromString("_value_"); - value2member_map_sunder_str = PyUnicode_InternFromString("_value2member_map_"); -#else - name_str = PyString_InternFromString("name"); - value_str = PyString_InternFromString("value"); - name_sunder_str = PyString_InternFromString("_name_"); - value_sunder_str = PyString_InternFromString("_value_"); - value2member_map_sunder_str = PyString_InternFromString("_value2member_map_"); -#endif - PyObject *name_value_tuple = PyTuple_New(4); - PyTuple_SET_ITEM(name_value_tuple, 0, Py_NewRef(name_str)); - PyTuple_SET_ITEM(name_value_tuple, 1, Py_NewRef(value_str)); - PyTuple_SET_ITEM(name_value_tuple, 2, name_sunder_str); - PyTuple_SET_ITEM(name_value_tuple, 3, value_sunder_str); - - PyObject *slots_dict = PyDict_New(); - PyDict_SetItemString(slots_dict, "__slots__", name_value_tuple); - Py_DECREF(name_value_tuple); - - enum_class = PyObject_CallFunction((PyObject *)&PyType_Type, (char *)"s()N", "Enum", slots_dict); - nassertr(enum_class != nullptr, nullptr); - } - - // Create a subclass of this generic Enum class we just created. - PyObject *value2member = PyDict_New(); - PyObject *dict = PyDict_New(); - PyDict_SetItem(dict, value2member_map_sunder_str, value2member); - PyObject *result = PyObject_CallFunction((PyObject *)&PyType_Type, (char *)"s(O)N", name, enum_class, dict); - nassertr(result != nullptr, nullptr); - - ((PyTypeObject *)result)->tp_new = Dtool_EnumType_New; - ((PyTypeObject *)result)->tp_str = Dtool_EnumType_Str; - ((PyTypeObject *)result)->tp_repr = Dtool_EnumType_Repr; - - PyObject *empty_tuple = PyTuple_New(0); - - // Copy the names as instances of the above to the class dict, and create a - // reverse mapping in the _value2member_map_ dict. - Py_ssize_t size = PyTuple_GET_SIZE(names); - for (Py_ssize_t i = 0; i < size; ++i) { - PyObject *item = PyTuple_GET_ITEM(names, i); - PyObject *name = PyTuple_GET_ITEM(item, 0); - PyObject *value = PyTuple_GET_ITEM(item, 1); - PyObject *member = PyType_GenericNew((PyTypeObject *)result, empty_tuple, nullptr); - PyObject_SetAttr(member, name_str, name); - PyObject_SetAttr(member, name_sunder_str, name); - PyObject_SetAttr(member, value_str, value); - PyObject_SetAttr(member, value_sunder_str, value); - PyObject_SetAttr(result, name, member); - PyDict_SetItem(value2member, value, member); - Py_DECREF(member); - } - Py_DECREF(names); - Py_DECREF(value2member); - Py_DECREF(empty_tuple); -#endif - - if (module != nullptr) { - PyObject *modstr = PyUnicode_FromString(module); - PyObject_SetAttrString(result, "__module__", modstr); - Py_DECREF(modstr); - } - nassertr(PyType_Check(result), nullptr); - return (PyTypeObject *)result; -} - -/** - - */ -PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject &known_class_type, bool memory_rules, bool is_const, int type_index) { - // We can't do the NULL check here like in DTool_CreatePyInstance, since the - // caller will have to get the type index to pass to this function to begin - // with. That code probably would have crashed by now if it was really NULL - // for whatever reason. - nassertr(local_this_in != nullptr, nullptr); - - // IF the class is possibly a run time typed object - if (type_index > 0) { - // get best fit class... - Dtool_PyInstDef *self = (Dtool_PyInstDef *)TypeHandle::from_index(type_index).wrap_python(local_this_in, &known_class_type._PyType); - if (self != nullptr) { - self->_memory_rules = memory_rules; - self->_is_const = is_const; - return (PyObject *)self; - } - } - - // if we get this far .. just wrap the thing in the known type ?? better - // than aborting...I guess.... - Dtool_PyInstDef *self = (Dtool_PyInstDef *)PyType_GenericAlloc(&known_class_type._PyType, 0); - if (self != nullptr) { - self->_signature = PY_PANDA_SIGNATURE; - self->_My_Type = &known_class_type; - self->_ptr_to_object = local_this_in; - self->_memory_rules = memory_rules; - self->_is_const = is_const; - } - return (PyObject *)self; -} - -// DTool_CreatePyInstance .. wrapper function to finalize the existance of a -// general dtool py instance.. -PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_classdef, bool memory_rules, bool is_const) { - if (local_this == nullptr) { - // This is actually a very common case, so let's allow this, but return - // Py_None consistently. This eliminates code in the wrappers. - return Py_NewRef(Py_None); - } - - Dtool_PyInstDef *self = (Dtool_PyInstDef *)PyType_GenericAlloc(&in_classdef._PyType, 0); - if (self != nullptr) { - self->_signature = PY_PANDA_SIGNATURE; - self->_My_Type = &in_classdef; - self->_ptr_to_object = local_this; - self->_memory_rules = memory_rules; - self->_is_const = is_const; - self->_My_Type = &in_classdef; - } - return (PyObject *)self; -} - -/** - * Returns a borrowed reference to the global type dictionary. - */ -Dtool_TypeMap *Dtool_GetGlobalTypeMap() { -#if PY_VERSION_HEX >= 0x030d0000 // 3.13 - PyObject *istate_dict = PyInterpreterState_GetDict(PyInterpreterState_Get()); - PyObject *key = PyUnicode_InternFromString("_interrogate_types"); - PyObject *capsule = PyDict_GetItem(istate_dict, key); - if (capsule != nullptr) { - Py_DECREF(key); - return (Dtool_TypeMap *)PyCapsule_GetPointer(capsule, nullptr); - } -#else - PyObject *capsule = PySys_GetObject((char *)"_interrogate_types"); - if (capsule != nullptr) { - return (Dtool_TypeMap *)PyCapsule_GetPointer(capsule, nullptr); - } -#endif - - Dtool_TypeMap *type_map = new Dtool_TypeMap; - capsule = PyCapsule_New((void *)type_map, nullptr, nullptr); - -#if PY_VERSION_HEX >= 0x030d0000 // 3.13 - PyObject *result; - if (PyDict_SetDefaultRef(istate_dict, key, capsule, &result) != 0) { - // Another thread already beat us to it. - Py_DECREF(capsule); - delete type_map; - capsule = result; - type_map = (Dtool_TypeMap *)PyCapsule_GetPointer(capsule, nullptr); - } - Py_DECREF(key); -#endif - - PySys_SetObject((char *)"_interrogate_types", capsule); - Py_DECREF(capsule); - return type_map; -} - -/** - * - */ -void DtoolProxy_Init(DtoolProxy *proxy, PyObject *self, - Dtool_PyTypedObject &classdef, - TypeRegistry::PythonWrapFunc *wrap_func) { - if (proxy == nullptr) { - // Out of memory, the generated code will handle this. - return; - } - - proxy->_self = Py_NewRef(self); - PyTypeObject *cls = Py_TYPE(self); - if (cls != &classdef._PyType) { - TypeRegistry *registry = TypeRegistry::ptr(); - TypeHandle handle = registry->register_dynamic_type(cls->tp_name); - registry->record_derivation(handle, classdef._type); - //TODO unregister type when it is unloaded? weak callback? - PyTypeObject *cls_ref = (PyTypeObject *)Py_NewRef((PyObject *)cls); - registry->record_python_type(handle, cls_ref, wrap_func); - proxy->_type = handle; - } else { - proxy->_type = classdef._type; - } -} - -#define PY_MAJOR_VERSION_STR #PY_MAJOR_VERSION "." #PY_MINOR_VERSION - -#if PY_MAJOR_VERSION >= 3 -PyObject *Dtool_PyModuleInitHelper(const LibraryDef *defs[], PyModuleDef *module_def) { -#else -PyObject *Dtool_PyModuleInitHelper(const LibraryDef *defs[], const char *modulename) { -#endif - // Check the version so we can print a helpful error if it doesn't match. - string version = Py_GetVersion(); - size_t version_len = version.find('.', 2); - if (version_len != string::npos) { - version.resize(version_len); - } - - if (version != STRINGIFY_VERSION(PY_MAJOR_VERSION, PY_MINOR_VERSION)) { - // Raise a helpful error message. We can safely do this because the - // signature and behavior for PyErr_SetString has remained consistent. - std::ostringstream errs; - errs << "this module was compiled for Python " - << PY_MAJOR_VERSION << "." << PY_MINOR_VERSION << ", which is " - << "incompatible with Python " << version; - string error = errs.str(); - PyErr_SetString(PyExc_ImportError, error.c_str()); - return nullptr; - } - - Dtool_TypeMap *type_map = Dtool_GetGlobalTypeMap(); - -#ifdef Py_GIL_DISABLED - PyMutex_Lock(&type_map->_lock); -#endif - - // the module level function inits.... - MethodDefmap functions; - for (size_t i = 0; defs[i] != nullptr; i++) { - const LibraryDef &def = *defs[i]; - - // Accumulate method definitions. - for (PyMethodDef *meth = def._methods; meth->ml_name != nullptr; meth++) { - if (functions.find(meth->ml_name) == functions.end()) { - functions[meth->ml_name] = meth; - } - } - - // Define exported types. - const Dtool_TypeDef *types = def._types; - if (types != nullptr) { - while (types->name != nullptr) { - (*type_map)[std::string(types->name)] = types->type; - ++types; - } - } - } - - // Resolve external types, in a second pass. - for (size_t i = 0; defs[i] != nullptr; i++) { - const LibraryDef &def = *defs[i]; - - Dtool_TypeDef *types = def._external_types; - if (types != nullptr) { - while (types->name != nullptr) { - auto it = type_map->find(std::string(types->name)); - if (it != type_map->end()) { - types->type = it->second; - } else { - PyErr_Format(PyExc_NameError, "name '%s' is not defined", types->name); -#ifdef Py_GIL_DISABLED - PyMutex_Unlock(&type_map->_lock); -#endif - return nullptr; - } - ++types; - } - } - } -#ifdef Py_GIL_DISABLED - PyMutex_Unlock(&type_map->_lock); -#endif - - PyMethodDef *newdef = new PyMethodDef[functions.size() + 1]; - MethodDefmap::iterator mi; - int offset = 0; - for (mi = functions.begin(); mi != functions.end(); mi++, offset++) { - newdef[offset] = *mi->second; - } - newdef[offset].ml_doc = nullptr; - newdef[offset].ml_name = nullptr; - newdef[offset].ml_meth = nullptr; - newdef[offset].ml_flags = 0; - -#if PY_MAJOR_VERSION >= 3 - module_def->m_methods = newdef; - PyObject *module = PyModule_Create(module_def); -#else - PyObject *module = Py_InitModule((char *)modulename, newdef); -#endif - - if (module == nullptr) { -#if PY_MAJOR_VERSION >= 3 - return Dtool_Raise_TypeError("PyModule_Create returned NULL"); -#else - return Dtool_Raise_TypeError("Py_InitModule returned NULL"); -#endif - } - - // MAIN_DIR needs to be set very early; this seems like a convenient place - // to do that. Perhaps we'll find a better place for this in the future. - static bool initialized_main_dir = false; - if (!initialized_main_dir) { - if (interrogatedb_cat.is_debug()) { - // Good opportunity to print this out once, at startup. - interrogatedb_cat.debug() - << "Python " << version << "\n"; - } - - if (!ExecutionEnvironment::has_environment_variable("MAIN_DIR")) { - // Grab the __main__ module. - PyObject *main_module = PyImport_ImportModule("__main__"); - if (main_module == NULL) { - interrogatedb_cat.warning() << "Unable to import __main__\n"; - } - - // Extract the __file__ attribute, if present. - Filename main_dir; - PyObject *file_attr = nullptr; - if (main_module != nullptr) { - file_attr = PyObject_GetAttrString(main_module, "__file__"); - } - if (file_attr == nullptr) { - // Must be running in the interactive interpreter. Use the CWD. - main_dir = ExecutionEnvironment::get_cwd(); - } else { -#if PY_MAJOR_VERSION >= 3 - Py_ssize_t length; - wchar_t *buffer = PyUnicode_AsWideCharString(file_attr, &length); - if (buffer != nullptr) { - main_dir = Filename::from_os_specific_w(std::wstring(buffer, length)); - main_dir.make_absolute(); - main_dir = main_dir.get_dirname(); - PyMem_Free(buffer); - } -#else - char *buffer; - Py_ssize_t length; - if (PyString_AsStringAndSize(file_attr, &buffer, &length) != -1) { - main_dir = Filename::from_os_specific(std::string(buffer, length)); - main_dir.make_absolute(); - main_dir = main_dir.get_dirname(); - } -#endif - else { - interrogatedb_cat.warning() << "Invalid string for __main__.__file__\n"; - } - } - ExecutionEnvironment::shadow_environment_variable("MAIN_DIR", main_dir.to_os_specific()); - PyErr_Clear(); - } - initialized_main_dir = true; - - // Also, while we are at it, initialize the thread swap hook. -#if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) - global_thread_state_swap = PyThreadState_Swap; -#endif - } - - PyModule_AddIntConstant(module, "Dtool_PyNativeInterface", 1); - return module; -} - -// HACK.... Be careful Dtool_BorrowThisReference This function can be used to -// grab the "THIS" pointer from an object and use it Required to support -// historical inheritance in the form of "is this instance of".. -PyObject *Dtool_BorrowThisReference(PyObject *self, PyObject *args) { - PyObject *from_in = nullptr; - PyObject *to_in = nullptr; - if (PyArg_UnpackTuple(args, "Dtool_BorrowThisReference", 2, 2, &to_in, &from_in)) { - - if (DtoolInstance_Check(from_in) && DtoolInstance_Check(to_in)) { - Dtool_PyInstDef *from = (Dtool_PyInstDef *) from_in; - Dtool_PyInstDef *to = (Dtool_PyInstDef *) to_in; - - // if (PyObject_TypeCheck(to_in, Py_TYPE(from_in))) { - if (from->_My_Type == to->_My_Type) { - to->_memory_rules = false; - to->_is_const = from->_is_const; - to->_ptr_to_object = from->_ptr_to_object; - - return Py_NewRef(Py_None); - } - - return PyErr_Format(PyExc_TypeError, "types %s and %s do not match", - Py_TYPE(from)->tp_name, Py_TYPE(to)->tp_name); - } else { - return Dtool_Raise_TypeError("One of these does not appear to be DTOOL Instance ??"); - } - } - return nullptr; -} - -// We do expose a dictionay for dtool classes .. this should be removed at -// some point.. -EXPCL_PYPANDA PyObject * -Dtool_AddToDictionary(PyObject *self1, PyObject *args) { - PyObject *self; - PyObject *subject; - PyObject *key; - if (PyArg_ParseTuple(args, "OSO", &self, &key, &subject)) { - PyObject *dict = ((PyTypeObject *)self)->tp_dict; - if (dict == nullptr || !PyDict_Check(dict)) { - return Dtool_Raise_TypeError("No dictionary On Object"); - } else { - PyDict_SetItem(dict, key, subject); - } - } - if (PyErr_Occurred()) { - return nullptr; - } - return Py_NewRef(Py_None); -} - -/** - * This is a support function for a synthesized __copy__() method from a C++ - * make_copy() method. - */ -PyObject *copy_from_make_copy(PyObject *self, PyObject *noargs) { - PyObject *callable = PyObject_GetAttrString(self, "make_copy"); - if (callable == nullptr) { - return nullptr; - } - PyObject *result = PyObject_CallNoArgs(callable); - Py_DECREF(callable); - return result; -} - -/** - * This is a support function for a synthesized __copy__() method from a C++ - * copy constructor. - */ -PyObject *copy_from_copy_constructor(PyObject *self, PyObject *noargs) { - PyObject *callable = (PyObject *)Py_TYPE(self); - return PyObject_CallOneArg(callable, self); -} - -/** - * This is a support function for a synthesized __deepcopy__() method for any - * class that has a __copy__() method. The sythethic method simply invokes - * __copy__(). - */ -PyObject *map_deepcopy_to_copy(PyObject *self, PyObject *args) { - PyObject *callable = PyObject_GetAttrString(self, "__copy__"); - if (callable == nullptr) { - return nullptr; - } - PyObject *result = PyObject_CallNoArgs(callable); - Py_DECREF(callable); - return result; -} - -/** - * A more efficient version of PyArg_ParseTupleAndKeywords for the special - * case where there is only a single PyObject argument. - */ -bool Dtool_ExtractArg(PyObject **result, PyObject *args, PyObject *kwds, - const char *keyword) { - - if (PyTuple_GET_SIZE(args) == 1) { - if (kwds == nullptr || PyDict_GET_SIZE(kwds) == 0) { - *result = PyTuple_GET_ITEM(args, 0); - return true; - } - } - else if (!keyword || !keyword[0]) { - return false; - } - else if (PyTuple_GET_SIZE(args) == 0) { - PyObject *key; - Py_ssize_t ppos = 0; - if (kwds != nullptr && PyDict_GET_SIZE(kwds) == 1 && - PyDict_Next(kwds, &ppos, &key, result)) { - // We got the item, we just need to make sure that it had the right key. -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_CheckExact(key) && PyUnicode_CompareWithASCIIString(key, keyword) == 0; -#else - return PyString_CheckExact(key) && strcmp(PyString_AS_STRING(key), keyword) == 0; -#endif - } - } - - return false; -} - -/** - * Variant of Dtool_ExtractArg that does not accept a keyword argument. - */ -bool Dtool_ExtractArg(PyObject **result, PyObject *args, PyObject *kwds) { - if (PyTuple_GET_SIZE(args) == 1 && - (kwds == nullptr || PyDict_GET_SIZE(kwds) == 0)) { - *result = PyTuple_GET_ITEM(args, 0); - return true; - } - return false; -} - -/** - * A more efficient version of PyArg_ParseTupleAndKeywords for the special - * case where there is only a single optional PyObject argument. - * - * Returns true if valid (including if there were 0 items), false if there was - * an error, such as an invalid number of parameters. - */ -bool Dtool_ExtractOptionalArg(PyObject **result, PyObject *args, PyObject *kwds, - const char *keyword) { - - if (PyTuple_GET_SIZE(args) == 1) { - if (kwds == nullptr || PyDict_GET_SIZE(kwds) == 0) { - *result = PyTuple_GET_ITEM(args, 0); - return true; - } - } - else if (!keyword || !keyword[0]) { - return (kwds == nullptr || PyDict_GET_SIZE(kwds) == 0); - } - else if (PyTuple_GET_SIZE(args) == 0) { - if (kwds != nullptr && PyDict_GET_SIZE(kwds) == 1) { - PyObject *key; - Py_ssize_t ppos = 0; - if (!PyDict_Next(kwds, &ppos, &key, result)) { - return true; - } - - // We got the item, we just need to make sure that it had the right key. -#if PY_VERSION_HEX >= 0x030d0000 - return PyUnicode_CheckExact(key) && PyUnicode_EqualToUTF8(key, keyword); -#elif PY_VERSION_HEX >= 0x03060000 - return PyUnicode_CheckExact(key) && _PyUnicode_EqualToASCIIString(key, keyword); -#elif PY_MAJOR_VERSION >= 3 - return PyUnicode_CheckExact(key) && PyUnicode_CompareWithASCIIString(key, keyword) == 0; -#else - return PyString_CheckExact(key) && strcmp(PyString_AS_STRING(key), keyword) == 0; -#endif - } else { - return true; - } - } - - return false; -} - -/** - * Variant of Dtool_ExtractOptionalArg that does not accept a keyword argument. - */ -bool Dtool_ExtractOptionalArg(PyObject **result, PyObject *args, PyObject *kwds) { - if (kwds != nullptr && PyDict_GET_SIZE(kwds) != 0) { - return false; - } - if (PyTuple_GET_SIZE(args) == 1) { - *result = PyTuple_GET_ITEM(args, 0); - return true; - } - return (PyTuple_GET_SIZE(args) == 0); -} - -#endif // HAVE_PYTHON diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index 6300009d9c..d57af784f7 100644 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -16,6 +16,7 @@ #include "pnotify.h" #include "vector_uchar.h" #include "register_type.h" +#include "interrogate_request.h" #if defined(HAVE_PYTHON) && !defined(CPPPARSER) @@ -345,6 +346,7 @@ struct LibraryDef { PyMethodDef *const _methods; const Dtool_TypeDef *const _types; Dtool_TypeDef *const _external_types; + const InterrogateModuleDef *const _module_def; }; #if PY_MAJOR_VERSION >= 3 diff --git a/dtool/src/interrogatedb/py_wrappers.cxx b/dtool/src/interrogatedb/py_wrappers.cxx deleted file mode 100644 index bf7398b328..0000000000 --- a/dtool/src/interrogatedb/py_wrappers.cxx +++ /dev/null @@ -1,1791 +0,0 @@ -/** - * @file py_wrappers.cxx - * @author rdb - * @date 2017-11-26 - */ - -#include "py_wrappers.h" - -#ifdef HAVE_PYTHON - -#if PY_VERSION_HEX >= 0x03040000 -#define _COLLECTIONS_ABC "_collections_abc" -#elif PY_VERSION_HEX >= 0x03030000 -#define _COLLECTIONS_ABC "collections.abc" -#else -#define _COLLECTIONS_ABC "_abcoll" -#endif - -static void _register_collection(PyTypeObject *type, const char *abc) { -#if PY_MAJOR_VERSION >= 3 - PyObject *module_name = PyUnicode_InternFromString(_COLLECTIONS_ABC); -#else - PyObject *module_name = PyString_InternFromString(_COLLECTIONS_ABC); -#endif - PyObject *module = PyImport_GetModule(module_name); - Py_DECREF(module_name); - if (module != nullptr) { - PyObject *dict = PyModule_GetDict(module); - if (dict != nullptr) { -#if PY_MAJOR_VERSION >= 3 - PyObject *register_str = PyUnicode_InternFromString("register"); -#else - PyObject *register_str = PyString_InternFromString("register"); -#endif - PyObject *obj = nullptr; - if (register_str == nullptr || - PyDict_GetItemStringRef(dict, abc, &obj) <= 0 || - PyObject_CallMethodOneArg(obj, register_str, (PyObject *)type) == nullptr) { - PyErr_Print(); - } - Py_XDECREF(obj); - Py_XDECREF(register_str); - } else { - PyErr_Clear(); - } - Py_DECREF(module); - } -} - -/** - * These classes are returned from properties that require a subscript - * interface, ie. something.children[i] = 3. - */ -static void Dtool_WrapperBase_dealloc(PyObject *self) { - Dtool_WrapperBase *wrap = (Dtool_WrapperBase *)self; - nassertv(wrap); - Py_XDECREF(wrap->_self); - Py_TYPE(self)->tp_free(self); -} - -static PyObject *Dtool_WrapperBase_repr(PyObject *self) { - Dtool_WrapperBase *wrap = (Dtool_WrapperBase *)self; - nassertr(wrap, nullptr); - - PyObject *repr = PyObject_Repr(wrap->_self); - PyObject *result; -#if PY_MAJOR_VERSION >= 3 - result = PyUnicode_FromFormat("<%s[] of %s>", wrap->_name, PyUnicode_AsUTF8(repr)); -#else - result = PyString_FromFormat("<%s[] of %s>", wrap->_name, PyString_AS_STRING(repr)); -#endif - Py_DECREF(repr); - return result; -} - -static PyObject *Dtool_SequenceWrapper_repr(PyObject *self) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)self; - nassertr(wrap, nullptr); - - Py_ssize_t len = -1; - if (wrap->_len_func != nullptr) { - len = wrap->_len_func(wrap->_base._self); - } - - if (len < 0) { - PyErr_Clear(); - return Dtool_WrapperBase_repr(self); - } - - PyObject *repr = PyObject_Repr(wrap->_base._self); - PyObject *result; -#if PY_MAJOR_VERSION >= 3 - result = PyUnicode_FromFormat("<%s[%zd] of %s>", wrap->_base._name, len, PyUnicode_AsUTF8(repr)); -#else - result = PyString_FromFormat("<%s[%zd] of %s>", wrap->_base._name, len, PyString_AS_STRING(repr)); -#endif - Py_DECREF(repr); - return result; -} - -static Py_ssize_t Dtool_SequenceWrapper_length(PyObject *self) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)self; - nassertr(wrap, -1); - if (wrap->_len_func != nullptr) { - return wrap->_len_func(wrap->_base._self); - } else { - Dtool_Raise_TypeError("property does not support len()"); - return -1; - } -} - -static PyObject *Dtool_SequenceWrapper_getitem(PyObject *self, Py_ssize_t index) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_getitem_func, nullptr); - return wrap->_getitem_func(wrap->_base._self, index); -} - -/** - * Implementation of (x in property) - */ -static int Dtool_SequenceWrapper_contains(PyObject *self, PyObject *value) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)self; - nassertr(wrap, -1); - nassertr(wrap->_len_func, -1); - nassertr(wrap->_getitem_func, -1); - - Py_ssize_t length = wrap->_len_func(wrap->_base._self); - - // Iterate through the items, invoking the equality function for each, until - // we have found the matching one. - for (Py_ssize_t index = 0; index < length; ++index) { - PyObject *item = wrap->_getitem_func(wrap->_base._self, index); - if (item != nullptr) { - int cmp = PyObject_RichCompareBool(item, value, Py_EQ); - if (cmp > 0) { - return 1; - } - if (cmp < 0) { - return -1; - } - } else { - return -1; - } - } - return 0; -} - -/** - * Implementation of property.index(x) which returns the index of the first - * occurrence of x in the sequence, or raises a ValueError if it isn't found. - */ -static PyObject *Dtool_SequenceWrapper_index(PyObject *self, PyObject *value) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_len_func, nullptr); - nassertr(wrap->_getitem_func, nullptr); - - Py_ssize_t length = wrap->_len_func(wrap->_base._self); - - // Iterate through the items, invoking the equality function for each, until - // we have found the right one. - for (Py_ssize_t index = 0; index < length; ++index) { - PyObject *item = wrap->_getitem_func(wrap->_base._self, index); - if (item != nullptr) { - int cmp = PyObject_RichCompareBool(item, value, Py_EQ); - if (cmp > 0) { - return Dtool_WrapValue(index); - } - if (cmp < 0) { - return nullptr; - } - } else { - return nullptr; - } - } - // Not found, raise ValueError. - return PyErr_Format(PyExc_ValueError, "%s.index() did not find value", wrap->_base._name); -} - -/** - * Implementation of property.count(x) which returns the number of occurrences - * of x in the sequence. - */ -static PyObject *Dtool_SequenceWrapper_count(PyObject *self, PyObject *value) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)self; - nassertr(wrap, nullptr); - Py_ssize_t index = 0; - if (wrap->_len_func != nullptr) { - index = wrap->_len_func(wrap->_base._self); - } else { - return Dtool_Raise_TypeError("property does not support count()"); - } - // Iterate through the items, invoking the == operator for each. - long count = 0; - nassertr(wrap->_getitem_func, nullptr); - while (index > 0) { - --index; - PyObject *item = wrap->_getitem_func(wrap->_base._self, index); - if (item == nullptr) { - return nullptr; - } - int cmp = PyObject_RichCompareBool(item, value, Py_EQ); - if (cmp > 0) { - ++count; - } - if (cmp < 0) { - return nullptr; - } - } -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(count); -#else - return PyInt_FromLong(count); -#endif -} - -/** - * Implementation of `property[i] = x` - */ -static int Dtool_MutableSequenceWrapper_setitem(PyObject *self, Py_ssize_t index, PyObject *value) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, -1); - if (wrap->_setitem_func != nullptr) { - return wrap->_setitem_func(wrap->_base._self, index, value); - } else { - Dtool_Raise_TypeError("property does not support item assignment"); - return -1; - } -} - -/** - * Implementation of property.clear() which removes all elements in the - * sequence, starting with the last. - */ -static PyObject *Dtool_MutableSequenceWrapper_clear(PyObject *self, PyObject *) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, nullptr); - Py_ssize_t index = 0; - if (wrap->_len_func != nullptr && wrap->_setitem_func != nullptr) { - index = wrap->_len_func(wrap->_base._self); - } else { - return Dtool_Raise_TypeError("property does not support clear()"); - } - - // Iterate through the items, invoking the delete function for each. We do - // this in reverse order, which may be more efficient. - while (index > 0) { - --index; - if (wrap->_setitem_func(wrap->_base._self, index, nullptr) != 0) { - return nullptr; - } - } - return Py_NewRef(Py_None); -} - -/** - * Implementation of property.remove(x) which removes the first occurrence of - * x in the sequence, or raises a ValueError if it isn't found. - */ -static PyObject *Dtool_MutableSequenceWrapper_remove(PyObject *self, PyObject *value) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, nullptr); - Py_ssize_t length = 0; - if (wrap->_len_func != nullptr && wrap->_setitem_func != nullptr) { - length = wrap->_len_func(wrap->_base._self); - } else { - return Dtool_Raise_TypeError("property does not support remove()"); - } - - // Iterate through the items, invoking the equality function for each, until - // we have found the right one. - nassertr(wrap->_getitem_func, nullptr); - for (Py_ssize_t index = 0; index < length; ++index) { - PyObject *item = wrap->_getitem_func(wrap->_base._self, index); - if (item != nullptr) { - int cmp = PyObject_RichCompareBool(item, value, Py_EQ); - if (cmp > 0) { - if (wrap->_setitem_func(wrap->_base._self, index, nullptr) == 0) { - return Py_NewRef(Py_None); - } else { - return nullptr; - } - } - if (cmp < 0) { - return nullptr; - } - } else { - return nullptr; - } - } - // Not found, raise ValueError. - return PyErr_Format(PyExc_ValueError, "%s.remove() did not find value", wrap->_base._name); -} - -/** - * Implementation of property.pop([i=-1]) which returns and removes the - * element at the indicated index in the sequence. If no index is provided, - * it removes from the end of the list. - */ -static PyObject *Dtool_MutableSequenceWrapper_pop(PyObject *self, PyObject *args) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, nullptr); - if (wrap->_getitem_func == nullptr || wrap->_setitem_func == nullptr || - wrap->_len_func == nullptr) { - return Dtool_Raise_TypeError("property does not support pop()"); - } - - Py_ssize_t length = wrap->_len_func(wrap->_base._self); - Py_ssize_t index; - switch (PyTuple_GET_SIZE(args)) { - case 0: - index = length - 1; - break; - case 1: - index = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 0), PyExc_IndexError); - if (index == -1 && PyErr_Occurred()) { - return nullptr; - } - if (index < 0) { - index += length; - } - break; - default: - return Dtool_Raise_TypeError("pop([i=-1]) takes 0 or 1 arguments"); - } - - if (length <= 0) { - return PyErr_Format(PyExc_IndexError, "%s.pop() from empty sequence", wrap->_base._name); - } - - // Index error will be caught by getitem_func. - PyObject *value = wrap->_getitem_func(wrap->_base._self, index); - if (value != nullptr) { - if (wrap->_setitem_func(wrap->_base._self, index, nullptr) != 0) { - return nullptr; - } - return value; - } - return nullptr; -} - -/** - * Implementation of property.append(x) which is an alias for - * property.insert(len(property), x). - */ -static PyObject *Dtool_MutableSequenceWrapper_append(PyObject *self, PyObject *arg) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, nullptr); - if (wrap->_insert_func == nullptr) { - return Dtool_Raise_TypeError("property does not support append()"); - } - return wrap->_insert_func(wrap->_base._self, (size_t)-1, arg); -} - -/** - * Implementation of property.insert(i, x) which inserts the given item at the - * given position. - */ -static PyObject *Dtool_MutableSequenceWrapper_insert(PyObject *self, PyObject *args) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, nullptr); - if (wrap->_insert_func == nullptr) { - return Dtool_Raise_TypeError("property does not support insert()"); - } - if (PyTuple_GET_SIZE(args) != 2) { - return Dtool_Raise_TypeError("insert() takes exactly 2 arguments"); - } - Py_ssize_t index = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 0), PyExc_IndexError); - if (index == -1 && PyErr_Occurred()) { - return nullptr; - } - if (index < 0) { - if (wrap->_len_func != nullptr) { - index += wrap->_len_func(wrap->_base._self); - } else { - return PyErr_Format(PyExc_TypeError, "%s.insert() does not support negative indices", wrap->_base._name); - } - } - return wrap->_insert_func(wrap->_base._self, (size_t)std::max(index, (Py_ssize_t)0), PyTuple_GET_ITEM(args, 1)); -} - -/** - * Implementation of property.extend(seq) which is equivalent to: - * @code - * for x in seq: - * property.append(seq) - * @endcode - */ -static PyObject *Dtool_MutableSequenceWrapper_extend(PyObject *self, PyObject *arg) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)self; - nassertr(wrap, nullptr); - if (wrap->_insert_func == nullptr) { - return Dtool_Raise_TypeError("property does not support extend()"); - } - PyObject *iter = PyObject_GetIter(arg); - if (iter == nullptr) { - return nullptr; - } - PyObject *next = PyIter_Next(iter); - PyObject *retval = nullptr; - while (next != nullptr) { - retval = wrap->_insert_func(wrap->_base._self, (size_t)-1, next); - Py_DECREF(next); - if (retval == nullptr) { - Py_DECREF(iter); - return nullptr; - } - Py_DECREF(retval); - next = PyIter_Next(iter); - } - - Py_DECREF(iter); - return Py_NewRef(Py_None); -} - -/** - * Implementation of `x in mapping`. - */ -static int Dtool_MappingWrapper_contains(PyObject *self, PyObject *key) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, -1); - nassertr(wrap->_getitem_func, -1); - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - if (value != nullptr) { - Py_DECREF(value); - return 1; - } else if (PyErr_ExceptionMatches(PyExc_KeyError) || - PyErr_ExceptionMatches(PyExc_TypeError)) { - PyErr_Clear(); - return 0; - } else { - return -1; - } -} - -static PyObject *Dtool_MappingWrapper_getitem(PyObject *self, PyObject *key) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_getitem_func, nullptr); - return wrap->_getitem_func(wrap->_base._self, key); -} - -/** - * Implementation of iter(property) that returns an iterable over all the - * keys. - */ -static PyObject *Dtool_MappingWrapper_iter(PyObject *self) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - - if (wrap->_keys._len_func == nullptr || wrap->_keys._getitem_func == nullptr) { - return PyErr_Format(PyExc_TypeError, "%s is not iterable", wrap->_base._name); - } - - Dtool_SequenceWrapper *keys = Dtool_NewSequenceWrapper(wrap->_base._self, wrap->_base._name); - if (keys != nullptr) { - keys->_len_func = wrap->_keys._len_func; - keys->_getitem_func = wrap->_keys._getitem_func; - return PySeqIter_New((PyObject *)keys); - } else { - return nullptr; - } -} - -/** - * Implementation of property.get(key[,def=None]) which returns the value with - * the given key in the mapping, or the given default value (which defaults to - * None) if the key isn't found in the mapping. - */ -static PyObject *Dtool_MappingWrapper_get(PyObject *self, PyObject *args) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_getitem_func, nullptr); - Py_ssize_t size = PyTuple_GET_SIZE(args); - if (size != 1 && size != 2) { - return PyErr_Format(PyExc_TypeError, "%s.get() takes 1 or 2 arguments", wrap->_base._name); - } - PyObject *defvalue = Py_None; - if (size >= 2) { - defvalue = PyTuple_GET_ITEM(args, 1); - } - PyObject *key = PyTuple_GET_ITEM(args, 0); - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - if (value != nullptr) { - return value; - } else if (PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_Clear(); - return Py_NewRef(defvalue); - } else { - return nullptr; - } -} - -/** - * This is returned by mapping.keys(). - */ -static PyObject *Dtool_MappingWrapper_Keys_repr(PyObject *self) { - Dtool_WrapperBase *wrap = (Dtool_WrapperBase *)self; - nassertr(wrap, nullptr); - - PyObject *repr = PyObject_Repr(wrap->_self); - PyObject *result; -#if PY_MAJOR_VERSION >= 3 - result = PyUnicode_FromFormat("<%s.keys() of %s>", wrap->_name, PyUnicode_AsUTF8(repr)); -#else - result = PyString_FromFormat("<%s.keys() of %s>", wrap->_name, PyString_AS_STRING(repr)); -#endif - Py_DECREF(repr); - return result; -} - -/** - * Implementation of property.keys(...) that returns a view of all the keys. - */ -static PyObject *Dtool_MappingWrapper_keys(PyObject *self, PyObject *) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - - if (wrap->_keys._len_func == nullptr || wrap->_keys._getitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support keys()"); - } - - Dtool_MappingWrapper *keys = (Dtool_MappingWrapper *)PyObject_MALLOC(sizeof(Dtool_MappingWrapper)); - if (keys == nullptr) { - return PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - Dtool_SequenceWrapper_getitem, - nullptr, // sq_slice - nullptr, // sq_ass_item - nullptr, // sq_ass_slice - Dtool_SequenceWrapper_contains, - nullptr, // sq_inplace_concat - nullptr, // sq_inplace_repeat - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "sequence wrapper", - sizeof(Dtool_SequenceWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_MappingWrapper_Keys_repr, - nullptr, // tp_as_number - &seq_methods, - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - PySeqIter_New, - nullptr, // tp_iternext - nullptr, // tp_methods - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "MappingView"); - } - - (void)PyObject_INIT(keys, &wrapper_type); - keys->_base._self = Py_XNewRef(wrap->_base._self); - keys->_base._name = wrap->_base._name; - keys->_keys._len_func = wrap->_keys._len_func; - keys->_keys._getitem_func = wrap->_keys._getitem_func; - keys->_getitem_func = wrap->_getitem_func; - keys->_setitem_func = nullptr; - return (PyObject *)keys; -} - -/** - * This is returned by mapping.values(). - */ -static PyObject *Dtool_MappingWrapper_Values_repr(PyObject *self) { - Dtool_WrapperBase *wrap = (Dtool_WrapperBase *)self; - nassertr(wrap, nullptr); - - PyObject *repr = PyObject_Repr(wrap->_self); - PyObject *result; -#if PY_MAJOR_VERSION >= 3 - result = PyUnicode_FromFormat("<%s.values() of %s>", wrap->_name, PyUnicode_AsUTF8(repr)); -#else - result = PyString_FromFormat("<%s.values() of %s>", wrap->_name, PyString_AS_STRING(repr)); -#endif - Py_DECREF(repr); - return result; -} - -static PyObject *Dtool_MappingWrapper_Values_getitem(PyObject *self, Py_ssize_t index) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_keys._getitem_func, nullptr); - - PyObject *key = wrap->_keys._getitem_func(wrap->_base._self, index); - if (key != nullptr) { - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - Py_DECREF(key); - return value; - } - return nullptr; -} - -/** - * Implementation of property.values(...) that returns a view of the values. - */ -static PyObject *Dtool_MappingWrapper_values(PyObject *self, PyObject *) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_getitem_func, nullptr); - - if (wrap->_keys._len_func == nullptr || wrap->_keys._getitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support values()"); - } - - Dtool_MappingWrapper *values = (Dtool_MappingWrapper *)PyObject_MALLOC(sizeof(Dtool_MappingWrapper)); - if (values == nullptr) { - return PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - Dtool_MappingWrapper_Values_getitem, - nullptr, // sq_slice - nullptr, // sq_ass_item - nullptr, // sq_ass_slice - Dtool_MappingWrapper_contains, - nullptr, // sq_inplace_concat - nullptr, // sq_inplace_repeat - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "sequence wrapper", - sizeof(Dtool_MappingWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_MappingWrapper_Values_repr, - nullptr, // tp_as_number - &seq_methods, - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - PySeqIter_New, - nullptr, // tp_iternext - nullptr, // tp_methods - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "ValuesView"); - } - - (void)PyObject_INIT(values, &wrapper_type); - values->_base._self = Py_XNewRef(wrap->_base._self); - values->_base._name = wrap->_base._name; - values->_keys._len_func = wrap->_keys._len_func; - values->_keys._getitem_func = wrap->_keys._getitem_func; - values->_getitem_func = wrap->_getitem_func; - values->_setitem_func = nullptr; - return (PyObject *)values; -} - -/** - * This is returned by mapping.items(). - */ -static PyObject *Dtool_MappingWrapper_Items_repr(PyObject *self) { - Dtool_WrapperBase *wrap = (Dtool_WrapperBase *)self; - nassertr(wrap, nullptr); - - PyObject *repr = PyObject_Repr(wrap->_self); - PyObject *result; -#if PY_MAJOR_VERSION >= 3 - result = PyUnicode_FromFormat("<%s.items() of %s>", wrap->_name, PyUnicode_AsUTF8(repr)); -#else - result = PyString_FromFormat("<%s.items() of %s>", wrap->_name, PyString_AS_STRING(repr)); -#endif - Py_DECREF(repr); - return result; -} - -static PyObject *Dtool_MappingWrapper_Items_getitem(PyObject *self, Py_ssize_t index) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_keys._getitem_func, nullptr); - - PyObject *key = wrap->_keys._getitem_func(wrap->_base._self, index); - if (key != nullptr) { - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - if (value != nullptr) { - // PyTuple_SET_ITEM steals the reference. - PyObject *item = PyTuple_New(2); - PyTuple_SET_ITEM(item, 0, key); - PyTuple_SET_ITEM(item, 1, value); - return item; - } else { - Py_DECREF(key); - } - } - return nullptr; -} - -/** - * Implementation of property.items(...) that returns an iterable yielding a - * `(key, value)` tuple for every item. - */ -static PyObject *Dtool_MappingWrapper_items(PyObject *self, PyObject *) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_getitem_func, nullptr); - - if (wrap->_keys._len_func == nullptr || wrap->_keys._getitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support items()"); - } - - Dtool_MappingWrapper *items = (Dtool_MappingWrapper *)PyObject_MALLOC(sizeof(Dtool_MappingWrapper)); - if (items == nullptr) { - return PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - Dtool_MappingWrapper_Items_getitem, - nullptr, // sq_slice - nullptr, // sq_ass_item - nullptr, // sq_ass_slice - Dtool_MappingWrapper_contains, - nullptr, // sq_inplace_concat - nullptr, // sq_inplace_repeat - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "sequence wrapper", - sizeof(Dtool_MappingWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_MappingWrapper_Items_repr, - nullptr, // tp_as_number - &seq_methods, - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - PySeqIter_New, - nullptr, // tp_iternext - nullptr, // tp_methods - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "MappingView"); - } - - (void)PyObject_INIT(items, &wrapper_type); - items->_base._self = Py_XNewRef(wrap->_base._self); - items->_base._name = wrap->_base._name; - items->_keys._len_func = wrap->_keys._len_func; - items->_keys._getitem_func = wrap->_keys._getitem_func; - items->_getitem_func = wrap->_getitem_func; - items->_setitem_func = nullptr; - return (PyObject *)items; -} - -/** - * Implementation of `property[key] = value` - */ -static int Dtool_MutableMappingWrapper_setitem(PyObject *self, PyObject *key, PyObject *value) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap->_setitem_func != nullptr, -1); - return wrap->_setitem_func(wrap->_base._self, key, value); -} - -/** - * Implementation of property.pop(key[,def=None]) which is the same as get() - * except that it also removes the element from the mapping. - */ -static PyObject *Dtool_MutableMappingWrapper_pop(PyObject *self, PyObject *args) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - if (wrap->_getitem_func == nullptr || wrap->_setitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support pop()"); - } - - Py_ssize_t size = PyTuple_GET_SIZE(args); - if (size != 1 && size != 2) { - return PyErr_Format(PyExc_TypeError, "%s.pop() takes 1 or 2 arguments", wrap->_base._name); - } - PyObject *defvalue = Py_None; - if (size >= 2) { - defvalue = PyTuple_GET_ITEM(args, 1); - } - - PyObject *key = PyTuple_GET_ITEM(args, 0); - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - if (value != nullptr) { - // OK, now set unset this value. - if (wrap->_setitem_func(wrap->_base._self, key, nullptr) == 0) { - return value; - } else { - Py_DECREF(value); - return nullptr; - } - } else if (PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_Clear(); - return Py_NewRef(defvalue); - } else { - return nullptr; - } -} - -/** - * Implementation of property.popitem() which returns and removes an arbitrary - * (key, value) pair from the mapping. Useful for destructive iteration. - */ -static PyObject *Dtool_MutableMappingWrapper_popitem(PyObject *self, PyObject *) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - if (wrap->_getitem_func == nullptr || wrap->_setitem_func == nullptr || - wrap->_keys._len_func == nullptr || wrap->_keys._getitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support popitem()"); - } - - Py_ssize_t length = wrap->_keys._len_func(wrap->_base._self); - if (length < 1) { - return PyErr_Format(PyExc_KeyError, "%s is empty", wrap->_base._name); - } - - PyObject *key = wrap->_keys._getitem_func(wrap->_base._self, length - 1); - if (key != nullptr) { - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - if (value != nullptr) { - // OK, now set unset this value. - if (wrap->_setitem_func(wrap->_base._self, key, nullptr) == 0) { - PyObject *item = PyTuple_New(2); - PyTuple_SET_ITEM(item, 0, key); - PyTuple_SET_ITEM(item, 1, value); - return item; - } - Py_DECREF(value); - } - } - return nullptr; -} - -/* - * Implementation of property.clear() which removes all elements in the - * mapping. - */ -static PyObject *Dtool_MutableMappingWrapper_clear(PyObject *self, PyObject *) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - Py_ssize_t index = 0; - if (wrap->_keys._len_func != nullptr && wrap->_keys._getitem_func != nullptr && - wrap->_setitem_func != nullptr) { - index = wrap->_keys._len_func(wrap->_base._self); - } else { - return Dtool_Raise_TypeError("property does not support clear()"); - } - - // Iterate through the items, invoking the delete function for each. We do - // this in reverse order, which may be more efficient. - while (index > 0) { - --index; - PyObject *key = wrap->_keys._getitem_func(wrap->_base._self, index); - if (key != nullptr) { - int result = wrap->_setitem_func(wrap->_base._self, key, nullptr); - Py_DECREF(key); - if (result != 0) { - return nullptr; - } - } - } - return Py_NewRef(Py_None); -} - -/** - * Implementation of property.setdefault(key[,def=None]) which is the same as - * get() except that it also writes the default value back to the mapping if - * the key was not found is missing. - */ -static PyObject *Dtool_MutableMappingWrapper_setdefault(PyObject *self, PyObject *args) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - - if (wrap->_getitem_func == nullptr || wrap->_setitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support setdefault()"); - } - - Py_ssize_t size = PyTuple_GET_SIZE(args); - if (size != 1 && size != 2) { - return PyErr_Format(PyExc_TypeError, "%s.setdefault() takes 1 or 2 arguments", wrap->_base._name); - } - PyObject *defvalue = Py_None; - if (size >= 2) { - defvalue = PyTuple_GET_ITEM(args, 1); - } - PyObject *key = PyTuple_GET_ITEM(args, 0); - PyObject *value = wrap->_getitem_func(wrap->_base._self, key); - if (value != nullptr) { - return value; - } else if (PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_Clear(); - if (wrap->_setitem_func(wrap->_base._self, key, defvalue) == 0) { - return Py_NewRef(defvalue); - } - } - return nullptr; -} - -/** - * Implementation of property.update(...) which sets multiple values in one - * go. It accepts either a single dictionary or keyword arguments, not both. - */ -static PyObject *Dtool_MutableMappingWrapper_update(PyObject *self, PyObject *args, PyObject *kwargs) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)self; - nassertr(wrap, nullptr); - - if (wrap->_getitem_func == nullptr || wrap->_setitem_func == nullptr) { - return Dtool_Raise_TypeError("property does not support update()"); - } - - // We accept either a dict argument or keyword arguments, but not both. - PyObject *dict; - switch (PyTuple_GET_SIZE(args)) { - case 0: - if (kwargs == nullptr) { - // This is legal. - return Py_NewRef(Py_None); - } - dict = kwargs; - break; - case 1: - if (PyDict_Check(PyTuple_GET_ITEM(args, 0)) && (kwargs == nullptr || Py_SIZE(kwargs) == 0)) { - dict = PyTuple_GET_ITEM(args, 0); - break; - } - // Fall through - default: - return PyErr_Format(PyExc_TypeError, "%s.update() takes either a dict argument or keyword arguments", wrap->_base._name); - } - - PyObject *result = Py_None; - PyObject *key, *value; - Py_ssize_t pos = 0; - Py_BEGIN_CRITICAL_SECTION(dict); - while (PyDict_Next(dict, &pos, &key, &value)) { - if (wrap->_setitem_func(wrap->_base._self, key, value) != 0) { - result = nullptr; - break; - } - } - Py_END_CRITICAL_SECTION(); - - return Py_XNewRef(result); -} - -/** - * This variant defines only a generator interface. - */ -static PyObject *Dtool_GeneratorWrapper_iternext(PyObject *self) { - Dtool_GeneratorWrapper *wrap = (Dtool_GeneratorWrapper *)self; - nassertr(wrap, nullptr); - nassertr(wrap->_iternext_func, nullptr); - return wrap->_iternext_func(wrap->_base._self); -} - -/** - * This is a variant of the Python getset mechanism that permits static - * properties. - */ -static void -Dtool_StaticProperty_dealloc(PyDescrObject *descr) { -#if PY_VERSION_HEX >= 0x03080000 - PyObject_GC_UnTrack(descr); -#else - _PyObject_GC_UNTRACK(descr); -#endif - Py_XDECREF(descr->d_type); - Py_XDECREF(descr->d_name); -//#if PY_MAJOR_VERSION >= 3 -// Py_XDECREF(descr->d_qualname); -//#endif - PyObject_GC_Del(descr); -} - -static PyObject * -Dtool_StaticProperty_repr(PyDescrObject *descr, const char *format) { -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - PyUnicode_AsUTF8(descr->d_name), - descr->d_type->tp_name); -#else - return PyString_FromFormat("", - PyString_AS_STRING(descr->d_name), - descr->d_type->tp_name); -#endif -} - -static int -Dtool_StaticProperty_traverse(PyObject *self, visitproc visit, void *arg) { - PyDescrObject *descr = (PyDescrObject *)self; - Py_VISIT(descr->d_type); - return 0; -} - -static PyObject * -Dtool_StaticProperty_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type) { - if (descr->d_getset->get != nullptr) { - return descr->d_getset->get(obj, descr->d_getset->closure); - } else { - return PyErr_Format(PyExc_AttributeError, - "attribute '%s' of type '%.100s' is not readable", -#if PY_MAJOR_VERSION >= 3 - PyUnicode_AsUTF8(((PyDescrObject *)descr)->d_name), -#else - PyString_AS_STRING(((PyDescrObject *)descr)->d_name), -#endif - ((PyDescrObject *)descr)->d_type->tp_name); - } -} - -static int -Dtool_StaticProperty_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) { - if (descr->d_getset->set != nullptr) { - return descr->d_getset->set(obj, value, descr->d_getset->closure); - } else { - PyErr_Format(PyExc_AttributeError, - "attribute '%s' of type '%.100s' is not writable", -#if PY_MAJOR_VERSION >= 3 - PyUnicode_AsUTF8(((PyDescrObject *)descr)->d_name), -#else - PyString_AS_STRING(((PyDescrObject *)descr)->d_name), -#endif - ((PyDescrObject *)descr)->d_type->tp_name); - return -1; - } -} - -/** - * This wraps around a property that exposes a sequence interface. - */ -Dtool_SequenceWrapper *Dtool_NewSequenceWrapper(PyObject *self, const char *name) { - Dtool_SequenceWrapper *wrap = (Dtool_SequenceWrapper *)PyObject_MALLOC(sizeof(Dtool_SequenceWrapper)); - if (wrap == nullptr) { - return (Dtool_SequenceWrapper *)PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - Dtool_SequenceWrapper_getitem, - nullptr, // sq_slice - nullptr, // sq_ass_item - nullptr, // sq_ass_slice - Dtool_SequenceWrapper_contains, - nullptr, // sq_inplace_concat - nullptr, // sq_inplace_repeat - }; - - static PyMethodDef methods[] = { - {"index", &Dtool_SequenceWrapper_index, METH_O, nullptr}, - {"count", &Dtool_SequenceWrapper_count, METH_O, nullptr}, - {nullptr, nullptr, 0, nullptr} - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "sequence wrapper", - sizeof(Dtool_SequenceWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_SequenceWrapper_repr, - nullptr, // tp_as_number - &seq_methods, - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - PySeqIter_New, - nullptr, // tp_iternext - methods, - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "Sequence"); - } - - (void)PyObject_INIT(wrap, &wrapper_type); - wrap->_base._self = Py_XNewRef(self); - wrap->_base._name = name; - wrap->_len_func = nullptr; - wrap->_getitem_func = nullptr; - return wrap; -} - -/** - * This wraps around a property that exposes a mutable sequence interface. - */ -Dtool_MutableSequenceWrapper *Dtool_NewMutableSequenceWrapper(PyObject *self, const char *name) { - Dtool_MutableSequenceWrapper *wrap = (Dtool_MutableSequenceWrapper *)PyObject_MALLOC(sizeof(Dtool_MutableSequenceWrapper)); - if (wrap == nullptr) { - return (Dtool_MutableSequenceWrapper *)PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - Dtool_SequenceWrapper_getitem, - nullptr, // sq_slice - Dtool_MutableSequenceWrapper_setitem, - nullptr, // sq_ass_slice - Dtool_SequenceWrapper_contains, - Dtool_MutableSequenceWrapper_extend, - nullptr, // sq_inplace_repeat - }; - - static PyMethodDef methods[] = { - {"index", &Dtool_SequenceWrapper_index, METH_O, nullptr}, - {"count", &Dtool_SequenceWrapper_count, METH_O, nullptr}, - {"clear", &Dtool_MutableSequenceWrapper_clear, METH_NOARGS, nullptr}, - {"pop", &Dtool_MutableSequenceWrapper_pop, METH_VARARGS, nullptr}, - {"remove", &Dtool_MutableSequenceWrapper_remove, METH_O, nullptr}, - {"append", &Dtool_MutableSequenceWrapper_append, METH_O, nullptr}, - {"insert", &Dtool_MutableSequenceWrapper_insert, METH_VARARGS, nullptr}, - {"extend", &Dtool_MutableSequenceWrapper_extend, METH_O, nullptr}, - {nullptr, nullptr, 0, nullptr} - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "sequence wrapper", - sizeof(Dtool_MutableSequenceWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_SequenceWrapper_repr, - nullptr, // tp_as_number - &seq_methods, - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - PySeqIter_New, - nullptr, // tp_iternext - methods, - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "MutableSequence"); - } - - (void)PyObject_INIT(wrap, &wrapper_type); - wrap->_base._self = Py_XNewRef(self); - wrap->_base._name = name; - wrap->_len_func = nullptr; - wrap->_getitem_func = nullptr; - wrap->_setitem_func = nullptr; - wrap->_insert_func = nullptr; - return wrap; -} - -/** - * This wraps around a mapping interface, with getitem function. - */ -Dtool_MappingWrapper *Dtool_NewMappingWrapper(PyObject *self, const char *name) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)PyObject_MALLOC(sizeof(Dtool_MappingWrapper)); - if (wrap == nullptr) { - return (Dtool_MappingWrapper *)PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - nullptr, // sq_item - nullptr, // sq_slice - nullptr, // sq_ass_item - nullptr, // sq_ass_slice - Dtool_MappingWrapper_contains, - nullptr, // sq_inplace_concat - nullptr, // sq_inplace_repeat - }; - - static PyMappingMethods map_methods = { - Dtool_SequenceWrapper_length, - Dtool_MappingWrapper_getitem, - nullptr, // mp_ass_subscript - }; - - static PyMethodDef methods[] = { - {"get", &Dtool_MappingWrapper_get, METH_VARARGS, nullptr}, - {"keys", &Dtool_MappingWrapper_keys, METH_NOARGS, nullptr}, - {"values", &Dtool_MappingWrapper_values, METH_NOARGS, nullptr}, - {"items", &Dtool_MappingWrapper_items, METH_NOARGS, nullptr}, - {nullptr, nullptr, 0, nullptr} - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "mapping wrapper", - sizeof(Dtool_MappingWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_WrapperBase_repr, - nullptr, // tp_as_number - &seq_methods, - &map_methods, - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - Dtool_MappingWrapper_iter, - nullptr, // tp_iternext - methods, - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "Mapping"); - } - - (void)PyObject_INIT(wrap, &wrapper_type); - wrap->_base._self = Py_XNewRef(self); - wrap->_base._name = name; - wrap->_keys._len_func = nullptr; - wrap->_keys._getitem_func = nullptr; - wrap->_getitem_func = nullptr; - wrap->_setitem_func = nullptr; - return wrap; -} - -/** - * This wraps around a mapping interface, with getitem/setitem functions. - */ -Dtool_MappingWrapper *Dtool_NewMutableMappingWrapper(PyObject *self, const char *name) { - Dtool_MappingWrapper *wrap = (Dtool_MappingWrapper *)PyObject_MALLOC(sizeof(Dtool_MappingWrapper)); - if (wrap == nullptr) { - return (Dtool_MappingWrapper *)PyErr_NoMemory(); - } - - static PySequenceMethods seq_methods = { - Dtool_SequenceWrapper_length, - nullptr, // sq_concat - nullptr, // sq_repeat - nullptr, // sq_item - nullptr, // sq_slice - nullptr, // sq_ass_item - nullptr, // sq_ass_slice - Dtool_MappingWrapper_contains, - nullptr, // sq_inplace_concat - nullptr, // sq_inplace_repeat - }; - - static PyMappingMethods map_methods = { - Dtool_SequenceWrapper_length, - Dtool_MappingWrapper_getitem, - Dtool_MutableMappingWrapper_setitem, - }; - - static PyMethodDef methods[] = { - {"get", &Dtool_MappingWrapper_get, METH_VARARGS, nullptr}, - {"pop", &Dtool_MutableMappingWrapper_pop, METH_VARARGS, nullptr}, - {"popitem", &Dtool_MutableMappingWrapper_popitem, METH_NOARGS, nullptr}, - {"clear", &Dtool_MutableMappingWrapper_clear, METH_VARARGS, nullptr}, - {"setdefault", &Dtool_MutableMappingWrapper_setdefault, METH_VARARGS, nullptr}, - {"update", (PyCFunction) &Dtool_MutableMappingWrapper_update, METH_VARARGS | METH_KEYWORDS, nullptr}, - {"keys", &Dtool_MappingWrapper_keys, METH_NOARGS, nullptr}, - {"values", &Dtool_MappingWrapper_values, METH_NOARGS, nullptr}, - {"items", &Dtool_MappingWrapper_items, METH_NOARGS, nullptr}, - {nullptr, nullptr, 0, nullptr} - }; - - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "mapping wrapper", - sizeof(Dtool_MappingWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - Dtool_WrapperBase_repr, - nullptr, // tp_as_number - &seq_methods, - &map_methods, - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - Dtool_MappingWrapper_iter, - nullptr, // tp_iternext - methods, - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - static bool registered = false; - if (!registered) { - registered = true; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - // If the collections.abc module is loaded, register this as a subclass. - _register_collection((PyTypeObject *)&wrapper_type, "MutableMapping"); - } - - (void)PyObject_INIT(wrap, &wrapper_type); - wrap->_base._self = Py_XNewRef(self); - wrap->_base._name = name; - wrap->_keys._len_func = nullptr; - wrap->_keys._getitem_func = nullptr; - wrap->_getitem_func = nullptr; - wrap->_setitem_func = nullptr; - return wrap; -} - -/** - * Creates a generator that invokes a given function with the given self arg. - */ -PyObject * -Dtool_NewGenerator(PyObject *self, iternextfunc gen_next) { - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(nullptr, 0) - "generator wrapper", - sizeof(Dtool_GeneratorWrapper), - 0, // tp_itemsize - Dtool_WrapperBase_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare - nullptr, // tp_repr - nullptr, // tp_as_number - nullptr, // tp_as_sequence - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - PyObject_GenericSetAttr, - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, - nullptr, // tp_doc - nullptr, // tp_traverse - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - PyObject_SelfIter, - Dtool_GeneratorWrapper_iternext, - nullptr, // tp_methods - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - nullptr, // tp_descr_get - nullptr, // tp_descr_set - 0, // tp_dictoffset - nullptr, // tp_init - PyType_GenericAlloc, - nullptr, // tp_new - PyObject_Del, - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - Dtool_GeneratorWrapper *gen; - gen = (Dtool_GeneratorWrapper *)PyType_GenericAlloc(&wrapper_type, 0); - if (gen != nullptr) { - gen->_base._self = Py_NewRef(self); - gen->_iternext_func = gen_next; - } - return (PyObject *)gen; -} - -/** - * This is a variant of the Python getset mechanism that permits static - * properties. - */ -PyObject * -Dtool_NewStaticProperty(PyTypeObject *type, const PyGetSetDef *getset) { - static PyTypeObject wrapper_type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "getset_descriptor", - sizeof(PyGetSetDescrObject), - 0, // tp_itemsize - (destructor)Dtool_StaticProperty_dealloc, - 0, // tp_vectorcall_offset - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_reserved - (reprfunc)Dtool_StaticProperty_repr, - nullptr, // tp_as_number - nullptr, // tp_as_sequence - nullptr, // tp_as_mapping - nullptr, // tp_hash - nullptr, // tp_call - nullptr, // tp_str - PyObject_GenericGetAttr, - nullptr, // tp_setattro - nullptr, // tp_as_buffer - Py_TPFLAGS_DEFAULT, - nullptr, // tp_doc - Dtool_StaticProperty_traverse, - nullptr, // tp_clear - nullptr, // tp_richcompare - 0, // tp_weaklistoffset - nullptr, // tp_iter - nullptr, // tp_iternext - nullptr, // tp_methods - nullptr, // tp_members - nullptr, // tp_getset - nullptr, // tp_base - nullptr, // tp_dict - (descrgetfunc)Dtool_StaticProperty_get, - (descrsetfunc)Dtool_StaticProperty_set, - 0, // tp_dictoffset - nullptr, // tp_init - nullptr, // tp_alloc - nullptr, // tp_new - nullptr, // tp_free - nullptr, // tp_is_gc - nullptr, // tp_bases - nullptr, // tp_mro - nullptr, // tp_cache - nullptr, // tp_subclasses - nullptr, // tp_weaklist - nullptr, // tp_del - 0, // tp_version_tag, -#if PY_VERSION_HEX >= 0x03040000 - nullptr, // tp_finalize -#endif -#if PY_VERSION_HEX >= 0x03080000 - nullptr, // tp_vectorcall -#endif - }; - - if (PyType_Ready(&wrapper_type) < 0) { - return nullptr; - } - - PyGetSetDescrObject *descr; - descr = (PyGetSetDescrObject *)PyType_GenericAlloc(&wrapper_type, 0); - if (descr != nullptr) { - Py_XINCREF(type); - descr->d_getset = (PyGetSetDef *)getset; -#if PY_MAJOR_VERSION >= 3 - descr->d_common.d_type = type; - descr->d_common.d_name = PyUnicode_InternFromString(getset->name); -#if PY_VERSION_HEX >= 0x03030000 - descr->d_common.d_qualname = nullptr; -#endif -#else - descr->d_type = type; - descr->d_name = PyString_InternFromString(getset->name); -#endif - } - return (PyObject *)descr; -} - -#endif // HAVE_PYTHON diff --git a/dtool/src/parser-inc/algorithm b/dtool/src/parser-inc/algorithm index 751a8ec2cb..52d538e5f2 100644 --- a/dtool/src/parser-inc/algorithm +++ b/dtool/src/parser-inc/algorithm @@ -25,7 +25,11 @@ namespace std { constexpr const T &min(const T &a, const T &b); template constexpr const T &max(const T &a, const T &b); + + template + void sort(RandomIt first, RandomIt last); + template + void sort(RandomIt first, RandomIt last, Compare comp); } #endif - diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index 9b5de53639..15b7816cd3 100644 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -145,7 +145,6 @@ var READABLE File /nonfatal /r "${BUILT}\panda3d\direct${EXT_SUFFIX}" File /nonfatal /r "${BUILT}\panda3d\egg${EXT_SUFFIX}" File /nonfatal /r "${BUILT}\panda3d\fx${EXT_SUFFIX}" - File /nonfatal /r "${BUILT}\panda3d\interrogatedb${EXT_SUFFIX}" File /nonfatal /r "${BUILT}\panda3d\physics${EXT_SUFFIX}" File /nonfatal /r "${BUILT}\panda3d\_rplight${EXT_SUFFIX}" File /nonfatal /r "${BUILT}\panda3d\skel${EXT_SUFFIX}" diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 446c4d6770..d4a174e909 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2773,7 +2773,8 @@ del_files = ['core.py', 'core.pyc', 'core.pyo', 'direct.py', 'direct.pyc', 'direct.pyo', '_direct.pyd', '_direct.so', 'dtoolconfig.pyd', 'dtoolconfig.so', - 'net.pyd', 'net.so'] + 'net.pyd', 'net.so', + 'interrogatedb.pyd', 'interrogatedb.so'] for basename in del_files: path = os.path.join(GetOutputDir(), 'panda3d', basename) @@ -3486,27 +3487,6 @@ TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite2.obj') TargetAdd('libp3dtoolconfig.dll', input='libp3dtool.dll') TargetAdd('libp3dtoolconfig.dll', opts=['ADVAPI', 'OPENSSL', 'WINGDI', 'WINUSER']) -# -# DIRECTORY: dtool/src/interrogatedb/ -# - -OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:INTERROGATEDB'] -TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx') -TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx') -TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj') -TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite2.obj') -TargetAdd('libp3interrogatedb.dll', input='libp3dtool.dll') -TargetAdd('libp3interrogatedb.dll', input='libp3dtoolconfig.dll') - -# This used to be called dtoolconfig.pyd, but it just contains the interrogatedb -# stuff, so it has been renamed appropriately. -OPTS=['DIR:dtool/metalibs/dtoolconfig'] -PyTargetAdd('interrogatedb_pydtool.obj', opts=OPTS, input="pydtool.cxx") -PyTargetAdd('interrogatedb.pyd', input='interrogatedb_pydtool.obj') -PyTargetAdd('interrogatedb.pyd', input='libp3dtool.dll') -PyTargetAdd('interrogatedb.pyd', input='libp3dtoolconfig.dll') -PyTargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll') - # # DIRECTORY: dtool/src/prckeys/ # @@ -4223,7 +4203,6 @@ PyTargetAdd('core.pyd', input='p3display_ext_composite.obj') PyTargetAdd('core.pyd', input='p3collide_ext_composite.obj') PyTargetAdd('core.pyd', input='core_module.obj') -PyTargetAdd('core.pyd', input='libp3interrogatedb.dll') PyTargetAdd('core.pyd', input=COMMON_PANDA_LIBS) PyTargetAdd('core.pyd', opts=['WINSOCK2']) @@ -4263,7 +4242,6 @@ if not PkgSkip("VISION"): PyTargetAdd('vision.pyd', input='vision_module.obj') PyTargetAdd('vision.pyd', input='libp3vision_igate.obj') PyTargetAdd('vision.pyd', input='libp3vision.dll') - PyTargetAdd('vision.pyd', input='libp3interrogatedb.dll') PyTargetAdd('vision.pyd', input=COMMON_PANDA_LIBS) # @@ -4295,7 +4273,6 @@ if not PkgSkip('SKEL'): PyTargetAdd('skel.pyd', input='skel_module.obj') PyTargetAdd('skel.pyd', input='libp3skel_igate.obj') PyTargetAdd('skel.pyd', input='libpandaskel.dll') - PyTargetAdd('skel.pyd', input='libp3interrogatedb.dll') PyTargetAdd('skel.pyd', input=COMMON_PANDA_LIBS) # @@ -4332,7 +4309,6 @@ if not PkgSkip('PANDAFX'): PyTargetAdd('fx.pyd', input='fx_module.obj') PyTargetAdd('fx.pyd', input='libp3distort_igate.obj') PyTargetAdd('fx.pyd', input='libpandafx.dll') - PyTargetAdd('fx.pyd', input='libp3interrogatedb.dll') PyTargetAdd('fx.pyd', input=COMMON_PANDA_LIBS) # @@ -4358,7 +4334,6 @@ if not PkgSkip("VRPN"): PyTargetAdd('vrpn.pyd', input='vrpn_module.obj') PyTargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj') PyTargetAdd('vrpn.pyd', input='libp3vrpn.dll') - PyTargetAdd('vrpn.pyd', input='libp3interrogatedb.dll') PyTargetAdd('vrpn.pyd', input=COMMON_PANDA_LIBS) # @@ -4577,7 +4552,6 @@ if not PkgSkip("EGG"): PyTargetAdd('egg.pyd', input='libp3egg_igate.obj') PyTargetAdd('egg.pyd', input='libp3egg2pg_igate.obj') PyTargetAdd('egg.pyd', input='libpandaegg.dll') - PyTargetAdd('egg.pyd', input='libp3interrogatedb.dll') PyTargetAdd('egg.pyd', input=COMMON_PANDA_LIBS) # @@ -4777,7 +4751,6 @@ if not PkgSkip("ODE"): PyTargetAdd('ode.pyd', input='libpandaode_igate.obj') PyTargetAdd('ode.pyd', input='p3ode_ext_composite.obj') PyTargetAdd('ode.pyd', input='libpandaode.dll') - PyTargetAdd('ode.pyd', input='libp3interrogatedb.dll') PyTargetAdd('ode.pyd', input=COMMON_PANDA_LIBS) PyTargetAdd('ode.pyd', opts=['WINUSER', 'ODE']) @@ -4813,7 +4786,6 @@ if not PkgSkip("BULLET"): PyTargetAdd('bullet.pyd', input='bullet_module.obj') PyTargetAdd('bullet.pyd', input='libpandabullet_igate.obj') PyTargetAdd('bullet.pyd', input='libpandabullet.dll') - PyTargetAdd('bullet.pyd', input='libp3interrogatedb.dll') PyTargetAdd('bullet.pyd', input=COMMON_PANDA_LIBS) PyTargetAdd('bullet.pyd', opts=['WINUSER', 'BULLET']) @@ -4879,7 +4851,6 @@ if not PkgSkip("PANDAPHYSICS"): if not PkgSkip("PANDAPARTICLESYSTEM"): PyTargetAdd('physics.pyd', input='libp3particlesystem_igate.obj') PyTargetAdd('physics.pyd', input='libpandaphysics.dll') - PyTargetAdd('physics.pyd', input='libp3interrogatedb.dll') PyTargetAdd('physics.pyd', input=COMMON_PANDA_LIBS) # @@ -5194,7 +5165,6 @@ if not PkgSkip("DIRECT"): PyTargetAdd('direct.pyd', input='direct_module.obj') PyTargetAdd('direct.pyd', input='libp3direct.dll') - PyTargetAdd('direct.pyd', input='libp3interrogatedb.dll') PyTargetAdd('direct.pyd', input=COMMON_PANDA_LIBS) PyTargetAdd('direct.pyd', opts=['WINUSER', 'WINGDI', 'WINSOCK2']) @@ -5893,7 +5863,6 @@ if not PkgSkip("CONTRIB"): PyTargetAdd('ai.pyd', input='ai_module.obj') PyTargetAdd('ai.pyd', input='libpandaai_igate.obj') PyTargetAdd('ai.pyd', input='libpandaai.dll') - PyTargetAdd('ai.pyd', input='libp3interrogatedb.dll') PyTargetAdd('ai.pyd', input=COMMON_PANDA_LIBS) # @@ -5914,7 +5883,6 @@ if not PkgSkip("CONTRIB") and not PkgSkip("PYTHON"): PyTargetAdd('_rplight.pyd', input='rplight_module.obj') PyTargetAdd('_rplight.pyd', input='libp3rplight_igate.obj') PyTargetAdd('_rplight.pyd', input='p3rplight_composite1.obj') - PyTargetAdd('_rplight.pyd', input='libp3interrogatedb.dll') PyTargetAdd('_rplight.pyd', input=COMMON_PANDA_LIBS) # diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 7b1a522ab3..662059d40c 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -592,8 +592,8 @@ def GetInterrogateDir(): return INTERROGATE_DIR dir = os.path.join(GetOutputDir(), "tmp", "interrogate") - if not os.path.isdir(os.path.join(dir, "panda3d_interrogate-0.3.0.dist-info")): - oscmd("\"%s\" -m pip install --force-reinstall --upgrade -t \"%s\" panda3d-interrogate==0.3.0" % (sys.executable, dir)) + if not os.path.isdir(os.path.join(dir, "panda3d_interrogate-0.4.0.dist-info")): + oscmd("\"%s\" -m pip install --force-reinstall --upgrade -t \"%s\" panda3d-interrogate==0.4.0" % (sys.executable, dir)) INTERROGATE_DIR = dir diff --git a/panda/src/express/CMakeLists.txt b/panda/src/express/CMakeLists.txt index 3ffc45a1e5..8b38007938 100644 --- a/panda/src/express/CMakeLists.txt +++ b/panda/src/express/CMakeLists.txt @@ -148,7 +148,7 @@ set(P3EXPRESS_IGATEEXT composite_sources(p3express P3EXPRESS_SOURCES) add_component_library(p3express SYMBOL BUILDING_PANDA_EXPRESS ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS}) -target_link_libraries(p3express p3pandabase p3interrogatedb p3prc p3dtool +target_link_libraries(p3express p3pandabase p3dconfig p3prc p3dtool PKG::ZLIB PKG::OPENSSL) target_interrogate(p3express ALL EXTENSIONS ${P3EXPRESS_IGATEEXT}) diff --git a/panda/src/express/memoryUsage.cxx b/panda/src/express/memoryUsage.cxx index bdc785222a..21161a025b 100644 --- a/panda/src/express/memoryUsage.cxx +++ b/panda/src/express/memoryUsage.cxx @@ -16,7 +16,6 @@ #include "trueClock.h" #include "typedReferenceCount.h" #include "mutexImpl.h" -#include "interrogate_request.h" #if defined(_MSC_VER) && defined(_DEBUG) #include diff --git a/panda/src/iphone/ipfreeze.py b/panda/src/iphone/ipfreeze.py index 8762b95b63..a18a20b9fc 100755 --- a/panda/src/iphone/ipfreeze.py +++ b/panda/src/iphone/ipfreeze.py @@ -66,7 +66,7 @@ if __name__ == '__main__': libs = '' libs += ' -framework Foundation -framework UIKit' if link_all_static: - libs += ' -lframework -lputil -lcollide -lpgraph -lchan -ltext -lpnmimage -lpnmimagetypes -levent -leffects -lgobj -ldisplay -lmathutil -lexpress -ldgraph -ldevice -ltform -llinmath -lpstatclient -lpanda -lglstuff -lrecorder -lpgui -lchar -lpipeline -lpandabase -llerp -lgsgbase -ldownloader -lparametrics -lpgraphnodes -lcull -lgrutil -lnet -lmovies -lnativenet -laudio -linterrogatedb -ldconfig -ldtoolutil -ldtoolbase -lprc -liphonedisplay -lpandaexpress -lpanda' + libs += ' -lframework -lputil -lcollide -lpgraph -lchan -ltext -lpnmimage -lpnmimagetypes -levent -leffects -lgobj -ldisplay -lmathutil -lexpress -ldgraph -ldevice -ltform -llinmath -lpstatclient -lpanda -lglstuff -lrecorder -lpgui -lchar -lpipeline -lpandabase -llerp -lgsgbase -ldownloader -lparametrics -lpgraphnodes -lcull -lgrutil -lnet -lmovies -lnativenet -laudio -ldconfig -ldtoolutil -ldtoolbase -lprc -liphonedisplay -lpandaexpress -lpanda' libs += ' -lphysics -lparticlesystem -lpandaphysics' libs += ' -ldistort -leffects -lpandafx' libs += ' -ldirectbase -ldcparser -ldeadrec -ldistributed -lhttp -lshowbase -linterval -lmotiontrail -ldirect' diff --git a/tests/test_imports.py b/tests/test_imports.py index c6295bc7d0..c31c2a461f 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -32,6 +32,9 @@ def test_imports_panda3d(): module = basename.split('.', 1)[0] ext = basename[len(module):] + if module == 'dtoolconfig' or module == 'interrogatedb': + continue + if ext in extensions: importlib.import_module('panda3d.%s' % (module))