diff options
Diffstat (limited to 'cpp/nissy.cpp')
| -rw-r--r-- | cpp/nissy.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp index 118a072..2faea6f 100644 --- a/cpp/nissy.cpp +++ b/cpp/nissy.cpp | |||
| @@ -20,7 +20,8 @@ extern "C" { | |||
| 20 | long long nissy_checkdata(unsigned long long, const unsigned char *); | 20 | long long nissy_checkdata(unsigned long long, const unsigned char *); |
| 21 | long long nissy_solve(const char *, const char *, unsigned, unsigned, | 21 | long long nissy_solve(const char *, const char *, unsigned, unsigned, |
| 22 | unsigned, unsigned, unsigned, unsigned, unsigned long long, | 22 | unsigned, unsigned, unsigned, unsigned, unsigned long long, |
| 23 | const unsigned char *, unsigned, char *, long long *); | 23 | const unsigned char *, unsigned, char *, long long *, |
| 24 | int (*)(void *), void *); | ||
| 24 | long long nissy_countmoves(const char *); | 25 | long long nissy_countmoves(const char *); |
| 25 | long long nissy_setlogger(void (*)(const char *, void *), void *); | 26 | long long nissy_setlogger(void (*)(const char *, void *), void *); |
| 26 | } | 27 | } |
| @@ -47,6 +48,10 @@ namespace nissy { | |||
| 47 | const error error::OPTIONS{-80}; | 48 | const error error::OPTIONS{-80}; |
| 48 | const error error::UNKNOWN{-999}; | 49 | const error error::UNKNOWN{-999}; |
| 49 | 50 | ||
| 51 | const status status::run{0}; | ||
| 52 | const status status::stop{1}; | ||
| 53 | const status status::pause{2}; | ||
| 54 | |||
| 50 | namespace size { | 55 | namespace size { |
| 51 | constexpr size_t CUBE = 22; | 56 | constexpr size_t CUBE = 22; |
| 52 | constexpr size_t TRANSFORMATION = 12; | 57 | constexpr size_t TRANSFORMATION = 12; |
| @@ -154,7 +159,8 @@ namespace nissy { | |||
| 154 | solver::solve_result | 159 | solver::solve_result |
| 155 | solver::solve(const cube& cube, nissflag niss, unsigned minmoves, | 160 | solver::solve(const cube& cube, nissflag niss, unsigned minmoves, |
| 156 | unsigned maxmoves, unsigned maxsols, unsigned optimal, | 161 | unsigned maxmoves, unsigned maxsols, unsigned optimal, |
| 157 | unsigned threads) | 162 | unsigned threads, int (*poll_status)(void *), |
| 163 | void *poll_status_data) | ||
| 158 | { | 164 | { |
| 159 | solver::solve_result result; | 165 | solver::solve_result result; |
| 160 | 166 | ||
| @@ -171,7 +177,8 @@ namespace nissy { | |||
| 171 | name.c_str(), niss.value, minmoves, maxmoves, maxsols, | 177 | name.c_str(), niss.value, minmoves, maxmoves, maxsols, |
| 172 | optimal, threads, data.size(), | 178 | optimal, threads, data.size(), |
| 173 | reinterpret_cast<const unsigned char *>(data.data()), len, | 179 | reinterpret_cast<const unsigned char *>(data.data()), len, |
| 174 | csols.data(), result.stats.data()); | 180 | csols.data(), result.stats.data(), poll_status, |
| 181 | poll_status_data); | ||
| 175 | result.err = error{err}; | 182 | result.err = error{err}; |
| 176 | 183 | ||
| 177 | if (err < 0) | 184 | if (err < 0) |
