timed-automata-analyzer 1.0.3 → 1.0.5

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Luthium
3
+ Copyright (c) 2024 - 2025 Luthium
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -21,7 +21,7 @@ In case you want to contribute to the tool or fork the repository, only few step
21
21
  - As a first step, you need to install Rust.
22
22
  See the [Rust website](https://www.rust-lang.org/tools/install) for information on how to do this.
23
23
  - Additionally, you need to install _wasm-pack_ with `cargo install wasm-pack` for WebAssembly outputs.
24
- - The WebAssembly binary (including glue code for JavaScript/TypeScript and an npm package) is generated by running `wasm-pack build --target bundler` and published to the npm registry by running `wasm-pack publish`.
24
+ - The WebAssembly binary (including glue code for JavaScript/TypeScript and an NPM package) is generated by running `wasm-pack build --target bundler` and published to the npm registry by running `wasm-pack publish`.
25
25
  - This project includes an extensive test suite. Tests can be run with `cargo test`.
26
26
  - For linting, this project uses the built-in linter of Rust as well as [Clippy](https://github.com/rust-lang/rust-clippy).
27
27
  To run the linters, execute `cargo check` and `cargo clippy`, respectively.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "luth1um"
6
6
  ],
7
7
  "description": "An analyzer for Timed Automata written in Rust",
8
- "version": "1.0.3",
8
+ "version": "1.0.5",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  * locations.</li>
20
20
  * </ul>
21
21
  */
22
- export function findUnreachableLocations(ta: TimedAutomaton): (string)[];
22
+ export function findUnreachableLocations(ta: TimedAutomaton): string[];
23
23
  export enum ClockComparator {
24
24
  LESSER = 0,
25
25
  LEQ = 1,
@@ -36,17 +36,17 @@ export class Clock {
36
36
  }
37
37
  export class ClockConstraint {
38
38
  free(): void;
39
- constructor(clauses: (Clause)[]);
39
+ constructor(clauses: Clause[]);
40
40
  }
41
41
  export class Location {
42
42
  free(): void;
43
- constructor(name: string, is_initial: boolean, invariant?: ClockConstraint);
43
+ constructor(name: string, is_initial: boolean, invariant?: ClockConstraint | null);
44
44
  }
45
45
  export class Switch {
46
46
  free(): void;
47
- constructor(source: Location, guard: ClockConstraint | undefined, action: string, reset: (Clock)[], target: Location);
47
+ constructor(source: Location, guard: ClockConstraint | null | undefined, action: string, reset: Clock[], target: Location);
48
48
  }
49
49
  export class TimedAutomaton {
50
50
  free(): void;
51
- constructor(locations: (Location)[], clocks: (Clock)[], switches: (Switch)[]);
51
+ constructor(locations: Location[], clocks: Clock[], switches: Switch[]);
52
52
  }
@@ -4,12 +4,6 @@ export function __wbg_set_wasm(val) {
4
4
  }
5
5
 
6
6
 
7
- const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
8
-
9
- let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
10
-
11
- cachedTextDecoder.decode();
12
-
13
7
  let cachedUint8ArrayMemory0 = null;
14
8
 
15
9
  function getUint8ArrayMemory0() {
@@ -19,16 +13,34 @@ function getUint8ArrayMemory0() {
19
13
  return cachedUint8ArrayMemory0;
20
14
  }
21
15
 
16
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
17
+
18
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
19
+
20
+ cachedTextDecoder.decode();
21
+
22
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
23
+ let numBytesDecoded = 0;
24
+ function decodeText(ptr, len) {
25
+ numBytesDecoded += len;
26
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
27
+ cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
+ cachedTextDecoder.decode();
29
+ numBytesDecoded = len;
30
+ }
31
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
32
+ }
33
+
22
34
  function getStringFromWasm0(ptr, len) {
23
35
  ptr = ptr >>> 0;
24
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
36
+ return decodeText(ptr, len);
25
37
  }
26
38
 
27
39
  let WASM_VECTOR_LEN = 0;
28
40
 
29
41
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
30
42
 
31
- let cachedTextEncoder = new lTextEncoder('utf-8');
43
+ const cachedTextEncoder = new lTextEncoder('utf-8');
32
44
 
33
45
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
34
46
  ? function (arg, view) {
@@ -105,9 +117,9 @@ function addToExternrefTable0(obj) {
105
117
 
106
118
  function passArrayJsValueToWasm0(array, malloc) {
107
119
  const ptr = malloc(array.length * 4, 4) >>> 0;
108
- const mem = getDataViewMemory0();
109
120
  for (let i = 0; i < array.length; i++) {
110
- mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
121
+ const add = addToExternrefTable0(array[i]);
122
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
111
123
  }
112
124
  WASM_VECTOR_LEN = array.length;
113
125
  return ptr;
@@ -146,7 +158,7 @@ function getArrayJsValueFromWasm0(ptr, len) {
146
158
  * locations.</li>
147
159
  * </ul>
148
160
  * @param {TimedAutomaton} ta
149
- * @returns {(string)[]}
161
+ * @returns {string[]}
150
162
  */
151
163
  export function findUnreachableLocations(ta) {
152
164
  _assertClass(ta, TimedAutomaton);
@@ -260,7 +272,7 @@ export class ClockConstraint {
260
272
  wasm.__wbg_clockconstraint_free(ptr, 0);
261
273
  }
262
274
  /**
263
- * @param {(Clause)[]} clauses
275
+ * @param {Clause[]} clauses
264
276
  */
265
277
  constructor(clauses) {
266
278
  const ptr0 = passArrayJsValueToWasm0(clauses, wasm.__wbindgen_malloc);
@@ -299,7 +311,7 @@ export class Location {
299
311
  /**
300
312
  * @param {string} name
301
313
  * @param {boolean} is_initial
302
- * @param {ClockConstraint | undefined} [invariant]
314
+ * @param {ClockConstraint | null} [invariant]
303
315
  */
304
316
  constructor(name, is_initial, invariant) {
305
317
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -342,9 +354,9 @@ export class Switch {
342
354
  }
343
355
  /**
344
356
  * @param {Location} source
345
- * @param {ClockConstraint | undefined} guard
357
+ * @param {ClockConstraint | null | undefined} guard
346
358
  * @param {string} action
347
- * @param {(Clock)[]} reset
359
+ * @param {Clock[]} reset
348
360
  * @param {Location} target
349
361
  */
350
362
  constructor(source, guard, action, reset, target) {
@@ -384,9 +396,9 @@ export class TimedAutomaton {
384
396
  wasm.__wbg_timedautomaton_free(ptr, 0);
385
397
  }
386
398
  /**
387
- * @param {(Location)[]} locations
388
- * @param {(Clock)[]} clocks
389
- * @param {(Switch)[]} switches
399
+ * @param {Location[]} locations
400
+ * @param {Clock[]} clocks
401
+ * @param {Switch[]} switches
390
402
  */
391
403
  constructor(locations, clocks, switches) {
392
404
  const ptr0 = passArrayJsValueToWasm0(locations, wasm.__wbindgen_malloc);
Binary file