timed-automata-analyzer 1.0.1 → 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.1",
8
+ "version": "1.0.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -1,96 +1,82 @@
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
+ * @param {TimedAutomaton} ta
22
+ * @returns {(string)[]}
23
+ */
24
24
  export function findUnreachableLocations(ta: TimedAutomaton): (string)[];
25
- /**
26
- */
27
25
  export enum ClockComparator {
28
26
  LESSER = 0,
29
27
  LEQ = 1,
30
28
  GEQ = 2,
31
29
  GREATER = 3,
32
30
  }
33
- /**
34
- */
35
31
  export class Clause {
36
32
  free(): void;
37
- /**
38
- * @param {Clock} lhs
39
- * @param {ClockComparator} op
40
- * @param {number} rhs
41
- */
33
+ /**
34
+ * @param {Clock} lhs
35
+ * @param {ClockComparator} op
36
+ * @param {number} rhs
37
+ */
42
38
  constructor(lhs: Clock, op: ClockComparator, rhs: number);
43
39
  }
44
- /**
45
- */
46
40
  export class Clock {
47
41
  free(): void;
48
- /**
49
- * @param {string} name
50
- */
42
+ /**
43
+ * @param {string} name
44
+ */
51
45
  constructor(name: string);
52
46
  }
53
- /**
54
- */
55
47
  export class ClockConstraint {
56
48
  free(): void;
57
- /**
58
- * @param {(Clause)[]} clauses
59
- */
49
+ /**
50
+ * @param {(Clause)[]} clauses
51
+ */
60
52
  constructor(clauses: (Clause)[]);
61
53
  }
62
- /**
63
- */
64
54
  export class Location {
65
55
  free(): void;
66
- /**
67
- * @param {string} name
68
- * @param {boolean} is_initial
69
- * @param {ClockConstraint | undefined} [invariant]
70
- */
56
+ /**
57
+ * @param {string} name
58
+ * @param {boolean} is_initial
59
+ * @param {ClockConstraint | undefined} [invariant]
60
+ */
71
61
  constructor(name: string, is_initial: boolean, invariant?: ClockConstraint);
72
62
  }
73
- /**
74
- */
75
63
  export class Switch {
76
64
  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
- */
65
+ /**
66
+ * @param {Location} source
67
+ * @param {ClockConstraint | undefined} guard
68
+ * @param {string} action
69
+ * @param {(Clock)[]} reset
70
+ * @param {Location} target
71
+ */
84
72
  constructor(source: Location, guard: ClockConstraint | undefined, action: string, reset: (Clock)[], target: Location);
85
73
  }
86
- /**
87
- */
88
74
  export class TimedAutomaton {
89
75
  free(): void;
90
- /**
91
- * @param {(Location)[]} locations
92
- * @param {(Clock)[]} clocks
93
- * @param {(Switch)[]} switches
94
- */
76
+ /**
77
+ * @param {(Location)[]} locations
78
+ * @param {(Clock)[]} clocks
79
+ * @param {(Switch)[]} switches
80
+ */
95
81
  constructor(locations: (Location)[], clocks: (Clock)[], switches: (Switch)[]);
96
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,56 +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
- * 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
- */
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
+ */
174
152
  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
- }
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;
188
159
  }
189
160
 
190
- /**
191
- */
192
161
  export const ClockComparator = Object.freeze({ LESSER:0,"0":"LESSER",LEQ:1,"1":"LEQ",GEQ:2,"2":"GEQ",GREATER:3,"3":"GREATER", });
193
162
 
194
163
  const ClauseFinalization = (typeof FinalizationRegistry === 'undefined')
195
164
  ? { register: () => {}, unregister: () => {} }
196
165
  : new FinalizationRegistry(ptr => wasm.__wbg_clause_free(ptr >>> 0, 1));
197
- /**
198
- */
166
+
199
167
  export class Clause {
200
168
 
201
169
  static __unwrap(jsValue) {
@@ -217,10 +185,10 @@ export class Clause {
217
185
  wasm.__wbg_clause_free(ptr, 0);
218
186
  }
219
187
  /**
220
- * @param {Clock} lhs
221
- * @param {ClockComparator} op
222
- * @param {number} rhs
223
- */
188
+ * @param {Clock} lhs
189
+ * @param {ClockComparator} op
190
+ * @param {number} rhs
191
+ */
224
192
  constructor(lhs, op, rhs) {
225
193
  _assertClass(lhs, Clock);
226
194
  const ret = wasm.clause_new(lhs.__wbg_ptr, op, rhs);
@@ -233,8 +201,7 @@ export class Clause {
233
201
  const ClockFinalization = (typeof FinalizationRegistry === 'undefined')
234
202
  ? { register: () => {}, unregister: () => {} }
235
203
  : new FinalizationRegistry(ptr => wasm.__wbg_clock_free(ptr >>> 0, 1));
236
- /**
237
- */
204
+
238
205
  export class Clock {
239
206
 
240
207
  static __unwrap(jsValue) {
@@ -256,8 +223,8 @@ export class Clock {
256
223
  wasm.__wbg_clock_free(ptr, 0);
257
224
  }
258
225
  /**
259
- * @param {string} name
260
- */
226
+ * @param {string} name
227
+ */
261
228
  constructor(name) {
262
229
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
263
230
  const len0 = WASM_VECTOR_LEN;
@@ -271,8 +238,7 @@ export class Clock {
271
238
  const ClockConstraintFinalization = (typeof FinalizationRegistry === 'undefined')
272
239
  ? { register: () => {}, unregister: () => {} }
273
240
  : new FinalizationRegistry(ptr => wasm.__wbg_clockconstraint_free(ptr >>> 0, 1));
274
- /**
275
- */
241
+
276
242
  export class ClockConstraint {
277
243
 
278
244
  __destroy_into_raw() {
@@ -287,8 +253,8 @@ export class ClockConstraint {
287
253
  wasm.__wbg_clockconstraint_free(ptr, 0);
288
254
  }
289
255
  /**
290
- * @param {(Clause)[]} clauses
291
- */
256
+ * @param {(Clause)[]} clauses
257
+ */
292
258
  constructor(clauses) {
293
259
  const ptr0 = passArrayJsValueToWasm0(clauses, wasm.__wbindgen_malloc);
294
260
  const len0 = WASM_VECTOR_LEN;
@@ -302,8 +268,7 @@ export class ClockConstraint {
302
268
  const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
303
269
  ? { register: () => {}, unregister: () => {} }
304
270
  : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0, 1));
305
- /**
306
- */
271
+
307
272
  export class Location {
308
273
 
309
274
  static __unwrap(jsValue) {
@@ -325,10 +290,10 @@ export class Location {
325
290
  wasm.__wbg_location_free(ptr, 0);
326
291
  }
327
292
  /**
328
- * @param {string} name
329
- * @param {boolean} is_initial
330
- * @param {ClockConstraint | undefined} [invariant]
331
- */
293
+ * @param {string} name
294
+ * @param {boolean} is_initial
295
+ * @param {ClockConstraint | undefined} [invariant]
296
+ */
332
297
  constructor(name, is_initial, invariant) {
333
298
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
334
299
  const len0 = WASM_VECTOR_LEN;
@@ -347,8 +312,7 @@ export class Location {
347
312
  const SwitchFinalization = (typeof FinalizationRegistry === 'undefined')
348
313
  ? { register: () => {}, unregister: () => {} }
349
314
  : new FinalizationRegistry(ptr => wasm.__wbg_switch_free(ptr >>> 0, 1));
350
- /**
351
- */
315
+
352
316
  export class Switch {
353
317
 
354
318
  static __unwrap(jsValue) {
@@ -370,12 +334,12 @@ export class Switch {
370
334
  wasm.__wbg_switch_free(ptr, 0);
371
335
  }
372
336
  /**
373
- * @param {Location} source
374
- * @param {ClockConstraint | undefined} guard
375
- * @param {string} action
376
- * @param {(Clock)[]} reset
377
- * @param {Location} target
378
- */
337
+ * @param {Location} source
338
+ * @param {ClockConstraint | undefined} guard
339
+ * @param {string} action
340
+ * @param {(Clock)[]} reset
341
+ * @param {Location} target
342
+ */
379
343
  constructor(source, guard, action, reset, target) {
380
344
  _assertClass(source, Location);
381
345
  let ptr0 = 0;
@@ -398,8 +362,7 @@ export class Switch {
398
362
  const TimedAutomatonFinalization = (typeof FinalizationRegistry === 'undefined')
399
363
  ? { register: () => {}, unregister: () => {} }
400
364
  : new FinalizationRegistry(ptr => wasm.__wbg_timedautomaton_free(ptr >>> 0, 1));
401
- /**
402
- */
365
+
403
366
  export class TimedAutomaton {
404
367
 
405
368
  __destroy_into_raw() {
@@ -414,10 +377,10 @@ export class TimedAutomaton {
414
377
  wasm.__wbg_timedautomaton_free(ptr, 0);
415
378
  }
416
379
  /**
417
- * @param {(Location)[]} locations
418
- * @param {(Clock)[]} clocks
419
- * @param {(Switch)[]} switches
420
- */
380
+ * @param {(Location)[]} locations
381
+ * @param {(Clock)[]} clocks
382
+ * @param {(Switch)[]} switches
383
+ */
421
384
  constructor(locations, clocks, switches) {
422
385
  const ptr0 = passArrayJsValueToWasm0(locations, wasm.__wbindgen_malloc);
423
386
  const len0 = WASM_VECTOR_LEN;
@@ -433,35 +396,42 @@ export class TimedAutomaton {
433
396
  }
434
397
 
435
398
  export function __wbg_clock_unwrap(arg0) {
436
- const ret = Clock.__unwrap(takeObject(arg0));
399
+ const ret = Clock.__unwrap(arg0);
437
400
  return ret;
438
401
  };
439
402
 
440
403
  export function __wbg_clause_unwrap(arg0) {
441
- const ret = Clause.__unwrap(takeObject(arg0));
404
+ const ret = Clause.__unwrap(arg0);
442
405
  return ret;
443
406
  };
444
407
 
445
- export function __wbg_location_unwrap(arg0) {
446
- const ret = Location.__unwrap(takeObject(arg0));
408
+ export function __wbg_switch_unwrap(arg0) {
409
+ const ret = Switch.__unwrap(arg0);
447
410
  return ret;
448
411
  };
449
412
 
450
- export function __wbg_switch_unwrap(arg0) {
451
- const ret = Switch.__unwrap(takeObject(arg0));
413
+ export function __wbg_location_unwrap(arg0) {
414
+ const ret = Location.__unwrap(arg0);
452
415
  return ret;
453
416
  };
454
417
 
455
418
  export function __wbindgen_string_new(arg0, arg1) {
456
419
  const ret = getStringFromWasm0(arg0, arg1);
457
- return addHeapObject(ret);
458
- };
459
-
460
- export function __wbindgen_object_drop_ref(arg0) {
461
- takeObject(arg0);
420
+ return ret;
462
421
  };
463
422
 
464
423
  export function __wbindgen_throw(arg0, arg1) {
465
424
  throw new Error(getStringFromWasm0(arg0, arg1));
466
425
  };
467
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