timed-automata-analyzer 1.0.0 → 1.0.2

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/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.0",
8
+ "version": "1.0.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -1,79 +1,82 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {TimedAutomaton} ta
5
- * @returns {(string)[]}
6
- */
4
+ * Checks all locations of the input TA for reachability and returns all unreachable locations. The
5
+ * result will be empty if all locations are reachable.
6
+ *
7
+ * This function will throw an error if one or more validation checks fail. The following
8
+ * properties will be validated:
9
+ * <ul>
10
+ * <li>There exists exactly one initial location.</li>
11
+ * <li>The set of locations is non-empty.</li>
12
+ * <li>All invariants are downward-closed.</li>
13
+ * <li>The highest constant used in any clock constraint is not greater than the highest allowed
14
+ * value (536870909).</li>
15
+ * <li>All locations names are unique.</li>
16
+ * <li>All clock names are unique.</li>
17
+ * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
18
+ * <li>All location names used as source and target of switches are also contained in the set of
19
+ * locations.</li>
20
+ * </ul>
21
+ * @param {TimedAutomaton} ta
22
+ * @returns {(string)[]}
23
+ */
7
24
  export function findUnreachableLocations(ta: TimedAutomaton): (string)[];
8
- /**
9
- */
10
25
  export enum ClockComparator {
11
26
  LESSER = 0,
12
27
  LEQ = 1,
13
28
  GEQ = 2,
14
29
  GREATER = 3,
15
30
  }
16
- /**
17
- */
18
31
  export class Clause {
19
32
  free(): void;
20
- /**
21
- * @param {Clock} lhs
22
- * @param {ClockComparator} op
23
- * @param {number} rhs
24
- */
33
+ /**
34
+ * @param {Clock} lhs
35
+ * @param {ClockComparator} op
36
+ * @param {number} rhs
37
+ */
25
38
  constructor(lhs: Clock, op: ClockComparator, rhs: number);
26
39
  }
27
- /**
28
- */
29
40
  export class Clock {
30
41
  free(): void;
31
- /**
32
- * @param {string} name
33
- */
42
+ /**
43
+ * @param {string} name
44
+ */
34
45
  constructor(name: string);
35
46
  }
36
- /**
37
- */
38
47
  export class ClockConstraint {
39
48
  free(): void;
40
- /**
41
- * @param {(Clause)[]} clauses
42
- */
49
+ /**
50
+ * @param {(Clause)[]} clauses
51
+ */
43
52
  constructor(clauses: (Clause)[]);
44
53
  }
45
- /**
46
- */
47
54
  export class Location {
48
55
  free(): void;
49
- /**
50
- * @param {string} name
51
- * @param {boolean} is_initial
52
- * @param {ClockConstraint | undefined} [invariant]
53
- */
56
+ /**
57
+ * @param {string} name
58
+ * @param {boolean} is_initial
59
+ * @param {ClockConstraint | undefined} [invariant]
60
+ */
54
61
  constructor(name: string, is_initial: boolean, invariant?: ClockConstraint);
55
62
  }
56
- /**
57
- */
58
63
  export class Switch {
59
64
  free(): void;
60
- /**
61
- * @param {Location} source
62
- * @param {ClockConstraint | undefined} guard
63
- * @param {string} action
64
- * @param {(Clock)[]} reset
65
- * @param {Location} target
66
- */
65
+ /**
66
+ * @param {Location} source
67
+ * @param {ClockConstraint | undefined} guard
68
+ * @param {string} action
69
+ * @param {(Clock)[]} reset
70
+ * @param {Location} target
71
+ */
67
72
  constructor(source: Location, guard: ClockConstraint | undefined, action: string, reset: (Clock)[], target: Location);
68
73
  }
69
- /**
70
- */
71
74
  export class TimedAutomaton {
72
75
  free(): void;
73
- /**
74
- * @param {(Location)[]} locations
75
- * @param {(Clock)[]} clocks
76
- * @param {(Switch)[]} switches
77
- */
76
+ /**
77
+ * @param {(Location)[]} locations
78
+ * @param {(Clock)[]} clocks
79
+ * @param {(Switch)[]} switches
80
+ */
78
81
  constructor(locations: (Location)[], clocks: (Clock)[], switches: (Switch)[]);
79
82
  }
@@ -1,5 +1,5 @@
1
-
2
1
  import * as wasm from "./timed_automata_analyzer_bg.wasm";
2
+ export * from "./timed_automata_analyzer_bg.js";
3
3
  import { __wbg_set_wasm } from "./timed_automata_analyzer_bg.js";
4
4
  __wbg_set_wasm(wasm);
5
- export * from "./timed_automata_analyzer_bg.js";
5
+ wasm.__wbindgen_start();
@@ -24,35 +24,6 @@ function getStringFromWasm0(ptr, len) {
24
24
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
25
  }
26
26
 
27
- const heap = new Array(128).fill(undefined);
28
-
29
- heap.push(undefined, null, true, false);
30
-
31
- let heap_next = heap.length;
32
-
33
- function addHeapObject(obj) {
34
- if (heap_next === heap.length) heap.push(heap.length + 1);
35
- const idx = heap_next;
36
- heap_next = heap[idx];
37
-
38
- heap[idx] = obj;
39
- return idx;
40
- }
41
-
42
- function getObject(idx) { return heap[idx]; }
43
-
44
- function dropObject(idx) {
45
- if (idx < 132) return;
46
- heap[idx] = heap_next;
47
- heap_next = idx;
48
- }
49
-
50
- function takeObject(idx) {
51
- const ret = getObject(idx);
52
- dropObject(idx);
53
- return ret;
54
- }
55
-
56
27
  let WASM_VECTOR_LEN = 0;
57
28
 
58
29
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
@@ -127,11 +98,17 @@ function getDataViewMemory0() {
127
98
  return cachedDataViewMemory0;
128
99
  }
129
100
 
101
+ function addToExternrefTable0(obj) {
102
+ const idx = wasm.__externref_table_alloc();
103
+ wasm.__wbindgen_export_0.set(idx, obj);
104
+ return idx;
105
+ }
106
+
130
107
  function passArrayJsValueToWasm0(array, malloc) {
131
108
  const ptr = malloc(array.length * 4, 4) >>> 0;
132
109
  const mem = getDataViewMemory0();
133
110
  for (let i = 0; i < array.length; i++) {
134
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
111
+ mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
135
112
  }
136
113
  WASM_VECTOR_LEN = array.length;
137
114
  return ptr;
@@ -146,39 +123,47 @@ function getArrayJsValueFromWasm0(ptr, len) {
146
123
  const mem = getDataViewMemory0();
147
124
  const result = [];
148
125
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
149
- result.push(takeObject(mem.getUint32(i, true)));
126
+ result.push(wasm.__wbindgen_export_0.get(mem.getUint32(i, true)));
150
127
  }
128
+ wasm.__externref_drop_slice(ptr, len);
151
129
  return result;
152
130
  }
153
131
  /**
154
- * @param {TimedAutomaton} ta
155
- * @returns {(string)[]}
156
- */
132
+ * Checks all locations of the input TA for reachability and returns all unreachable locations. The
133
+ * result will be empty if all locations are reachable.
134
+ *
135
+ * This function will throw an error if one or more validation checks fail. The following
136
+ * properties will be validated:
137
+ * <ul>
138
+ * <li>There exists exactly one initial location.</li>
139
+ * <li>The set of locations is non-empty.</li>
140
+ * <li>All invariants are downward-closed.</li>
141
+ * <li>The highest constant used in any clock constraint is not greater than the highest allowed
142
+ * value (536870909).</li>
143
+ * <li>All locations names are unique.</li>
144
+ * <li>All clock names are unique.</li>
145
+ * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
146
+ * <li>All location names used as source and target of switches are also contained in the set of
147
+ * locations.</li>
148
+ * </ul>
149
+ * @param {TimedAutomaton} ta
150
+ * @returns {(string)[]}
151
+ */
157
152
  export function findUnreachableLocations(ta) {
158
- try {
159
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
- _assertClass(ta, TimedAutomaton);
161
- var ptr0 = ta.__destroy_into_raw();
162
- wasm.findUnreachableLocations(retptr, ptr0);
163
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
164
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
165
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
166
- wasm.__wbindgen_free(r0, r1 * 4, 4);
167
- return v2;
168
- } finally {
169
- wasm.__wbindgen_add_to_stack_pointer(16);
170
- }
153
+ _assertClass(ta, TimedAutomaton);
154
+ var ptr0 = ta.__destroy_into_raw();
155
+ const ret = wasm.findUnreachableLocations(ptr0);
156
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
157
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
158
+ return v2;
171
159
  }
172
160
 
173
- /**
174
- */
175
161
  export const ClockComparator = Object.freeze({ LESSER:0,"0":"LESSER",LEQ:1,"1":"LEQ",GEQ:2,"2":"GEQ",GREATER:3,"3":"GREATER", });
176
162
 
177
163
  const ClauseFinalization = (typeof FinalizationRegistry === 'undefined')
178
164
  ? { register: () => {}, unregister: () => {} }
179
165
  : new FinalizationRegistry(ptr => wasm.__wbg_clause_free(ptr >>> 0, 1));
180
- /**
181
- */
166
+
182
167
  export class Clause {
183
168
 
184
169
  static __unwrap(jsValue) {
@@ -200,10 +185,10 @@ export class Clause {
200
185
  wasm.__wbg_clause_free(ptr, 0);
201
186
  }
202
187
  /**
203
- * @param {Clock} lhs
204
- * @param {ClockComparator} op
205
- * @param {number} rhs
206
- */
188
+ * @param {Clock} lhs
189
+ * @param {ClockComparator} op
190
+ * @param {number} rhs
191
+ */
207
192
  constructor(lhs, op, rhs) {
208
193
  _assertClass(lhs, Clock);
209
194
  const ret = wasm.clause_new(lhs.__wbg_ptr, op, rhs);
@@ -216,8 +201,7 @@ export class Clause {
216
201
  const ClockFinalization = (typeof FinalizationRegistry === 'undefined')
217
202
  ? { register: () => {}, unregister: () => {} }
218
203
  : new FinalizationRegistry(ptr => wasm.__wbg_clock_free(ptr >>> 0, 1));
219
- /**
220
- */
204
+
221
205
  export class Clock {
222
206
 
223
207
  static __unwrap(jsValue) {
@@ -239,8 +223,8 @@ export class Clock {
239
223
  wasm.__wbg_clock_free(ptr, 0);
240
224
  }
241
225
  /**
242
- * @param {string} name
243
- */
226
+ * @param {string} name
227
+ */
244
228
  constructor(name) {
245
229
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
230
  const len0 = WASM_VECTOR_LEN;
@@ -254,8 +238,7 @@ export class Clock {
254
238
  const ClockConstraintFinalization = (typeof FinalizationRegistry === 'undefined')
255
239
  ? { register: () => {}, unregister: () => {} }
256
240
  : new FinalizationRegistry(ptr => wasm.__wbg_clockconstraint_free(ptr >>> 0, 1));
257
- /**
258
- */
241
+
259
242
  export class ClockConstraint {
260
243
 
261
244
  __destroy_into_raw() {
@@ -270,8 +253,8 @@ export class ClockConstraint {
270
253
  wasm.__wbg_clockconstraint_free(ptr, 0);
271
254
  }
272
255
  /**
273
- * @param {(Clause)[]} clauses
274
- */
256
+ * @param {(Clause)[]} clauses
257
+ */
275
258
  constructor(clauses) {
276
259
  const ptr0 = passArrayJsValueToWasm0(clauses, wasm.__wbindgen_malloc);
277
260
  const len0 = WASM_VECTOR_LEN;
@@ -285,8 +268,7 @@ export class ClockConstraint {
285
268
  const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
286
269
  ? { register: () => {}, unregister: () => {} }
287
270
  : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0, 1));
288
- /**
289
- */
271
+
290
272
  export class Location {
291
273
 
292
274
  static __unwrap(jsValue) {
@@ -308,10 +290,10 @@ export class Location {
308
290
  wasm.__wbg_location_free(ptr, 0);
309
291
  }
310
292
  /**
311
- * @param {string} name
312
- * @param {boolean} is_initial
313
- * @param {ClockConstraint | undefined} [invariant]
314
- */
293
+ * @param {string} name
294
+ * @param {boolean} is_initial
295
+ * @param {ClockConstraint | undefined} [invariant]
296
+ */
315
297
  constructor(name, is_initial, invariant) {
316
298
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
317
299
  const len0 = WASM_VECTOR_LEN;
@@ -330,8 +312,7 @@ export class Location {
330
312
  const SwitchFinalization = (typeof FinalizationRegistry === 'undefined')
331
313
  ? { register: () => {}, unregister: () => {} }
332
314
  : new FinalizationRegistry(ptr => wasm.__wbg_switch_free(ptr >>> 0, 1));
333
- /**
334
- */
315
+
335
316
  export class Switch {
336
317
 
337
318
  static __unwrap(jsValue) {
@@ -353,12 +334,12 @@ export class Switch {
353
334
  wasm.__wbg_switch_free(ptr, 0);
354
335
  }
355
336
  /**
356
- * @param {Location} source
357
- * @param {ClockConstraint | undefined} guard
358
- * @param {string} action
359
- * @param {(Clock)[]} reset
360
- * @param {Location} target
361
- */
337
+ * @param {Location} source
338
+ * @param {ClockConstraint | undefined} guard
339
+ * @param {string} action
340
+ * @param {(Clock)[]} reset
341
+ * @param {Location} target
342
+ */
362
343
  constructor(source, guard, action, reset, target) {
363
344
  _assertClass(source, Location);
364
345
  let ptr0 = 0;
@@ -381,8 +362,7 @@ export class Switch {
381
362
  const TimedAutomatonFinalization = (typeof FinalizationRegistry === 'undefined')
382
363
  ? { register: () => {}, unregister: () => {} }
383
364
  : new FinalizationRegistry(ptr => wasm.__wbg_timedautomaton_free(ptr >>> 0, 1));
384
- /**
385
- */
365
+
386
366
  export class TimedAutomaton {
387
367
 
388
368
  __destroy_into_raw() {
@@ -397,10 +377,10 @@ export class TimedAutomaton {
397
377
  wasm.__wbg_timedautomaton_free(ptr, 0);
398
378
  }
399
379
  /**
400
- * @param {(Location)[]} locations
401
- * @param {(Clock)[]} clocks
402
- * @param {(Switch)[]} switches
403
- */
380
+ * @param {(Location)[]} locations
381
+ * @param {(Clock)[]} clocks
382
+ * @param {(Switch)[]} switches
383
+ */
404
384
  constructor(locations, clocks, switches) {
405
385
  const ptr0 = passArrayJsValueToWasm0(locations, wasm.__wbindgen_malloc);
406
386
  const len0 = WASM_VECTOR_LEN;
@@ -416,35 +396,42 @@ export class TimedAutomaton {
416
396
  }
417
397
 
418
398
  export function __wbg_clock_unwrap(arg0) {
419
- const ret = Clock.__unwrap(takeObject(arg0));
399
+ const ret = Clock.__unwrap(arg0);
420
400
  return ret;
421
401
  };
422
402
 
423
403
  export function __wbg_clause_unwrap(arg0) {
424
- const ret = Clause.__unwrap(takeObject(arg0));
404
+ const ret = Clause.__unwrap(arg0);
425
405
  return ret;
426
406
  };
427
407
 
428
- export function __wbg_location_unwrap(arg0) {
429
- const ret = Location.__unwrap(takeObject(arg0));
408
+ export function __wbg_switch_unwrap(arg0) {
409
+ const ret = Switch.__unwrap(arg0);
430
410
  return ret;
431
411
  };
432
412
 
433
- export function __wbg_switch_unwrap(arg0) {
434
- const ret = Switch.__unwrap(takeObject(arg0));
413
+ export function __wbg_location_unwrap(arg0) {
414
+ const ret = Location.__unwrap(arg0);
435
415
  return ret;
436
416
  };
437
417
 
438
418
  export function __wbindgen_string_new(arg0, arg1) {
439
419
  const ret = getStringFromWasm0(arg0, arg1);
440
- return addHeapObject(ret);
441
- };
442
-
443
- export function __wbindgen_object_drop_ref(arg0) {
444
- takeObject(arg0);
420
+ return ret;
445
421
  };
446
422
 
447
423
  export function __wbindgen_throw(arg0, arg1) {
448
424
  throw new Error(getStringFromWasm0(arg0, arg1));
449
425
  };
450
426
 
427
+ export function __wbindgen_init_externref_table() {
428
+ const table = wasm.__wbindgen_export_0;
429
+ const offset = table.grow(4);
430
+ table.set(0, undefined);
431
+ table.set(offset + 0, undefined);
432
+ table.set(offset + 1, null);
433
+ table.set(offset + 2, true);
434
+ table.set(offset + 3, false);
435
+ ;
436
+ };
437
+
Binary file