Browse Source

interrogatedb: Add functions to interrogate_interface.h:

- `interrogate_function_is_unary_op`
- `interrogate_function_is_operator_typecast`
- `interrogate_type_is_array`
- `interrogate_type_array_size`

Closes #1362
WMOkiishi 3 years ago
parent
commit
813490b2c7

+ 108 - 0
dtool/metalibs/dtoolconfig/pydtool.cxx

@@ -60,6 +60,8 @@ static PyObject *_inP07ytISgV(PyObject *self, PyObject *args);
 static PyObject *_inP07ytH3bx(PyObject *self, PyObject *args);
 static PyObject *_inP07ytH3bx(PyObject *self, PyObject *args);
 static PyObject *_inP07ytzeUk(PyObject *self, PyObject *args);
 static PyObject *_inP07ytzeUk(PyObject *self, PyObject *args);
 static PyObject *_inP07ytUeI5(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 *_inP07ytJAAI(PyObject *self, PyObject *args);
 static PyObject *_inP07yt0UXw(PyObject *self, PyObject *args);
 static PyObject *_inP07yt0UXw(PyObject *self, PyObject *args);
 static PyObject *_inP07ytuSvx(PyObject *self, PyObject *args);
 static PyObject *_inP07ytuSvx(PyObject *self, PyObject *args);
@@ -95,6 +97,8 @@ static PyObject *_inP07ytiytI(PyObject *self, PyObject *args);
 static PyObject *_inP07ytZc07(PyObject *self, PyObject *args);
 static PyObject *_inP07ytZc07(PyObject *self, PyObject *args);
 static PyObject *_inP07ytfaH0(PyObject *self, PyObject *args);
 static PyObject *_inP07ytfaH0(PyObject *self, PyObject *args);
 static PyObject *_inP07ytGB9D(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 *_inP07ytsxxs(PyObject *self, PyObject *args);
 static PyObject *_inP07ytMT0z(PyObject *self, PyObject *args);
 static PyObject *_inP07ytMT0z(PyObject *self, PyObject *args);
 static PyObject *_inP07ytiW3v(PyObject *self, PyObject *args);
 static PyObject *_inP07ytiW3v(PyObject *self, PyObject *args);
@@ -126,6 +130,8 @@ static PyObject *_inP07ytDyRd(PyObject *self, PyObject *args);
 static PyObject *_inP07ytMnKa(PyObject *self, PyObject *args);
 static PyObject *_inP07ytMnKa(PyObject *self, PyObject *args);
 static PyObject *_inP07ytRtji(PyObject *self, PyObject *args);
 static PyObject *_inP07ytRtji(PyObject *self, PyObject *args);
 static PyObject *_inP07ytCnbQ(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 *_inP07ytdUVN(PyObject *self, PyObject *args);
 static PyObject *_inP07ytZtNk(PyObject *self, PyObject *args);
 static PyObject *_inP07ytZtNk(PyObject *self, PyObject *args);
 static PyObject *_inP07ytihbt(PyObject *self, PyObject *args);
 static PyObject *_inP07ytihbt(PyObject *self, PyObject *args);
@@ -828,6 +834,34 @@ _inP07ytUeI5(PyObject *, PyObject *args) {
   return nullptr;
   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", &param0)) {
+    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", &param0)) {
+    bool return_value = (::interrogate_function_is_operator_typecast)((FunctionIndex)param0);
+    return PyBool_FromLong(return_value);
+  }
+  return nullptr;
+}
+
 /*
 /*
  * Python simple wrapper for
  * Python simple wrapper for
  * bool interrogate_function_is_constructor(FunctionIndex function)
  * bool interrogate_function_is_constructor(FunctionIndex function)
@@ -1405,6 +1439,42 @@ _inP07ytGB9D(PyObject *, PyObject *args) {
   return nullptr;
   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", &param0)) {
+    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", &param0)) {
+    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
  * Python simple wrapper for
  * int interrogate_number_of_global_types(void)
  * int interrogate_number_of_global_types(void)
@@ -1901,6 +1971,38 @@ _inP07ytCnbQ(PyObject *, PyObject *args) {
   return nullptr;
   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", &param0)) {
+    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", &param0)) {
+    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
  * Python simple wrapper for
  * bool interrogate_type_is_enum(TypeIndex type)
  * bool interrogate_type_is_enum(TypeIndex type)
@@ -2565,6 +2667,8 @@ static PyMethodDef python_simple_funcs[] = {
   { "interrogate_function_prototype", &_inP07ytH3bx, METH_VARARGS },
   { "interrogate_function_prototype", &_inP07ytH3bx, METH_VARARGS },
   { "interrogate_function_is_method", &_inP07ytzeUk, METH_VARARGS },
   { "interrogate_function_is_method", &_inP07ytzeUk, METH_VARARGS },
   { "interrogate_function_class", &_inP07ytUeI5, METH_VARARGS },
   { "interrogate_function_class", &_inP07ytUeI5, METH_VARARGS },
+  { "interrogate_function_is_unary_op", &_inP07ytbmxJ, METH_VARARGS },
+  { "interrogate_function_is_operator_typecast", &_inP07ytY8Lc, METH_VARARGS },
   { "interrogate_function_is_constructor", &_inP07ytJAAI, METH_VARARGS },
   { "interrogate_function_is_constructor", &_inP07ytJAAI, METH_VARARGS },
   { "interrogate_function_is_destructor", &_inP07yt0UXw, METH_VARARGS },
   { "interrogate_function_is_destructor", &_inP07yt0UXw, METH_VARARGS },
   { "interrogate_function_has_module_name", &_inP07ytuSvx, METH_VARARGS },
   { "interrogate_function_has_module_name", &_inP07ytuSvx, METH_VARARGS },
@@ -2600,6 +2704,8 @@ static PyMethodDef python_simple_funcs[] = {
   { "interrogate_make_seq_comment", &_inP07ytZc07, METH_VARARGS },
   { "interrogate_make_seq_comment", &_inP07ytZc07, METH_VARARGS },
   { "interrogate_make_seq_num_name", &_inP07ytfaH0, METH_VARARGS },
   { "interrogate_make_seq_num_name", &_inP07ytfaH0, METH_VARARGS },
   { "interrogate_make_seq_element_name", &_inP07ytGB9D, METH_VARARGS },
   { "interrogate_make_seq_element_name", &_inP07ytGB9D, METH_VARARGS },
+  { "interrogate_make_seq_num_getter", &_inP07ytrppS, METH_VARARGS },
+  { "interrogate_make_seq_element_getter", &_inP07ytO50x, METH_VARARGS },
   { "interrogate_number_of_global_types", &_inP07ytsxxs, METH_VARARGS },
   { "interrogate_number_of_global_types", &_inP07ytsxxs, METH_VARARGS },
   { "interrogate_get_global_type", &_inP07ytMT0z, METH_VARARGS },
   { "interrogate_get_global_type", &_inP07ytMT0z, METH_VARARGS },
   { "interrogate_number_of_types", &_inP07ytiW3v, METH_VARARGS },
   { "interrogate_number_of_types", &_inP07ytiW3v, METH_VARARGS },
@@ -2631,6 +2737,8 @@ static PyMethodDef python_simple_funcs[] = {
   { "interrogate_type_is_const", &_inP07ytMnKa, METH_VARARGS },
   { "interrogate_type_is_const", &_inP07ytMnKa, METH_VARARGS },
   { "interrogate_type_is_typedef", &_inP07ytRtji, METH_VARARGS },
   { "interrogate_type_is_typedef", &_inP07ytRtji, METH_VARARGS },
   { "interrogate_type_wrapped_type", &_inP07ytCnbQ, METH_VARARGS },
   { "interrogate_type_wrapped_type", &_inP07ytCnbQ, METH_VARARGS },
+  { "interrogate_type_is_array", &_inP07ytoxqc, METH_VARARGS },
+  { "interrogate_type_array_size", &_inP07ytZQIS, METH_VARARGS },
   { "interrogate_type_is_enum", &_inP07ytdUVN, METH_VARARGS },
   { "interrogate_type_is_enum", &_inP07ytdUVN, METH_VARARGS },
   { "interrogate_type_is_scoped_enum", &_inP07ytZtNk, METH_VARARGS },
   { "interrogate_type_is_scoped_enum", &_inP07ytZtNk, METH_VARARGS },
   { "interrogate_type_number_of_enum_values", &_inP07ytihbt, METH_VARARGS },
   { "interrogate_type_number_of_enum_values", &_inP07ytihbt, METH_VARARGS },

+ 25 - 0
dtool/src/interrogatedb/interrogate_interface.cxx

@@ -266,6 +266,19 @@ interrogate_function_class(FunctionIndex function) {
   return InterrogateDatabase::get_ptr()->get_function(function).get_class();
   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
 bool
 interrogate_function_is_constructor(FunctionIndex function) {
 interrogate_function_is_constructor(FunctionIndex function) {
   // cerr << "interrogate_function_is_constructor(" << function << ")\n";
   // cerr << "interrogate_function_is_constructor(" << function << ")\n";
@@ -697,6 +710,18 @@ interrogate_type_wrapped_type(TypeIndex type) {
   return InterrogateDatabase::get_ptr()->get_type(type).get_wrapped_type();
   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
 bool
 interrogate_type_is_enum(TypeIndex type) {
 interrogate_type_is_enum(TypeIndex type) {
   // cerr << "interrogate_type_is_enum(" << type << ")\n";
   // cerr << "interrogate_type_is_enum(" << type << ")\n";

+ 6 - 0
dtool/src/interrogatedb/interrogate_interface.h

@@ -210,6 +210,8 @@ EXPCL_INTERROGATEDB const char *interrogate_function_prototype(FunctionIndex fun
 // if the function is a class method.
 // if the function is a class method.
 EXPCL_INTERROGATEDB bool interrogate_function_is_method(FunctionIndex function);
 EXPCL_INTERROGATEDB bool interrogate_function_is_method(FunctionIndex function);
 EXPCL_INTERROGATEDB TypeIndex interrogate_function_class(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_constructor(FunctionIndex function);
 EXPCL_INTERROGATEDB bool interrogate_function_is_destructor(FunctionIndex function);
 EXPCL_INTERROGATEDB bool interrogate_function_is_destructor(FunctionIndex function);
 
 
@@ -424,6 +426,10 @@ EXPCL_INTERROGATEDB bool interrogate_type_is_const(TypeIndex type);
 EXPCL_INTERROGATEDB bool interrogate_type_is_typedef(TypeIndex type);
 EXPCL_INTERROGATEDB bool interrogate_type_is_typedef(TypeIndex type);
 EXPCL_INTERROGATEDB TypeIndex interrogate_type_wrapped_type(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,
 // 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.
 // 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_enum(TypeIndex type);