@sccharts-lab/trace 0.0.0-stage → 0.1.0
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 +277 -0
- package/README.md +233 -2
- package/dist/comparison-report.d.ts +15 -0
- package/dist/comparison-report.js +258 -0
- package/dist/comparison-report.js.map +1 -0
- package/dist/csv.d.ts +13 -0
- package/dist/csv.js +188 -0
- package/dist/csv.js.map +1 -0
- package/dist/data-pool.d.ts +2 -0
- package/dist/data-pool.js +26 -0
- package/dist/data-pool.js.map +1 -0
- package/dist/engine-replay.d.ts +78 -0
- package/dist/engine-replay.js +115 -0
- package/dist/engine-replay.js.map +1 -0
- package/dist/engine-sequence.d.ts +26 -0
- package/dist/engine-sequence.js +132 -0
- package/dist/engine-sequence.js.map +1 -0
- package/dist/engine.d.ts +51 -0
- package/dist/engine.js +210 -0
- package/dist/engine.js.map +1 -0
- package/dist/helper.d.ts +10 -0
- package/dist/helper.js +26 -0
- package/dist/helper.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/input-value.d.ts +2 -0
- package/dist/input-value.js +38 -0
- package/dist/input-value.js.map +1 -0
- package/dist/json.d.ts +8 -0
- package/dist/json.js +122 -0
- package/dist/json.js.map +1 -0
- package/dist/ktrace.d.ts +11 -0
- package/dist/ktrace.js +266 -0
- package/dist/ktrace.js.map +1 -0
- package/dist/protocol.d.ts +25 -0
- package/dist/protocol.js +18 -0
- package/dist/protocol.js.map +1 -0
- package/dist/trace-compare.d.ts +77 -0
- package/dist/trace-compare.js +156 -0
- package/dist/trace-compare.js.map +1 -0
- package/dist/trace-file.d.ts +6 -0
- package/dist/trace-file.js +65 -0
- package/dist/trace-file.js.map +1 -0
- package/dist/trace-record.d.ts +71 -0
- package/dist/trace-record.js +181 -0
- package/dist/trace-record.js.map +1 -0
- package/dist/trace-rename.d.ts +40 -0
- package/dist/trace-rename.js +112 -0
- package/dist/trace-rename.js.map +1 -0
- package/dist/trace-replay.d.ts +72 -0
- package/dist/trace-replay.js +169 -0
- package/dist/trace-replay.js.map +1 -0
- package/dist/trace-timing.d.ts +55 -0
- package/dist/trace-timing.js +122 -0
- package/dist/trace-timing.js.map +1 -0
- package/dist/xml.d.ts +8 -0
- package/dist/xml.js +179 -0
- package/dist/xml.js.map +1 -0
- package/package.json +70 -3
package/dist/engine.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
//
|
|
3
|
+
// Runs of the in-browser engine (@sccharts-lab/engine) as traces: the same columns, names, roles, types and values
|
|
4
|
+
// as the SCCharts Lab extension saves for the same run on KIELER's server, so the two write the same files.
|
|
5
|
+
//
|
|
6
|
+
// The extension's columns are KIELER's data pool: the C simulation's variables in KIELER's VARIABLE_ORDER
|
|
7
|
+
// (VariableStore.xtend: inputs, then outputs, then the rest, each by name), without the compiler's helpers
|
|
8
|
+
// (`_` and `#` names). The client lists the pool's variables before tick 1 first and the ones the pool lacks then
|
|
9
|
+
// (unset strings, the member declarations of classes and structs) after them, and puts inputs first, then outputs,
|
|
10
|
+
// then locals. Values are the pool after each tick; a name missing from a tick's pool keeps its value.
|
|
11
|
+
import { allScopes } from "@sccharts-lab/engine/internal";
|
|
12
|
+
import { compareTraces } from "./trace-compare.js";
|
|
13
|
+
import { printedOf } from "./trace-record.js";
|
|
14
|
+
/** KIELER's VARIABLE_ORDER: inputs (pure ones before in-outs), then outputs, then the rest; then by name. */
|
|
15
|
+
function kielerOrder(a, b) {
|
|
16
|
+
if (a.input && b.input) {
|
|
17
|
+
if (a.output !== b.output)
|
|
18
|
+
return a.output ? 1 : -1;
|
|
19
|
+
}
|
|
20
|
+
else if (a.input !== b.input) {
|
|
21
|
+
return a.input ? -1 : 1;
|
|
22
|
+
}
|
|
23
|
+
else if (a.output !== b.output) {
|
|
24
|
+
return a.output ? -1 : 1;
|
|
25
|
+
}
|
|
26
|
+
// Java's String.compareTo compares UTF-16 code units, as `<` does.
|
|
27
|
+
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
|
|
28
|
+
}
|
|
29
|
+
function typeName(type, hostType) {
|
|
30
|
+
if (type === 'pure' || type === undefined)
|
|
31
|
+
return 'bool';
|
|
32
|
+
if (type === 'clock' || type === 'clock-time')
|
|
33
|
+
return 'float';
|
|
34
|
+
if (type === 'host')
|
|
35
|
+
return hostType ?? 'host';
|
|
36
|
+
return type;
|
|
37
|
+
}
|
|
38
|
+
/** The member declarations KIELER lists for a class or struct type: `Type.member`, nested types by their path. */
|
|
39
|
+
function memberDeclarations(prefix, members, out) {
|
|
40
|
+
const member = (name, type) => ({ name, input: false, output: false, type, dims: [], late: true });
|
|
41
|
+
for (const m of members) {
|
|
42
|
+
if (m.declKind === 'method' || m.const)
|
|
43
|
+
continue;
|
|
44
|
+
if (m.declKind === 'class' || m.declKind === 'struct') {
|
|
45
|
+
if (m.className)
|
|
46
|
+
memberDeclarations(`${prefix}.${m.className}`, m.members ?? [], out);
|
|
47
|
+
for (const vo of m.valuedObjects)
|
|
48
|
+
out.push(member(`${prefix}.${vo.name}`, m.declKind));
|
|
49
|
+
}
|
|
50
|
+
else if (m.declKind === 'variable') {
|
|
51
|
+
for (const vo of m.valuedObjects)
|
|
52
|
+
out.push(member(`${prefix}.${vo.name}`, typeName(m.type, m.hostType)));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The member declarations of the types KIELER makes as it compiles: a chart used as a class (`ref C x`) becomes the
|
|
58
|
+
* class `C1`, and a type declared in an inner state moves to the root with a `1` added (`Point1`, `C11`). The members
|
|
59
|
+
* have the names KIELER gives them (an inherited private field: `<Base>_<field>`), which the engine's are.
|
|
60
|
+
*/
|
|
61
|
+
function generatedMemberDeclarations(result, out) {
|
|
62
|
+
const compiled = result.sim;
|
|
63
|
+
for (const scope of allScopes(compiled.core)) {
|
|
64
|
+
for (const v of scope.decls) {
|
|
65
|
+
if (!v.member || v.declKind || v.const || v.tags.has('#const-member'))
|
|
66
|
+
continue;
|
|
67
|
+
const { of } = v.member;
|
|
68
|
+
const nested = scope !== compiled.core;
|
|
69
|
+
let type;
|
|
70
|
+
if (of.declKind === 'reference' && of.instance)
|
|
71
|
+
type = `${of.instance.target}1`;
|
|
72
|
+
else if (nested && (of.declKind === 'class' || of.declKind === 'struct'))
|
|
73
|
+
type = result.index?.vos.get(of.decl ?? '')?.decl?.className;
|
|
74
|
+
if (!type)
|
|
75
|
+
continue;
|
|
76
|
+
out.push({ name: `${type}${nested ? '1' : ''}.${v.member.name}`, input: false, output: false, type: typeName(v.type, v.hostType), dims: [], late: true });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* KIELER's data pool for the chart, in KIELER's order (its `#interface`), without the compiler's helpers. The names
|
|
82
|
+
* are the engine's pool's (exec.ts builds it from the same declarations). Empty when the chart did not compile.
|
|
83
|
+
*/
|
|
84
|
+
export function poolVariables(result) {
|
|
85
|
+
const compiled = result.sim;
|
|
86
|
+
if (!compiled)
|
|
87
|
+
return [];
|
|
88
|
+
const declared = new Map(result.interface.map((v) => [v.name, v]));
|
|
89
|
+
const out = new Map();
|
|
90
|
+
const add = (entry) => {
|
|
91
|
+
if (!out.has(entry.name))
|
|
92
|
+
out.set(entry.name, entry);
|
|
93
|
+
};
|
|
94
|
+
const instance = (v) => ({
|
|
95
|
+
name: v.name, input: false, output: false, type: v.declKind === 'struct' ? 'struct' : 'class', dims: [], late: false,
|
|
96
|
+
});
|
|
97
|
+
for (const v of compiled.core.decls) {
|
|
98
|
+
if (v.member && !v.const && !v.declKind) {
|
|
99
|
+
if (!v.tags.has('#const-member'))
|
|
100
|
+
add(instance(v.member.of));
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (v.const || v.declKind || v.name.startsWith('_'))
|
|
104
|
+
continue;
|
|
105
|
+
const info = declared.get(v.name) ?? (v.of ? declared.get(v.of.name) : undefined);
|
|
106
|
+
const type = typeName(v.type, v.hostType);
|
|
107
|
+
const dims = info?.dims ?? [];
|
|
108
|
+
// An unset string is null, which the pool leaves out; KIELER's reset() sets constant initial values.
|
|
109
|
+
const late = type === 'string' && dims.length === 0 && info?.initialValue == null;
|
|
110
|
+
add({ name: v.name, input: v.input, output: v.output, type, dims, late });
|
|
111
|
+
}
|
|
112
|
+
const instances = compiled.core.ext.emptyInstances ?? [];
|
|
113
|
+
for (const name of instances) {
|
|
114
|
+
const v = compiled.core.decls.find((d) => d.name === name);
|
|
115
|
+
add(v ? instance(v) : { name, input: false, output: false, type: 'class', dims: [], late: false });
|
|
116
|
+
}
|
|
117
|
+
const members = [];
|
|
118
|
+
for (const d of result.chart?.declarations ?? []) {
|
|
119
|
+
// @UnpackClass makes the members plain variables (`<instance>_<member>`), which are in the pool.
|
|
120
|
+
const unpacked = d.annotations.some((a) => a.name === 'UnpackClass');
|
|
121
|
+
if ((d.declKind === 'class' || d.declKind === 'struct') && !d.host && !unpacked && d.className) {
|
|
122
|
+
memberDeclarations(d.className, d.members ?? [], members);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
generatedMemberDeclarations(result, members);
|
|
126
|
+
members.forEach(add);
|
|
127
|
+
return Array.from(out.values())
|
|
128
|
+
.filter(({ name }) => !name.startsWith('_') && !name.startsWith('#') && !name.includes('_tickCounter'))
|
|
129
|
+
.sort(kielerOrder);
|
|
130
|
+
}
|
|
131
|
+
const ROLES = ['input', 'output', 'local'];
|
|
132
|
+
function roleOf(variable) {
|
|
133
|
+
if (variable.input)
|
|
134
|
+
return 'input';
|
|
135
|
+
return variable.output ? 'output' : 'local';
|
|
136
|
+
}
|
|
137
|
+
/** The pool's variables in the order the extension lists them: present before tick 1 first, then by role. */
|
|
138
|
+
function extensionOrder(variables) {
|
|
139
|
+
const listed = [...variables.filter((v) => !v.late), ...variables.filter((v) => v.late)];
|
|
140
|
+
return listed.sort((a, b) => ROLES.indexOf(roleOf(a)) - ROLES.indexOf(roleOf(b)));
|
|
141
|
+
}
|
|
142
|
+
/** The columns of a trace of the chart's runs, as the extension saves them: name, role and KIELER's type. */
|
|
143
|
+
export function traceColumns(result) {
|
|
144
|
+
return extensionOrder(poolVariables(result)).map((v) => ({ name: v.name, role: roleOf(v), type: v.type }));
|
|
145
|
+
}
|
|
146
|
+
/** A value as KIELER's pool holds it: the members of an instance in KIELER's order, by name. */
|
|
147
|
+
function kielerValue(value) {
|
|
148
|
+
if (Array.isArray(value))
|
|
149
|
+
return value.map(kielerValue);
|
|
150
|
+
if (!value || typeof value !== 'object')
|
|
151
|
+
return value;
|
|
152
|
+
const entries = Object.entries(value).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
153
|
+
return Object.fromEntries(entries.map(([key, member]) => [key, kielerValue(member)]));
|
|
154
|
+
}
|
|
155
|
+
function ticksOf(run) {
|
|
156
|
+
return 'history' in run ? run.history : run;
|
|
157
|
+
}
|
|
158
|
+
/** The ticks a trace holds: up to the first runtime error, after which KIELER's simulation has stopped. */
|
|
159
|
+
function completedTicks(run) {
|
|
160
|
+
const ticks = ticksOf(run);
|
|
161
|
+
const failed = ticks.findIndex((tick) => tick.error);
|
|
162
|
+
return failed < 0 ? ticks : ticks.slice(0, failed);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The run as the trace the extension saves for the same run on KIELER's server: every variable of KIELER's data pool
|
|
166
|
+
* after each tick, inputs, outputs and the chart's own locals, and what the chart printed. A tick with a runtime
|
|
167
|
+
* error ends the trace.
|
|
168
|
+
*/
|
|
169
|
+
export function traceFromRun(result, run, options = {}) {
|
|
170
|
+
const variables = traceColumns(result);
|
|
171
|
+
const ticks = completedTicks(run);
|
|
172
|
+
const read = options.inputs === 'read';
|
|
173
|
+
// Keyed by the chart's names, which may be any identifier (`constructor`): no inherited keys.
|
|
174
|
+
const last = Object.create(null);
|
|
175
|
+
const own = (o, k) => (o && Object.hasOwn(o, k) ? o[k] : undefined);
|
|
176
|
+
const values = ticks.map((tick) => {
|
|
177
|
+
const row = {};
|
|
178
|
+
for (const { name, role } of variables) {
|
|
179
|
+
const value = read && role === 'input' ? own(tick.ranWith, name) : own(tick.pool, name);
|
|
180
|
+
if (value !== undefined && value !== null)
|
|
181
|
+
last[name] = kielerValue(value);
|
|
182
|
+
row[name] = last[name];
|
|
183
|
+
}
|
|
184
|
+
return row;
|
|
185
|
+
});
|
|
186
|
+
const printed = printedOf(ticks.map((tick) => [...tick.printed]));
|
|
187
|
+
return {
|
|
188
|
+
...(options.model ? { model: options.model } : {}),
|
|
189
|
+
variables,
|
|
190
|
+
ticks: values,
|
|
191
|
+
...(printed ? { printed } : {}),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/** Compares runs of the engine, the first being the reference (convenience over compareTraces). */
|
|
195
|
+
export function compareRuns(runs) {
|
|
196
|
+
return compareTraces(runs.map(({ label, result, run, ...options }) => ({ label, trace: traceFromRun(result, run, options) })));
|
|
197
|
+
}
|
|
198
|
+
/** An input's value before the first tick, in the form the extension edits it (an unset string is ''). */
|
|
199
|
+
export function initialValue(variable) {
|
|
200
|
+
const scalar = () => {
|
|
201
|
+
if (variable.type === 'bool')
|
|
202
|
+
return false;
|
|
203
|
+
if (variable.type === 'string')
|
|
204
|
+
return '';
|
|
205
|
+
return 0;
|
|
206
|
+
};
|
|
207
|
+
const build = (dims) => (dims.length === 0 ? scalar() : Array.from({ length: dims[0] }, () => build(dims.slice(1))));
|
|
208
|
+
return build(variable.dims);
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,mHAAmH;AACnH,4GAA4G;AAC5G,EAAE;AACF,0GAA0G;AAC1G,2GAA2G;AAC3G,kHAAkH;AAClH,mHA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AE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,SAAS;QACT,KAAK,EAAE,MAAM;QACb,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClC,CAAA;AACL,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,WAAW,CAAC,IAA4E;IACpG,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAClI,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,YAAY,CAAC,QAAsB;IAC/C,MAAM,MAAM,GAAG,GAAU,EAAE;QACvB,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,KAAK,CAAA;QAC1C,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAA;QACzC,OAAO,CAAC,CAAA;IACZ,CAAC,CAAA;IACD,MAAM,KAAK,GAAG,CAAC,IAAc,EAAS,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACrI,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAC","sourcesContent":["// SPDX-License-Identifier: EPL-2.0\n//\n// Runs of the in-browser engine (@sccharts-lab/engine) as traces: the same columns, names, roles, types and values\n// as the SCCharts Lab extension saves for the same run on KIELER's server, so the two write the same files.\n//\n// The extension's columns are KIELER's data pool: the C simulation's variables in KIELER's VARIABLE_ORDER\n// (VariableStore.xtend: inputs, then outputs, then the rest, each by name), without the compiler's helpers\n// (`_` and `#` names). The client lists the pool's variables before tick 1 first and the ones the pool lacks then\n// (unset strings, the member declarations of classes and structs) after them, and puts inputs first, then outputs,\n// then locals. Values are the pool after each tick; a name missing from a tick's pool keeps its value.\n\nimport type { CompileResult, Simulation, SimTickResult } from '@sccharts-lab/engine'\nimport { allScopes } from '@sccharts-lab/engine/internal'\nimport type { CVar } from '@sccharts-lab/engine/internal'\nimport type { Declaration, Value } from '@sccharts-lab/engine/types'\nimport { compareTraces } from './trace-compare'\nimport type { TraceComparison } from './trace-compare'\nimport { printedOf } from './trace-record'\nimport type { TraceRecord, TraceRole, TraceVariable } from './trace-record'\n\n/** A variable of KIELER's data pool for a compiled chart. */\nexport interface PoolVariable {\n name: string\n input: boolean\n output: boolean\n /** KIELER's type name: bool, int, float, string, class, struct. */\n type: string\n /** Array dimensions (empty for scalars), for an input's value before the first tick. */\n dims: number[]\n /** Not in the pool before the first tick: a string without a value, a member declaration of a class or struct. */\n late: boolean\n}\n\n/** A completed run: a Simulation, or the ticks it returned. */\nexport type EngineRun = Simulation | readonly SimTickResult[]\n\ntype Compiled = Pick<CompileResult, 'sim' | 'chart' | 'interface' | 'index'>\n\n/** KIELER's VARIABLE_ORDER: inputs (pure ones before in-outs), then outputs, then the rest; then by name. */\nfunction kielerOrder(a: PoolVariable, b: PoolVariable): number {\n if (a.input && b.input) {\n if (a.output !== b.output) return a.output ? 1 : -1\n } else if (a.input !== b.input) {\n return a.input ? -1 : 1\n } else if (a.output !== b.output) {\n return a.output ? -1 : 1\n }\n // Java's String.compareTo compares UTF-16 code units, as `<` does.\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0\n}\n\nfunction typeName(type: string | undefined, hostType?: string): string {\n if (type === 'pure' || type === undefined) return 'bool'\n if (type === 'clock' || type === 'clock-time') return 'float'\n if (type === 'host') return hostType ?? 'host'\n return type\n}\n\n/** The member declarations KIELER lists for a class or struct type: `Type.member`, nested types by their path. */\nfunction memberDeclarations(prefix: string, members: Declaration[], out: PoolVariable[]): void {\n const member = (name: string, type: string): PoolVariable => ({ name, input: false, output: false, type, dims: [], late: true })\n for (const m of members) {\n if (m.declKind === 'method' || m.const) continue\n if (m.declKind === 'class' || m.declKind === 'struct') {\n if (m.className) memberDeclarations(`${prefix}.${m.className}`, m.members ?? [], out)\n for (const vo of m.valuedObjects) out.push(member(`${prefix}.${vo.name}`, m.declKind))\n } else if (m.declKind === 'variable') {\n for (const vo of m.valuedObjects) out.push(member(`${prefix}.${vo.name}`, typeName(m.type, m.hostType)))\n }\n }\n}\n\n/**\n * The member declarations of the types KIELER makes as it compiles: a chart used as a class (`ref C x`) becomes the\n * class `C1`, and a type declared in an inner state moves to the root with a `1` added (`Point1`, `C11`). The members\n * have the names KIELER gives them (an inherited private field: `<Base>_<field>`), which the engine's are.\n */\nfunction generatedMemberDeclarations(result: Compiled, out: PoolVariable[]): void {\n const compiled = result.sim!\n for (const scope of allScopes(compiled.core)) {\n for (const v of scope.decls as CVar[]) {\n if (!v.member || v.declKind || v.const || v.tags.has('#const-member')) continue\n const { of } = v.member\n const nested = scope !== compiled.core\n let type: string | undefined\n if (of.declKind === 'reference' && of.instance) type = `${of.instance.target}1`\n else if (nested && (of.declKind === 'class' || of.declKind === 'struct')) type = result.index?.vos.get(of.decl ?? '')?.decl?.className\n if (!type) continue\n out.push({ name: `${type}${nested ? '1' : ''}.${v.member.name}`, input: false, output: false, type: typeName(v.type, v.hostType), dims: [], late: true })\n }\n }\n}\n\n/**\n * KIELER's data pool for the chart, in KIELER's order (its `#interface`), without the compiler's helpers. The names\n * are the engine's pool's (exec.ts builds it from the same declarations). Empty when the chart did not compile.\n */\nexport function poolVariables(result: Compiled): PoolVariable[] {\n const compiled = result.sim\n if (!compiled) return []\n const declared = new Map(result.interface.map((v) => [v.name, v]))\n const out = new Map<string, PoolVariable>()\n const add = (entry: PoolVariable) => {\n if (!out.has(entry.name)) out.set(entry.name, entry)\n }\n const instance = (v: CVar) => ({\n name: v.name, input: false, output: false, type: v.declKind === 'struct' ? 'struct' : 'class', dims: [], late: false,\n })\n for (const v of compiled.core.decls as CVar[]) {\n if (v.member && !v.const && !v.declKind) {\n if (!v.tags.has('#const-member')) add(instance(v.member.of))\n continue\n }\n if (v.const || v.declKind || v.name.startsWith('_')) continue\n const info = declared.get(v.name) ?? (v.of ? declared.get(v.of.name) : undefined)\n const type = typeName(v.type, v.hostType)\n const dims = info?.dims ?? []\n // An unset string is null, which the pool leaves out; KIELER's reset() sets constant initial values.\n const late = type === 'string' && dims.length === 0 && info?.initialValue == null\n add({ name: v.name, input: v.input, output: v.output, type, dims, late })\n }\n const instances = (compiled.core.ext.emptyInstances as string[] | undefined) ?? []\n for (const name of instances) {\n const v = (compiled.core.decls as CVar[]).find((d) => d.name === name)\n add(v ? instance(v) : { name, input: false, output: false, type: 'class', dims: [], late: false })\n }\n const members: PoolVariable[] = []\n for (const d of result.chart?.declarations ?? []) {\n // @UnpackClass makes the members plain variables (`<instance>_<member>`), which are in the pool.\n const unpacked = d.annotations.some((a) => a.name === 'UnpackClass')\n if ((d.declKind === 'class' || d.declKind === 'struct') && !d.host && !unpacked && d.className) {\n memberDeclarations(d.className, d.members ?? [], members)\n }\n }\n generatedMemberDeclarations(result, members)\n members.forEach(add)\n return Array.from(out.values())\n .filter(({ name }) => !name.startsWith('_') && !name.startsWith('#') && !name.includes('_tickCounter'))\n .sort(kielerOrder)\n}\n\nconst ROLES: TraceRole[] = ['input', 'output', 'local']\n\nfunction roleOf(variable: PoolVariable): TraceRole {\n if (variable.input) return 'input'\n return variable.output ? 'output' : 'local'\n}\n\n/** The pool's variables in the order the extension lists them: present before tick 1 first, then by role. */\nfunction extensionOrder(variables: PoolVariable[]): PoolVariable[] {\n const listed = [...variables.filter((v) => !v.late), ...variables.filter((v) => v.late)]\n return listed.sort((a, b) => ROLES.indexOf(roleOf(a)) - ROLES.indexOf(roleOf(b)))\n}\n\n/** The columns of a trace of the chart's runs, as the extension saves them: name, role and KIELER's type. */\nexport function traceColumns(result: Compiled): TraceVariable[] {\n return extensionOrder(poolVariables(result)).map((v) => ({ name: v.name, role: roleOf(v), type: v.type }))\n}\n\n/** A value as KIELER's pool holds it: the members of an instance in KIELER's order, by name. */\nfunction kielerValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(kielerValue)\n if (!value || typeof value !== 'object') return value\n const entries = Object.entries(value).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n return Object.fromEntries(entries.map(([key, member]) => [key, kielerValue(member)]))\n}\n\nfunction ticksOf(run: EngineRun): readonly SimTickResult[] {\n return 'history' in run ? run.history : run\n}\n\n/** The ticks a trace holds: up to the first runtime error, after which KIELER's simulation has stopped. */\nfunction completedTicks(run: EngineRun): readonly SimTickResult[] {\n const ticks = ticksOf(run)\n const failed = ticks.findIndex((tick) => tick.error)\n return failed < 0 ? ticks : ticks.slice(0, failed)\n}\n\nexport interface TraceOptions {\n /** The file name the trace names (the extension: the simulated model's file name). */\n model?: string\n /**\n * `pool` (the default, as the extension): an input's value after the tick, as KIELER's data pool has it. `read`:\n * the value the tick read (`ranWith`), which differs where the chart writes its input (basics.md B-10); a trace\n * replays such a run only with these.\n */\n inputs?: 'pool' | 'read'\n}\n\n/**\n * The run as the trace the extension saves for the same run on KIELER's server: every variable of KIELER's data pool\n * after each tick, inputs, outputs and the chart's own locals, and what the chart printed. A tick with a runtime\n * error ends the trace.\n */\nexport function traceFromRun(result: Compiled, run: EngineRun, options: TraceOptions = {}): TraceRecord {\n const variables = traceColumns(result)\n const ticks = completedTicks(run)\n const read = options.inputs === 'read'\n // Keyed by the chart's names, which may be any identifier (`constructor`): no inherited keys.\n const last: Record<string, unknown> = Object.create(null)\n const own = (o: object | undefined, k: string) => (o && Object.hasOwn(o, k) ? (o as Record<string, unknown>)[k] : undefined)\n const values = ticks.map((tick) => {\n const row: Record<string, unknown> = {}\n for (const { name, role } of variables) {\n const value = read && role === 'input' ? own(tick.ranWith, name) : own(tick.pool, name)\n if (value !== undefined && value !== null) last[name] = kielerValue(value)\n row[name] = last[name]\n }\n return row\n })\n const printed = printedOf(ticks.map((tick) => [...tick.printed]))\n return {\n ...(options.model ? { model: options.model } : {}),\n variables,\n ticks: values,\n ...(printed ? { printed } : {}),\n }\n}\n\n/** Compares runs of the engine, the first being the reference (convenience over compareTraces). */\nexport function compareRuns(runs: ({ label: string; result: Compiled; run: EngineRun } & TraceOptions)[]): TraceComparison {\n return compareTraces(runs.map(({ label, result, run, ...options }) => ({ label, trace: traceFromRun(result, run, options) })))\n}\n\n/** An input's value before the first tick, in the form the extension edits it (an unset string is ''). */\nexport function initialValue(variable: PoolVariable): Value {\n const scalar = (): Value => {\n if (variable.type === 'bool') return false\n if (variable.type === 'string') return ''\n return 0\n }\n const build = (dims: number[]): Value => (dims.length === 0 ? scalar() : Array.from({ length: dims[0] }, () => build(dims.slice(1))))\n return build(variable.dims)\n}\n"]}
|
package/dist/helper.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The input that tells timed models how much time passes per tick; clocks only advance when it is set. */
|
|
2
|
+
export declare function isTimeDelta(data: {
|
|
3
|
+
id?: string;
|
|
4
|
+
categories: string[];
|
|
5
|
+
}): boolean;
|
|
6
|
+
/** Clocks and the time delta belong to the model author, whatever the compiler tagged them as. */
|
|
7
|
+
export declare function isTimeRelated(data: {
|
|
8
|
+
id?: string;
|
|
9
|
+
categories: string[];
|
|
10
|
+
}): boolean;
|
package/dist/helper.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
|
|
3
|
+
*
|
|
4
|
+
* http://rtsys.informatik.uni-kiel.de/kieler
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2021 by
|
|
7
|
+
* + Kiel University
|
|
8
|
+
* + Department of Computer Science
|
|
9
|
+
* + Real-Time and Embedded Systems Group
|
|
10
|
+
*
|
|
11
|
+
* This program and the accompanying materials are made available under the
|
|
12
|
+
* terms of the Eclipse Public License 2.0 which is available at
|
|
13
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
16
|
+
*/
|
|
17
|
+
// The helpers of keith-vscode's simulation/helper.ts that traces use.
|
|
18
|
+
/** The input that tells timed models how much time passes per tick; clocks only advance when it is set. */
|
|
19
|
+
export function isTimeDelta(data) {
|
|
20
|
+
return /^[#_]*deltaT$/i.test(data.id ?? '');
|
|
21
|
+
}
|
|
22
|
+
/** Clocks and the time delta belong to the model author, whatever the compiler tagged them as. */
|
|
23
|
+
export function isTimeRelated(data) {
|
|
24
|
+
return isTimeDelta(data) || data.categories.includes('clock');
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sEAAsE;AAEtE,2GAA2G;AAC3G,MAAM,UAAU,WAAW,CAAC,IAA2C;IACnE,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;AAC/C,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,IAA2C;IACrE,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AACjE,CAAC","sourcesContent":["/*\n * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient\n *\n * http://rtsys.informatik.uni-kiel.de/kieler\n *\n * Copyright 2021 by\n * + Kiel University\n * + Department of Computer Science\n * + Real-Time and Embedded Systems Group\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0.\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n// The helpers of keith-vscode's simulation/helper.ts that traces use.\n\n/** The input that tells timed models how much time passes per tick; clocks only advance when it is set. */\nexport function isTimeDelta(data: { id?: string; categories: string[] }): boolean {\n return /^[#_]*deltaT$/i.test(data.id ?? '')\n}\n\n/** Clocks and the time delta belong to the model author, whatever the compiler tagged them as. */\nexport function isTimeRelated(data: { id?: string; categories: string[] }): boolean {\n return isTimeDelta(data) || data.categories.includes('clock')\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { formatTraceValue, inputsOnly, printedOf, readTrace, sameTraceValue, timeDeltaOf, TRACE_FORMAT_ID, TRACE_FORMATS, TraceFileError, traceFormatOf, traceTimes, writeTrace, } from "./trace-file.js";
|
|
2
|
+
export type { TraceFormat, TraceRecord, TraceRole, TraceVariable } from "./trace-file.js";
|
|
3
|
+
export { compareTraces, valueOf } from "./trace-compare.js";
|
|
4
|
+
export type { Alignment, NamedTrace, PrintedComparison, TraceComparison, ValueChange, VariableComparison } from "./trace-compare.js";
|
|
5
|
+
export { comparisonCsv, comparisonMarkdown } from "./comparison-report.js";
|
|
6
|
+
export { coerceInput, TraceReplay } from "./trace-replay.js";
|
|
7
|
+
export type { ReplayMismatch, ReplayTarget } from "./trace-replay.js";
|
|
8
|
+
export type { ReplayState } from "./protocol.js";
|
|
9
|
+
export { couldMatch, describeRenames, forgetAliases, nameKey, rememberAliases, renameTrace, sameKind, suggestRenames, unmatched, } from "./trace-rename.js";
|
|
10
|
+
export type { Alias, NamedVariable, Renames, RenameSuggestion } from "./trace-rename.js";
|
|
11
|
+
export { MAX_TIMED_TICKS, TimedSchedule, timedEvents } from "./trace-timing.js";
|
|
12
|
+
export type { TickMode, TimedTick } from "./trace-timing.js";
|
|
13
|
+
export { compareRuns, initialValue, poolVariables, traceColumns, traceFromRun } from "./engine.js";
|
|
14
|
+
export type { EngineRun, PoolVariable, TraceOptions } from "./engine.js";
|
|
15
|
+
export { replayTargets, replayTrace, SimulationReplay } from "./engine-replay.js";
|
|
16
|
+
export type { EngineReplayOptions, ReplayOutcome, ReplayStep } from "./engine-replay.js";
|
|
17
|
+
export { runOnSequence, runOnTimedSequence } from "./engine-sequence.js";
|
|
18
|
+
export type { SequenceRun } from "./engine-sequence.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
//
|
|
3
|
+
// @sccharts-lab/trace: the SCCharts Lab extension's simulation traces (save, replay, compare) for the web IDE, on
|
|
4
|
+
// the in-browser engine. README.md has the API and the formats.
|
|
5
|
+
// Files: KTrace (KIELER's), CSV, JSON and XML.
|
|
6
|
+
export { formatTraceValue, inputsOnly, printedOf, readTrace, sameTraceValue, timeDeltaOf, TRACE_FORMAT_ID, TRACE_FORMATS, TraceFileError, traceFormatOf, traceTimes, writeTrace, } from "./trace-file.js";
|
|
7
|
+
// Comparing runs.
|
|
8
|
+
export { compareTraces, valueOf } from "./trace-compare.js";
|
|
9
|
+
export { comparisonCsv, comparisonMarkdown } from "./comparison-report.js";
|
|
10
|
+
// Replaying a trace into a model, matching names, timed sequences.
|
|
11
|
+
export { coerceInput, TraceReplay } from "./trace-replay.js";
|
|
12
|
+
export { couldMatch, describeRenames, forgetAliases, nameKey, rememberAliases, renameTrace, sameKind, suggestRenames, unmatched, } from "./trace-rename.js";
|
|
13
|
+
export { MAX_TIMED_TICKS, TimedSchedule, timedEvents } from "./trace-timing.js";
|
|
14
|
+
// The in-browser engine's runs as traces, and replaying into its simulations.
|
|
15
|
+
export { compareRuns, initialValue, poolVariables, traceColumns, traceFromRun } from "./engine.js";
|
|
16
|
+
export { replayTargets, replayTrace, SimulationReplay } from "./engine-replay.js";
|
|
17
|
+
export { runOnSequence, runOnTimedSequence } from "./engine-sequence.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,kHAAkH;AAClH,gEAAgE;AAEhE,+CAA+C;AAC/C,OAAO,EACH,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,UAAU,GACb,wBAAoB;AAGrB,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,2BAAuB;AAExD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,+BAA2B;AAEvE,mEAAmE;AACnE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,0BAAsB;AAGzD,OAAO,EACH,UAAU,EACV,eAAe,EACf,aAAa,EACb,OAAO,EACP,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,EACd,SAAS,GACZ,0BAAsB;AAEvB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,0BAAsB;AAG5E,8EAA8E;AAC9E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,oBAAgB;AAE/F,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,2BAAuB;AAE9E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,6BAAyB","sourcesContent":["// SPDX-License-Identifier: EPL-2.0\n//\n// @sccharts-lab/trace: the SCCharts Lab extension's simulation traces (save, replay, compare) for the web IDE, on\n// the in-browser engine. README.md has the API and the formats.\n\n// Files: KTrace (KIELER's), CSV, JSON and XML.\nexport {\n formatTraceValue,\n inputsOnly,\n printedOf,\n readTrace,\n sameTraceValue,\n timeDeltaOf,\n TRACE_FORMAT_ID,\n TRACE_FORMATS,\n TraceFileError,\n traceFormatOf,\n traceTimes,\n writeTrace,\n} from './trace-file'\nexport type { TraceFormat, TraceRecord, TraceRole, TraceVariable } from './trace-file'\n\n// Comparing runs.\nexport { compareTraces, valueOf } from './trace-compare'\nexport type { Alignment, NamedTrace, PrintedComparison, TraceComparison, ValueChange, VariableComparison } from './trace-compare'\nexport { comparisonCsv, comparisonMarkdown } from './comparison-report'\n\n// Replaying a trace into a model, matching names, timed sequences.\nexport { coerceInput, TraceReplay } from './trace-replay'\nexport type { ReplayMismatch, ReplayTarget } from './trace-replay'\nexport type { ReplayState } from './protocol'\nexport {\n couldMatch,\n describeRenames,\n forgetAliases,\n nameKey,\n rememberAliases,\n renameTrace,\n sameKind,\n suggestRenames,\n unmatched,\n} from './trace-rename'\nexport type { Alias, NamedVariable, Renames, RenameSuggestion } from './trace-rename'\nexport { MAX_TIMED_TICKS, TimedSchedule, timedEvents } from './trace-timing'\nexport type { TickMode, TimedTick } from './trace-timing'\n\n// The in-browser engine's runs as traces, and replaying into its simulations.\nexport { compareRuns, initialValue, poolVariables, traceColumns, traceFromRun } from './engine'\nexport type { EngineRun, PoolVariable, TraceOptions } from './engine'\nexport { replayTargets, replayTrace, SimulationReplay } from './engine-replay'\nexport type { EngineReplayOptions, ReplayOutcome, ReplayStep } from './engine-replay'\nexport { runOnSequence, runOnTimedSequence } from './engine-sequence'\nexport type { SequenceRun } from './engine-sequence'\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
|
|
3
|
+
*
|
|
4
|
+
* http://rtsys.informatik.uni-kiel.de/kieler
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2026 by
|
|
7
|
+
* + Kiel University
|
|
8
|
+
* + Department of Computer Science
|
|
9
|
+
* + Real-Time and Embedded Systems Group
|
|
10
|
+
*
|
|
11
|
+
* This program and the accompanying materials are made available under the
|
|
12
|
+
* terms of the Eclipse Public License 2.0 which is available at
|
|
13
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
16
|
+
*/
|
|
17
|
+
/** Reject values that cannot be represented by the existing simulation input. */
|
|
18
|
+
export function isCompatibleInput(value, current) {
|
|
19
|
+
if (typeof current === 'number')
|
|
20
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
21
|
+
if (current === null)
|
|
22
|
+
return value === null;
|
|
23
|
+
if (Array.isArray(current)) {
|
|
24
|
+
return (Array.isArray(value) &&
|
|
25
|
+
value.length === current.length &&
|
|
26
|
+
value.every((entry, index) => isCompatibleInput(entry, current[index])));
|
|
27
|
+
}
|
|
28
|
+
if (typeof current === 'object') {
|
|
29
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
30
|
+
return false;
|
|
31
|
+
const expected = current;
|
|
32
|
+
const actual = value;
|
|
33
|
+
return (Object.keys(actual).length === Object.keys(expected).length &&
|
|
34
|
+
Object.keys(expected).every((key) => Object.prototype.hasOwnProperty.call(actual, key) && isCompatibleInput(actual[key], expected[key])));
|
|
35
|
+
}
|
|
36
|
+
return current !== undefined && typeof value === typeof current;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=input-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-value.js","sourceRoot":"","sources":["../src/input-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,OAAgB;IAC9D,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3F,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,KAAK,IAAI,CAAA;IAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,OAAO,CACH,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACpB,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;YAC/B,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAC1E,CAAA;IACL,CAAC;IACD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAA;QAC7E,MAAM,QAAQ,GAAG,OAAkC,CAAA;QACnD,MAAM,MAAM,GAAG,KAAgC,CAAA;QAC/C,OAAO,CACH,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM;YAC3D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CACvB,CAAC,GAAG,EAAE,EAAE,CACJ,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CACzG,CACJ,CAAA;IACL,CAAC;IACD,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,OAAO,OAAO,CAAA;AACnE,CAAC","sourcesContent":["/*\n * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient\n *\n * http://rtsys.informatik.uni-kiel.de/kieler\n *\n * Copyright 2026 by\n * + Kiel University\n * + Department of Computer Science\n * + Real-Time and Embedded Systems Group\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0.\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n/** Reject values that cannot be represented by the existing simulation input. */\nexport function isCompatibleInput(value: unknown, current: unknown): boolean {\n if (typeof current === 'number') return typeof value === 'number' && Number.isFinite(value)\n if (current === null) return value === null\n if (Array.isArray(current)) {\n return (\n Array.isArray(value) &&\n value.length === current.length &&\n value.every((entry, index) => isCompatibleInput(entry, current[index]))\n )\n }\n if (typeof current === 'object') {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false\n const expected = current as Record<string, unknown>\n const actual = value as Record<string, unknown>\n return (\n Object.keys(actual).length === Object.keys(expected).length &&\n Object.keys(expected).every(\n (key) =>\n Object.prototype.hasOwnProperty.call(actual, key) && isCompatibleInput(actual[key], expected[key])\n )\n )\n }\n return current !== undefined && typeof value === typeof current\n}\n"]}
|
package/dist/json.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TraceRecord } from "./trace-record.js";
|
|
2
|
+
/** One tick per line, so a long run stays readable and diffs well. */
|
|
3
|
+
export declare function writeJson(trace: TraceRecord): string;
|
|
4
|
+
/**
|
|
5
|
+
* Reads this lab's JSON trace. Ticks may list only what changes, so an input sequence can be
|
|
6
|
+
* written by hand: `{"ticks": [{"inputs": {"start": true}}, {}, {"inputs": {"start": false}}]}`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readJson(text: string): TraceRecord;
|
package/dist/json.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
|
|
3
|
+
*
|
|
4
|
+
* http://rtsys.informatik.uni-kiel.de/kieler
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2026 by
|
|
7
|
+
* + Kiel University
|
|
8
|
+
* + Department of Computer Science
|
|
9
|
+
* + Real-Time and Embedded Systems Group
|
|
10
|
+
*
|
|
11
|
+
* This program and the accompanying materials are made available under the
|
|
12
|
+
* terms of the Eclipse Public License 2.0 which is available at
|
|
13
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { carryForward, givenTimes, printedOf, TRACE_FORMAT_ID, TraceFileError, traceTimes, typeOfValue, VariableList } from "./trace-record.js";
|
|
18
|
+
// This lab's JSON trace.
|
|
19
|
+
const GROUPS = [
|
|
20
|
+
{ key: 'inputs', role: 'input' },
|
|
21
|
+
{ key: 'outputs', role: 'output' },
|
|
22
|
+
{ key: 'locals', role: 'local' },
|
|
23
|
+
{ key: 'values' },
|
|
24
|
+
];
|
|
25
|
+
function groupOf(role) {
|
|
26
|
+
return GROUPS.find((group) => group.role === role)?.key ?? 'values';
|
|
27
|
+
}
|
|
28
|
+
/** One tick per line, so a long run stays readable and diffs well. */
|
|
29
|
+
export function writeJson(trace) {
|
|
30
|
+
const times = traceTimes(trace);
|
|
31
|
+
const header = {
|
|
32
|
+
format: TRACE_FORMAT_ID,
|
|
33
|
+
version: 1,
|
|
34
|
+
...(trace.model ? { model: trace.model } : {}),
|
|
35
|
+
variables: trace.variables.map((variable) => ({
|
|
36
|
+
name: variable.name,
|
|
37
|
+
...(variable.role ? { role: variable.role } : {}),
|
|
38
|
+
...(variable.type ? { type: variable.type } : {}),
|
|
39
|
+
})),
|
|
40
|
+
};
|
|
41
|
+
const ticks = trace.ticks.map((tick, index) => {
|
|
42
|
+
const entry = { tick: index + 1 };
|
|
43
|
+
if (times)
|
|
44
|
+
entry.time = times[index];
|
|
45
|
+
if (trace.printed?.[index]?.length)
|
|
46
|
+
entry.printed = trace.printed[index];
|
|
47
|
+
trace.variables.forEach(({ name, role }) => {
|
|
48
|
+
if (tick[name] === undefined)
|
|
49
|
+
return;
|
|
50
|
+
const group = groupOf(role);
|
|
51
|
+
entry[group] = { ...(entry[group] ?? {}), [name]: tick[name] };
|
|
52
|
+
});
|
|
53
|
+
return ` ${JSON.stringify(entry)}`;
|
|
54
|
+
});
|
|
55
|
+
const head = JSON.stringify(header, null, 2).replace(/\n}$/, '');
|
|
56
|
+
return `${head},\n "ticks": [\n${ticks.join(',\n')}\n ]\n}\n`;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reads this lab's JSON trace. Ticks may list only what changes, so an input sequence can be
|
|
60
|
+
* written by hand: `{"ticks": [{"inputs": {"start": true}}, {}, {"inputs": {"start": false}}]}`.
|
|
61
|
+
*/
|
|
62
|
+
export function readJson(text) {
|
|
63
|
+
let parsed;
|
|
64
|
+
try {
|
|
65
|
+
parsed = JSON.parse(text);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw new TraceFileError(`The file is not valid JSON: ${error instanceof Error ? error.message : error}`);
|
|
69
|
+
}
|
|
70
|
+
const root = Array.isArray(parsed) ? { ticks: parsed } : parsed;
|
|
71
|
+
if (!root || typeof root !== 'object' || !Array.isArray(root.ticks)) {
|
|
72
|
+
throw new TraceFileError('Expected an object with a "ticks" array.');
|
|
73
|
+
}
|
|
74
|
+
const list = new VariableList();
|
|
75
|
+
if (Array.isArray(root.variables)) {
|
|
76
|
+
root.variables.forEach((variable, index) => {
|
|
77
|
+
const entry = variable;
|
|
78
|
+
if (!entry || typeof entry.name !== 'string')
|
|
79
|
+
throw new TraceFileError(`Variable ${index + 1} has no name.`);
|
|
80
|
+
const role = ['input', 'output', 'local'].includes(entry.role)
|
|
81
|
+
? entry.role
|
|
82
|
+
: undefined;
|
|
83
|
+
list.add(entry.name, role, typeof entry.type === 'string' ? entry.type : undefined);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const times = [];
|
|
87
|
+
const printed = [];
|
|
88
|
+
const ticks = root.ticks.map((tick, index) => {
|
|
89
|
+
if (!tick || typeof tick !== 'object' || Array.isArray(tick)) {
|
|
90
|
+
throw new TraceFileError(`Tick ${index + 1} is not an object.`);
|
|
91
|
+
}
|
|
92
|
+
const { time, printed: lines } = tick;
|
|
93
|
+
times.push(typeof time === 'number' ? time : undefined);
|
|
94
|
+
if (lines !== undefined && !(Array.isArray(lines) && lines.every((line) => typeof line === 'string'))) {
|
|
95
|
+
throw new TraceFileError(`"printed" of tick ${index + 1} is not a list of strings.`);
|
|
96
|
+
}
|
|
97
|
+
printed.push(lines ?? []);
|
|
98
|
+
const values = {};
|
|
99
|
+
GROUPS.forEach(({ key, role }) => {
|
|
100
|
+
const group = tick[key];
|
|
101
|
+
if (group === undefined)
|
|
102
|
+
return;
|
|
103
|
+
if (!group || typeof group !== 'object' || Array.isArray(group)) {
|
|
104
|
+
throw new TraceFileError(`"${key}" of tick ${index + 1} is not an object.`);
|
|
105
|
+
}
|
|
106
|
+
Object.entries(group).forEach(([name, value]) => {
|
|
107
|
+
list.add(name, role, typeOfValue(value));
|
|
108
|
+
if (value !== null)
|
|
109
|
+
values[name] = value;
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
return values;
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
model: typeof root.model === 'string' ? root.model : undefined,
|
|
116
|
+
variables: list.variables,
|
|
117
|
+
ticks: carryForward(ticks, list.variables),
|
|
118
|
+
times: givenTimes(times, list.variables, (index) => `Tick ${index + 1}`),
|
|
119
|
+
printed: printedOf(printed),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=json.js.map
|
package/dist/json.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,0BAAsB;AAG5I,yBAAyB;AAEzB,MAAM,MAAM,GAAwC;IAChD,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;IAChC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAA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AAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;gBAC5C,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;gBACxC,IAAI,KAAK,KAAK,IAAI;oBAAE,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;YAC5C,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACjB,CAAC,CAAC,CAAA;IACF,OAAO;QACH,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAC9D,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;QAC1C,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,KAAK,GAAG,CAAC,EAAE,CAAC;QACxE,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAA;AACL,CAAC","sourcesContent":["/*\n * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient\n *\n * http://rtsys.informatik.uni-kiel.de/kieler\n *\n * Copyright 2026 by\n * + Kiel University\n * + Department of Computer Science\n * + Real-Time and Embedded Systems Group\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0.\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport { carryForward, givenTimes, printedOf, TRACE_FORMAT_ID, TraceFileError, traceTimes, typeOfValue, VariableList } from './trace-record'\nimport type { TraceRecord, TraceRole } from './trace-record'\n\n// This lab's JSON trace.\n\nconst GROUPS: { key: string; role?: TraceRole }[] = [\n { key: 'inputs', role: 'input' },\n { key: 'outputs', role: 'output' },\n { key: 'locals', role: 'local' },\n { key: 'values' },\n]\n\nfunction groupOf(role: TraceRole | undefined): string {\n return GROUPS.find((group) => group.role === role)?.key ?? 'values'\n}\n\n/** One tick per line, so a long run stays readable and diffs well. */\nexport function writeJson(trace: TraceRecord): string {\n const times = traceTimes(trace)\n const header = {\n format: TRACE_FORMAT_ID,\n version: 1,\n ...(trace.model ? { model: trace.model } : {}),\n variables: trace.variables.map((variable) => ({\n name: variable.name,\n ...(variable.role ? { role: variable.role } : {}),\n ...(variable.type ? { type: variable.type } : {}),\n })),\n }\n const ticks = trace.ticks.map((tick, index) => {\n const entry: Record<string, unknown> = { tick: index + 1 }\n if (times) entry.time = times[index]\n if (trace.printed?.[index]?.length) entry.printed = trace.printed[index]\n trace.variables.forEach(({ name, role }) => {\n if (tick[name] === undefined) return\n const group = groupOf(role)\n entry[group] = { ...((entry[group] as Record<string, unknown>) ?? {}), [name]: tick[name] }\n })\n return ` ${JSON.stringify(entry)}`\n })\n const head = JSON.stringify(header, null, 2).replace(/\\n}$/, '')\n return `${head},\\n \"ticks\": [\\n${ticks.join(',\\n')}\\n ]\\n}\\n`\n}\n\n/**\n * Reads this lab's JSON trace. Ticks may list only what changes, so an input sequence can be\n * written by hand: `{\"ticks\": [{\"inputs\": {\"start\": true}}, {}, {\"inputs\": {\"start\": false}}]}`.\n */\nexport function readJson(text: string): TraceRecord {\n let parsed: unknown\n try {\n parsed = JSON.parse(text)\n } catch (error) {\n throw new TraceFileError(`The file is not valid JSON: ${error instanceof Error ? error.message : error}`)\n }\n const root = Array.isArray(parsed) ? { ticks: parsed } : (parsed as Record<string, unknown>)\n if (!root || typeof root !== 'object' || !Array.isArray(root.ticks)) {\n throw new TraceFileError('Expected an object with a \"ticks\" array.')\n }\n const list = new VariableList()\n if (Array.isArray(root.variables)) {\n root.variables.forEach((variable: unknown, index: number) => {\n const entry = variable as Record<string, unknown>\n if (!entry || typeof entry.name !== 'string') throw new TraceFileError(`Variable ${index + 1} has no name.`)\n const role = ['input', 'output', 'local'].includes(entry.role as string)\n ? (entry.role as TraceRole)\n : undefined\n list.add(entry.name, role, typeof entry.type === 'string' ? entry.type : undefined)\n })\n }\n const times: (number | undefined)[] = []\n const printed: string[][] = []\n const ticks = (root.ticks as unknown[]).map((tick, index) => {\n if (!tick || typeof tick !== 'object' || Array.isArray(tick)) {\n throw new TraceFileError(`Tick ${index + 1} is not an object.`)\n }\n const { time, printed: lines } = tick as Record<string, unknown>\n times.push(typeof time === 'number' ? time : undefined)\n if (lines !== undefined && !(Array.isArray(lines) && lines.every((line) => typeof line === 'string'))) {\n throw new TraceFileError(`\"printed\" of tick ${index + 1} is not a list of strings.`)\n }\n printed.push((lines as string[] | undefined) ?? [])\n const values: Record<string, unknown> = {}\n GROUPS.forEach(({ key, role }) => {\n const group = (tick as Record<string, unknown>)[key]\n if (group === undefined) return\n if (!group || typeof group !== 'object' || Array.isArray(group)) {\n throw new TraceFileError(`\"${key}\" of tick ${index + 1} is not an object.`)\n }\n Object.entries(group).forEach(([name, value]) => {\n list.add(name, role, typeOfValue(value))\n if (value !== null) values[name] = value\n })\n })\n return values\n })\n return {\n model: typeof root.model === 'string' ? root.model : undefined,\n variables: list.variables,\n ticks: carryForward(ticks, list.variables),\n times: givenTimes(times, list.variables, (index) => `Tick ${index + 1}`),\n printed: printedOf(printed),\n }\n}\n"]}
|
package/dist/ktrace.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TraceRecord } from "./trace-record.js";
|
|
2
|
+
/**
|
|
3
|
+
* KTrace as KIELER writes it: one tick per line, inputs then `=>` and outputs, each value only
|
|
4
|
+
* when it changed. Variables that are neither inputs nor outputs have no place in KTrace.
|
|
5
|
+
*/
|
|
6
|
+
export declare function writeKTrace(trace: TraceRecord): string;
|
|
7
|
+
/**
|
|
8
|
+
* Reads the literal part of KTrace: ticks of `name = value` assignments, `=>` before the outputs,
|
|
9
|
+
* `pause`, and `reset;` between traces (only the first is kept). Values must be literals.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readKTrace(text: string): TraceRecord;
|