Skip to content

Commit 3753527

Browse files
authored
refactor: Make second argument in ADD / MUL variadic (#1312)
This commit changes the function signature of the ADD and MUL functions, i.e. ```diff FUNCTION ADD < T1: ANY, T2: ANY >: T1 VAR_INPUT IN1: T1; - IN1: T2; + IN2: T2...; END_VAR END_FUNCTION ``` (This should not change the behavior when calling some specific `ADD__...` function either implicitly or explicitly because the validation should catch such cases)
1 parent 3404cb0 commit 3753527

File tree

3 files changed

+77
-72
lines changed

3 files changed

+77
-72
lines changed

libs/stdlib/iec61131-st/arithmetic_functions.st

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,32 @@ VAR_GLOBAL
1212
E_LREAL : LREAL;
1313
END_VAR
1414

15+
(********************
16+
*
17+
* This operator returns the value of adding up the operands.
18+
* It overloads the variadic builtin implementation of ADD, which is implemented for ANY_NUM
19+
*
20+
*********************)
21+
FUNCTION ADD < T1: ANY, T2: ANY >: T1
22+
VAR_INPUT
23+
IN1: T1;
24+
IN2: T2...;
25+
END_VAR
26+
END_FUNCTION
27+
28+
(********************
29+
*
30+
* This operator produces the multiplication of the operands.
31+
* It overloads the variadic builtin implementation of MUL, which is implemented for ANY_NUM
32+
*
33+
*********************)
34+
FUNCTION MUL < T1: ANY, T2: ANY >: T1
35+
VAR_INPUT
36+
IN1: T1;
37+
IN2: T2...;
38+
END_VAR
39+
END_FUNCTION
40+
1541
(* Calculates the square root of a given value *)
1642
{external}
1743
FUNCTION SQRT<T : ANY_REAL> : T

libs/stdlib/iec61131-st/date_time_numeric_functions.st

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
(********************
2-
*
3-
* This operator returns the value of adding up the operands.
4-
* It overloads the variadic builtin implementation of ADD, which is impemented for ANY_NUM
5-
*
6-
*********************)
7-
FUNCTION ADD < T1: ANY, T2: ANY >: T1
8-
VAR_INPUT
9-
IN1: T1;
10-
IN2: T2;
11-
END_VAR
12-
END_FUNCTION
13-
141
(* Specialized implementation of ADD for TIME *)
152
FUNCTION ADD__TIME__TIME: TIME
163
VAR_INPUT
@@ -340,19 +327,6 @@ END_VAR
340327
SUB_LDT_LDT := SUB_DT_DT(IN1, IN2);
341328
END_FUNCTION
342329

343-
(********************
344-
*
345-
* This operator produces the multiplication of the operands.
346-
* It overloads the variadic builtin implementation of MUL, which is impemented for ANY_NUM
347-
*
348-
*********************)
349-
FUNCTION MUL < T1: ANY, T2: ANY >: T1
350-
VAR_INPUT
351-
IN1: T1;
352-
IN2: T2;
353-
END_VAR
354-
END_FUNCTION
355-
356330
(********************
357331
*
358332
* This operator produces the multiplication of TIME and ANY_NUM.

0 commit comments

Comments
 (0)