diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-14 16:18:29 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-14 16:18:29 +0100 |
| commit | 1e1fd628207034b0412c50e289f146d34c5baf71 (patch) | |
| tree | f21715cf39ef5fcc0a9197b214702fb7d16a1c58 /python/nissy_module.c | |
| parent | bfb7b1ab9d2c85a256c42c006060ffe7c2652638 (diff) | |
| download | nissy-core-1e1fd628207034b0412c50e289f146d34c5baf71.tar.gz nissy-core-1e1fd628207034b0412c50e289f146d34c5baf71.zip | |
Replaced datasize with solverinfo
Diffstat (limited to '')
| -rw-r--r-- | python/nissy_module.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/python/nissy_module.c b/python/nissy_module.c index 29facc4..db63dbb 100644 --- a/python/nissy_module.c +++ b/python/nissy_module.c | |||
| @@ -219,27 +219,33 @@ getcube(PyObject *self, PyObject *args) | |||
| 219 | return string_result(err, result); | 219 | return string_result(err, result); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | PyDoc_STRVAR(datasize_doc, | 222 | PyDoc_STRVAR(solverinfo_doc, |
| 223 | "datasize(solver)\n" | 223 | "solverinfo(solver)\n" |
| 224 | "--\n\n" | 224 | "--\n\n" |
| 225 | "Returns the size of the data (pruning table) for the given solver\n" | 225 | "Returns the size and the short name of the data for the given solver\n" |
| 226 | "\n" | 226 | "\n" |
| 227 | "Parameters:\n" | 227 | "Parameters:\n" |
| 228 | " - solver: the name of the solver\n" | 228 | " - solver: the name of the solver\n" |
| 229 | "\n" | 229 | "\n" |
| 230 | "Returns: the size of the data for the solver, in bytes\n" | 230 | "Returns: a pair containing the size and the short name " |
| 231 | "of the data for the solver, in bytes\n" | ||
| 231 | ); | 232 | ); |
| 232 | static PyObject * | 233 | static PyObject * |
| 233 | datasize(PyObject *self, PyObject *args) | 234 | solverinfo(PyObject *self, PyObject *args) |
| 234 | { | 235 | { |
| 235 | long long result; | 236 | long long result; |
| 236 | const char *solver; | 237 | const char *solver; |
| 238 | char buf[NISSY_DATAID_SIZE]; | ||
| 239 | PyObject *py_result, *py_buf; | ||
| 237 | 240 | ||
| 238 | if (!PyArg_ParseTuple(args, "s", &solver)) | 241 | if (!PyArg_ParseTuple(args, "s", &solver)) |
| 239 | return NULL; | 242 | return NULL; |
| 240 | 243 | ||
| 241 | result = nissy_datasize(solver); | 244 | result = nissy_solverinfo(solver, buf); |
| 242 | return long_result(result); | 245 | |
| 246 | py_result = PyLong_FromLong(result); | ||
| 247 | py_buf = PyUnicode_FromString(buf); | ||
| 248 | return PyTuple_Pack(2, py_result, py_buf); | ||
| 243 | } | 249 | } |
| 244 | 250 | ||
| 245 | PyDoc_STRVAR(gendata_doc, | 251 | PyDoc_STRVAR(gendata_doc, |
| @@ -257,12 +263,12 @@ gendata(PyObject *self, PyObject *args) | |||
| 257 | { | 263 | { |
| 258 | long long size, err; | 264 | long long size, err; |
| 259 | const char *solver; | 265 | const char *solver; |
| 260 | char *buf; | 266 | char *buf, dataid[NISSY_DATAID_SIZE]; |
| 261 | 267 | ||
| 262 | if (!PyArg_ParseTuple(args, "s", &solver)) | 268 | if (!PyArg_ParseTuple(args, "s", &solver)) |
| 263 | return NULL; | 269 | return NULL; |
| 264 | 270 | ||
| 265 | size = nissy_datasize(solver); | 271 | size = nissy_solverinfo(solver, dataid); |
| 266 | if (!check_error(size)) | 272 | if (!check_error(size)) |
| 267 | return NULL; | 273 | return NULL; |
| 268 | 274 | ||
| @@ -394,7 +400,7 @@ static PyMethodDef nissy_methods[] = { | |||
| 394 | { "applytrans", applytrans, METH_VARARGS, applytrans_doc }, | 400 | { "applytrans", applytrans, METH_VARARGS, applytrans_doc }, |
| 395 | { "convert", convert, METH_VARARGS, convert_doc }, | 401 | { "convert", convert, METH_VARARGS, convert_doc }, |
| 396 | { "getcube", getcube, METH_VARARGS, getcube_doc }, | 402 | { "getcube", getcube, METH_VARARGS, getcube_doc }, |
| 397 | { "datasize", datasize, METH_VARARGS, datasize_doc }, | 403 | { "solverinfo", solverinfo, METH_VARARGS, solverinfo_doc }, |
| 398 | { "gendata", gendata, METH_VARARGS, gendata_doc }, | 404 | { "gendata", gendata, METH_VARARGS, gendata_doc }, |
| 399 | { "checkdata", checkdata, METH_VARARGS, checkdata_doc }, | 405 | { "checkdata", checkdata, METH_VARARGS, checkdata_doc }, |
| 400 | { "solve", solve, METH_VARARGS, solve_doc }, | 406 | { "solve", solve, METH_VARARGS, solve_doc }, |
