@tsplc/compiler 0.2.9 → 0.2.11
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/backends/codesys/emit.ts +24 -41
- package/backends/codesys/global-names.ts +49 -0
- package/backends/codesys/plan.ts +4 -89
- package/backends/codesys/task-access.ts +125 -0
- package/dist/cli.js +50 -48
- package/dist/cli.js.map +5 -5
- package/dist/codesys.js +360 -307
- package/dist/codesys.js.map +9 -8
- package/dist/index.js +23 -7
- package/dist/index.js.map +4 -4
- package/dist/ir.js +52 -2
- package/dist/ir.js.map +4 -4
- package/ir/declarations.ts +12 -5
- package/ir/model.ts +40 -1
- package/package.json +6 -6
- package/project/plant.ts +22 -9
- package/project/server.ts +43 -13
- package/src/frontend/async.ts +9 -4
- package/src/frontend/typescript.ts +21 -7
- package/types/globals.d.ts +6 -0
- package/types/index.d.ts +37 -1
package/dist/ir.js
CHANGED
|
@@ -90,6 +90,45 @@ var standardBlocks = {
|
|
|
90
90
|
inputs: [["signal", "CLK", "BOOL"]],
|
|
91
91
|
outputs: [["fell", "Q", "BOOL"]]
|
|
92
92
|
},
|
|
93
|
+
UpCounter: {
|
|
94
|
+
native: "CTU",
|
|
95
|
+
inputs: [
|
|
96
|
+
["countUp", "CU", "BOOL"],
|
|
97
|
+
["reset", "RESET", "BOOL"],
|
|
98
|
+
["preset", "PV", "WORD"]
|
|
99
|
+
],
|
|
100
|
+
outputs: [
|
|
101
|
+
["reachedPreset", "Q", "BOOL"],
|
|
102
|
+
["value", "CV", "WORD"]
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
DownCounter: {
|
|
106
|
+
native: "CTD",
|
|
107
|
+
inputs: [
|
|
108
|
+
["countDown", "CD", "BOOL"],
|
|
109
|
+
["load", "LOAD", "BOOL"],
|
|
110
|
+
["preset", "PV", "WORD"]
|
|
111
|
+
],
|
|
112
|
+
outputs: [
|
|
113
|
+
["atZero", "Q", "BOOL"],
|
|
114
|
+
["value", "CV", "WORD"]
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
UpDownCounter: {
|
|
118
|
+
native: "CTUD",
|
|
119
|
+
inputs: [
|
|
120
|
+
["countUp", "CU", "BOOL"],
|
|
121
|
+
["countDown", "CD", "BOOL"],
|
|
122
|
+
["reset", "RESET", "BOOL"],
|
|
123
|
+
["load", "LOAD", "BOOL"],
|
|
124
|
+
["preset", "PV", "WORD"]
|
|
125
|
+
],
|
|
126
|
+
outputs: [
|
|
127
|
+
["reachedPreset", "QU", "BOOL"],
|
|
128
|
+
["atZero", "QD", "BOOL"],
|
|
129
|
+
["value", "CV", "WORD"]
|
|
130
|
+
]
|
|
131
|
+
},
|
|
93
132
|
Blinker: {
|
|
94
133
|
native: "Util.BLINK",
|
|
95
134
|
inputs: [
|
|
@@ -931,7 +970,18 @@ class ModuleDeclarations {
|
|
|
931
970
|
if (block.standard) {
|
|
932
971
|
const expected = Object.hasOwn(standardBlocks, block.standard) ? standardBlocks[block.standard] : undefined;
|
|
933
972
|
const matches = (variables, schema) => variables.length === schema.length && schema.every(([name, , type]) => variables.some((variable) => variable.name === name && variable.type === type && !variable.mode && !variable.retain));
|
|
934
|
-
if (!expected || block.name !== block.standard || block.body.length || block.state.length || block.locals.length || !matches(block.inputs, expected.inputs) || !matches(block.outputs, expected.outputs) || block.outputs.some((
|
|
973
|
+
if (!expected || block.name !== block.standard || block.body.length || block.state.length || block.locals.length || !matches(block.inputs, expected.inputs) || !matches(block.outputs, expected.outputs) || block.outputs.some(({ initial }) => {
|
|
974
|
+
switch (initial?.kind) {
|
|
975
|
+
case "bool":
|
|
976
|
+
return initial.value !== false;
|
|
977
|
+
case "duration":
|
|
978
|
+
return initial.nanoseconds !== "0";
|
|
979
|
+
case "integer":
|
|
980
|
+
return initial.value !== "0";
|
|
981
|
+
default:
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
}))
|
|
935
985
|
reject("Invalid canonical standard block definition.", block.span);
|
|
936
986
|
}
|
|
937
987
|
}
|
|
@@ -1884,5 +1934,5 @@ export {
|
|
|
1884
1934
|
wrapsNatively
|
|
1885
1935
|
};
|
|
1886
1936
|
|
|
1887
|
-
//# debugId=
|
|
1937
|
+
//# debugId=6C2C28B29E0F243F64756E2164756E21
|
|
1888
1938
|
//# sourceMappingURL=ir.js.map
|