mario@108: (* Test whether the keyword XXXX may be used as an identifier for:
mario@108:  * FUNCTION_BLOCK declaration
mario@108:  *
mario@108:  * The XXXX names in the following code are merely a placeholder.
mario@108:  * They will be replaced by several identifiers before actual testing
mario@108:  * of the compiler.
mario@108:  *)
mario@108: 
mario@108: (* The identifiers that will replace the XXXX
mario@108:  * must be placed on a line starting with #
mario@108:  * All identifiers preceded by # are ignored!
mario@108:  * The identifier list must be placed inside an IEC 61131-3 comment.
mario@108:  *)
mario@108: (*
mario@108: #IL_operators ANDN CAL CALC CALCN CD CLK CU IN JMP JMPC JMPCN LD LDN ORN 
mario@108: #IL_operators PT PV R R1 RET RETC RETCN S S1 ST STN XORN
mario@108:      NOTE: R and S are identical to IL operators!!
mario@108: #SFC_qualifiers D DS L N P #R #S SD SL   
mario@108: #Task_initialisers PRIORITY SINGLE INTERVAL
mario@108: *)
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: (* The FUNCTION BLOCK declaration *)
mario@108: function_block XXXX
mario@108:  var_input
mario@108:   a_1, b_1: int;
mario@108:  end_var
mario@108:  var_output
mario@108:   c_1, d_1: int;
mario@108:  end_var
mario@108:   c_1 := 10 + b_1;
mario@108: end_function_block
mario@108: 
mario@108: 
mario@108: (* Calling of the function block from within ST code *)
mario@108: 
mario@108: function_block foo
mario@108:  var
mario@108:   e_1, f_1 : int;
mario@108:   fb : XXXX;
mario@108:  end_var
mario@108:   fb(10, 20);
mario@108:   fb (10, 20, e_1, f_1);
mario@108:   fb (a_1 := 10, b_1:=20, c_1=>e_1, d_1=>f_1);
mario@108:   fb(a_1 := 10, b_1:=20, c_1=>e_1, d_1=>f_1);
mario@108:   fb (c_1=>e_1, a_1:=20, d_1=>f_1);
mario@108:   f_1 := fb.c_1;
mario@108:   fb.a_1 := e_1;
mario@108: end_function_block
mario@108: 
mario@108: 
mario@108: 
mario@108: (* Calling of the function block from within IL code *)
mario@108: function_block bar
mario@108:  var
mario@108:   e_1, f_1 : int;
mario@108:   fb : XXXX;
mario@108:  end_var
mario@108:   CAL fb
mario@108:   LD fb.a_1
mario@108:   ST fb.b_1
mario@108:   CAL fb (10)
mario@108:   CAL fb(30, 20, e_1, f_1)
mario@108:   CAL fb (
mario@108:     a_1 := 10,
mario@108:     c_1 => f_1
mario@108:    )
mario@108:   CAL fb(
mario@108:     a_1 := 10,
mario@108:     c_1 => f_1
mario@108:    )
mario@108: end_function_block
mario@108: 
mario@108: 
mario@108: 
mario@108: (* Checking whether the use of XXXX will confuse any other
mario@108:  * normal and correct IL or ST code.
mario@108:  *)
mario@108: {#include "basic_code.test" }
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: 
mario@108: (*
mario@108: 
mario@108: CONFIGURATION
mario@108: ......
mario@108: using these XXXX identifiers within a configuration
mario@108: 
mario@108: especially a task initialisation, as Priority, single and interval may clash here.
mario@108: (they shouldn't, but if the parser has an error, they will....)
mario@108: 
mario@108: END_CONFIGURATION
mario@108: 
mario@108: *)