timed-automata-analyzer 1.0.1 → 1.0.3

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.1",
8
+ "version": "1.0.3",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -1,96 +1,52 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
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
- */
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
+ */
24
22
  export function findUnreachableLocations(ta: TimedAutomaton): (string)[];
25
- /**
26
- */
27
23
  export enum ClockComparator {
28
24
  LESSER = 0,
29
25
  LEQ = 1,
30
26
  GEQ = 2,
31
27
  GREATER = 3,
32
28
  }
33
- /**
34
- */
35
29
  export class Clause {
36
30
  free(): void;
37
- /**
38
- * @param {Clock} lhs
39
- * @param {ClockComparator} op
40
- * @param {number} rhs
41
- */
42
31
  constructor(lhs: Clock, op: ClockComparator, rhs: number);
43
32
  }
44
- /**
45
- */
46
33
  export class Clock {
47
34
  free(): void;
48
- /**
49
- * @param {string} name
50
- */
51
35
  constructor(name: string);
52
36
  }
53
- /**
54
- */
55
37
  export class ClockConstraint {
56
38
  free(): void;
57
- /**
58
- * @param {(Clause)[]} clauses
59
- */
60
39
  constructor(clauses: (Clause)[]);
61
40
  }
62
- /**
63
- */
64
41
  export class Location {
65
42
  free(): void;
66
- /**
67
- * @param {string} name
68
- * @param {boolean} is_initial
69
- * @param {ClockConstraint | undefined} [invariant]
70
- */
71
43
  constructor(name: string, is_initial: boolean, invariant?: ClockConstraint);
72
44
  }
73
- /**
74
- */
75
45
  export class Switch {
76
46
  free(): void;
77
- /**
78
- * @param {Location} source
79
- * @param {ClockConstraint | undefined} guard
80
- * @param {string} action
81
- * @param {(Clock)[]} reset
82
- * @param {Location} target
83
- */
84
47
  constructor(source: Location, guard: ClockConstraint | undefined, action: string, reset: (Clock)[], target: Location);
85
48
  }
86
- /**
87
- */
88
49
  export class TimedAutomaton {
89
50
  free(): void;
90
- /**
91
- * @param {(Location)[]} locations
92
- * @param {(Clock)[]} clocks
93
- * @param {(Switch)[]} switches
94
- */
95
51
  constructor(locations: (Location)[], clocks: (Clock)[], switches: (Switch)[]);
96
52
  }
@@ -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;
@@ -115,7 +86,6 @@ function _assertClass(instance, klass) {
115
86
  if (!(instance instanceof klass)) {
116
87
  throw new Error(`expected instance of ${klass.name}`);
117
88
  }
118
- return instance.ptr;
119
89
  }
120
90
 
121
91
  let cachedDataViewMemory0 = null;
@@ -127,11 +97,17 @@ function getDataViewMemory0() {
127
97
  return cachedDataViewMemory0;
128
98
  }
129
99
 
100
+ function addToExternrefTable0(obj) {
101
+ const idx = wasm.__externref_table_alloc();
102
+ wasm.__wbindgen_export_0.set(idx, obj);
103
+ return idx;
104
+ }
105
+
130
106
  function passArrayJsValueToWasm0(array, malloc) {
131
107
  const ptr = malloc(array.length * 4, 4) >>> 0;
132
108
  const mem = getDataViewMemory0();
133
109
  for (let i = 0; i < array.length; i++) {
134
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
110
+ mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
135
111
  }
136
112
  WASM_VECTOR_LEN = array.length;
137
113
  return ptr;
@@ -146,56 +122,55 @@ function getArrayJsValueFromWasm0(ptr, len) {
146
122
  const mem = getDataViewMemory0();
147
123
  const result = [];
148
124
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
149
- result.push(takeObject(mem.getUint32(i, true)));
125
+ result.push(wasm.__wbindgen_export_0.get(mem.getUint32(i, true)));
150
126
  }
127
+ wasm.__externref_drop_slice(ptr, len);
151
128
  return result;
152
129
  }
153
130
  /**
154
- * Checks all locations of the input TA for reachability and returns all unreachable locations. The
155
- * result will be empty if all locations are reachable.
156
- *
157
- * This function will throw an error if one or more validation checks fail. The following
158
- * properties will be validated:
159
- * <ul>
160
- * <li>There exists exactly one initial location.</li>
161
- * <li>The set of locations is non-empty.</li>
162
- * <li>All invariants are downward-closed.</li>
163
- * <li>The highest constant used in any clock constraint is not greater than the highest allowed
164
- * value (536870909).</li>
165
- * <li>All locations names are unique.</li>
166
- * <li>All clock names are unique.</li>
167
- * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
168
- * <li>All location names used as source and target of switches are also contained in the set of
169
- * locations.</li>
170
- * </ul>
171
- * @param {TimedAutomaton} ta
172
- * @returns {(string)[]}
173
- */
131
+ * Checks all locations of the input TA for reachability and returns all unreachable locations. The
132
+ * result will be empty if all locations are reachable.
133
+ *
134
+ * This function will throw an error if one or more validation checks fail. The following
135
+ * properties will be validated:
136
+ * <ul>
137
+ * <li>There exists exactly one initial location.</li>
138
+ * <li>The set of locations is non-empty.</li>
139
+ * <li>All invariants are downward-closed.</li>
140
+ * <li>The highest constant used in any clock constraint is not greater than the highest allowed
141
+ * value (536870909).</li>
142
+ * <li>All locations names are unique.</li>
143
+ * <li>All clock names are unique.</li>
144
+ * <li>All clocks used in clock constraints are also contained in the set of clocks.</li>
145
+ * <li>All location names used as source and target of switches are also contained in the set of
146
+ * locations.</li>
147
+ * </ul>
148
+ * @param {TimedAutomaton} ta
149
+ * @returns {(string)[]}
150
+ */
174
151
  export function findUnreachableLocations(ta) {
175
- try {
176
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
177
- _assertClass(ta, TimedAutomaton);
178
- var ptr0 = ta.__destroy_into_raw();
179
- wasm.findUnreachableLocations(retptr, ptr0);
180
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
181
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
182
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
183
- wasm.__wbindgen_free(r0, r1 * 4, 4);
184
- return v2;
185
- } finally {
186
- wasm.__wbindgen_add_to_stack_pointer(16);
187
- }
152
+ _assertClass(ta, TimedAutomaton);
153
+ var ptr0 = ta.__destroy_into_raw();
154
+ const ret = wasm.findUnreachableLocations(ptr0);
155
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
156
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
157
+ return v2;
188
158
  }
189
159
 
190
160
  /**
191
- */
192
- export const ClockComparator = Object.freeze({ LESSER:0,"0":"LESSER",LEQ:1,"1":"LEQ",GEQ:2,"2":"GEQ",GREATER:3,"3":"GREATER", });
161
+ * @enum {0 | 1 | 2 | 3}
162
+ */
163
+ export const ClockComparator = Object.freeze({
164
+ LESSER: 0, "0": "LESSER",
165
+ LEQ: 1, "1": "LEQ",
166
+ GEQ: 2, "2": "GEQ",
167
+ GREATER: 3, "3": "GREATER",
168
+ });
193
169
 
194
170
  const ClauseFinalization = (typeof FinalizationRegistry === 'undefined')
195
171
  ? { register: () => {}, unregister: () => {} }
196
172
  : new FinalizationRegistry(ptr => wasm.__wbg_clause_free(ptr >>> 0, 1));
197
- /**
198
- */
173
+
199
174
  export class Clause {
200
175
 
201
176
  static __unwrap(jsValue) {
@@ -217,10 +192,10 @@ export class Clause {
217
192
  wasm.__wbg_clause_free(ptr, 0);
218
193
  }
219
194
  /**
220
- * @param {Clock} lhs
221
- * @param {ClockComparator} op
222
- * @param {number} rhs
223
- */
195
+ * @param {Clock} lhs
196
+ * @param {ClockComparator} op
197
+ * @param {number} rhs
198
+ */
224
199
  constructor(lhs, op, rhs) {
225
200
  _assertClass(lhs, Clock);
226
201
  const ret = wasm.clause_new(lhs.__wbg_ptr, op, rhs);
@@ -233,8 +208,7 @@ export class Clause {
233
208
  const ClockFinalization = (typeof FinalizationRegistry === 'undefined')
234
209
  ? { register: () => {}, unregister: () => {} }
235
210
  : new FinalizationRegistry(ptr => wasm.__wbg_clock_free(ptr >>> 0, 1));
236
- /**
237
- */
211
+
238
212
  export class Clock {
239
213
 
240
214
  static __unwrap(jsValue) {
@@ -256,8 +230,8 @@ export class Clock {
256
230
  wasm.__wbg_clock_free(ptr, 0);
257
231
  }
258
232
  /**
259
- * @param {string} name
260
- */
233
+ * @param {string} name
234
+ */
261
235
  constructor(name) {
262
236
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
263
237
  const len0 = WASM_VECTOR_LEN;
@@ -271,8 +245,7 @@ export class Clock {
271
245
  const ClockConstraintFinalization = (typeof FinalizationRegistry === 'undefined')
272
246
  ? { register: () => {}, unregister: () => {} }
273
247
  : new FinalizationRegistry(ptr => wasm.__wbg_clockconstraint_free(ptr >>> 0, 1));
274
- /**
275
- */
248
+
276
249
  export class ClockConstraint {
277
250
 
278
251
  __destroy_into_raw() {
@@ -287,8 +260,8 @@ export class ClockConstraint {
287
260
  wasm.__wbg_clockconstraint_free(ptr, 0);
288
261
  }
289
262
  /**
290
- * @param {(Clause)[]} clauses
291
- */
263
+ * @param {(Clause)[]} clauses
264
+ */
292
265
  constructor(clauses) {
293
266
  const ptr0 = passArrayJsValueToWasm0(clauses, wasm.__wbindgen_malloc);
294
267
  const len0 = WASM_VECTOR_LEN;
@@ -302,8 +275,7 @@ export class ClockConstraint {
302
275
  const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
303
276
  ? { register: () => {}, unregister: () => {} }
304
277
  : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0, 1));
305
- /**
306
- */
278
+
307
279
  export class Location {
308
280
 
309
281
  static __unwrap(jsValue) {
@@ -325,10 +297,10 @@ export class Location {
325
297
  wasm.__wbg_location_free(ptr, 0);
326
298
  }
327
299
  /**
328
- * @param {string} name
329
- * @param {boolean} is_initial
330
- * @param {ClockConstraint | undefined} [invariant]
331
- */
300
+ * @param {string} name
301
+ * @param {boolean} is_initial
302
+ * @param {ClockConstraint | undefined} [invariant]
303
+ */
332
304
  constructor(name, is_initial, invariant) {
333
305
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
334
306
  const len0 = WASM_VECTOR_LEN;
@@ -347,8 +319,7 @@ export class Location {
347
319
  const SwitchFinalization = (typeof FinalizationRegistry === 'undefined')
348
320
  ? { register: () => {}, unregister: () => {} }
349
321
  : new FinalizationRegistry(ptr => wasm.__wbg_switch_free(ptr >>> 0, 1));
350
- /**
351
- */
322
+
352
323
  export class Switch {
353
324
 
354
325
  static __unwrap(jsValue) {
@@ -370,12 +341,12 @@ export class Switch {
370
341
  wasm.__wbg_switch_free(ptr, 0);
371
342
  }
372
343
  /**
373
- * @param {Location} source
374
- * @param {ClockConstraint | undefined} guard
375
- * @param {string} action
376
- * @param {(Clock)[]} reset
377
- * @param {Location} target
378
- */
344
+ * @param {Location} source
345
+ * @param {ClockConstraint | undefined} guard
346
+ * @param {string} action
347
+ * @param {(Clock)[]} reset
348
+ * @param {Location} target
349
+ */
379
350
  constructor(source, guard, action, reset, target) {
380
351
  _assertClass(source, Location);
381
352
  let ptr0 = 0;
@@ -398,8 +369,7 @@ export class Switch {
398
369
  const TimedAutomatonFinalization = (typeof FinalizationRegistry === 'undefined')
399
370
  ? { register: () => {}, unregister: () => {} }
400
371
  : new FinalizationRegistry(ptr => wasm.__wbg_timedautomaton_free(ptr >>> 0, 1));
401
- /**
402
- */
372
+
403
373
  export class TimedAutomaton {
404
374
 
405
375
  __destroy_into_raw() {
@@ -414,10 +384,10 @@ export class TimedAutomaton {
414
384
  wasm.__wbg_timedautomaton_free(ptr, 0);
415
385
  }
416
386
  /**
417
- * @param {(Location)[]} locations
418
- * @param {(Clock)[]} clocks
419
- * @param {(Switch)[]} switches
420
- */
387
+ * @param {(Location)[]} locations
388
+ * @param {(Clock)[]} clocks
389
+ * @param {(Switch)[]} switches
390
+ */
421
391
  constructor(locations, clocks, switches) {
422
392
  const ptr0 = passArrayJsValueToWasm0(locations, wasm.__wbindgen_malloc);
423
393
  const len0 = WASM_VECTOR_LEN;
@@ -432,33 +402,40 @@ export class TimedAutomaton {
432
402
  }
433
403
  }
434
404
 
435
- export function __wbg_clock_unwrap(arg0) {
436
- const ret = Clock.__unwrap(takeObject(arg0));
405
+ export function __wbg_clause_unwrap(arg0) {
406
+ const ret = Clause.__unwrap(arg0);
437
407
  return ret;
438
408
  };
439
409
 
440
- export function __wbg_clause_unwrap(arg0) {
441
- const ret = Clause.__unwrap(takeObject(arg0));
410
+ export function __wbg_clock_unwrap(arg0) {
411
+ const ret = Clock.__unwrap(arg0);
442
412
  return ret;
443
413
  };
444
414
 
445
415
  export function __wbg_location_unwrap(arg0) {
446
- const ret = Location.__unwrap(takeObject(arg0));
416
+ const ret = Location.__unwrap(arg0);
447
417
  return ret;
448
418
  };
449
419
 
450
420
  export function __wbg_switch_unwrap(arg0) {
451
- const ret = Switch.__unwrap(takeObject(arg0));
421
+ const ret = Switch.__unwrap(arg0);
452
422
  return ret;
453
423
  };
454
424
 
455
- export function __wbindgen_string_new(arg0, arg1) {
456
- const ret = getStringFromWasm0(arg0, arg1);
457
- return addHeapObject(ret);
425
+ export function __wbindgen_init_externref_table() {
426
+ const table = wasm.__wbindgen_export_0;
427
+ const offset = table.grow(4);
428
+ table.set(0, undefined);
429
+ table.set(offset + 0, undefined);
430
+ table.set(offset + 1, null);
431
+ table.set(offset + 2, true);
432
+ table.set(offset + 3, false);
433
+ ;
458
434
  };
459
435
 
460
- export function __wbindgen_object_drop_ref(arg0) {
461
- takeObject(arg0);
436
+ export function __wbindgen_string_new(arg0, arg1) {
437
+ const ret = getStringFromWasm0(arg0, arg1);
438
+ return ret;
462
439
  };
463
440
 
464
441
  export function __wbindgen_throw(arg0, arg1) {
Binary file