@areb0s/scip.js 1.0.8 → 1.0.9

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/dist/scip.js CHANGED
@@ -274,9 +274,10 @@ var SCIPModule = (() => {
274
274
  var info = { "a": wasmImports };
275
275
  function receiveInstance(instance, module) {
276
276
  wasmExports = instance.exports;
277
- wasmMemory = wasmExports["y"];
277
+ wasmMemory = wasmExports["O"];
278
278
  updateMemoryViews();
279
- addOnInit(wasmExports["z"]);
279
+ wasmTable = wasmExports["R"];
280
+ addOnInit(wasmExports["P"]);
280
281
  removeRunDependency("wasm-instantiate");
281
282
  return wasmExports;
282
283
  }
@@ -308,6 +309,17 @@ var SCIPModule = (() => {
308
309
  }
309
310
  };
310
311
  var noExitRuntime = Module["noExitRuntime"] || true;
312
+ var wasmTableMirror = [];
313
+ var wasmTable;
314
+ var getWasmTableEntry = (funcPtr) => {
315
+ var func = wasmTableMirror[funcPtr];
316
+ if (!func) {
317
+ if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
318
+ wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
319
+ }
320
+ return func;
321
+ };
322
+ var ___call_sighandler = (fp, sig) => getWasmTableEntry(fp)(sig);
311
323
  class ExceptionInfo {
312
324
  constructor(excPtr) {
313
325
  this.excPtr = excPtr;
@@ -2250,6 +2262,41 @@ var SCIPModule = (() => {
2250
2262
  var stream = FS.getStreamChecked(fd);
2251
2263
  return stream;
2252
2264
  } };
2265
+ function ___syscall_chdir(path) {
2266
+ try {
2267
+ path = SYSCALLS.getStr(path);
2268
+ FS.chdir(path);
2269
+ return 0;
2270
+ } catch (e) {
2271
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
2272
+ return -e.errno;
2273
+ }
2274
+ }
2275
+ function ___syscall_faccessat(dirfd, path, amode, flags) {
2276
+ try {
2277
+ path = SYSCALLS.getStr(path);
2278
+ path = SYSCALLS.calculateAt(dirfd, path);
2279
+ if (amode & ~7) {
2280
+ return -28;
2281
+ }
2282
+ var lookup = FS.lookupPath(path, { follow: true });
2283
+ var node = lookup.node;
2284
+ if (!node) {
2285
+ return -44;
2286
+ }
2287
+ var perms = "";
2288
+ if (amode & 4) perms += "r";
2289
+ if (amode & 2) perms += "w";
2290
+ if (amode & 1) perms += "x";
2291
+ if (perms && FS.nodePermissions(node, perms)) {
2292
+ return -2;
2293
+ }
2294
+ return 0;
2295
+ } catch (e) {
2296
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
2297
+ return -e.errno;
2298
+ }
2299
+ }
2253
2300
  function ___syscall_fcntl64(fd, cmd, varargs) {
2254
2301
  SYSCALLS.varargs = varargs;
2255
2302
  try {
@@ -2302,6 +2349,20 @@ var SCIPModule = (() => {
2302
2349
  return -e.errno;
2303
2350
  }
2304
2351
  }
2352
+ var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
2353
+ function ___syscall_getcwd(buf, size) {
2354
+ try {
2355
+ if (size === 0) return -28;
2356
+ var cwd = FS.cwd();
2357
+ var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
2358
+ if (size < cwdLengthInBytes) return -68;
2359
+ stringToUTF8(cwd, buf, size);
2360
+ return cwdLengthInBytes;
2361
+ } catch (e) {
2362
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
2363
+ return -e.errno;
2364
+ }
2365
+ }
2305
2366
  function ___syscall_ioctl(fd, op, varargs) {
2306
2367
  SYSCALLS.varargs = varargs;
2307
2368
  try {
@@ -2427,6 +2488,13 @@ var SCIPModule = (() => {
2427
2488
  }
2428
2489
  var nowIsMonotonic = 1;
2429
2490
  var __emscripten_get_now_is_monotonic = () => nowIsMonotonic;
2491
+ var __emscripten_runtime_keepalive_clear = () => {
2492
+ noExitRuntime = false;
2493
+ runtimeKeepaliveCounter = 0;
2494
+ };
2495
+ var __emscripten_throw_longjmp = () => {
2496
+ throw Infinity;
2497
+ };
2430
2498
  var convertI32PairToI53Checked = (lo, hi) => hi + 2097152 >>> 0 < 4194305 - !!lo ? (lo >>> 0) + hi * 4294967296 : NaN;
2431
2499
  function __mmap_js(len, prot, flags, fd, offset_low, offset_high, allocated, addr) {
2432
2500
  var offset = convertI32PairToI53Checked(offset_low, offset_high);
@@ -2788,7 +2856,6 @@ var SCIPModule = (() => {
2788
2856
  }
2789
2857
  quit_(1, e);
2790
2858
  };
2791
- var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
2792
2859
  var stringToUTF8OnStack = (str) => {
2793
2860
  var size = lengthBytesUTF8(str) + 1;
2794
2861
  var ret = stackAlloc(size);
@@ -2803,13 +2870,106 @@ var SCIPModule = (() => {
2803
2870
  Module["FS_unlink"] = FS.unlink;
2804
2871
  Module["FS_createLazyFile"] = FS.createLazyFile;
2805
2872
  Module["FS_createDevice"] = FS.createDevice;
2806
- var wasmImports = { a: ___cxa_throw, f: ___syscall_fcntl64, v: ___syscall_fstat64, k: ___syscall_ioctl, t: ___syscall_newfstatat, g: ___syscall_openat, u: ___syscall_stat64, x: __emscripten_get_now_is_monotonic, l: __mmap_js, m: __munmap_js, b: _abort, i: _emscripten_date_now, q: _emscripten_get_heap_max, w: _emscripten_get_now, j: _emscripten_memcpy_js, p: _emscripten_resize_heap, r: _environ_get, s: _environ_sizes_get, h: _exit, c: _fd_close, e: _fd_read, n: _fd_seek, d: _fd_write, o: _strftime_l };
2873
+ var wasmImports = { y: ___call_sighandler, a: ___cxa_throw, L: ___syscall_chdir, M: ___syscall_faccessat, q: ___syscall_fcntl64, G: ___syscall_fstat64, D: ___syscall_getcwd, N: ___syscall_ioctl, E: ___syscall_newfstatat, n: ___syscall_openat, F: ___syscall_stat64, I: __emscripten_get_now_is_monotonic, A: __emscripten_runtime_keepalive_clear, v: __emscripten_throw_longjmp, r: __mmap_js, s: __munmap_js, b: _abort, J: _emscripten_date_now, x: _emscripten_get_heap_max, H: _emscripten_get_now, K: _emscripten_memcpy_js, w: _emscripten_resize_heap, B: _environ_get, C: _environ_sizes_get, j: _exit, l: _fd_close, p: _fd_read, t: _fd_seek, o: _fd_write, h: invoke_i, k: invoke_iii, d: invoke_iiii, e: invoke_iiiii, m: invoke_iiiiii, c: invoke_v, f: invoke_vi, i: invoke_vii, g: invoke_viii, z: _proc_exit, u: _strftime_l };
2807
2874
  var wasmExports = createWasm();
2808
- var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports["z"])();
2809
- var _main = Module["_main"] = (a0, a1) => (_main = Module["_main"] = wasmExports["A"])(a0, a1);
2810
- var _emscripten_builtin_memalign = (a0, a1) => (_emscripten_builtin_memalign = wasmExports["C"])(a0, a1);
2811
- var stackAlloc = (a0) => (stackAlloc = wasmExports["D"])(a0);
2812
- var ___cxa_is_pointer_type = (a0) => (___cxa_is_pointer_type = wasmExports["E"])(a0);
2875
+ var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports["P"])();
2876
+ var _main = Module["_main"] = (a0, a1) => (_main = Module["_main"] = wasmExports["Q"])(a0, a1);
2877
+ var _emscripten_builtin_memalign = (a0, a1) => (_emscripten_builtin_memalign = wasmExports["S"])(a0, a1);
2878
+ var _setThrew = (a0, a1) => (_setThrew = wasmExports["T"])(a0, a1);
2879
+ var stackSave = () => (stackSave = wasmExports["U"])();
2880
+ var stackRestore = (a0) => (stackRestore = wasmExports["V"])(a0);
2881
+ var stackAlloc = (a0) => (stackAlloc = wasmExports["W"])(a0);
2882
+ var ___cxa_is_pointer_type = (a0) => (___cxa_is_pointer_type = wasmExports["X"])(a0);
2883
+ function invoke_iiii(index, a1, a2, a3) {
2884
+ var sp = stackSave();
2885
+ try {
2886
+ return getWasmTableEntry(index)(a1, a2, a3);
2887
+ } catch (e) {
2888
+ stackRestore(sp);
2889
+ if (e !== e + 0) throw e;
2890
+ _setThrew(1, 0);
2891
+ }
2892
+ }
2893
+ function invoke_iiiii(index, a1, a2, a3, a4) {
2894
+ var sp = stackSave();
2895
+ try {
2896
+ return getWasmTableEntry(index)(a1, a2, a3, a4);
2897
+ } catch (e) {
2898
+ stackRestore(sp);
2899
+ if (e !== e + 0) throw e;
2900
+ _setThrew(1, 0);
2901
+ }
2902
+ }
2903
+ function invoke_iii(index, a1, a2) {
2904
+ var sp = stackSave();
2905
+ try {
2906
+ return getWasmTableEntry(index)(a1, a2);
2907
+ } catch (e) {
2908
+ stackRestore(sp);
2909
+ if (e !== e + 0) throw e;
2910
+ _setThrew(1, 0);
2911
+ }
2912
+ }
2913
+ function invoke_v(index) {
2914
+ var sp = stackSave();
2915
+ try {
2916
+ getWasmTableEntry(index)();
2917
+ } catch (e) {
2918
+ stackRestore(sp);
2919
+ if (e !== e + 0) throw e;
2920
+ _setThrew(1, 0);
2921
+ }
2922
+ }
2923
+ function invoke_vi(index, a1) {
2924
+ var sp = stackSave();
2925
+ try {
2926
+ getWasmTableEntry(index)(a1);
2927
+ } catch (e) {
2928
+ stackRestore(sp);
2929
+ if (e !== e + 0) throw e;
2930
+ _setThrew(1, 0);
2931
+ }
2932
+ }
2933
+ function invoke_i(index) {
2934
+ var sp = stackSave();
2935
+ try {
2936
+ return getWasmTableEntry(index)();
2937
+ } catch (e) {
2938
+ stackRestore(sp);
2939
+ if (e !== e + 0) throw e;
2940
+ _setThrew(1, 0);
2941
+ }
2942
+ }
2943
+ function invoke_iiiiii(index, a1, a2, a3, a4, a5) {
2944
+ var sp = stackSave();
2945
+ try {
2946
+ return getWasmTableEntry(index)(a1, a2, a3, a4, a5);
2947
+ } catch (e) {
2948
+ stackRestore(sp);
2949
+ if (e !== e + 0) throw e;
2950
+ _setThrew(1, 0);
2951
+ }
2952
+ }
2953
+ function invoke_viii(index, a1, a2, a3) {
2954
+ var sp = stackSave();
2955
+ try {
2956
+ getWasmTableEntry(index)(a1, a2, a3);
2957
+ } catch (e) {
2958
+ stackRestore(sp);
2959
+ if (e !== e + 0) throw e;
2960
+ _setThrew(1, 0);
2961
+ }
2962
+ }
2963
+ function invoke_vii(index, a1, a2) {
2964
+ var sp = stackSave();
2965
+ try {
2966
+ getWasmTableEntry(index)(a1, a2);
2967
+ } catch (e) {
2968
+ stackRestore(sp);
2969
+ if (e !== e + 0) throw e;
2970
+ _setThrew(1, 0);
2971
+ }
2972
+ }
2813
2973
  Module["addRunDependency"] = addRunDependency;
2814
2974
  Module["removeRunDependency"] = removeRunDependency;
2815
2975
  Module["FS_createPath"] = FS.createPath;
@@ -3062,7 +3222,8 @@ var SCIPModule = (() => {
3062
3222
  if (verbose) console.error("[SCIP Error]", text);
3063
3223
  };
3064
3224
  try {
3065
- const ext = format === "mps" ? "mps" : format === "zpl" ? "zpl" : "lp";
3225
+ const formatExtMap = { mps: "mps", zpl: "zpl", cip: "cip", lp: "lp" };
3226
+ const ext = formatExtMap[format] || "lp";
3066
3227
  const problemFile = `/problems/problem.${ext}`;
3067
3228
  const solutionFile = "/solutions/solution.sol";
3068
3229
  scipModule.FS.writeFile(problemFile, problem);
@@ -3107,21 +3268,19 @@ var SCIPModule = (() => {
3107
3268
  output: stdout + stderr
3108
3269
  };
3109
3270
  } finally {
3110
- try {
3111
- scipModule.FS.unlink("/problems/problem.lp");
3112
- } catch (e) {
3113
- }
3114
- try {
3115
- scipModule.FS.unlink("/problems/problem.mps");
3116
- } catch (e) {
3117
- }
3118
- try {
3119
- scipModule.FS.unlink("/solutions/solution.sol");
3120
- } catch (e) {
3121
- }
3122
- try {
3123
- scipModule.FS.unlink("/settings/commands.txt");
3124
- } catch (e) {
3271
+ const cleanupFiles = [
3272
+ "/problems/problem.lp",
3273
+ "/problems/problem.mps",
3274
+ "/problems/problem.zpl",
3275
+ "/problems/problem.cip",
3276
+ "/solutions/solution.sol",
3277
+ "/settings/commands.txt"
3278
+ ];
3279
+ for (const file of cleanupFiles) {
3280
+ try {
3281
+ scipModule.FS.unlink(file);
3282
+ } catch (e) {
3283
+ }
3125
3284
  }
3126
3285
  }
3127
3286
  }