|
4 | 4 |
|
5 | 5 | #include <Python.h> |
6 | 6 |
|
7 | | -#include "examplelib.h" |
8 | | -#include "examplelib2.h" |
| 7 | +#include "lib.h" |
9 | 8 |
|
10 | | -static PyObject* example_sum(PyObject* self, PyObject *args) |
| 9 | +static PyObject* example_prodsum(PyObject* self, PyObject *args) |
11 | 10 | { |
12 | | - int a, b; |
13 | | - if (!PyArg_ParseTuple(args, "ii", &a, &b)) { |
14 | | - return NULL; |
15 | | - } |
| 11 | + int a, b, x; |
16 | 12 |
|
17 | | - long result = sum(a, b); |
18 | | - |
19 | | - return PyLong_FromLong(result); |
20 | | -} |
21 | | - |
22 | | -static PyObject* example_prod(PyObject* self, PyObject *args) |
23 | | -{ |
24 | | - int a, b; |
25 | | - if (!PyArg_ParseTuple(args, "ii", &a, &b)) { |
| 13 | + if (!PyArg_ParseTuple(args, "iii", &a, &b, &x)) { |
26 | 14 | return NULL; |
27 | 15 | } |
28 | 16 |
|
29 | | - long result = prod(a, b); |
| 17 | + long result = prodsum(a, b, x); |
30 | 18 |
|
31 | 19 | return PyLong_FromLong(result); |
32 | 20 | } |
33 | 21 |
|
34 | 22 | static PyMethodDef methods[] = { |
35 | | - {"example_prod", (PyCFunction)example_prod, METH_VARARGS, NULL}, |
36 | | - {"example_sum", (PyCFunction)example_sum, METH_VARARGS, NULL}, |
| 23 | + {"prodsum", (PyCFunction)example_prodsum, METH_VARARGS, NULL}, |
37 | 24 | {NULL, NULL, 0, NULL}, |
38 | 25 | }; |
39 | 26 |
|
|
0 commit comments