@logic-pad/core 0.4.1 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/logic-core.global.d.ts +24 -13
- package/dist/data/events/onSetGrid.d.ts +1 -0
- package/dist/data/events/onSetGrid.js +15 -0
- package/dist/data/grid.d.ts +0 -8
- package/dist/data/grid.js +0 -23
- package/dist/data/instruction.d.ts +5 -0
- package/dist/data/primitives.d.ts +2 -1
- package/dist/data/primitives.js +1 -0
- package/dist/data/puzzle.d.ts +2 -2
- package/dist/data/puzzle.js +2 -2
- package/dist/data/rules/cellCountPerZoneRule.d.ts +1 -1
- package/dist/data/rules/cellCountPerZoneRule.js +7 -2
- package/dist/data/rules/foresightRule.d.ts +2 -1
- package/dist/data/rules/foresightRule.js +8 -1
- package/dist/data/rules/perfectionRule.d.ts +11 -3
- package/dist/data/rules/perfectionRule.js +69 -13
- package/dist/data/rules/rule.d.ts +2 -1
- package/dist/data/rules/rule.js +3 -0
- package/dist/data/symbols/symbol.d.ts +2 -1
- package/dist/data/symbols/symbol.js +3 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/assets/z3-built.js +0 -14723
- package/assets/z3-built.wasm +0 -0
- package/assets/z3-built.worker.js +0 -206
package/assets/z3-built.wasm
DELETED
|
Binary file
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2015 The Emscripten Authors
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Pthread Web Worker startup routine:
|
|
8
|
-
// This is the entry point file that is loaded first by each Web Worker
|
|
9
|
-
// that executes pthreads on the Emscripten application.
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var Module = {};
|
|
14
|
-
|
|
15
|
-
// Node.js support
|
|
16
|
-
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
|
|
17
|
-
if (ENVIRONMENT_IS_NODE) {
|
|
18
|
-
// Create as web-worker-like an environment as we can.
|
|
19
|
-
|
|
20
|
-
var nodeWorkerThreads = require('worker_threads');
|
|
21
|
-
|
|
22
|
-
var parentPort = nodeWorkerThreads.parentPort;
|
|
23
|
-
|
|
24
|
-
parentPort.on('message', function(data) {
|
|
25
|
-
onmessage({ data: data });
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
var fs = require('fs');
|
|
29
|
-
|
|
30
|
-
Object.assign(global, {
|
|
31
|
-
self: global,
|
|
32
|
-
require: require,
|
|
33
|
-
Module: Module,
|
|
34
|
-
location: {
|
|
35
|
-
href: __filename
|
|
36
|
-
},
|
|
37
|
-
Worker: nodeWorkerThreads.Worker,
|
|
38
|
-
importScripts: function(f) {
|
|
39
|
-
(0, eval)(fs.readFileSync(f, 'utf8'));
|
|
40
|
-
},
|
|
41
|
-
postMessage: function(msg) {
|
|
42
|
-
parentPort.postMessage(msg);
|
|
43
|
-
},
|
|
44
|
-
performance: global.performance || {
|
|
45
|
-
now: function() {
|
|
46
|
-
return Date.now();
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Thread-local guard variable for one-time init of the JS state
|
|
53
|
-
var initializedJS = false;
|
|
54
|
-
|
|
55
|
-
// Proxying queues that were notified before the thread started and need to be
|
|
56
|
-
// executed as part of startup.
|
|
57
|
-
var pendingNotifiedProxyingQueues = [];
|
|
58
|
-
|
|
59
|
-
function assert(condition, text) {
|
|
60
|
-
if (!condition) abort('Assertion failed: ' + text);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function threadPrintErr() {
|
|
64
|
-
var text = Array.prototype.slice.call(arguments).join(' ');
|
|
65
|
-
// See https://github.com/emscripten-core/emscripten/issues/14804
|
|
66
|
-
if (ENVIRONMENT_IS_NODE) {
|
|
67
|
-
fs.writeSync(2, text + '\n');
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
console.error(text);
|
|
71
|
-
}
|
|
72
|
-
function threadAlert() {
|
|
73
|
-
var text = Array.prototype.slice.call(arguments).join(' ');
|
|
74
|
-
postMessage({cmd: 'alert', text: text, threadId: Module['_pthread_self']()});
|
|
75
|
-
}
|
|
76
|
-
// We don't need out() for now, but may need to add it if we want to use it
|
|
77
|
-
// here. Or, if this code all moves into the main JS, that problem will go
|
|
78
|
-
// away. (For now, adding it here increases code size for no benefit.)
|
|
79
|
-
var out = () => { throw 'out() is not defined in worker.js.'; }
|
|
80
|
-
var err = threadPrintErr;
|
|
81
|
-
self.alert = threadAlert;
|
|
82
|
-
|
|
83
|
-
Module['instantiateWasm'] = (info, receiveInstance) => {
|
|
84
|
-
// Instantiate from the module posted from the main thread.
|
|
85
|
-
// We can just use sync instantiation in the worker.
|
|
86
|
-
var instance = new WebAssembly.Instance(Module['wasmModule'], info);
|
|
87
|
-
// TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193,
|
|
88
|
-
// the above line no longer optimizes out down to the following line.
|
|
89
|
-
// When the regression is fixed, we can remove this if/else.
|
|
90
|
-
receiveInstance(instance);
|
|
91
|
-
// We don't need the module anymore; new threads will be spawned from the main thread.
|
|
92
|
-
Module['wasmModule'] = null;
|
|
93
|
-
return instance.exports;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
self.onmessage = (e) => {
|
|
97
|
-
try {
|
|
98
|
-
if (e.data.cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
|
|
99
|
-
|
|
100
|
-
// Module and memory were sent from main thread
|
|
101
|
-
Module['wasmModule'] = e.data.wasmModule;
|
|
102
|
-
|
|
103
|
-
Module['wasmMemory'] = e.data.wasmMemory;
|
|
104
|
-
|
|
105
|
-
Module['buffer'] = Module['wasmMemory'].buffer;
|
|
106
|
-
|
|
107
|
-
Module['ENVIRONMENT_IS_PTHREAD'] = true;
|
|
108
|
-
|
|
109
|
-
if (typeof e.data.urlOrBlob == 'string') {
|
|
110
|
-
importScripts(e.data.urlOrBlob);
|
|
111
|
-
} else {
|
|
112
|
-
var objectUrl = URL.createObjectURL(e.data.urlOrBlob);
|
|
113
|
-
importScripts(objectUrl);
|
|
114
|
-
URL.revokeObjectURL(objectUrl);
|
|
115
|
-
}
|
|
116
|
-
initZ3(Module).then(function (instance) {
|
|
117
|
-
Module = instance;
|
|
118
|
-
});
|
|
119
|
-
} else if (e.data.cmd === 'run') {
|
|
120
|
-
// This worker was idle, and now should start executing its pthread entry
|
|
121
|
-
// point.
|
|
122
|
-
// performance.now() is specced to return a wallclock time in msecs since
|
|
123
|
-
// that Web Worker/main thread launched. However for pthreads this can
|
|
124
|
-
// cause subtle problems in emscripten_get_now() as this essentially
|
|
125
|
-
// would measure time from pthread_create(), meaning that the clocks
|
|
126
|
-
// between each threads would be wildly out of sync. Therefore sync all
|
|
127
|
-
// pthreads to the clock on the main browser thread, so that different
|
|
128
|
-
// threads see a somewhat coherent clock across each of them
|
|
129
|
-
// (+/- 0.1msecs in testing).
|
|
130
|
-
Module['__performance_now_clock_drift'] = performance.now() - e.data.time;
|
|
131
|
-
|
|
132
|
-
// Pass the thread address inside the asm.js scope to store it for fast access that avoids the need for a FFI out.
|
|
133
|
-
Module['__emscripten_thread_init'](e.data.threadInfoStruct, /*isMainBrowserThread=*/0, /*isMainRuntimeThread=*/0, /*canBlock=*/1);
|
|
134
|
-
|
|
135
|
-
assert(e.data.threadInfoStruct);
|
|
136
|
-
// Also call inside JS module to set up the stack frame for this pthread in JS module scope
|
|
137
|
-
Module['establishStackSpace']();
|
|
138
|
-
Module['PThread'].receiveObjectTransfer(e.data);
|
|
139
|
-
Module['PThread'].threadInitTLS();
|
|
140
|
-
|
|
141
|
-
if (!initializedJS) {
|
|
142
|
-
|
|
143
|
-
// Execute any proxied work that came in before the thread was
|
|
144
|
-
// initialized. Only do this once because it is only possible for
|
|
145
|
-
// proxying notifications to arrive before thread initialization on
|
|
146
|
-
// fresh workers.
|
|
147
|
-
pendingNotifiedProxyingQueues.forEach(queue => {
|
|
148
|
-
Module['executeNotifiedProxyingQueue'](queue);
|
|
149
|
-
});
|
|
150
|
-
pendingNotifiedProxyingQueues = [];
|
|
151
|
-
initializedJS = true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
Module['invokeEntryPoint'](e.data.start_routine, e.data.arg);
|
|
156
|
-
} catch(ex) {
|
|
157
|
-
if (ex != 'unwind') {
|
|
158
|
-
// ExitStatus not present in MINIMAL_RUNTIME
|
|
159
|
-
if (ex instanceof Module['ExitStatus']) {
|
|
160
|
-
if (Module['keepRuntimeAlive']()) {
|
|
161
|
-
err('Pthread 0x' + Module['_pthread_self']().toString(16) + ' called exit(), staying alive due to noExitRuntime.');
|
|
162
|
-
} else {
|
|
163
|
-
err('Pthread 0x' + Module['_pthread_self']().toString(16) + ' called exit(), calling _emscripten_thread_exit.');
|
|
164
|
-
Module['__emscripten_thread_exit'](ex.status);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else
|
|
168
|
-
{
|
|
169
|
-
// The pthread "crashed". Do not call `_emscripten_thread_exit` (which
|
|
170
|
-
// would make this thread joinable. Instead, re-throw the exception
|
|
171
|
-
// and let the top level handler propagate it back to the main thread.
|
|
172
|
-
throw ex;
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
// else e == 'unwind', and we should fall through here and keep the pthread alive for asynchronous events.
|
|
176
|
-
err('Pthread 0x' + Module['_pthread_self']().toString(16) + ' completed its main entry point with an `unwind`, keeping the worker alive for asynchronous operation.');
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
} else if (e.data.cmd === 'cancel') { // Main thread is asking for a pthread_cancel() on this thread.
|
|
180
|
-
if (Module['_pthread_self']()) {
|
|
181
|
-
Module['__emscripten_thread_exit'](-1/*PTHREAD_CANCELED*/);
|
|
182
|
-
}
|
|
183
|
-
} else if (e.data.target === 'setimmediate') {
|
|
184
|
-
// no-op
|
|
185
|
-
} else if (e.data.cmd === 'processProxyingQueue') {
|
|
186
|
-
if (initializedJS) {
|
|
187
|
-
Module['executeNotifiedProxyingQueue'](e.data.queue);
|
|
188
|
-
} else {
|
|
189
|
-
// Defer executing this queue until the runtime is initialized.
|
|
190
|
-
pendingNotifiedProxyingQueues.push(e.data.queue);
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
err('worker.js received unknown command ' + e.data.cmd);
|
|
194
|
-
err(e.data);
|
|
195
|
-
}
|
|
196
|
-
} catch(ex) {
|
|
197
|
-
err('worker.js onmessage() captured an uncaught exception: ' + ex);
|
|
198
|
-
if (ex && ex.stack) err(ex.stack);
|
|
199
|
-
if (Module['__emscripten_thread_crashed']) {
|
|
200
|
-
Module['__emscripten_thread_crashed']();
|
|
201
|
-
}
|
|
202
|
-
throw ex;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
|