| 844 | |
| 845 | extern "C" |
| 846 | int OPS_GetIntInput(int *numData, int*data) |
| 847 | { |
| 848 | if ((numberArgs - currentArg) >= *numData) { |
| 849 | for (int i=0; i<*numData; i++) { |
| 850 | PyObject *o = PyTuple_GetItem(currentArgs,currentArg); |
| 851 | |
| 852 | #if PY_MAJOR_VERSION==2 |
| 853 | if (!PyInt_Check(o)) { |
| 854 | //PyErr_SetString(PyExc_ValueError,"invalid integer"); |
| 855 | return -1; |
| 856 | } |
| 857 | #elif PY_MAJOR_VERSION==3 |
| 858 | if (!PyLong_Check(o)) { |
| 859 | //PyErr_SetString(PyExc_ValueError,"invalid integer"); |
| 860 | return -1; |
| 861 | } |
| 862 | #endif |
| 863 | |
| 864 | |
| 865 | #if PY_MAJOR_VERSION==2 |
| 866 | long value = PyInt_AS_LONG(o); |
| 867 | #elif PY_MAJOR_VERSION==3 |
| 868 | long value = PyLong_AsLong(o); |
| 869 | #endif |
| 870 | |
| 871 | data[i] = value; |
| 872 | currentArg++; |
| 873 | } |
| 874 | |
| 875 | return 0; |
| 876 | } |
| 877 | return -1; |
| 878 | } |
| 879 | |
| 880 | |
| 881 | extern "C" |
no outgoing calls
no test coverage detected