aboutsummaryrefslogtreecommitdiff
path: root/web/adapter.cpp
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-06-05 11:42:12 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-06-05 11:42:12 +0200
commitf1a2985897850321e0a9acb1b74bb41e016deb5c (patch)
treebc0585a7bb629549bc3f7914027d62bb21bde30c /web/adapter.cpp
parent52c74a1c33ce12b93ec5830f5a6348d9578c7c6e (diff)
downloadnissy-core-f1a2985897850321e0a9acb1b74bb41e016deb5c.tar.gz
nissy-core-f1a2985897850321e0a9acb1b74bb41e016deb5c.zip
Added debug mode to web build and fixed a couple of bugs
Diffstat (limited to '')
-rw-r--r--web/adapter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/web/adapter.cpp b/web/adapter.cpp
index 3df3a54..9cb2e2d 100644
--- a/web/adapter.cpp
+++ b/web/adapter.cpp
@@ -151,13 +151,14 @@ int poll_status(void *arg)
151 if (arg == nullptr) 151 if (arg == nullptr)
152 return nissy::status::RUN.value; 152 return nissy::status::RUN.value;
153 153
154 std::function<int(void)> poll((int (*)(void))arg); 154 std::function<int(void)> poll((int (*)(void))*(int *)arg);
155 return poll(); 155 return poll();
156} 156}
157 157
158// The parameter js_poll_status is of type int here, but actually it is a 158// The parameter js_poll_status is of type int here, but actually it is a
159// pointer to a JS function. The type will have to be changed to a 64-bit 159// pointer to a JS function. The type will have to be changed to a 64-bit
160// integer when we move to WASM64. 160// integer when we move to WASM64.
161int js_poll_status_global = 0;
161nissy::solver::solve_result solve(std::string name, 162nissy::solver::solve_result solve(std::string name,
162 nissy::cube cube, nissy::nissflag nissflag, unsigned minmoves, 163 nissy::cube cube, nissy::nissflag nissflag, unsigned minmoves,
163 unsigned maxmoves, unsigned maxsols, unsigned optimal, unsigned threads, 164 unsigned maxmoves, unsigned maxsols, unsigned optimal, unsigned threads,
@@ -179,9 +180,10 @@ nissy::solver::solve_result solve(std::string name,
179 180
180 // TODO: when running multiple solvers at the same time, we could use 181 // TODO: when running multiple solvers at the same time, we could use
181 // poll_status_id as intended (i.e. an id of some sort) 182 // poll_status_id as intended (i.e. an id of some sort)
183 js_poll_status_global = js_poll_status;
182 return loaded_solvers.at(name).solve(cube, nissflag, minmoves, 184 return loaded_solvers.at(name).solve(cube, nissflag, minmoves,
183 maxmoves, maxsols, optimal, threads, 185 maxmoves, maxsols, optimal, threads,
184 poll_status, &js_poll_status); 186 poll_status, &js_poll_status_global);
185} 187}
186 188
187EMSCRIPTEN_BINDINGS(Nissy) 189EMSCRIPTEN_BINDINGS(Nissy)

Generated with cgit - Back to sebastiano.tronto.net